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

Andreas Fuchs afuchs at common-lisp.net
Sun Oct 2 23:52:33 UTC 2005


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

Modified Files:
	message-display.lisp 
Log Message:
while I'm at it, refactor hostmask presenting into present-as-hostmask.

Date: Mon Oct  3 01:52:32 2005
Author: afuchs

Index: beirc/message-display.lisp
diff -u beirc/message-display.lisp:1.23 beirc/message-display.lisp:1.24
--- beirc/message-display.lisp:1.23	Mon Oct  3 01:48:45 2005
+++ beirc/message-display.lisp	Mon Oct  3 01:52:32 2005
@@ -189,16 +189,21 @@
              (format-message* (irc:trailing-argument message)
 			      :start-length (+ 8 (length (irc:source message))))))))
 
+(defun present-as-hostmask (user host)
+  (write-char #\()
+  (with-output-as-presentation (t (format nil "*!*@~A" host) 'hostmask)
+    (format t "~A@~A" user host))
+  (write-char #\)))
+
 (defmethod print-message ((message irc:irc-nick-message) receiver)
   (formatting-message (t message receiver)
                       ((format t "   "))
                       ((with-drawing-options (*standard-output* :ink +gray33+ :text-size :small)
                          (format t "Nick change: ")
                          (present (irc:source message) 'nickname)
-                         (write-string " (")
-                         (with-output-as-presentation (t (format nil "*!*@~A" (irc:host message)) 'hostmask)
-                             (format t "~A@~A" (irc:user message) (irc:host message)))
-                         (write-string ") is now known as ")
+                         (write-string " ")
+                         (present-as-hostmask (irc:user message) (irc:host message))
+                         (write-string " is now known as ")
                          (present (irc:trailing-argument message) 'nickname)))))
 
 (defmethod print-message ((message irc:irc-rpl_whoisuser-message) receiver)
@@ -208,10 +213,9 @@
                          (destructuring-bind (me nickname user host &rest args) (irc:arguments message)
                            (declare (ignore me args))
                            (present nickname 'nickname)
-                           (format t " is (")
-                           (with-output-as-presentation (t (format nil "*!*@~A" host) 'hostmask)
-                             (format t "~A@~A" user host))
-                           (format t ") (~A)" (irc:trailing-argument message)))))))
+                           (format t " is ")
+                           (present-as-hostmask user host)
+                           (format t " (~A)" (irc:trailing-argument message)))))))
 
 (defmethod print-message ((message irc:irc-rpl_whoischannels-message) receiver)
   (formatting-message (t message receiver)
@@ -319,9 +323,7 @@
              (format t "Join: ")
              (present (irc:source message) 'nickname)
              (write-char #\Space)
-             (with-output-as-presentation (t (format nil "*!*@~A" (irc:host message))
-                                             'hostmask)
-               (format t "(~A@~A)" (irc:user message) (irc:host message)))))))
+             (present-as-hostmask (irc:user message) (irc:host message))))))
 
 (defmethod print-message ((message irc:irc-kick-message) receiver)
   (formatting-message (t message receiver)




More information about the Beirc-cvs mailing list