Commits

Anonymous committed 31c5e33

Improved jump_server behaviour. Patch from Jeff Huang.

  • Participants
  • Parent commits c6479dd

Comments (0)

Files changed (3)

+2005-01-17  Joel Rosdahl  <joel@rosdahl.net>
+
+	* ircbot.py (SingleServerIRCBot.jump_server): Improved jump_server
+	behaviour. Patch from Jeff Huang.
+
 2004-07-09  Joel Rosdahl  <joel@rosdahl.net>
 
 	* Released version 0.4.2.
         """
         return "ircbot.py by Joel Rosdahl <joel@rosdahl.net>"
 
-    def jump_server(self):
+    def jump_server(self, msg="Changing servers"):
         """Connect to a new server, possibly disconnecting from the current.
 
         The bot will skip to next server in the server_list each time
         jump_server is called.
         """
         if self.connection.is_connected():
-            self.connection.quit("Jumping servers")
+            self.connection.quit(msg)
+            self.connected = 0
+            try:
+                self.connection.socket.close()
+            except socket.error, x:
+                pass
+            self.socket = None
         self.server_list.append(self.server_list.pop(0))
         self._connect()
 
                             print "command: %s, source: %s, target: %s, arguments: %s" % (
                                 command, prefix, target, m)
                         self._handle_event(Event(command, prefix, target, m))
+                        if command == "ctcp" and m[0] == "ACTION":
+                            # Emit an action event too. We're generous today.
+                            self._handle_event(Event("action", prefix, target, m[1:]))
                     else:
                         if DEBUG:
                             print "command: %s, source: %s, target: %s, arguments: %s" % (