[Cl-irc-cvs] CVS update: cl-irc/example/cliki.lisp cl-irc/example/eliza-rules.lisp

Brian Mastenbrook bmastenbrook at common-lisp.net
Wed Jun 9 18:54:25 UTC 2004


Update of /project/cl-irc/cvsroot/cl-irc/example
In directory common-lisp.net:/tmp/cvs-serv10886/example

Modified Files:
	cliki.lisp eliza-rules.lisp 
Log Message:
Armed Bear Common Lisp compatibility

Date: Wed Jun  9 11:54:25 2004
Author: bmastenbrook

Index: cl-irc/example/cliki.lisp
diff -u cl-irc/example/cliki.lisp:1.8 cl-irc/example/cliki.lisp:1.9
--- cl-irc/example/cliki.lisp:1.8	Thu Jun  3 07:15:16 2004
+++ cl-irc/example/cliki.lisp	Wed Jun  9 11:54:25 2004
@@ -1,4 +1,4 @@
-;;;; $Id: cliki.lisp,v 1.8 2004/06/03 14:15:16 bmastenbrook Exp $
+;;;; $Id: cliki.lisp,v 1.9 2004/06/09 18:54:25 bmastenbrook Exp $
 ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/example/cliki.lisp,v $
 
 ;;;; cliki.lisp - CLiki as an infobot; only works on SBCL.
@@ -51,27 +51,6 @@
 			(or port-start (length url)))))
     (subseq url 7 host-end)))
 
-#+(or ccl allegro)
-(defun socket-connect (host port)
-  (#+ccl ccl:make-socket
-         #+allegro socket:make-socket
-         :connect :active
-         :remote-host host
-         :remote-port port))
-
-#+sbcl
-(defun socket-connect (host port)
-  (let ((s (make-instance 'sb-bsd-sockets:inet-socket
-                          :type :stream
-                          :protocol :tcp)))
-    (sb-bsd-sockets:socket-connect s (car (sb-bsd-sockets:host-ent-addresses
-                                           (sb-bsd-sockets:get-host-by-name host))) port)
-    (sb-bsd-sockets:socket-make-stream s
-                                       :element-type 'character
-                                       :input t
-                                       :output t
-                                       :buffering :none)))
-
 (defun url-connection (url)
   (let* ((host (url-host url))
          (port (url-port url))
@@ -100,6 +79,11 @@
   ;(format t "hi ~A~%" str)
   str)
 
+#-(or sbcl ccl)
+(defmacro host-with-timeout (timeout &body body)
+  (declare (ignore timeout))
+  `(progn , at body))
+
 #+sbcl
 (defmacro host-with-timeout (timeout &body body)
   `(sb-ext:with-timeout ,timeout , at body))
@@ -178,7 +162,10 @@
        (symbol-macrolet ((it ,test))
          ,else))))
 
-(defparameter *cliki-attention-prefix* "^minion[,:]\\s+")
+(defun make-cliki-attention-prefix (nick)
+  (format nil "^~A[,:]\\s+" nick))
+
+(defparameter *cliki-attention-prefix* "")
 
 (defparameter *cliki-bot-help* "The minion bot supplies small definitions and performs lookups on CLiki. To use it, try ``minion: term?''. To add a term for IRC, try saying ``minion: add \"term\" as: definition'' or ``minion: alias \"term\" as: term''; otherwise, edit the corresponding CLiki page.")
 
@@ -259,6 +246,7 @@
   (read-small-definitions)
   (setf *cliki-nickname* nick)
   (setf *cliki-connection* (connect :nickname *cliki-nickname* :server server))
+  (setf *cliki-attention-prefix* (make-cliki-attention-prefix nick))
   (mapcar #'(lambda (channel) (join *cliki-connection* channel)) channels)
   (add-hook *cliki-connection* 'irc::irc-privmsg-message 'msg-hook)
   (add-hook *cliki-connection* 'irc::irc-notice-message 'notice-hook)


Index: cl-irc/example/eliza-rules.lisp
diff -u cl-irc/example/eliza-rules.lisp:1.3 cl-irc/example/eliza-rules.lisp:1.4
--- cl-irc/example/eliza-rules.lisp:1.3	Tue Jun  1 06:48:12 2004
+++ cl-irc/example/eliza-rules.lisp	Wed Jun  9 11:54:25 2004
@@ -21,6 +21,7 @@
    (((?* ?x) bot (?* ?y))
     (|I'm| not a |bot.| I prefer the term |``electronically composed''.|))
 
+   #-armedbear
    ((seen ?x)
     (?x was last seen 5y6m14d32h43m10s |ago,| saying |"minion: when are you going to support seen?"|))
 
@@ -44,14 +45,17 @@
 
    ((not much) (good))
 
+   #-armedbear
    (((?* ?x) linux (?* ?y))
     (I run on Crux Linux - |http://www.crux.nu/|))
 
+   #-armedbear
    (((?* ?x) crux (?* ?y))
     (I like running on Crux Linux))
 
    (((?* ?x) slackware (?* ?y))
     (Slackware is nice but I like Crux))
+   #-armedbear
    (((?* ?x) debian (?* ?y))
     (|baah, use crux: http://www.crux.nu/|))
 
@@ -376,7 +380,7 @@
     (superman) (bill clinton) (king kong) (me))
 
    ((what (?* ?x))
-    (a |man, a plan, a canal: panama|)
+    (a |man, a plan, a canal - panama|)
     (a banana)
     (42))
 





More information about the cl-irc-cvs mailing list