[Lisppaste-cvs] CVS update: lisppaste2/lisppaste.lisp

Brian Mastenbrook bmastenbrook at common-lisp.net
Wed Mar 3 03:43:05 UTC 2004


Update of /project/lisppaste/cvsroot/lisppaste2
In directory common-lisp.net:/home/bmastenbrook/lisppaste2

Modified Files:
	lisppaste.lisp 
Log Message:
msg for help

Date: Tue Mar  2 22:43:05 2004
Author: bmastenbrook

Index: lisppaste2/lisppaste.lisp
diff -u lisppaste2/lisppaste.lisp:1.8 lisppaste2/lisppaste.lisp:1.9
--- lisppaste2/lisppaste.lisp:1.8	Tue Feb 10 11:17:52 2004
+++ lisppaste2/lisppaste.lisp	Tue Mar  2 22:43:04 2004
@@ -1,10 +1,21 @@
-;;;; $Id: lisppaste.lisp,v 1.8 2004/02/10 16:17:52 bmastenbrook Exp $
+;;;; $Id: lisppaste.lisp,v 1.9 2004/03/03 03:43:04 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $
 
 ;;;; See the LICENSE file for licensing information.
 
 (in-package :lisppaste)
 
+(defun make-msg-hook (nick)
+  (lambda (message)
+    (if (string= (first (irc:arguments message)) nick)
+	(irc:privmsg *connection*
+		     (irc:source message)
+		     (format nil "To use the lisppaste bot, visit ~A and enter your paste. Be sure to select the right channel!" (araneida:urlstring *new-paste-url*))))))
+
+(defun add-hook (nick)
+  (irc:remove-hooks *connection* 'irc:irc-privmsg-message)
+  (irc:add-hook *connection* 'irc:irc-privmsg-message (make-msg-hook nick)))
+
 (defun start-lisppaste (&key (channels (list *default-channel*))
                              (nickname *default-nickname*)
                              (server *default-irc-server*)
@@ -20,6 +31,7 @@
     (read-pastes-from-file *paste-file*)
     (mapcar #'(lambda (channel) (irc:join connection channel)) channels)
     (araneida:start-listening *paste-listener*)
+    (add-hook nickname)
     (irc:read-message-loop connection)))
 
 (defun join-new-channel (channel)
@@ -33,4 +45,5 @@
 				  :server server
 				  :port *default-irc-server-port*))
   (mapcar #'(lambda (channel) (irc:join *connection* channel)) *channels*)
+  (add-hook nickname)
   (irc:read-message-loop *connection*))





More information about the Lisppaste-cvs mailing list