From bmastenbrook at common-lisp.net Fri Oct 15 18:23:16 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Fri, 15 Oct 2004 20:23:16 +0200 Subject: [Lisppaste-cvs] CVS update: lisppaste2/README.lisp lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: README.lisp variable.lisp Log Message: No clue Date: Fri Oct 15 20:23:15 2004 Author: bmastenbrook Index: lisppaste2/README.lisp diff -u lisppaste2/README.lisp:1.12 lisppaste2/README.lisp:1.13 --- lisppaste2/README.lisp:1.12 Fri Oct 1 01:55:43 2004 +++ lisppaste2/README.lisp Fri Oct 15 20:23:15 2004 @@ -1,4 +1,4 @@ -;;;; $Id: README.lisp,v 1.12 2004/09/30 23:55:43 bmastenbrook Exp $ +;;;; $Id: README.lisp,v 1.13 2004/10/15 18:23:15 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/README.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -28,7 +28,7 @@ (s-xml-rpc:start-xml-rpc-server :port 8185) -(lisppaste:start-lisppaste :channels '("#lisp" "#scheme" "#opendarwin" "#macdev" "#fink" "#jedit" "#dylan" "#emacs" "#xemacs" "#colloquy" "#adium" "#growl" "#chicken" "#quicksilver" "#svn" "#slate" "#squeak") +(lisppaste:start-lisppaste :channels '("#lisp" "#scheme" "#opendarwin" "#macdev" "#fink" "#jedit" "#dylan" "#emacs" "#xemacs" "#colloquy" "#adium" "#growl" "#chicken" "#quicksilver" "#svn" "#slate" "#squeak" "#wiki" "#nebula" "#imgames") :nickname "lisppaste" :server "orwell.freenode.net" :port 6667) Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.30 lisppaste2/variable.lisp:1.31 --- lisppaste2/variable.lisp:1.30 Fri Oct 1 01:44:49 2004 +++ lisppaste2/variable.lisp Fri Oct 15 20:23:15 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.30 2004/09/30 23:44:49 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.31 2004/10/15 18:23:15 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -54,7 +54,8 @@ (defparameter *banned-ips* '("69.11.238.252" "168.143.113.138" - "64.236.227.6")) ; two examples of + "64.236.227.6" "83.216.146.102" + "206.159.155.203")) ; two examples of ; troublemakers affecting ; freenode's lisppaste From bmastenbrook at common-lisp.net Sat Oct 16 21:55:13 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 16 Oct 2004 23:55:13 +0200 Subject: [Lisppaste-cvs] CVS update: lisppaste2/redirect-handler.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Added Files: redirect-handler.lisp Log Message: Add this file Date: Sat Oct 16 23:55:12 2004 Author: bmastenbrook From bmastenbrook at common-lisp.net Wed Oct 20 19:56:55 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Wed, 20 Oct 2004 21:56:55 +0200 Subject: [Lisppaste-cvs] CVS update: lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: web-server.lisp Log Message: Remove orhpan "Donations Accepted" link: whoops! Date: Wed Oct 20 21:56:55 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.66 lisppaste2/web-server.lisp:1.67 --- lisppaste2/web-server.lisp:1.66 Fri Oct 1 01:44:49 2004 +++ lisppaste2/web-server.lisp Wed Oct 20 21:56:54 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.66 2004/09/30 23:44:49 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.67 2004/10/20 19:56:54 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -944,12 +944,6 @@ (br) ((input :type submit :value "Annotate this paste"))))))) `(p) - `(table - (tr - (td - ((div :class "info-text") - ((span :class "small-header") "Donations accepted") - )))) )))))))) (defun ends-with (str end) From bmastenbrook at common-lisp.net Wed Oct 20 20:22:15 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Wed, 20 Oct 2004 22:22:15 +0200 Subject: [Lisppaste-cvs] CVS update: lisppaste2/irc-notification.lisp lisppaste2/README.lisp lisppaste2/lisppaste.asd lisppaste2/lisppaste.lisp lisppaste2/package.lisp lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: README.lisp lisppaste.asd lisppaste.lisp package.lisp variable.lisp Added Files: irc-notification.lisp Log Message: Support for running without IRC notification: cleanup pending; for now, take a hacksaw and separate the parts Date: Wed Oct 20 22:22:13 2004 Author: bmastenbrook Index: lisppaste2/README.lisp diff -u lisppaste2/README.lisp:1.13 lisppaste2/README.lisp:1.14 --- lisppaste2/README.lisp:1.13 Fri Oct 15 20:23:15 2004 +++ lisppaste2/README.lisp Wed Oct 20 22:22:13 2004 @@ -1,4 +1,4 @@ -;;;; $Id: README.lisp,v 1.13 2004/10/15 18:23:15 bmastenbrook Exp $ +;;;; $Id: README.lisp,v 1.14 2004/10/20 20:22:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/README.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -22,13 +22,24 @@ ;;; httpd.conf. Then, run SBCL and invoke the magical invocation as ;;; follows, or simply (load "README"). +;;; If you wish to run without an IRC server, uncomment the following +;;; line: +;; (pushnew :lisppaste-no-irc *features*) + (require :asdf) (asdf:operate 'asdf:load-op :lisppaste) (load (compile-file "redirect-handler")) (s-xml-rpc:start-xml-rpc-server :port 8185) -(lisppaste:start-lisppaste :channels '("#lisp" "#scheme" "#opendarwin" "#macdev" "#fink" "#jedit" "#dylan" "#emacs" "#xemacs" "#colloquy" "#adium" "#growl" "#chicken" "#quicksilver" "#svn" "#slate" "#squeak" "#wiki" "#nebula" "#imgames") - :nickname "lisppaste" - :server "orwell.freenode.net" - :port 6667) +(lisppaste:start-lisppaste) + +#-lisppaste-no-irc +(lisppaste:start-irc-notification) + :channels '("#lisp" "#scheme" "#opendarwin" "#macdev" "#fink" + "#jedit" "#dylan" "#emacs" "#xemacs" "#colloquy" "#adium" + "#growl" "#chicken" "#quicksilver" "#svn" "#slate" + "#squeak" "#wiki" "#nebula" "#imgames") + :nickname "lisppaste" + :server "orwell.freenode.net" + :port 6667) Index: lisppaste2/lisppaste.asd diff -u lisppaste2/lisppaste.asd:1.17 lisppaste2/lisppaste.asd:1.18 --- lisppaste2/lisppaste.asd:1.17 Tue Jul 27 20:47:10 2004 +++ lisppaste2/lisppaste.asd Wed Oct 20 22:22:13 2004 @@ -1,5 +1,5 @@ ;;;; Silly emacs, this is -*- Lisp -*- -;;;; $Id: lisppaste.asd,v 1.17 2004/07/27 18:47:10 bmastenbrook Exp $ +;;;; $Id: lisppaste.asd,v 1.18 2004/10/20 20:22:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.asd,v $ ;;;; See the LICENSE file for licensing information. @@ -21,7 +21,8 @@ paste text into it. Once pasted, lisppaste will notify a pre-configured IRC channel about the paste and where it can be located." - :depends-on (:araneida :cl-irc :split-sequence :s-xml :s-xml-rpc) + :depends-on (:araneida #-lisppaste-no-irc :cl-irc + :split-sequence :s-xml :s-xml-rpc) :components ((:file "encode-for-pre") (:file "package" :depends-on ("encode-for-pre")) (:file "variable" @@ -33,10 +34,13 @@ (:file "clhs-lookup" :depends-on ("encode-for-pre" "abbrev")) (:file "r5rs-lookup" :depends-on ("encode-for-pre")) (:file "elisp-lookup" :depends-on ("encode-for-pre")) + #-lisppaste-no-irc (:file "irc-notification" :depends-on ("variable" "package")) (:file "lisppaste" :depends-on ("variable" "clhs-lookup" "r5rs-lookup" - "elisp-lookup")) + "elisp-lookup" + #-lisppaste-no-irc + "irc-notification")) (:file "coloring-types" :depends-on ("colorize" "clhs-lookup")) (:file "web-server" Index: lisppaste2/lisppaste.lisp diff -u lisppaste2/lisppaste.lisp:1.24 lisppaste2/lisppaste.lisp:1.25 --- lisppaste2/lisppaste.lisp:1.24 Tue Jul 27 20:47:10 2004 +++ lisppaste2/lisppaste.lisp Wed Oct 20 22:22:13 2004 @@ -1,107 +1,38 @@ -;;;; $Id: lisppaste.lisp,v 1.24 2004/07/27 18:47:10 bmastenbrook Exp $ +;;;; $Id: lisppaste.lisp,v 1.25 2004/10/20 20:22:13 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))) - (cond ((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*)))) - ((some #'(lambda (e) - (help-request-p nick e text)) - '("url" "help" "hello")) - (say-help (first (irc:arguments message)))))))) - - -(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*) - (port *default-irc-server-port*)) - "Connect to specified server, join specified channel and start -accepting requests through the web." - (let ((connection (irc:connect :nickname nickname - :realname (araneida:urlstring *new-paste-url*) - :server server - :port port))) - (setf *connection* connection) - (setf *channels* channels) - (if *no-channel-pastes* - (pushnew "None" *channels* :test #'string-equal)) - (read-xml-pastes) - (format t "Populating lookup table...~%") - (clhs-lookup:populate-table) - (r5rs-lookup:populate-table) - (elisp-lookup:populate-table) - (format t "Done!~%") - (mapcar #'(lambda (channel) (irc:join connection channel)) channels) - (add-hook nickname) - (setf *boot-time* (get-universal-time)) - (irc:start-background-message-handler connection) - (araneida:start-listening *paste-listener*))) - -(defun join-new-channel (channel) - (setf *channels* (nconc *channels* (list channel))) - (irc:join *connection* channel)) - -(defun hup-connection (nickname server) - (ignore-errors (irc:quit *connection*)) - (setf *connection* (irc:connect :nickname nickname - :realname (araneida:urlstring *new-paste-url*) - :server server - :port *default-irc-server-port*)) - (mapcar #'(lambda (channel) (irc:join *connection* channel)) *channels*) - (add-hook nickname) - (irc:start-background-message-handler *connection*)) +(defun start-lisppaste () + "Start accepting web requests." + (if *no-channel-pastes* + (pushnew "None" *channels* :test #'string-equal)) + (read-xml-pastes) + (format t "Populating lookup table...~%") + (clhs-lookup:populate-table) + (r5rs-lookup:populate-table) + (elisp-lookup:populate-table) + (format t "Done!~%") + (setf *boot-time* (get-universal-time)) + (araneida:start-listening *paste-listener*)) (defmacro make-new-paste (paste-list (&optional annotate real-number annotate-list) url &rest keys &key channel user title &allow-other-keys) (let ((paste-name (gensym))) `(let ((,paste-name (make-paste , at keys))) (if (not (string-equal ,channel "None")) - (irc:privmsg *connection* ,channel - (if ,annotate - (format nil "~A annotated #~A with \"~A\" at ~A" ,user ,real-number ,title ,url) - (format nil "~A pasted \"~A\" at ~A" ,user ,title ,url)))) + (irc-notify ,channel + (if ,annotate + (format nil "~A annotated #~A with \"~A\" at ~A" ,user ,real-number ,title ,url) + (format nil "~A pasted \"~A\" at ~A" ,user ,title ,url)))) ,(if annotate `(if ,annotate (push ,paste-name ,annotate-list) (push ,paste-name ,paste-list)) `(push ,paste-name ,paste-list)) (serialize-transaction ,paste-name (if ,annotate ,real-number))))) - -(defun shut-up () - (setf (irc:client-stream *connection*) (make-broadcast-stream))) - -(defun un-shut-up () - (setf (irc:client-stream *connection*) *trace-output*)) (defun kill-paste (number) (let ((paste (find-paste number))) Index: lisppaste2/package.lisp diff -u lisppaste2/package.lisp:1.8 lisppaste2/package.lisp:1.9 --- lisppaste2/package.lisp:1.8 Tue Jul 6 18:34:24 2004 +++ lisppaste2/package.lisp Wed Oct 20 22:22:13 2004 @@ -1,4 +1,4 @@ -;;;; $Id: package.lisp,v 1.8 2004/07/06 16:34:24 bmastenbrook Exp $ +;;;; $Id: package.lisp,v 1.9 2004/10/20 20:22:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/package.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -8,7 +8,9 @@ (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 :say-help + (:export :start-lisppaste :join-new-irc-channel + :start-irc-notification :hup-irc-connection + :shut-up :un-shut-up :irc-say-help :kill-paste :kill-paste-annotations :kill-paste-annotation :display-paste-url :find-paste))) Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.31 lisppaste2/variable.lisp:1.32 --- lisppaste2/variable.lisp:1.31 Fri Oct 15 20:23:15 2004 +++ lisppaste2/variable.lisp Wed Oct 20 22:22:13 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.31 2004/10/15 18:23:15 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.32 2004/10/20 20:22:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -48,6 +48,11 @@ (defvar *meme-links* t) ; whether to link to meme IRC logs, probably ; only useful for freenode's lisppaste +(defvar *irc-network-name* "Freenode") ; the name of the IRC network + ; lisppaste is running on; can + ; be ignored when not running + ; with an IRC connection + (defvar *paste-maximum-size* 51200) ; in bytes (defvar *pastes-per-page* 50) ; for the paste list @@ -149,6 +154,7 @@ (defvar *pastes* nil) (defvar *paste-counter* 0) (defvar *connection* nil) +(defvar *nickname*) (defvar *channels* '("None")) (defvar *paste-file* From bmastenbrook at common-lisp.net Wed Oct 20 20:37:52 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Wed, 20 Oct 2004 22:37:52 +0200 Subject: [Lisppaste-cvs] CVS update: lisppaste2/README.lisp lisppaste2/irc-notification.lisp lisppaste2/persistent-pastes.lisp lisppaste2/variable.lisp lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv12377 Modified Files: README.lisp irc-notification.lisp persistent-pastes.lisp variable.lisp web-server.lisp Log Message: Fixes for IRC-less mode Date: Wed Oct 20 22:37:50 2004 Author: bmastenbrook Index: lisppaste2/README.lisp diff -u lisppaste2/README.lisp:1.14 lisppaste2/README.lisp:1.15 --- lisppaste2/README.lisp:1.14 Wed Oct 20 22:22:13 2004 +++ lisppaste2/README.lisp Wed Oct 20 22:37:50 2004 @@ -1,4 +1,4 @@ -;;;; $Id: README.lisp,v 1.14 2004/10/20 20:22:13 bmastenbrook Exp $ +;;;; $Id: README.lisp,v 1.15 2004/10/20 20:37:50 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/README.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -35,7 +35,7 @@ (lisppaste:start-lisppaste) #-lisppaste-no-irc -(lisppaste:start-irc-notification) +(lisppaste:start-irc-notification :channels '("#lisp" "#scheme" "#opendarwin" "#macdev" "#fink" "#jedit" "#dylan" "#emacs" "#xemacs" "#colloquy" "#adium" "#growl" "#chicken" "#quicksilver" "#svn" "#slate" Index: lisppaste2/irc-notification.lisp diff -u lisppaste2/irc-notification.lisp:1.1 lisppaste2/irc-notification.lisp:1.2 --- lisppaste2/irc-notification.lisp:1.1 Wed Oct 20 22:22:13 2004 +++ lisppaste2/irc-notification.lisp Wed Oct 20 22:37:50 2004 @@ -1,4 +1,4 @@ -;;;; $Id: irc-notification.lisp,v 1.1 2004/10/20 20:22:13 bmastenbrook Exp $ +;;;; $Id: irc-notification.lisp,v 1.2 2004/10/20 20:37:50 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/irc-notification.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -49,7 +49,7 @@ :server server :port port))) (setf *connection* connection) - (setf *channels* channels) + (setf *channels* (nconc *channels* channels)) (setf *nickname* nickname) (mapcar #'(lambda (channel) (irc:join connection channel)) channels) (add-irc-hook nickname) Index: lisppaste2/persistent-pastes.lisp diff -u lisppaste2/persistent-pastes.lisp:1.13 lisppaste2/persistent-pastes.lisp:1.14 --- lisppaste2/persistent-pastes.lisp:1.13 Tue Jul 27 20:47:10 2004 +++ lisppaste2/persistent-pastes.lisp Wed Oct 20 22:37:50 2004 @@ -50,7 +50,6 @@ *paste-path*)) (defun paste-write-xml (paste stream) - (ensure-directories-exist *paste-path*) (write-string "" stream) (write-string (s-xml:print-xml-string (paste-lxml paste) :pretty t) stream) (mapc #'(lambda (ann) @@ -59,6 +58,7 @@ (paste-annotations paste))) (defun paste-write-xml-to-file (paste) + (ensure-directories-exist *paste-path*) (with-open-file (s (paste-xml-file paste) :direction :output :if-exists :supersede) (paste-write-xml paste s))) Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.32 lisppaste2/variable.lisp:1.33 --- lisppaste2/variable.lisp:1.32 Wed Oct 20 22:22:13 2004 +++ lisppaste2/variable.lisp Wed Oct 20 22:37:50 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.32 2004/10/20 20:22:13 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.33 2004/10/20 20:37:50 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -23,12 +23,12 @@ (in-package :lisppaste) -(defparameter *internal-http-port* 8080 +(defparameter *internal-http-port* 8081 "Port lisppaste's araneida will listen on for requests from Apache.") -(defparameter *external-http-port* 80 +(defparameter *external-http-port* 8081 "Port lisppaste's araneida will listen on for requests from remote clients.") -(defparameter *paste-site-name* "paste.lisp.org" +(defparameter *paste-site-name* "www.unmutual.info" "Website we are running on (used for creating links).") (defparameter *paste-external-url* @@ -37,7 +37,7 @@ :host *paste-site-name* ;;; comment out this next line when running ;;; behind a proxying apache - #| :port *external-http-port* |# + :port *external-http-port* ) "/")) (defparameter *old-url* (araneida:merge-url Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.67 lisppaste2/web-server.lisp:1.68 --- lisppaste2/web-server.lisp:1.67 Wed Oct 20 21:56:54 2004 +++ lisppaste2/web-server.lisp Wed Oct 20 22:37:50 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.67 2004/10/20 19:56:54 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.68 2004/10/20 20:37:50 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -215,7 +215,7 @@ users can paste code, and the URL of the paste is announced on the desired channel. Lisppaste is an advanced pastebot running on the IRC server " - ,(encode-for-pre (irc:server-name *connection*)) + ,(encode-for-pre *irc-network-name*) " which has many unique features." ,@(if *no-channel-pastes* '((p) " It also allows pastes which are not announced on any channel, which @@ -855,7 +855,7 @@ ,@(unless (and annotate *no-channel-pastes* (string-equal (paste-channel annotate) "None")) - `("The paste will be announced on the selected channel on " ,(irc:server-name *connection*) ". ")) + `("The paste will be announced on the selected channel on " ,*irc-network-name* ". ")) ,@(if annotate `("This paste will be used to annotate " (b @@ -933,7 +933,7 @@ `(p ,(if annotate "Your annotation should be available at " "Your paste should be available at ") (b ((a :href ,url) ,url)) ,@(unless (and *no-channel-pastes* (string-equal channel "none")) - `(", and was also sent to " ,channel " at " ,(irc:server-name *connection*))) ".") + `(", and was also sent to " ,channel " at " ,*irc-network-name*)) ".") `((form :method post :action ,(araneida:urlstring *new-paste-url*)) ((input :type hidden :name "annotate" :value ,(prin1-to-string paste-number))) (table From bmastenbrook at common-lisp.net Wed Oct 20 20:39:22 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Wed, 20 Oct 2004 22:39:22 +0200 Subject: [Lisppaste-cvs] CVS update: lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: variable.lisp Log Message: Oops: put correct variable.lisp back Date: Wed Oct 20 22:39:21 2004 Author: bmastenbrook Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.33 lisppaste2/variable.lisp:1.34 --- lisppaste2/variable.lisp:1.33 Wed Oct 20 22:37:50 2004 +++ lisppaste2/variable.lisp Wed Oct 20 22:39:21 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.33 2004/10/20 20:37:50 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.34 2004/10/20 20:39:21 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -23,12 +23,12 @@ (in-package :lisppaste) -(defparameter *internal-http-port* 8081 +(defparameter *internal-http-port* 8080 "Port lisppaste's araneida will listen on for requests from Apache.") -(defparameter *external-http-port* 8081 +(defparameter *external-http-port* 80 "Port lisppaste's araneida will listen on for requests from remote clients.") -(defparameter *paste-site-name* "www.unmutual.info" +(defparameter *paste-site-name* "paste.lisp.org" "Website we are running on (used for creating links).") (defparameter *paste-external-url* @@ -37,7 +37,7 @@ :host *paste-site-name* ;;; comment out this next line when running ;;; behind a proxying apache - :port *external-http-port* + #| :port *external-http-port* |# ) "/")) (defparameter *old-url* (araneida:merge-url From bmastenbrook at common-lisp.net Sun Oct 24 19:54:34 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sun, 24 Oct 2004 21:54:34 +0200 Subject: [Lisppaste-cvs] CVS update: lisppaste2/irc-notification.lisp lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv24665 Modified Files: irc-notification.lisp variable.lisp Log Message: More changes for multiple server support Date: Sun Oct 24 21:54:33 2004 Author: bmastenbrook Index: lisppaste2/irc-notification.lisp diff -u lisppaste2/irc-notification.lisp:1.2 lisppaste2/irc-notification.lisp:1.3 --- lisppaste2/irc-notification.lisp:1.2 Wed Oct 20 22:37:50 2004 +++ lisppaste2/irc-notification.lisp Sun Oct 24 21:54:33 2004 @@ -1,18 +1,39 @@ -;;;; $Id: irc-notification.lisp,v 1.2 2004/10/20 20:37:50 bmastenbrook Exp $ +;;;; $Id: irc-notification.lisp,v 1.3 2004/10/24 19:54:33 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/irc-notification.lisp,v $ ;;;; See the LICENSE file for licensing information. (in-package :lisppaste) +(defvar *connections* nil) +(defvar *nicknames* nil) + +(defun channel-nick (channel) + (cdr (assoc channel *nicknames* + :test #'(lambda (e s) + (member e s :test #'string=))))) + +(defun nick-connection (nick) + (cdr (assoc nick *connections* :test #'string=))) + +(defun find-connection (channel) + (nick-connection (channel-nick channel))) + (defun irc-say-help (channel) - (when (and *connection* + (when (and (find-connection channel) (find channel *channels* :test #'string=)) - (irc:privmsg *connection* + (irc:privmsg (find-connection channel) 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 excluding-trailing-digits (nick) + (coerce + (loop for i from (1- (length nick)) downto 0 + if (not (digit-char-p (elt nick i))) + return (subseq nick 0 (1+ i))) + 'string)) + (defun help-request-p (nick help text) (and (> (length text) (length nick)) @@ -21,24 +42,24 @@ :test #'char-equal))) (and url-position - (notany #'alphanumericp (subseq text (length nick) (1- url-position))) - (notany #'alphanumericp (subseq text (+ url-position (length help)))))))) + (notany #'alpha-char-p (subseq text (length nick) (1- url-position))) + (notany #'alpha-char-p (subseq text (+ url-position (length help)))))))) -(defun make-irc-msg-hook (nick) +(defun make-irc-msg-hook (connection nick) (lambda (message) (let ((text (irc:trailing-argument message))) (cond ((string= (first (irc:arguments message)) nick) - (irc:privmsg *connection* + (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*)))) ((some #'(lambda (e) - (help-request-p nick e text)) + (help-request-p (excluding-trailing-digits nick) e text)) '("url" "help" "hello")) (irc-say-help (first (irc:arguments message)))))))) -(defun add-irc-hook (nick) - (irc:remove-hooks *connection* 'irc:irc-privmsg-message) - (irc:add-hook *connection* 'irc:irc-privmsg-message (make-irc-msg-hook nick))) +(defun add-irc-hook (connection nick) + (irc:remove-hooks connection 'irc:irc-privmsg-message) + (irc:add-hook connection 'irc:irc-privmsg-message (make-irc-msg-hook connection nick))) (defun start-irc-notification (&key (channels (list *default-channel*)) (nickname *default-nickname*) @@ -48,36 +69,58 @@ :realname (araneida:urlstring *new-paste-url*) :server server :port port))) - (setf *connection* connection) - (setf *channels* (nconc *channels* channels)) - (setf *nickname* nickname) + (push (cons nickname connection) *connections*) + (setf *channels* (append *channels* channels)) + (push (cons (copy-list channels) nickname) *nicknames*) (mapcar #'(lambda (channel) (irc:join connection channel)) channels) - (add-irc-hook nickname) + (add-irc-hook connection nickname) (irc:start-background-message-handler connection))) -(defun join-new-irc-channel (channel) - (setf *channels* (nconc *channels* (list channel))) - (irc:join *connection* channel)) +(defun stop-irc-notification (nickname) + (ignore-errors (irc:quit (nick-connection nickname))) + (loop for i in (car (rassoc nickname *nicknames* :test #'string=)) + do (setf *channels* (remove i *channels* :test #'string=))) + (setf *nicknames* (remove nickname *nicknames* :key #'cdr :test #'string=)) + (setf *connections* (remove nickname *connections* :key #'car :test #'string=))) + +(defun join-new-irc-channel (nickname channel) + (push channel (car (rassoc nickname *nicknames* :test #'string=))) + (irc:join (find-connection channel) channel) + (setf *channels* (nconc *channels* (list channel)))) -(defun leave-irc-channel (channel) +(defun leave-irc-channel (nickname channel) (setf *channels* (remove channel *channels* :test #'string-equal)) - (irc:part *connection* channel)) - -(defun hup-irc-connection (server) - (ignore-errors (irc:quit *connection*)) - (setf *connection* (irc:connect :nickname *nickname* - :realname (araneida:urlstring *new-paste-url*) - :server server - :port *default-irc-server-port*)) - (mapcar #'(lambda (channel) (irc:join *connection* channel)) *channels*) - (add-irc-hook *nickname*) - (irc:start-background-message-handler *connection*)) + (irc:part (find-connection channel) channel) + (setf (car (rassoc nickname *nicknames* :test #'string=)) + (remove channel (car (rassoc nickname *nicknames* :test #'string=)) + :test #'string=))) + +(defun hup-irc-connection (nickname &optional (server *default-irc-server*)) + (ignore-errors (irc:quit (nick-connection nickname))) + (sleep 1) + (setf + (cdr (assoc nickname *connections* :test #'string=)) + (irc:connect :nickname nickname + :realname (araneida:urlstring *new-paste-url*) + :server server + :port *default-irc-server-port*)) + (mapcar #'(lambda (channel) (irc:join (nick-connection nickname) channel)) + (car (rassoc nickname *nicknames* :test #'string=))) + (add-irc-hook (nick-connection nickname) nickname) + (irc:start-background-message-handler (nick-connection nickname))) + +(defun %shut-up (connection) + (setf (irc:client-stream connection) + (make-broadcast-stream))) (defun shut-up () - (setf (irc:client-stream *connection*) (make-broadcast-stream))) + (mapc #'%shut-up (mapcar #'cdr *connections*))) + +(defun %un-shut-up (connection) + (setf (irc:client-stream connection) *trace-output*)) (defun un-shut-up () - (setf (irc:client-stream *connection*) *trace-output*)) + (mapc #'%un-shut-up (mapcar #'cdr *connections*))) (defun irc-notify (channel text) - (irc:privmsg *connection* channel text)) + (irc:privmsg (find-connection channel) channel text)) Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.34 lisppaste2/variable.lisp:1.35 --- lisppaste2/variable.lisp:1.34 Wed Oct 20 22:39:21 2004 +++ lisppaste2/variable.lisp Sun Oct 24 21:54:33 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.34 2004/10/20 20:39:21 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.35 2004/10/24 19:54:33 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -23,12 +23,12 @@ (in-package :lisppaste) -(defparameter *internal-http-port* 8080 +(defparameter *internal-http-port* 8081 "Port lisppaste's araneida will listen on for requests from Apache.") -(defparameter *external-http-port* 80 +(defparameter *external-http-port* 8081 "Port lisppaste's araneida will listen on for requests from remote clients.") -(defparameter *paste-site-name* "paste.lisp.org" +(defparameter *paste-site-name* "www.unmutual.info" "Website we are running on (used for creating links).") (defparameter *paste-external-url* @@ -37,7 +37,7 @@ :host *paste-site-name* ;;; comment out this next line when running ;;; behind a proxying apache - #| :port *external-http-port* |# + :port *external-http-port* ) "/")) (defparameter *old-url* (araneida:merge-url @@ -153,8 +153,7 @@ (defvar *pastes* nil) (defvar *paste-counter* 0) -(defvar *connection* nil) -(defvar *nickname*) + (defvar *channels* '("None")) (defvar *paste-file*