From bmastenbrook at common-lisp.net Sat Jan 17 17:53:32 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 12:53:32 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/persistent-pastes.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv13057 Added Files: persistent-pastes.lisp Log Message: Serialize list of pastes in the pastebot Date: Sat Jan 17 12:53:31 2004 Author: bmastenbrook From bmastenbrook at common-lisp.net Sat Jan 17 17:54:13 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 12:54:13 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/encode-for-pre.lisp lisppaste2/lisppaste.asd lisppaste2/lisppaste.lisp lisppaste2/variable.lisp lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv14272 Modified Files: encode-for-pre.lisp lisppaste.asd lisppaste.lisp variable.lisp web-server.lisp Log Message: Add multiple channel support; allow line-wrapping of pastes Date: Sat Jan 17 12:54:13 2004 Author: bmastenbrook Index: lisppaste2/encode-for-pre.lisp diff -u lisppaste2/encode-for-pre.lisp:1.6 lisppaste2/encode-for-pre.lisp:1.7 --- lisppaste2/encode-for-pre.lisp:1.6 Sun Nov 30 17:32:45 2003 +++ lisppaste2/encode-for-pre.lisp Sat Jan 17 12:54:13 2004 @@ -1,18 +1,26 @@ -;;;; $Id: encode-for-pre.lisp,v 1.6 2003/11/30 22:32:45 bmastenbrook Exp $ +;;;; $Id: encode-for-pre.lisp,v 1.7 2004/01/17 17:54:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/encode-for-pre.lisp,v $ ;;;; See the LICENSE file for licensing information. (in-package :lisppaste) -(defun replace-in-string-1 (str char repstr) +(defun replace-in-string-1 (str char repstr &optional only-in-dup) (let* ((new-length (loop for i from 0 to (1- (length str)) - summing (if (char= (elt str i) char) - (length repstr) 1))) + summing (if (not only-in-dup) + (if (char= (elt str i) char) + (length repstr) 1) + (if (< i (1- (length str))) + (if (and (char= (elt str i) char) + (char= (elt str (1+ i)) char)) + (length repstr) 1) 1)))) (new-array (make-array `(,new-length) :element-type 'character))) (loop for i from 0 to (1- (length str)) with j = 0 - do (if (char= (elt str i) char) + do (if (if only-in-dup + (and (< i (1- (length str))) (and (char= (elt str i) char) + (char= (elt str (1+ i)) char))) + (char= (elt str i) char)) (progn (loop for k from 0 to (1- (length repstr)) do (setf (elt new-array (+ j k)) (elt repstr k))) @@ -33,4 +41,4 @@ (replace-in-string str '(#\& #\< #\>) '("&" "<" ">"))) (defun encode-for-tt (str) - (replace-in-string str '(#\& #\< #\> #\newline #\return #\linefeed #\space #\tab) '("&" "<" ">" "" "
" "" " " "    "))) \ No newline at end of file + (replace-in-string-1 (replace-in-string str '(#\& #\< #\> #\newline #\return #\linefeed #\tab) '("&" "<" ">" "" "
" "" "    ")) #\space " " 1)) \ No newline at end of file Index: lisppaste2/lisppaste.asd diff -u lisppaste2/lisppaste.asd:1.1.1.1 lisppaste2/lisppaste.asd:1.2 --- lisppaste2/lisppaste.asd:1.1.1.1 Mon Nov 3 12:17:53 2003 +++ lisppaste2/lisppaste.asd Sat Jan 17 12:54:13 2004 @@ -1,4 +1,4 @@ -;;;; $Id: lisppaste.asd,v 1.1.1.1 2003/11/03 17:17:53 eenge Exp $ +;;;; $Id: lisppaste.asd,v 1.2 2004/01/17 17:54:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.asd,v $ ;;;; See the LICENSE file for licensing information. @@ -20,7 +20,7 @@ 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 :net-nittin-irc) + :depends-on (:araneida :cl-irc) :components ((:file "package") (:file "variable" :depends-on ("package")) Index: lisppaste2/lisppaste.lisp diff -u lisppaste2/lisppaste.lisp:1.2 lisppaste2/lisppaste.lisp:1.3 --- lisppaste2/lisppaste.lisp:1.2 Mon Nov 10 11:28:43 2003 +++ lisppaste2/lisppaste.lisp Sat Jan 17 12:54:13 2004 @@ -1,11 +1,11 @@ -;;;; $Id: lisppaste.lisp,v 1.2 2003/11/10 16:28:43 eenge Exp $ +;;;; $Id: lisppaste.lisp,v 1.3 2004/01/17 17:54:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $ ;;;; See the LICENSE file for licensing information. (in-package :lisppaste) -(defun start-lisppaste (&key (channel *default-channel*) +(defun start-lisppaste (&key (channels (list *default-channel*)) (nickname *default-nickname*) (server *default-irc-server*) (port *default-irc-server-port*)) @@ -15,8 +15,7 @@ :server server :port port))) (setf *connection* connection) - (setf *channel* channel) - (irc:join connection channel) + (setf *channels* channels) + (mapcar #'(lambda (channel) (irc:join connection channel)) channels) (araneida:start-listening *paste-listener*) - (irc:read-message-loop connection))) - + (irc:read-message-loop connection))) \ No newline at end of file Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.4 lisppaste2/variable.lisp:1.5 --- lisppaste2/variable.lisp:1.4 Tue Nov 11 23:19:38 2003 +++ lisppaste2/variable.lisp Sat Jan 17 12:54:13 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.4 2003/11/12 04:19:38 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.5 2004/01/17 17:54:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -55,4 +55,4 @@ (defvar *pastes* nil) (defvar *paste-counter* 0) (defvar *connection* nil) -(defvar *channel* "") \ No newline at end of file +(defvar *channels* nil) \ No newline at end of file Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.16 lisppaste2/web-server.lisp:1.17 --- lisppaste2/web-server.lisp:1.16 Wed Nov 12 01:23:43 2003 +++ lisppaste2/web-server.lisp Sat Jan 17 12:54:13 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.16 2003/11/12 06:23:43 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.17 2004/01/17 17:54:13 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -13,7 +13,8 @@ (universal-time nil :type integer) (is-annotation nil :type boolean) (annotations nil :type list) - (annotation-counter 0 :type integer)) + (annotation-counter 0 :type integer) + (channel "" :type string)) (defclass new-paste-handler (araneida:handler) ()) @@ -81,11 +82,12 @@ (body (center (h2 "All pastes in system")) ((table :width "100%" :cellpadding 2) - (tr (td) (td "By") (td "When") (td "Titled") (td "Ann.")) + (tr (td) (td "By") (td "Where") (td "When") (td "Titled") (td "Ann.")) ,@(reverse (mapcar #'(lambda (paste) `(tr ((td :nowrap) ((a :href ,(araneida:urlstring (araneida:merge-url *display-paste-url* (prin1-to-string (paste-number paste))))) ,(concatenate 'string "#" (prin1-to-string (paste-number paste))))) ((td :nowrap) ,(encode-for-pre (paste-user paste))) + ((td :nowrap) ,(encode-for-pre (paste-channel paste))) ((td :nowrap) ,(time-delta (paste-universal-time paste) 1)) ((td :width "100%" :bgcolor "#F4F4F4" :nowrap) ,(encode-for-pre (paste-title paste))) ((td :nowrap) ,(length (paste-annotations paste))))) @@ -102,13 +104,18 @@ ((font :color red) (h2 ,message)) ((form :method post :action ,(araneida:urlstring *submit-paste-url*)) (p "Enter a username, title, and paste contents into the fields below. The -paste will be announced on " ,*channel* " @ " ,(irc:server-name *connection*) ".") +paste will be announced on the selected channel @ " ,(irc:server-name *connection*) ".") ,@(if annotate `((p "This paste will be used to annotate " ((a :href ,(araneida:urlstring (araneida:merge-url *display-paste-url* (prin1-to-string (paste-number annotate))))) ,(concatenate 'string (paste-title annotate) "."))) - ((input :type hidden :name "annotate" :value ,(prin1-to-string (paste-number annotate)))))) + ((input :type hidden :name "annotate" :value ,(prin1-to-string (paste-number annotate)))) + ((input :type hidden :name "channel" :value ,(paste-channel annotate))))) (hr) (table + ,@(if (not annotate) + `((tr + (th "Select a channel:") + (td ((select :name "channel") ,@(mapcar #'(lambda (e) `((option :value ,e) ,(encode-for-pre e))) *channels*)))))) (tr (th "Enter your username:") (td ((input :type text :name "username")))) @@ -127,7 +134,8 @@ (let ((username (araneida:body-param "username" (araneida:request-body request))) (title (araneida:body-param "title" (araneida:request-body request))) (text (araneida:body-param "text" (araneida:request-body request))) - (annotate (araneida:body-param "annotate" (araneida:request-body request)))) + (annotate (araneida:body-param "annotate" (araneida:request-body request))) + (channel (araneida:body-param "channel" (araneida:request-body request)))) (araneida:request-send-headers request) (cond @@ -139,8 +147,9 @@ (new-paste-form request :message "Please enter your paste.")) ((and annotate (not (parse-integer annotate :junk-allowed t))) (new-paste-form request :message "Malformed annotation request.")) + ((not (member channel *channels* :test #'string-equal)) + (new-paste-form request :message "Whatever channel that is, I don't know about it.")) (t - (let* ((paste-number (if annotate (parse-integer annotate :junk-allowed t) (incf *paste-counter*))) (paste-to-annotate (if annotate (find paste-number *pastes* :key #'paste-number))) (annotation-number (if annotate (incf (paste-annotation-counter paste-to-annotate))))) @@ -155,11 +164,12 @@ :user username :title title :contents text - :universal-time (get-universal-time)))) - (irc:privmsg *connection* *channel* + :universal-time (get-universal-time) + :channel channel))) + (irc:privmsg *connection* channel (if annotate - (format nil "~A annotated #~A with ~A at ~A" username paste-number title url) - (format nil "~A pasted ~A at ~A" username title url))) + (format nil "~A annotated #~A with \"~A\" at ~A" username paste-number title url) + (format nil "~A pasted \"~A\" at ~A" username title url))) (if annotate (push paste (paste-annotations paste-to-annotate)) (push paste *pastes*)) @@ -169,7 +179,7 @@ (head (title "Paste number " ,*paste-counter*)) (body (h1 "Pasted!") - (p ,(if annotate "Your annotation should be available at " "Your paste should be available at ") ((a :href ,url) ,url) ", and was also sent to " ,*channel* " @ " ,(irc:server-name *connection*)) + (p ,(if annotate "Your annotation should be available at " "Your paste should be available at ") ((a :href ,url) ,url) ", and was also sent to " ,channel " @ " ,(irc:server-name *connection*)) (p "If you wish to paste a correction or addendum to this paste, you can annotate the paste using the submission button on the " ((a :href ,url) "paste's page.")) ,@(bottom-links)))))))))) @@ -196,6 +206,8 @@ ((td :align "left" :width "100%") ,(encode-for-pre (paste-user paste)))) (tr (td) ((td :align "left" :width "100%") ,(time-delta (paste-universal-time paste)))) + (tr (td) + ((td :align "left" :width "100%") ,(encode-for-pre (paste-channel paste)))) (tr ((td :align "left" :valign "top" :nowrap) "Paste contents:") ((td :width "100%"))) (tr (td (p))) From bmastenbrook at common-lisp.net Sat Jan 17 18:02:15 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 13:02:15 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/lisppaste.asd lisppaste2/persistent-pastes.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv1913 Modified Files: lisppaste.asd persistent-pastes.lisp Log Message: added persistent-pastes to the asdf file Date: Sat Jan 17 13:02:15 2004 Author: bmastenbrook Index: lisppaste2/lisppaste.asd diff -u lisppaste2/lisppaste.asd:1.2 lisppaste2/lisppaste.asd:1.3 --- lisppaste2/lisppaste.asd:1.2 Sat Jan 17 12:54:13 2004 +++ lisppaste2/lisppaste.asd Sat Jan 17 13:02:14 2004 @@ -1,4 +1,4 @@ -;;;; $Id: lisppaste.asd,v 1.2 2004/01/17 17:54:13 bmastenbrook Exp $ +;;;; $Id: lisppaste.asd,v 1.3 2004/01/17 18:02:14 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.asd,v $ ;;;; See the LICENSE file for licensing information. @@ -29,6 +29,8 @@ (:file "web-server" :depends-on ("encode-for-pre")) (:file "lisppaste" + :depends-on ("web-server")) + (:file "persistent-pastes" :depends-on ("web-server")))) Index: lisppaste2/persistent-pastes.lisp diff -u lisppaste2/persistent-pastes.lisp:1.1 lisppaste2/persistent-pastes.lisp:1.2 --- lisppaste2/persistent-pastes.lisp:1.1 Sat Jan 17 12:53:31 2004 +++ lisppaste2/persistent-pastes.lisp Sat Jan 17 13:02:14 2004 @@ -7,6 +7,7 @@ (cons 'title (paste-title paste)) (cons 'contents (paste-contents paste)) (cons 'universal-time (paste-universal-time paste)) + (cons 'channel (paste-channel paste)) (cons 'annotations (mapcar #'paste-alist (paste-annotations paste))))) (defun save-pastes-to-file (file-name) From bmastenbrook at common-lisp.net Sat Jan 17 18:07:21 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 13:07:21 -0500 Subject: [Lisppaste-cvs] CVS update: 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-serv4249 Modified Files: persistent-pastes.lisp variable.lisp web-server.lisp Log Message: Make persistence default Date: Sat Jan 17 13:07:21 2004 Author: bmastenbrook Index: lisppaste2/persistent-pastes.lisp diff -u lisppaste2/persistent-pastes.lisp:1.2 lisppaste2/persistent-pastes.lisp:1.3 --- lisppaste2/persistent-pastes.lisp:1.2 Sat Jan 17 13:02:14 2004 +++ lisppaste2/persistent-pastes.lisp Sat Jan 17 13:07:21 2004 @@ -11,7 +11,7 @@ (cons 'annotations (mapcar #'paste-alist (paste-annotations paste))))) (defun save-pastes-to-file (file-name) - (with-open-file (file file-name :direction :output) + (with-open-file (file file-name :direction :output :if-exists :supersede) (let ((*print-readably* t)) (format file "~A~%" (prin1-to-string (mapcar #'paste-alist *pastes*)))))) Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.5 lisppaste2/variable.lisp:1.6 --- lisppaste2/variable.lisp:1.5 Sat Jan 17 12:54:13 2004 +++ lisppaste2/variable.lisp Sat Jan 17 13:07:21 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.5 2004/01/17 17:54:13 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.6 2004/01/17 18:07:21 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -55,4 +55,6 @@ (defvar *pastes* nil) (defvar *paste-counter* 0) (defvar *connection* nil) -(defvar *channels* nil) \ No newline at end of file +(defvar *channels* nil) + +(defvar *paste-file* "pastes.lisp-expr") \ No newline at end of file Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.17 lisppaste2/web-server.lisp:1.18 --- lisppaste2/web-server.lisp:1.17 Sat Jan 17 12:54:13 2004 +++ lisppaste2/web-server.lisp Sat Jan 17 13:07:21 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.17 2004/01/17 17:54:13 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.18 2004/01/17 18:07:21 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -173,6 +173,7 @@ (if annotate (push paste (paste-annotations paste-to-annotate)) (push paste *pastes*)) + (save-pastes-to-file *paste-file*) (araneida:html-stream (araneida:request-stream request) `(html From bmastenbrook at common-lisp.net Sat Jan 17 18:22:36 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 13:22:36 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/README.lisp lisppaste2/lisppaste.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv13984 Modified Files: README.lisp lisppaste.lisp Log Message: Make lisppaste read pastes from a file on startup, and fix the README Date: Sat Jan 17 13:22:35 2004 Author: bmastenbrook Index: lisppaste2/README.lisp diff -u lisppaste2/README.lisp:1.1.1.1 lisppaste2/README.lisp:1.2 --- lisppaste2/README.lisp:1.1.1.1 Mon Nov 3 12:17:53 2003 +++ lisppaste2/README.lisp Sat Jan 17 13:22:35 2004 @@ -1,4 +1,4 @@ -;;;; $Id: README.lisp,v 1.1.1.1 2003/11/03 17:17:53 eenge Exp $ +;;;; $Id: README.lisp,v 1.2 2004/01/17 18:22:35 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/README.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -15,7 +15,7 @@ (load "lisppaste.asd") (asdf:oos 'asdf:load-op :lisppaste) -(lisppaste:start-lisppaste :channel "#lisppaste" - :nickname "toby" +(lisppaste:start-lisppaste :channels '("#lisppaste") + :nickname "devpaste" :server "irc.freenode.net" :port 6667) Index: lisppaste2/lisppaste.lisp diff -u lisppaste2/lisppaste.lisp:1.3 lisppaste2/lisppaste.lisp:1.4 --- lisppaste2/lisppaste.lisp:1.3 Sat Jan 17 12:54:13 2004 +++ lisppaste2/lisppaste.lisp Sat Jan 17 13:22:35 2004 @@ -1,4 +1,4 @@ -;;;; $Id: lisppaste.lisp,v 1.3 2004/01/17 17:54:13 bmastenbrook Exp $ +;;;; $Id: lisppaste.lisp,v 1.4 2004/01/17 18:22:35 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -16,6 +16,7 @@ :port port))) (setf *connection* connection) (setf *channels* channels) + (read-pastes-from-file *paste-file*) (mapcar #'(lambda (channel) (irc:join connection channel)) channels) (araneida:start-listening *paste-listener*) (irc:read-message-loop connection))) From bmastenbrook at common-lisp.net Sat Jan 17 18:29:41 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 13:29:41 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/persistent-pastes.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv28903 Modified Files: persistent-pastes.lisp Log Message: stupid bugfix Date: Sat Jan 17 13:29:41 2004 Author: bmastenbrook Index: lisppaste2/persistent-pastes.lisp diff -u lisppaste2/persistent-pastes.lisp:1.3 lisppaste2/persistent-pastes.lisp:1.4 --- lisppaste2/persistent-pastes.lisp:1.3 Sat Jan 17 13:07:21 2004 +++ lisppaste2/persistent-pastes.lisp Sat Jan 17 13:29:41 2004 @@ -28,7 +28,7 @@ :title title :contents contents :universal-time universal-time - :channel (if (not channel) (car *channels*)) + :channel (if (not channel) (car *channels*) channel) :annotations (mapcar #'(lambda (e) (make-paste-from-alist e)) annotations)))) (defun read-pastes-from-file (file-name) From bmastenbrook at common-lisp.net Sat Jan 17 18:34:37 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 13:34:37 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/README.lisp lisppaste2/persistent-pastes.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv21216 Modified Files: README.lisp persistent-pastes.lisp Log Message: More bugfixen Date: Sat Jan 17 13:34:37 2004 Author: bmastenbrook Index: lisppaste2/README.lisp diff -u lisppaste2/README.lisp:1.2 lisppaste2/README.lisp:1.3 --- lisppaste2/README.lisp:1.2 Sat Jan 17 13:22:35 2004 +++ lisppaste2/README.lisp Sat Jan 17 13:34:37 2004 @@ -1,4 +1,4 @@ -;;;; $Id: README.lisp,v 1.2 2004/01/17 18:22:35 bmastenbrook Exp $ +;;;; $Id: README.lisp,v 1.3 2004/01/17 18:34:37 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/README.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -12,8 +12,8 @@ ;;; from your httpd.conf. Then, run SBCL and invoke the magical ;;; invocation as follows, or simply (load "README"). -(load "lisppaste.asd") -(asdf:oos 'asdf:load-op :lisppaste) +(require :asdf) +(require :lisppaste) (lisppaste:start-lisppaste :channels '("#lisppaste") :nickname "devpaste" Index: lisppaste2/persistent-pastes.lisp diff -u lisppaste2/persistent-pastes.lisp:1.4 lisppaste2/persistent-pastes.lisp:1.5 --- lisppaste2/persistent-pastes.lisp:1.4 Sat Jan 17 13:29:41 2004 +++ lisppaste2/persistent-pastes.lisp Sat Jan 17 13:34:37 2004 @@ -11,10 +11,11 @@ (cons 'annotations (mapcar #'paste-alist (paste-annotations paste))))) (defun save-pastes-to-file (file-name) - (with-open-file (file file-name :direction :output :if-exists :supersede) - (let ((*print-readably* t)) - (format file "~A~%" (prin1-to-string - (mapcar #'paste-alist *pastes*)))))) + (let ((*package* (find-package :lisppaste))) + (with-open-file (file file-name :direction :output :if-exists :supersede) + (let ((*print-readably* t)) + (format file "~A~%" (prin1-to-string + (mapcar #'paste-alist *pastes*))))))) (defmacro with-assoc-vals (entry-list alist &body body) `(let ,(mapcar #'(lambda (e) (list e `(cdr (assoc ',e ,alist)))) entry-list) @@ -33,6 +34,7 @@ (defun read-pastes-from-file (file-name) (setf *pastes* nil) - (with-open-file (file file-name :direction :input :if-does-not-exist nil) - (let ((paste-alist (read file nil))) - (setf *pastes* (mapcar #'make-paste-from-alist paste-alist))))) \ No newline at end of file + (let ((*package* (find-package :lisppaste))) + (with-open-file (file file-name :direction :input :if-does-not-exist nil) + (let ((paste-alist (read file nil))) + (setf *pastes* (mapcar #'make-paste-from-alist paste-alist)))))) \ No newline at end of file From bmastenbrook at common-lisp.net Sat Jan 17 18:35:46 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 13:35:46 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/.cvsignore Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv29216 Added Files: .cvsignore Log Message: Foo Bar Date: Sat Jan 17 13:35:45 2004 Author: bmastenbrook From bmastenbrook at common-lisp.net Sat Jan 17 18:47:01 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Sat, 17 Jan 2004 13:47:01 -0500 Subject: [Lisppaste-cvs] CVS update: public_html/index.html Message-ID: Update of /project/lisppaste/cvsroot/public_html In directory common-lisp.net:/tmp/cvs-serv19723 Modified Files: index.html Log Message: New release! Date: Sat Jan 17 13:47:01 2004 Author: bmastenbrook Index: public_html/index.html diff -u public_html/index.html:1.3 public_html/index.html:1.4 --- public_html/index.html:1.3 Wed Nov 5 09:01:41 2003 +++ public_html/index.html Sat Jan 17 13:47:01 2004 @@ -14,13 +14,21 @@ on IRC. 'lisppaste' on #lisp is available through common-lisp.net here. -

No downloads are available but the code in CVS (checkout instructions) is considered fairly - usable. You'll also need araneida and Compared to the perl version + a lot of people use, lisppaste features paste annotations, useful + paste timestamps, and a listing page for all pastes in the system. + +

Lisppaste 2 can be downloaded from here: lisppaste2-latest.tar.gz. The + latest version is 2.0, released January 17 2004. + +

The code in CVS (checkout + instructions) is also considered fairly usable. You'll also + need araneida and SBCL. If you do install it, read the README.lisp + href="/cgi-bin/viewcvs.cgi/lisppaste2/README.lisp?rev=HEAD&cvsroot=lisppaste&content-type=text/vnd.viewcvs-markup">README.lisp file which contains all the information you need to run a lisppaste on your own. @@ -28,18 +36,20 @@ href="/cgi-bin/viewcvs.cgi/?cvsroot=lisppaste">ViewCVS for the curious.

-

There's a second version of lisppaste in CVS called lisppaste2. - It uses the net-nittin-irc - library and features an ASDF system.

+

The current version of lisppaste in CVS called lisppaste2, + after having undergone a fairly major rewrite. It uses the cl-irc library and features an ASDF + system.

'lisppaste' is written and copyrighted by Brian Mastenbrook. The sources are covered by an MIT-type license.


Erik Enge
+
Brian Mastenbrook
-Last modified: Fri Oct 31 17:17:45 EST 2003 +Last modified: Sat Jan 17 13:49:09 EST 2004 From bmastenbrook at common-lisp.net Tue Jan 20 14:22:06 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 20 Jan 2004 09:22:06 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/lisppaste.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: lisppaste.lisp Log Message: Programmatic join-new-channel Date: Tue Jan 20 09:22:06 2004 Author: bmastenbrook Index: lisppaste2/lisppaste.lisp diff -u lisppaste2/lisppaste.lisp:1.4 lisppaste2/lisppaste.lisp:1.5 --- lisppaste2/lisppaste.lisp:1.4 Sat Jan 17 13:22:35 2004 +++ lisppaste2/lisppaste.lisp Tue Jan 20 09:22:06 2004 @@ -1,4 +1,4 @@ -;;;; $Id: lisppaste.lisp,v 1.4 2004/01/17 18:22:35 bmastenbrook Exp $ +;;;; $Id: lisppaste.lisp,v 1.5 2004/01/20 14:22:06 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -19,4 +19,8 @@ (read-pastes-from-file *paste-file*) (mapcar #'(lambda (channel) (irc:join connection channel)) channels) (araneida:start-listening *paste-listener*) - (irc:read-message-loop connection))) \ No newline at end of file + (irc:read-message-loop connection))) + +(defun join-new-channel (channel) + (setf *channels* (nconc *channels* (list channel))) + (irc:join *connection* channel)) \ No newline at end of file From bmastenbrook at common-lisp.net Fri Jan 30 16:08:31 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Fri, 30 Jan 2004 11:08:31 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/variable.lisp lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv31311 Modified Files: variable.lisp web-server.lisp Log Message: RSS! RSS! RSS! Date: Fri Jan 30 11:08:31 2004 Author: bmastenbrook Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.6 lisppaste2/variable.lisp:1.7 --- lisppaste2/variable.lisp:1.6 Sat Jan 17 13:07:21 2004 +++ lisppaste2/variable.lisp Fri Jan 30 11:08:31 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.6 2004/01/17 18:07:21 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.7 2004/01/30 16:08:31 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -36,6 +36,9 @@ (defparameter *submit-paste-url* (araneida:merge-url *paste-external-url* "submit")) + +(defparameter *rdf-url* + (araneida:merge-url *paste-external-url* "list.rdf")) (defparameter *paste-listener* (let ((fwd-url (araneida:copy-url *paste-url*))) Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.18 lisppaste2/web-server.lisp:1.19 --- lisppaste2/web-server.lisp:1.18 Sat Jan 17 13:07:21 2004 +++ lisppaste2/web-server.lisp Fri Jan 30 11:08:31 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.18 2004/01/17 18:07:21 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.19 2004/01/30 16:08:31 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -24,6 +24,8 @@ (defclass display-paste-handler (araneida:handler) ()) +(defclass rss-handler (araneida:handler) ()) + (defmethod araneida:handle-request-response ((handler new-paste-handler) method request) (araneida:request-send-headers request :expires 0) (let* ((annotate-string (araneida:body-param "annotate" (araneida:request-body request))) @@ -94,6 +96,27 @@ *pastes*))) ,@(bottom-links))))) +(defmethod araneida:handle-request-response ((handler rss-handler) method request) + (araneida:request-send-headers request :expires 0) + (format (araneida:request-stream request) "~%") + (araneida:html-stream + (araneida:request-stream request) + `((|rss| :|version| "2.0") + ,(format nil + "Lisppaste pastes~APastes in this pastebot~{~A~}~%" + (araneida:urlstring *list-paste-url*) + (reverse (mapcar #'(lambda (paste) + (format nil "~A~A\"~A\" by ~A~A" + (concatenate 'string + (araneida:urlstring + (araneida:merge-url *display-paste-url* + (prin1-to-string (paste-number paste)))) "#" (prin1-to-string (paste-number paste))) + (date:universal-time-to-rfc-date (paste-universal-time paste)) + (encode-for-pre (paste-title paste)) + (encode-for-pre (paste-user paste)) + (format nil "Paste to channel ~A with ~A annotations." (encode-for-pre (paste-channel paste)) (length (paste-annotations paste))))) + *pastes*)))))) + (defun new-paste-form (request &key (message "") (annotate nil)) (araneida:html-stream (araneida:request-stream request) @@ -268,3 +291,7 @@ (make-instance 'display-paste-handler) (araneida:urlstring *display-paste-url*) nil) +(araneida:install-handler + (araneida:http-listener-handler *paste-listener*) + (make-instance 'rss-handler) + (araneida:urlstring *rss-url*) nil) \ No newline at end of file From bmastenbrook at common-lisp.net Fri Jan 30 16:09:48 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Fri, 30 Jan 2004 11:09:48 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv17792 Modified Files: variable.lisp Log Message: Er, this time save the file before committing. Date: Fri Jan 30 11:09:48 2004 Author: bmastenbrook Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.7 lisppaste2/variable.lisp:1.8 --- lisppaste2/variable.lisp:1.7 Fri Jan 30 11:08:31 2004 +++ lisppaste2/variable.lisp Fri Jan 30 11:09:47 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.7 2004/01/30 16:08:31 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.8 2004/01/30 16:09:47 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -37,8 +37,8 @@ (defparameter *submit-paste-url* (araneida:merge-url *paste-external-url* "submit")) -(defparameter *rdf-url* - (araneida:merge-url *paste-external-url* "list.rdf")) +(defparameter *rss-url* + (araneida:merge-url *paste-external-url* "list.rss")) (defparameter *paste-listener* (let ((fwd-url (araneida:copy-url *paste-url*))) From bmastenbrook at common-lisp.net Fri Jan 30 16:34:22 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Fri, 30 Jan 2004 11:34:22 -0500 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: Canonical order Date: Fri Jan 30 11:34:20 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.19 lisppaste2/web-server.lisp:1.20 --- lisppaste2/web-server.lisp:1.19 Fri Jan 30 11:08:31 2004 +++ lisppaste2/web-server.lisp Fri Jan 30 11:34:12 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.19 2004/01/30 16:08:31 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.20 2004/01/30 16:34:12 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -105,7 +105,7 @@ ,(format nil "Lisppaste pastes~APastes in this pastebot~{~A~}~%" (araneida:urlstring *list-paste-url*) - (reverse (mapcar #'(lambda (paste) + (mapcar #'(lambda (paste) (format nil "~A~A\"~A\" by ~A~A" (concatenate 'string (araneida:urlstring @@ -115,7 +115,7 @@ (encode-for-pre (paste-title paste)) (encode-for-pre (paste-user paste)) (format nil "Paste to channel ~A with ~A annotations." (encode-for-pre (paste-channel paste)) (length (paste-annotations paste))))) - *pastes*)))))) + *pastes*))))) (defun new-paste-form (request &key (message "") (annotate nil)) (araneida:html-stream @@ -294,4 +294,4 @@ (araneida:install-handler (araneida:http-listener-handler *paste-listener*) (make-instance 'rss-handler) - (araneida:urlstring *rss-url*) nil) \ No newline at end of file + (araneida:urlstring *rss-url*) nil) From bmastenbrook at common-lisp.net Fri Jan 30 16:36:45 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Fri, 30 Jan 2004 11:36:45 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv28832 Modified Files: variable.lisp Log Message: defparameter is kind of unintuitive there. Spent a frustrated ten minutes wondering why my new page was 404ing until I realized that variable.lisp smashes over the old handler but never replaces it. Date: Fri Jan 30 11:36:41 2004 Author: bmastenbrook Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.8 lisppaste2/variable.lisp:1.9 --- lisppaste2/variable.lisp:1.8 Fri Jan 30 11:09:47 2004 +++ lisppaste2/variable.lisp Fri Jan 30 11:36:37 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.8 2004/01/30 16:09:47 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.9 2004/01/30 16:36:37 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -40,7 +40,7 @@ (defparameter *rss-url* (araneida:merge-url *paste-external-url* "list.rss")) -(defparameter *paste-listener* +(defvar *paste-listener* (let ((fwd-url (araneida:copy-url *paste-url*))) (setf (araneida:url-port fwd-url) *internal-http-port*) (make-instance 'araneida:serve-event-reverse-proxy-listener