Author: zothar
Date: 2006-12-05 00:32:33 +0000 (Tue, 05 Dec 2006)
New Revision: 11231

Modified:
   trunk/apps/pyFreenet/minibot.py
   trunk/apps/pyFreenet/refbot.py
Log:
refbot: Fix a few bugs with parsing that were causing bot crashes.  Fix the bug 
that meant the bot wouldn't identify with nickserv after a crash.

Modified: trunk/apps/pyFreenet/minibot.py
===================================================================
--- trunk/apps/pyFreenet/minibot.py     2006-12-04 22:59:48 UTC (rev 11230)
+++ trunk/apps/pyFreenet/minibot.py     2006-12-05 00:32:33 UTC (rev 11231)
@@ -146,6 +146,7 @@
             except:
                 traceback.print_exc()
                 self.sock.close()
+                self.hasIdentified = False
                 log("** ERROR: bot crashed, restarting in 45 seconds...")
                 time.sleep(45)  # a repeatedly crashing bot can be very 
annoying
                 continue
@@ -401,6 +402,9 @@
             return

         parts = line.split(" ", 3)
+        if( len( parts ) == 0 ):
+            log("?? no parts could be split from: %s" % ( line ));
+            return;
         sender = parts[0]

         sender = sender[1:]
@@ -409,8 +413,14 @@
         else:
             sender = self.stripNickSpecialChars(sender.split("!")[0])

+        if( len( parts ) == 1 ):
+            log("?? only 1 part could be split from: %s" % ( line ));
+            return;
         typ = parts[1]

+        if( len( parts ) == 2 ):
+            log("?? only 2 parts could be split from: %s" % ( line ));
+            return;
         target = parts[2].strip()
         if len(parts) > 3:
             msg = parts[3][1:].rstrip()
@@ -738,7 +748,7 @@
         if(recent_received >= received_too_fast_threshold):
             if(self.last_ignore_start == None or (time.time() - 
self.last_ignore_start) > ignore_time):
                 self.last_ignore_start = time.time()
-                self.privmsg("It looks to me like you're talking to fast.  
I'll ignore you until you've stopped \"babbling\" for awhile.")
+                self.privmsg("It looks to me like you're talking too fast.  
I'll ignore you until you've stopped \"babbling\" for awhile.")
             log("** on_anymsg: IGNORING BABBLER: %s: %s" % (self.peernick, 
msg))
             return
         log("** on_anymsg: %s: %s" % (self.peernick, msg))

Modified: trunk/apps/pyFreenet/refbot.py
===================================================================
--- trunk/apps/pyFreenet/refbot.py      2006-12-04 22:59:48 UTC (rev 11230)
+++ trunk/apps/pyFreenet/refbot.py      2006-12-05 00:32:33 UTC (rev 11231)
@@ -673,7 +673,7 @@

         url = args[0]
         if(url == self.bot.refurl):
-            self.privmsg("error - already have my own ref <%s>" % (cmd))
+            self.privmsg("error - already have my own ref <%s>" % (url))
             return
         if(not self.bot.has_ref(url)):
             self.bot.maybe_add_ref(url.strip(), replyfunc, self.peernick)


Reply via email to