]> jfr.im git - irc/rizon/bncbot.git/commitdiff
Add various bits of logging (code found on server, original author unknown).
authorDarius Jahandarie <redacted>
Fri, 17 Jan 2020 21:22:06 +0000 (16:22 -0500)
committerDarius Jahandarie <redacted>
Fri, 17 Jan 2020 21:22:06 +0000 (16:22 -0500)
src/net/rizon/bncbot/UserDB.java
src/net/rizon/bncbot/commands/RequestCmd.java
src/net/rizon/bncmanager/BncServer.java

index 52875524f5c402e9187a01bc35c005b98573280e..fd5e8fa21053df7f516a4c2196e0723aff9ba850 100644 (file)
@@ -565,6 +565,11 @@ public final class UserDB implements Iterable<UserDB.UserEntry> {
                PreparedStatement ps = null;
                UserEntry ue = findUser(username);
 
+               if (ue == null) {
+                       System.out.println("log connect event for unknown user " + username);
+                       return;
+               }
+
                try {
                        ps = conn.prepareStatement("INSERT INTO `bncbot_conn_log` (user_id, ip, event_type, was_last_client) VALUES (?, INET_ATON(?), ?, ?);");
 
index d592eb1cdab6394ec3a9208082229c178387a012..7e9d888d4b540c21c6e3c31feb688ce0e5369fc1 100644 (file)
@@ -31,6 +31,7 @@ public class RequestCmd extends AbstractSimpleCommand {
                boolean ident = bot.lookupIdentified(nick);
                if(!ident) {
                        bot.privmsg(nick, bot.getString("genericErrorReason", bot.getString("userErrorIdentify")));
+                       System.out.println(user + " no ident");
                        return;
                }
 
@@ -38,11 +39,13 @@ public class RequestCmd extends AbstractSimpleCommand {
                String mainNick = bot.lookupNick(nick);
                if(mainNick == null) {
                        bot.privmsg(nick, bot.getString("genericErrorReason", bot.getString("userErrorInfo")));
+                       System.out.println(user + " no nick");
                        return;
                }
                Date regTime = bot.lookupRegTime(mainNick);
                if(regTime == null) {
                        bot.privmsg(nick, bot.getString("genericErrorReason", bot.getString("userErrorInfo")));
+                       System.out.println(user + " no regtime");
                        return;
                }
                
index 518dc7479e725c35a8be0542375d4a59d38f3b5e..ec3c598dcd7603ec80b609ffeb694bb495bba1ec 100644 (file)
@@ -515,7 +515,13 @@ public class BncServer {
                                                String ip = connectMatcher.group(4);
                                                boolean lastClient = connectMatcher.group(5) == null;
 
-                                               BncBot.get().database.logConnectEvent(username, verb, ip, lastClient);
+                                               try {
+                                                       BncBot.get().database.logConnectEvent(username, verb, ip, lastClient);
+                                               }
+                                               catch (Throwable ex) {
+                                                       System.out.println("Error processing connect event for " + username + ": " + line);
+                                                       ex.printStackTrace();
+                                               }
                                                continue;
                                        }