[beirc-cvs] CVS update: beirc/application.lisp beirc/message-display.lisp beirc/receivers.lisp

Andreas Fuchs afuchs at common-lisp.net
Mon Sep 26 10:52:06 UTC 2005


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

Modified Files:
	application.lisp message-display.lisp receivers.lisp 
Log Message:
add handling for the "no such nick or channel" message.

Date: Mon Sep 26 12:52:05 2005
Author: afuchs

Index: beirc/application.lisp
diff -u beirc/application.lisp:1.12 beirc/application.lisp:1.13
--- beirc/application.lisp:1.12	Mon Sep 26 11:46:25 2005
+++ beirc/application.lisp	Mon Sep 26 12:52:05 2005
@@ -269,6 +269,8 @@
   (raise-receiver receiver))
 
 (define-beirc-command (com-close :name t) ((receiver 'receiver :prompt "receiver"))
+  (when (eql receiver (server-receiver *application-frame*))
+    (error "Can't close the server tab for this application!"))
   (let* ((connection (current-connection *application-frame*))
          (channel (irc:find-channel connection (title receiver))))
     (when channel


Index: beirc/message-display.lisp
diff -u beirc/message-display.lisp:1.19 beirc/message-display.lisp:1.20
--- beirc/message-display.lisp:1.19	Mon Sep 26 11:46:25 2005
+++ beirc/message-display.lisp	Mon Sep 26 12:52:05 2005
@@ -244,10 +244,23 @@
 
 ;;; channel management messages
 
+(defmethod print-message ((message irc:irc-err_nosuchnick-message) receiver)
+  (formatting-message (t message receiver)
+          ((format t "    "))
+          ((with-drawing-options (*standard-output* :ink +red3+ :text-size :small)
+             (let* ((target (second (irc:arguments message)))
+                    (close-p (string= (title receiver)
+                                      (irc:normalize-nickname (current-connection *application-frame*)
+                                                              target))))
+              (format-message* (format nil "No such nick or channel \"~A\". ~@[To close this tab, click ~]"
+                                       target close-p))
+              (when close-p
+                (present `(com-close ,receiver) 'command)))))))
+
 (defmethod print-message ((message irc:irc-err_chanoprivsneeded-message) receiver)
   (formatting-message (t message receiver)
           ((format t "    "))
-          ((with-drawing-options (*standard-output* :ink +gray33+ :text-size :small)
+          ((with-drawing-options (*standard-output* :ink +red3+ :text-size :small)
              (format-message* (format nil "Not permitted: ~A" (irc:trailing-argument message)))))))
 
 (defun print-topic (receiver message sender channel topic)
@@ -267,6 +280,16 @@
 (defmethod print-message ((message irc:irc-rpl_topic-message) receiver)
   (print-topic receiver message nil
                (second (irc:arguments message)) (irc:trailing-argument message)))
+
+(defmethod print-message ((message irc:irc-rpl_topicwhotime-message) receiver)
+  (formatting-message (t message receiver)
+          ((format t "   "))
+          ((with-drawing-options (*standard-output* :ink +gray33+ :text-size :small)
+             (destructuring-bind (me channel who time) (irc:arguments message)
+               (declare (ignore me
+                                time ; TODO: no date display for now.
+                                ))
+              (format-message* (format nil "~A topic set by ~A" channel who)))))))
 
 (defmethod print-message ((message irc:irc-rpl_namreply-message) receiver)
   (formatting-message (t message receiver)


Index: beirc/receivers.lisp
diff -u beirc/receivers.lisp:1.5 beirc/receivers.lisp:1.6
--- beirc/receivers.lisp:1.5	Mon Sep 26 11:46:25 2005
+++ beirc/receivers.lisp	Mon Sep 26 12:52:05 2005
@@ -142,7 +142,7 @@
                                            (intern-receiver target frame :channel target))))))))
   (define-nth-arg-message-receiver-lookup
       (0 irc:irc-topic-message irc:irc-kick-message)
-      (1 irc:irc-rpl_topic-message irc:irc-rpl_topicwhotime-message irc:irc-err_chanoprivsneeded-message irc:irc-err_nosuchnick-message)
+      (1 irc:irc-rpl_topic-message irc:irc-rpl_topicwhotime-message irc:irc-err_chanoprivsneeded-message)
       (2 irc:irc-rpl_namreply-message)
       (nil irc:irc-join-message)))
 
@@ -169,7 +169,8 @@
   (define-current-receiver-message-types
       irc:irc-rpl_whoisuser-message
       irc:irc-rpl_whoischannels-message
-      irc:irc-rpl_whoisserver-message))
+      irc:irc-rpl_whoisserver-message
+      irc:irc-err_nosuchnick-message))
 
 (macrolet ((define-ignore-message-types (&rest mtypes)
              `(progn




More information about the Beirc-cvs mailing list