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

Brian Mastenbrook bmastenbrook at common-lisp.net
Thu Jun 3 14:17:58 UTC 2004


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

Modified Files:
	package.lisp lisppaste.lisp lisppaste.asd 
Log Message:
package: export shut-up; lisppaste: better response for help; lisppaste.asd: add r5rs-lookup

Date: Thu Jun  3 07:17:58 2004
Author: bmastenbrook

Index: lisppaste2/package.lisp
diff -u lisppaste2/package.lisp:1.5 lisppaste2/package.lisp:1.6
--- lisppaste2/package.lisp:1.5	Tue Jun  1 06:18:35 2004
+++ lisppaste2/package.lisp	Thu Jun  3 07:17:58 2004
@@ -1,4 +1,4 @@
-;;;; $Id: package.lisp,v 1.5 2004/06/01 13:18:35 bmastenbrook Exp $
+;;;; $Id: package.lisp,v 1.6 2004/06/03 14:17:58 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/package.lisp,v $
 
 ;;;; See the LICENSE file for licensing information.
@@ -8,6 +8,6 @@
 (eval-when (:execute :load-toplevel :compile-toplevel)
   (defpackage :lisppaste
       (:use :cl #+sbcl :sb-bsd-sockets :html-encode)
-    (:export :start-lisppaste :join-new-channel :shut-up :un-shut-up)))
+    (:export :start-lisppaste :join-new-channel :shut-up :un-shut-up :say-help)))
 
 


Index: lisppaste2/lisppaste.lisp
diff -u lisppaste2/lisppaste.lisp:1.16 lisppaste2/lisppaste.lisp:1.17
--- lisppaste2/lisppaste.lisp:1.16	Tue Jun  1 06:17:50 2004
+++ lisppaste2/lisppaste.lisp	Thu Jun  3 07:17:58 2004
@@ -1,10 +1,29 @@
-;;;; $Id: lisppaste.lisp,v 1.16 2004/06/01 13:17:50 bmastenbrook Exp $
+;;;; $Id: lisppaste.lisp,v 1.17 2004/06/03 14:17:58 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $
 
 ;;;; See the LICENSE file for licensing information.
 
 (in-package :lisppaste)
 
+(defun say-help (channel)
+  (when (and *connection*
+             (find channel *channels* :test #'string=))
+    (irc:privmsg *connection*
+                 channel
+                 (format nil "To use the lisppaste bot, visit ~A/~A and enter your paste." (araneida:urlstring *new-paste-url*) (subseq channel 1)))
+    t))
+
+(defun help-request-p (nick help text)
+  (and (> (length text)
+          (length nick))
+       (search nick text :start2 0 :end2 (length nick) :test #'char-equal)
+       (let ((url-position (search help text :start2 (length nick)
+                                   :test #'char-equal)))
+         (and
+          url-position
+          (notany #'alphanumericp (subseq text (length nick) (1- url-position)))
+          (notany #'alphanumericp (subseq text (+ url-position (length help))))))))
+
 (defun make-msg-hook (nick)
   (lambda (message)
     (let ((text (irc:trailing-argument message)))
@@ -12,18 +31,10 @@
              (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*))))
-            ((and (> (length text)
-                     (length nick))
-                  (search nick text :start2 0 :end2 (length nick) :test #'char-equal))
-             (let ((url-position (search "url" text :start2 (length nick)
-                                         :test #'char-equal)))
-               (if (and
-                    url-position
-                    (notany #'alphanumericp (subseq text (length nick) (1- url-position)))
-                    (notany #'alphanumericp (subseq text (+ url-position 3))))
-                   (irc:privmsg *connection*
-                                (first (irc:arguments message))
-                                (format nil "To use the lisppaste bot, visit ~A/~A and enter your paste." (araneida:urlstring *new-paste-url*) (subseq (first (irc:arguments message)) 1))))))))))
+            ((some #'(lambda (e)
+                       (help-request-p nick e text))
+                   '("url" "help" "hello"))
+             (say-help (first (irc:arguments message))))))))
   
   
 (defun add-hook (nick)
@@ -44,6 +55,7 @@
     (setf *channels* channels)
     (read-pastes-from-file *paste-file*)
     (mapcar #'(lambda (channel) (irc:join connection channel)) channels)
+    (clhs-lookup:populate-table)
     (araneida:start-listening *paste-listener*)
     (add-hook nickname)
     (setf *boot-time* (get-universal-time))


Index: lisppaste2/lisppaste.asd
diff -u lisppaste2/lisppaste.asd:1.9 lisppaste2/lisppaste.asd:1.10
--- lisppaste2/lisppaste.asd:1.9	Tue Jun  1 06:19:22 2004
+++ lisppaste2/lisppaste.asd	Thu Jun  3 07:17:58 2004
@@ -1,5 +1,5 @@
 ;;;; Silly emacs, this is -*- Lisp -*-
-;;;; $Id: lisppaste.asd,v 1.9 2004/06/01 13:19:22 bmastenbrook Exp $
+;;;; $Id: lisppaste.asd,v 1.10 2004/06/03 14:17:58 bmastenbrook Exp $
 ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.asd,v $
 
 ;;;; See the LICENSE file for licensing information.
@@ -22,15 +22,17 @@
 pre-configured IRC channel about the paste and where it can be
 located."
     :depends-on (:araneida :cl-irc)
-    :components ((:file "package")
+    :components ((:file "encode-for-pre")
+                 (:file "package" :depends-on ("encode-for-pre"))
                  (:file "variable"
                         :depends-on ("package"))
-                 (:file "encode-for-pre"
-                        :depends-on ("variable"))
                  (:file "lisppaste"
                         :depends-on ("variable"))
-                 (:file "colorize")
-                 (:file "clhs-lookup")
+                 (:file "colorize-package")
+                 (:file "coloring-css" :depends-on ("colorize-package"))
+                 (:file "colorize" :depends-on ("colorize-package" "coloring-css"))
+                 (:file "clhs-lookup" :depends-on ("encode-for-pre"))
+                 (:file "r5rs-lookup" :depends-on ("encode-for-pre"))
                  (:file "coloring-types"
                         :depends-on ("colorize" "clhs-lookup"))
                  (:file "web-server"





More information about the Lisppaste-cvs mailing list