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

Erik Huelsmann ehuelsmann at common-lisp.net
Sun Mar 27 21:40:32 UTC 2005


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

Modified Files:
	protocol.lisp event.lisp 
Log Message:
Extend mode tracking: Handle response to a MODE request on a channel

Date: Sun Mar 27 23:40:31 2005
Author: ehuelsmann

Index: cl-irc/protocol.lisp
diff -u cl-irc/protocol.lisp:1.21 cl-irc/protocol.lisp:1.22
--- cl-irc/protocol.lisp:1.21	Sun Mar 27 22:27:18 2005
+++ cl-irc/protocol.lisp	Sun Mar 27 23:40:30 2005
@@ -1,4 +1,4 @@
-;;;; $Id: protocol.lisp,v 1.21 2005/03/27 20:27:18 ehuelsmann Exp $
+;;;; $Id: protocol.lisp,v 1.22 2005/03/27 21:40:30 ehuelsmann Exp $
 ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/protocol.lisp,v $
 
 ;;;; See LICENSE for licensing information.
@@ -220,6 +220,7 @@
                      irc-kick-message
                      irc-nick-message
                      irc-mode-message
+                     irc-rpl_channelmodeis-message
                      ctcp-time-message
                      ctcp-source-message
                      ctcp-finger-message


Index: cl-irc/event.lisp
diff -u cl-irc/event.lisp:1.8 cl-irc/event.lisp:1.9
--- cl-irc/event.lisp:1.8	Sun Mar 27 22:27:18 2005
+++ cl-irc/event.lisp	Sun Mar 27 23:40:30 2005
@@ -1,4 +1,4 @@
-;;;; $Id: event.lisp,v 1.8 2005/03/27 20:27:18 ehuelsmann Exp $
+;;;; $Id: event.lisp,v 1.9 2005/03/27 21:40:30 ehuelsmann Exp $
 ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/event.lisp,v $
 
 ;;;; See LICENSE for licensing information.
@@ -185,6 +185,27 @@
 (defmethod default-hook ((message irc-quit-message))
   (let ((connection (connection message)))
     (remove-user-everywhere connection (find-user connection (source message)))))
+
+(defmethod default-hook ((message irc-rpl_channelmodeis-message))
+  (destructuring-bind
+      (target &rest arguments)
+      ;; ignore the my own nick which is the first message argument
+      (rest (arguments message))
+    (let* ((connection (connection message))
+           (target (find-channel connection target))
+           (mode-changes
+            (when target
+              (parse-mode-arguments connection target arguments
+                                    :server-p (user connection)))))
+      (dolist (change mode-changes)
+        (destructuring-bind
+            (op mode-name value)
+            change
+          (unless (has-mode-p target mode-name)
+            (add-mode target mode-name
+                      (make-mode connection target mode-name)))
+          (funcall (if (char= #\+ op) #'set-mode #'unset-mode)
+                   target mode-name value))))))
 
 (defmethod default-hook ((message irc-mode-message))
   (destructuring-bind




More information about the cl-irc-cvs mailing list