Update of /project/net-nittin-irc/cvsroot/net-nittin-irc In directory common-lisp.net:/tmp/cvs-serv32047
Modified Files: event.lisp protocol.lisp Log Message: change-user didn't properly change nicknames; fixed.
Date: Mon Nov 24 22:56:06 2003 Author: eenge
Index: net-nittin-irc/event.lisp diff -u net-nittin-irc/event.lisp:1.12 net-nittin-irc/event.lisp:1.13 --- net-nittin-irc/event.lisp:1.12 Mon Nov 24 22:35:55 2003 +++ net-nittin-irc/event.lisp Mon Nov 24 22:56:06 2003 @@ -1,4 +1,4 @@ -;;;; $Id: event.lisp,v 1.12 2003/11/25 03:35:55 eenge Exp $ +;;;; $Id: event.lisp,v 1.13 2003/11/25 03:56:06 eenge Exp $ ;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/event.lisp,v $
;;;; See LICENSE for licensing information. @@ -84,15 +84,9 @@ (remove-user-everywhere connection (find-user connection (source message)))))
(defmethod default-hook ((message irc-nick-message)) - (if (self-message-p message) - (change-nickname (connection message) (user (connection message)) - (trailing-argument message)) - (let ((user (find-user (connection message) (source message)))) - (if user - (change-nickname (connection message) user (trailing-argument message)) - (client-raw-log (connection message) - (format nil "Could not find user with nick ~A~%" - (source message))))))) + (let ((con (connection message))) + (change-nickname con (find-user con (source message)) + (trailing-argument message))))
(defmethod default-hook ((message irc-kick-message)) (let* ((connection (connection message))
Index: net-nittin-irc/protocol.lisp diff -u net-nittin-irc/protocol.lisp:1.20 net-nittin-irc/protocol.lisp:1.21 --- net-nittin-irc/protocol.lisp:1.20 Mon Nov 24 22:35:55 2003 +++ net-nittin-irc/protocol.lisp Mon Nov 24 22:56:06 2003 @@ -1,4 +1,4 @@ -;;;; $Id: protocol.lisp,v 1.20 2003/11/25 03:35:55 eenge Exp $ +;;;; $Id: protocol.lisp,v 1.21 2003/11/25 03:56:06 eenge Exp $ ;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/protocol.lisp,v $
;;;; See LICENSE for licensing information. @@ -416,11 +416,16 @@ "Remove `channel' from `user'." (setf (channels user) (remove channel (channels user))))
+(defmethod remove-user ((connection connection) (user user)) + "Remove `user' from `connection' but leave user in any channels he +may be already be on." + (remhash (normalized-nickname user) (users connection))) + (defmethod remove-user-everywhere ((connection connection) (user user)) "Remove `user' anywhere present in the `connection'." (dolist (channel (channels user)) (remove-user channel user)) - (remhash (normalized-nickname user) (users connection))) + (remove-user connection user))
(defmethod find-or-make-user ((connection connection) nickname &key (username "") (hostname "") (realname "")) @@ -431,7 +436,14 @@ :realname realname)))
(defmethod change-nickname ((connection connection) (user user) new-nickname) - (setf (nickname user) new-nickname)) + (let ((new-user user) + (channels (channels user))) + (remove-user connection user) + (setf (nickname new-user) new-nickname) + (setf (normalized-nickname new-user) (normalize-nickname new-nickname)) + (dolist (channel channels) + (remove-user channel user) + (add-user connection channel new-user))))
;; IRC Message ;;
net-nittin-irc-cvs@common-lisp.net