[Cl-irc-cvs] CVS update: cl-irc/event.lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Tue Sep 13 20:34:42 UTC 2005


Update of /project/cl-irc/cvsroot/cl-irc
In directory common-lisp.net:/tmp/cvs-serv12600

Modified Files:
	event.lisp 
Log Message:
Prevent the bot from crashing when it got out-of-sync.

* event.lisp (default-hook irc-nick-message):
  If we can't find the old user object, create a new one to set the nick on.


Date: Tue Sep 13 22:34:41 2005
Author: ehuelsmann

Index: cl-irc/event.lisp
diff -u cl-irc/event.lisp:1.9 cl-irc/event.lisp:1.10
--- cl-irc/event.lisp:1.9	Sun Mar 27 23:40:30 2005
+++ cl-irc/event.lisp	Tue Sep 13 22:34:41 2005
@@ -1,4 +1,4 @@
-;;;; $Id: event.lisp,v 1.9 2005/03/27 21:40:30 ehuelsmann Exp $
+;;;; $Id: event.lisp,v 1.10 2005/09/13 20:34:41 ehuelsmann Exp $
 ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/event.lisp,v $
 
 ;;;; See LICENSE for licensing information.
@@ -163,11 +163,10 @@
          (channel (or (find-channel connection (trailing-argument message))
                       (make-channel connection
                                     :name (trailing-argument message)))))
-    (if (self-message-p message)
-        (add-channel connection channel)
-        (progn
-          (add-user connection user)
-          (add-user channel user)))))
+    (when (self-message-p message)
+      (add-channel connection channel))
+    (add-user connection user)
+    (add-user channel user)))
 
 (defmethod default-hook ((message irc-topic-message))
   (setf (topic (find-channel (connection message)
@@ -229,9 +228,9 @@
                    target mode-name value))))))
 
 (defmethod default-hook ((message irc-nick-message))
-  (let ((con (connection message)))
-    (change-nickname con (find-user con (source message))
-                     (trailing-argument message))))
+  (let* ((con (connection message))
+         (user (find-or-create-user con (source message))))
+    (change-nickname con user (trailing-argument message))))
 
 (defmethod default-hook ((message irc-kick-message))
   (let* ((connection (connection message))




More information about the cl-irc-cvs mailing list