Update of /project/net-nittin-irc/cvsroot/net-nittin-irc
In directory common-lisp.net:/tmp/cvs-serv27042
Modified Files:
TODO event.lisp package.lisp protocol.lisp variable.lisp
Log Message:
adding support for return code 320 from dancerd
fixing a bug related to nickname changes that would leave the connection
object in an inconsistent state
Date: Fri Nov 14 11:13:22 2003
Author: eenge
Index: net-nittin-irc/TODO
diff -u net-nittin-irc/TODO:1.6 net-nittin-irc/TODO:1.7
--- net-nittin-irc/TODO:1.6 Mon Nov 10 12:25:38 2003
+++ net-nittin-irc/TODO Fri Nov 14 11:13:21 2003
@@ -11,3 +11,13 @@
equivalence of two nicknames or channel names.
So when we do FIND-USER etc. we need to be mindful of this fact.
+
+ - Need to optimize the user approach. When joining ten high-volume
+ (2000+ users total) channels there seems to be O(n) or somesuch
+ performance because of, I'm guessing, the way FIND-USER works.
+
+ - If a message (as in PRIVMSG) is longer than 512 characters
+ (including carriage return and linefeed) we should probably split
+ the message into several on behalf of the user.
+
+ - Add ignore
Index: net-nittin-irc/event.lisp
diff -u net-nittin-irc/event.lisp:1.6 net-nittin-irc/event.lisp:1.7
--- net-nittin-irc/event.lisp:1.6 Mon Nov 10 12:25:38 2003
+++ net-nittin-irc/event.lisp Fri Nov 14 11:13:21 2003
@@ -1,4 +1,4 @@
-;;;; $Id: event.lisp,v 1.6 2003/11/10 17:25:38 eenge Exp $
+;;;; $Id: event.lisp,v 1.7 2003/11/14 16:13:21 eenge Exp $
;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/event.lisp,v $
;;;; See LICENSE for licensing information.
@@ -868,15 +868,15 @@
(defmethod irc-message-event ((message irc-nick-message))
(apply-to-hooks message)
(client-log (connection message) message)
- (when (self-message-p message)
- (setf (nickname (user (connection message)))
- (trailing-argument message)))
- (let ((user (find-user (connection message) (source message))))
- (if user
- (setf (nickname user) (trailing-argument message))
- (client-raw-log (connection message)
- (format nil "Could not find user with nick ~A~%"
- (source 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)))))))
(defmethod irc-message-event ((message irc-notice-message))
(apply-to-hooks message)
Index: net-nittin-irc/package.lisp
diff -u net-nittin-irc/package.lisp:1.4 net-nittin-irc/package.lisp:1.5
--- net-nittin-irc/package.lisp:1.4 Mon Nov 10 12:25:38 2003
+++ net-nittin-irc/package.lisp Fri Nov 14 11:13:21 2003
@@ -1,4 +1,4 @@
-;;;; $Id: package.lisp,v 1.4 2003/11/10 17:25:38 eenge Exp $
+;;;; $Id: package.lisp,v 1.5 2003/11/14 16:13:21 eenge Exp $
;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/package.lisp,v $
;;;; See the LICENSE file for licensing information.
@@ -26,6 +26,7 @@
:remove-hooks
:get-hooks
:make-user
+ :change-nickname
:make-connection
:make-channel
:client-log
Index: net-nittin-irc/protocol.lisp
diff -u net-nittin-irc/protocol.lisp:1.7 net-nittin-irc/protocol.lisp:1.8
--- net-nittin-irc/protocol.lisp:1.7 Mon Nov 10 12:25:38 2003
+++ net-nittin-irc/protocol.lisp Fri Nov 14 11:13:21 2003
@@ -1,4 +1,4 @@
-;;;; $Id: protocol.lisp,v 1.7 2003/11/10 17:25:38 eenge Exp $
+;;;; $Id: protocol.lisp,v 1.8 2003/11/14 16:13:21 eenge Exp $
;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/protocol.lisp,v $
;;;; See LICENSE for licensing information.
@@ -323,7 +323,7 @@
(setf (channels connection) (remove channel (channels connection))))
(defmethod remove-users ((channel channel))
- (setf (users channel) (make-hash-table :test #'equal)))
+ (clrhash (users channel)))
;;
;; User
@@ -388,7 +388,7 @@
(remhash (nickname user) (users channel)))
(defmethod remove-user-everywhere ((connection connection) (user user))
- (dolist (channel (all-channels connection))
+ (dolist (channel (channels connection))
(remove-user channel user)))
(defmethod find-or-make-user ((connection connection) nickname &key (username "")
@@ -398,6 +398,16 @@
:username username
:hostname hostname
:realname realname)))
+
+(defmethod change-nickname ((connection connection) (user user) new-nickname)
+ (dolist (channel (channels connection))
+ (let ((old-user (gethash (nickname user) (users channel))))
+ (when old-user
+ (remhash (nickname user) (users channel))
+ (setf (nickname user) new-nickname)
+ (add-user channel user))))
+ (when (equal user (user connection))
+ (setf (nickname user) new-nickname)))
;; IRC Message
;;
Index: net-nittin-irc/variable.lisp
diff -u net-nittin-irc/variable.lisp:1.4 net-nittin-irc/variable.lisp:1.5
--- net-nittin-irc/variable.lisp:1.4 Fri Nov 7 10:40:19 2003
+++ net-nittin-irc/variable.lisp Fri Nov 14 11:13:21 2003
@@ -1,4 +1,4 @@
-;;;; $Id: variable.lisp,v 1.4 2003/11/07 15:40:19 eenge Exp $
+;;;; $Id: variable.lisp,v 1.5 2003/11/14 16:13:21 eenge Exp $
;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/variable.lisp,v $
;;;; See the LICENSE file for licensing information.
@@ -110,6 +110,7 @@
(317 :rpl_whoisidle)
(318 :rpl_endofwhois)
(319 :rpl_whoischannels)
+ (320 :rpl_whoisidentified) ; Seen in dancer ircd source
(321 :rpl_liststart)
(322 :rpl_list)
(323 :rpl_listend)