[beirc-cvs] CVS update: beirc/beirc.lisp

Andreas Fuchs afuchs at common-lisp.net
Sat Sep 24 17:39:36 UTC 2005


Update of /project/beirc/cvsroot/beirc
In directory common-lisp.net:/tmp/cvs-serv12043

Modified Files:
	beirc.lisp 
Log Message:
add /part and better /close functionality.

 * /part exits the current channel and leaves the receiver intact.
 * /close closes the receiver and parts the channel (if the closed
   receiver is a channel). The part message from a closed channel goes
   to the server buffer.


Date: Sat Sep 24 19:39:36 2005
Author: afuchs

Index: beirc/beirc.lisp
diff -u beirc/beirc.lisp:1.23 beirc/beirc.lisp:1.24
--- beirc/beirc.lisp:1.23	Sat Sep 24 19:28:38 2005
+++ beirc/beirc.lisp	Sat Sep 24 19:39:36 2005
@@ -178,7 +178,11 @@
 
 (defmethod receiver-for-message ((message irc:irc-part-message) frame)
   (let ((target (first (irc:arguments message))))
-    (intern-receiver target frame :channel target)))
+    (if (and
+         (null (find-receiver target frame))
+         (string= (irc:source message) (slot-value frame 'nick)))
+        (server-receiver frame) ; don't re-open previously closed channels.
+        (intern-receiver target frame :channel target))))
 
 (defmethod receiver-for-message ((message irc:irc-mode-message) frame)
   (case (length (irc:arguments message))
@@ -497,7 +501,15 @@
   (raise-receiver receiver))
 
 (define-beirc-command (com-close :name t) ((receiver 'receiver :prompt "receiver"))
+  (let* ((connection (current-connection *application-frame*))
+         (channel (irc:find-channel connection (title receiver))))
+    (when channel
+      (irc:part connection channel)))
   (remove-receiver receiver *application-frame*))
+
+(define-beirc-command (com-part :name t) ()
+  (irc:part (current-connection *application-frame*)
+            (title (current-receiver *application-frame*))))
 
 (define-beirc-command (com-focus :name t) ((who 'nickname :prompt "who"))
   (pushnew who (current-focused-nicks) :test #'string=))




More information about the Beirc-cvs mailing list