From bmastenbrook at common-lisp.net Tue Feb 3 23:46:20 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 18:46:20 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/lisppaste.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv22399 Modified Files: lisppaste.lisp Log Message: URL in realname Date: Tue Feb 3 18:46:20 2004 Author: bmastenbrook Index: lisppaste2/lisppaste.lisp diff -u lisppaste2/lisppaste.lisp:1.5 lisppaste2/lisppaste.lisp:1.6 --- lisppaste2/lisppaste.lisp:1.5 Tue Jan 20 09:22:06 2004 +++ lisppaste2/lisppaste.lisp Tue Feb 3 18:46:20 2004 @@ -1,4 +1,4 @@ -;;;; $Id: lisppaste.lisp,v 1.5 2004/01/20 14:22:06 bmastenbrook Exp $ +;;;; $Id: lisppaste.lisp,v 1.6 2004/02/03 23:46:20 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -12,6 +12,7 @@ "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) @@ -23,4 +24,4 @@ (defun join-new-channel (channel) (setf *channels* (nconc *channels* (list channel))) - (irc:join *connection* channel)) \ No newline at end of file + (irc:join *connection* channel)) From bmastenbrook at common-lisp.net Tue Feb 3 23:47:27 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 18:47:27 -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: More RSS! Date: Tue Feb 3 18:47:27 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.20 lisppaste2/web-server.lisp:1.21 --- lisppaste2/web-server.lisp:1.20 Fri Jan 30 11:34:12 2004 +++ lisppaste2/web-server.lisp Tue Feb 3 18:47:26 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.20 2004/01/30 16:34:12 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.21 2004/02/03 23:47:26 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -80,7 +80,8 @@ (araneida:html-stream (araneida:request-stream request) `(html - (head (title "All pastes")) + (head (title "All pastes") + ((link :rel "alternate" :type "application/rss+xml" :title "Lisppaste RSS" :href ,(araneida:urlstring *rss-url*)))) (body (center (h2 "All pastes in system")) ((table :width "100%" :cellpadding 2) From bmastenbrook at common-lisp.net Tue Feb 3 23:52:04 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 18:52:04 -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: MORE HUP! Date: Tue Feb 3 18:52:04 2004 Author: bmastenbrook Index: lisppaste2/lisppaste.lisp diff -u lisppaste2/lisppaste.lisp:1.6 lisppaste2/lisppaste.lisp:1.7 --- lisppaste2/lisppaste.lisp:1.6 Tue Feb 3 18:46:20 2004 +++ lisppaste2/lisppaste.lisp Tue Feb 3 18:52:04 2004 @@ -1,4 +1,4 @@ -;;;; $Id: lisppaste.lisp,v 1.6 2004/02/03 23:46:20 bmastenbrook Exp $ +;;;; $Id: lisppaste.lisp,v 1.7 2004/02/03 23:52:04 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -25,3 +25,12 @@ (defun join-new-channel (channel) (setf *channels* (nconc *channels* (list channel))) (irc:join *connection* channel)) + +(defun hup-connection (nickname server) + (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*) + (irc:read-message-loop *connection*)) \ No newline at end of file From bmastenbrook at common-lisp.net Wed Feb 4 01:18:39 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 20:18:39 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv19328 Modified Files: web-server.lisp Log Message: MORE RSS! Date: Tue Feb 3 20:18:38 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.21 lisppaste2/web-server.lisp:1.22 --- lisppaste2/web-server.lisp:1.21 Tue Feb 3 18:47:26 2004 +++ lisppaste2/web-server.lisp Tue Feb 3 20:18:38 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.21 2004/02/03 23:47:26 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.22 2004/02/04 01:18:38 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -75,13 +75,16 @@ (first-<-mod delta years months weeks days hours minutes seconds) (1- level))))))) +(defun rss-link-header () + `((link :rel "alternate" :type "application/rss+xml" :title "Lisppaste RSS" :href ,(araneida:urlstring *rss-url*)))) + (defmethod araneida:handle-request-response ((handler list-paste-handler) method request) (araneida:request-send-headers request :expires 0) (araneida:html-stream (araneida:request-stream request) `(html (head (title "All pastes") - ((link :rel "alternate" :type "application/rss+xml" :title "Lisppaste RSS" :href ,(araneida:urlstring *rss-url*)))) + ,(rss-link-header)) (body (center (h2 "All pastes in system")) ((table :width "100%" :cellpadding 2) @@ -122,7 +125,8 @@ (araneida:html-stream (araneida:request-stream request) `(html - (head (title ,(if annotate "Annotate" "Paste"))) + (head (title ,(if annotate "Annotate" "Paste")) + ,(rss-link-header)) (body (h1 ,(if annotate "Enter your annotation" "Enter your paste")) ((font :color red) (h2 ,message)) @@ -201,7 +205,8 @@ (araneida:html-stream (araneida:request-stream request) `(html - (head (title "Paste number " ,*paste-counter*)) + (head (title "Paste number " ,*paste-counter*) + ,(rss-link-header)) (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*)) @@ -222,7 +227,8 @@ (araneida:request-stream request) `(html (head - (title "Paste number " ,paste-number)) + (title "Paste number " ,paste-number) + ,(rss-link-header)) (body ((table :width "100%" :cellpadding 2) (tr ((td :align "left" :width "0%" :nowrap) "Paste number " ,paste-number ": ") @@ -267,7 +273,8 @@ (araneida:request-stream request) `(html (head - (title "Invalid paste number" ,paste-number)) + (title "Invalid paste number" ,paste-number) + ,(rss-link-header)) (body (h3 "No paste numbered " ,paste-number " could be found.") ,@(bottom-links))))))) From bmastenbrook at common-lisp.net Wed Feb 4 02:41:12 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 21:41:12 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/irc-log-link.lisp lisppaste2/encode-for-pre.lisp lisppaste2/lisppaste.asd lisppaste2/package.lisp lisppaste2/persistent-pastes.lisp lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv3389 Modified Files: encode-for-pre.lisp lisppaste.asd package.lisp persistent-pastes.lisp web-server.lisp Added Files: irc-log-link.lisp Log Message: IRC log links from the pastebot to the context at meme.b9.com Date: Tue Feb 3 21:41:12 2004 Author: bmastenbrook Index: lisppaste2/encode-for-pre.lisp diff -u lisppaste2/encode-for-pre.lisp:1.7 lisppaste2/encode-for-pre.lisp:1.8 --- lisppaste2/encode-for-pre.lisp:1.7 Sat Jan 17 12:54:13 2004 +++ lisppaste2/encode-for-pre.lisp Tue Feb 3 21:41:12 2004 @@ -1,4 +1,4 @@ -;;;; $Id: encode-for-pre.lisp,v 1.7 2004/01/17 17:54:13 bmastenbrook Exp $ +;;;; $Id: encode-for-pre.lisp,v 1.8 2004/02/04 02:41:12 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/encode-for-pre.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -41,4 +41,4 @@ (replace-in-string str '(#\& #\< #\>) '("&" "<" ">"))) (defun encode-for-tt (str) - (replace-in-string-1 (replace-in-string str '(#\& #\< #\> #\newline #\return #\linefeed #\tab) '("&" "<" ">" "" "
" "" "    ")) #\space " " 1)) \ No newline at end of file + (replace-in-string (replace-in-string-1 str #\space " " t) '(#\& #\< #\> #\newline #\return #\linefeed #\tab) '("&" "<" ">" "" "
" "" "    "))) Index: lisppaste2/lisppaste.asd diff -u lisppaste2/lisppaste.asd:1.3 lisppaste2/lisppaste.asd:1.4 --- lisppaste2/lisppaste.asd:1.3 Sat Jan 17 13:02:14 2004 +++ lisppaste2/lisppaste.asd Tue Feb 3 21:41:12 2004 @@ -1,4 +1,5 @@ -;;;; $Id: lisppaste.asd,v 1.3 2004/01/17 18:02:14 bmastenbrook Exp $ +;;;; Silly emacs, this is -*- Lisp -*- +;;;; $Id: lisppaste.asd,v 1.4 2004/02/04 02:41:12 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.asd,v $ ;;;; See the LICENSE file for licensing information. @@ -26,11 +27,10 @@ :depends-on ("package")) (:file "encode-for-pre" :depends-on ("variable")) + (:file "irc-log-link") (:file "web-server" - :depends-on ("encode-for-pre")) + :depends-on ("encode-for-pre" "irc-log-link")) (:file "lisppaste" :depends-on ("web-server")) (:file "persistent-pastes" :depends-on ("web-server")))) - - Index: lisppaste2/package.lisp diff -u lisppaste2/package.lisp:1.1.1.1 lisppaste2/package.lisp:1.2 --- lisppaste2/package.lisp:1.1.1.1 Mon Nov 3 12:17:53 2003 +++ lisppaste2/package.lisp Tue Feb 3 21:41:12 2004 @@ -1,4 +1,4 @@ -;;;; $Id: package.lisp,v 1.1.1.1 2003/11/03 17:17:53 eenge Exp $ +;;;; $Id: package.lisp,v 1.2 2004/02/04 02:41:12 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/package.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -7,7 +7,7 @@ (eval-when (:execute :load-toplevel :compile-toplevel) (defpackage :lisppaste - (:use :cl) + (:use :cl :sb-bsd-sockets) (:export :start-lisppaste))) Index: lisppaste2/persistent-pastes.lisp diff -u lisppaste2/persistent-pastes.lisp:1.5 lisppaste2/persistent-pastes.lisp:1.6 --- lisppaste2/persistent-pastes.lisp:1.5 Sat Jan 17 13:34:37 2004 +++ lisppaste2/persistent-pastes.lisp Tue Feb 3 21:41:12 2004 @@ -8,7 +8,8 @@ (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))))) + (cons 'annotations (mapcar #'paste-alist (paste-annotations paste))) + (cons 'log-link (paste-log-link paste)))) (defun save-pastes-to-file (file-name) (let ((*package* (find-package :lisppaste))) @@ -22,7 +23,7 @@ , at body)) (defun make-paste-from-alist (e &optional annotation) - (with-assoc-vals (number user title contents universal-time annotations channel) e + (with-assoc-vals (number user title contents universal-time annotations channel log-link) e (unless annotation (setf *paste-counter* (max *paste-counter* number))) (make-paste :number number :user user @@ -30,11 +31,13 @@ :contents contents :universal-time universal-time :channel (if (not channel) (car *channels*) channel) - :annotations (mapcar #'(lambda (e) (make-paste-from-alist e)) annotations)))) + :annotations (mapcar #'(lambda (e) (make-paste-from-alist e)) annotations) + :log-link (if (not log-link) "" log-link)))) (defun read-pastes-from-file (file-name) (setf *pastes* nil) (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 + (if file + (let ((paste-alist (read file nil))) + (setf *pastes* (mapcar #'make-paste-from-alist paste-alist))))))) Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.22 lisppaste2/web-server.lisp:1.23 --- lisppaste2/web-server.lisp:1.22 Tue Feb 3 20:18:38 2004 +++ lisppaste2/web-server.lisp Tue Feb 3 21:41:12 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.22 2004/02/04 01:18:38 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.23 2004/02/04 02:41:12 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -14,7 +14,8 @@ (is-annotation nil :type boolean) (annotations nil :type list) (annotation-counter 0 :type integer) - (channel "" :type string)) + (channel "" :type string) + (log-link "" :type string)) (defclass new-paste-handler (araneida:handler) ()) @@ -180,7 +181,8 @@ (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))))) + (annotation-number (if annotate (incf (paste-annotation-counter paste-to-annotate)))) + (log-link (araneida:urlstring (irc-log-link channel)))) (let ((url (araneida:urlstring (araneida:merge-url *display-paste-url* (if annotate @@ -193,7 +195,8 @@ :title title :contents text :universal-time (get-universal-time) - :channel channel))) + :channel channel + :log-link log-link))) (irc:privmsg *connection* channel (if annotate (format nil "~A annotated #~A with \"~A\" at ~A" username paste-number title url) @@ -238,7 +241,10 @@ (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)))) + ((td :align "left" :width "100%") ,(encode-for-pre (paste-channel paste)) + ,@(if (not (string= (paste-log-link paste) "")) + `(" | " + ((a :href ,(paste-log-link paste)) "Context in IRC logs"))))) (tr ((td :align "left" :valign "top" :nowrap) "Paste contents:") ((td :width "100%"))) (tr (td (p))) From bmastenbrook at common-lisp.net Wed Feb 4 02:43:57 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 21:43:57 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/irc-log-link.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv15187 Modified Files: irc-log-link.lisp Log Message: oops, this won't work quite right when things fail :-) Date: Tue Feb 3 21:43:57 2004 Author: bmastenbrook Index: lisppaste2/irc-log-link.lisp diff -u lisppaste2/irc-log-link.lisp:1.1 lisppaste2/irc-log-link.lisp:1.2 --- lisppaste2/irc-log-link.lisp:1.1 Tue Feb 3 21:41:12 2004 +++ lisppaste2/irc-log-link.lisp Tue Feb 3 21:43:57 2004 @@ -61,4 +61,4 @@ (let ((link (fetch-irc-log-link (string-left-trim "#" channel)))) (if (stringp link) (araneida:merge-url (araneida:make-url :scheme "http" :host *meme-host*) link) - nil))) + ""))) From bmastenbrook at common-lisp.net Wed Feb 4 02:54:24 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 21:54:24 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/encode-for-pre.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: encode-for-pre.lisp Log Message: doh, that order causes lots of &nbsp; :-) Date: Tue Feb 3 21:54:24 2004 Author: bmastenbrook Index: lisppaste2/encode-for-pre.lisp diff -u lisppaste2/encode-for-pre.lisp:1.8 lisppaste2/encode-for-pre.lisp:1.9 --- lisppaste2/encode-for-pre.lisp:1.8 Tue Feb 3 21:41:12 2004 +++ lisppaste2/encode-for-pre.lisp Tue Feb 3 21:54:24 2004 @@ -1,4 +1,4 @@ -;;;; $Id: encode-for-pre.lisp,v 1.8 2004/02/04 02:41:12 bmastenbrook Exp $ +;;;; $Id: encode-for-pre.lisp,v 1.9 2004/02/04 02:54:24 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/encode-for-pre.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -41,4 +41,4 @@ (replace-in-string str '(#\& #\< #\>) '("&" "<" ">"))) (defun encode-for-tt (str) - (replace-in-string (replace-in-string-1 str #\space " " t) '(#\& #\< #\> #\newline #\return #\linefeed #\tab) '("&" "<" ">" "" "
" "" "    "))) + (replace-in-string-1 (replace-in-string str '(#\& #\< #\> #\newline #\return #\linefeed #\tab) '("&" "<" ">" "" "
" "" "    ")) #\space " " t)) From bmastenbrook at common-lisp.net Wed Feb 4 02:55:36 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 21:55:36 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv9184 Modified Files: web-server.lisp Log Message: Explicitly link to RSS Date: Tue Feb 3 21:55:36 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.23 lisppaste2/web-server.lisp:1.24 --- lisppaste2/web-server.lisp:1.23 Tue Feb 3 21:41:12 2004 +++ lisppaste2/web-server.lisp Tue Feb 3 21:55:36 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.23 2004/02/04 02:41:12 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.24 2004/02/04 02:55:36 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -39,6 +39,8 @@ ((a :href ,(araneida:urlstring *new-paste-url*)) "New paste") " | " ((a :href ,(araneida:urlstring *list-paste-url*)) "List all pastes") + " | " + ((a :href ,(araneida:urlstring *rss-url*)) "Syndicate (RSS)") " | " ((a :href "http://common-lisp.net/project/lisppaste") "lisppaste home page"))) From bmastenbrook at common-lisp.net Wed Feb 4 03:03:11 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 22:03:11 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/README.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv4324 Modified Files: README.lisp Log Message: Updated README.lisp with more information on dependencies Date: Tue Feb 3 22:03:10 2004 Author: bmastenbrook Index: lisppaste2/README.lisp diff -u lisppaste2/README.lisp:1.3 lisppaste2/README.lisp:1.4 --- lisppaste2/README.lisp:1.3 Sat Jan 17 13:34:37 2004 +++ lisppaste2/README.lisp Tue Feb 3 22:03:09 2004 @@ -1,21 +1,33 @@ -;;;; $Id: README.lisp,v 1.3 2004/01/17 18:34:37 bmastenbrook Exp $ +;;;; $Id: README.lisp,v 1.4 2004/02/04 03:03:09 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/README.lisp,v $ ;;;; See the LICENSE file for licensing information. ;;; README for lisppaste: + +;;; lisppaste requires a recent SBCL 0.8, araneida 0.80, and cl-irc +;;; 0.5. Once SBCL is installed, installing araneida and cl-irc is +;;; quite simple: +;;; +;;; (require :asdf) (require :asdf-install) +;;; (asdf-install:install :araneida) +;;; ; possibly selecting a restart to bypass GPG +;;; (asdf-install:install :cl-irc) ;;; ;;; lisppaste is pretty easy to get running. First, edit the top few -;;; lines of variable.lisp and change *paste-site-name* and to what's -;;; appropriate for your host. If you want to run it behind a proxying -;;; Apache (recommended), edit apache.conf.include and include that -;;; from your httpd.conf. Then, run SBCL and invoke the magical -;;; invocation as follows, or simply (load "README"). +;;; lines of variable.lisp and change *paste-site-name* and the +;;; internal and external ports to what's appropriate for your +;;; host. If you want to run it behind a proxying Apache +;;; (recommended), edit apache.conf.include and include that from your +;;; httpd.conf. Then, run SBCL and invoke the magical invocation as +;;; follows, or simply (load "README"). (require :asdf) (require :lisppaste) (lisppaste:start-lisppaste :channels '("#lisppaste") - :nickname "devpaste" + :nickname (format nil + "devpaste~A" + (random 500)) :server "irc.freenode.net" :port 6667) From bmastenbrook at common-lisp.net Wed Feb 4 03:10:30 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 22:10:30 -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-serv31936 Modified Files: index.html Log Message: Lisppaste 2.1 Date: Tue Feb 3 22:10:29 2004 Author: bmastenbrook Index: public_html/index.html diff -u public_html/index.html:1.4 public_html/index.html:1.5 --- public_html/index.html:1.4 Sat Jan 17 13:47:01 2004 +++ public_html/index.html Tue Feb 3 22:10:29 2004 @@ -21,7 +21,10 @@

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

New in lisppaste 2.1 is support for RSS and linking to IRC log + context at meme.b9.com.

The code in CVS (checkout instructions) is also considered fairly usable. You'll also @@ -49,7 +52,7 @@

Brian Mastenbrook
-Last modified: Sat Jan 17 13:49:09 EST 2004 +Last modified: Tue Feb 3 22:13:23 EST 2004 From bmastenbrook at common-lisp.net Wed Feb 4 03:26:03 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 03 Feb 2004 22:26:03 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv22127 Modified Files: web-server.lisp Log Message: Whoops, bug fix slightly after release! not that it would have harmed anything..:. Date: Tue Feb 3 22:26:03 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.24 lisppaste2/web-server.lisp:1.25 --- lisppaste2/web-server.lisp:1.24 Tue Feb 3 21:55:36 2004 +++ lisppaste2/web-server.lisp Tue Feb 3 22:26:03 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.24 2004/02/04 02:55:36 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.25 2004/02/04 03:26:03 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -117,7 +117,7 @@ (concatenate 'string (araneida:urlstring (araneida:merge-url *display-paste-url* - (prin1-to-string (paste-number paste)))) "#" (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)) From bmastenbrook at common-lisp.net Wed Feb 4 13:07:28 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Wed, 04 Feb 2004 08:07:28 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/irc-log-link.lisp lisppaste2/web-server.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: irc-log-link.lisp web-server.lisp Log Message: Small bug fix; log links for annotations Date: Wed Feb 4 08:07:27 2004 Author: bmastenbrook Index: lisppaste2/irc-log-link.lisp diff -u lisppaste2/irc-log-link.lisp:1.2 lisppaste2/irc-log-link.lisp:1.3 --- lisppaste2/irc-log-link.lisp:1.2 Tue Feb 3 21:43:57 2004 +++ lisppaste2/irc-log-link.lisp Wed Feb 4 08:07:27 2004 @@ -60,5 +60,5 @@ (defun irc-log-link (channel) (let ((link (fetch-irc-log-link (string-left-trim "#" channel)))) (if (stringp link) - (araneida:merge-url (araneida:make-url :scheme "http" :host *meme-host*) link) + (araneida:urlstring (araneida:merge-url (araneida:make-url :scheme "http" :host *meme-host*) link)) ""))) Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.25 lisppaste2/web-server.lisp:1.26 --- lisppaste2/web-server.lisp:1.25 Tue Feb 3 22:26:03 2004 +++ lisppaste2/web-server.lisp Wed Feb 4 08:07:27 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.25 2004/02/04 03:26:03 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.26 2004/02/04 13:07:27 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -184,7 +184,7 @@ (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)))) - (log-link (araneida:urlstring (irc-log-link channel)))) + (log-link (irc-log-link channel))) (let ((url (araneida:urlstring (araneida:merge-url *display-paste-url* (if annotate @@ -259,7 +259,10 @@ `((tr (td (p)) (td)) (tr (td ((a :name ,(prin1-to-string (paste-number a))) "Title:")) - ((td :align "left") ,(encode-for-pre (paste-title a)))) + ((td :align "left") ,(encode-for-pre (paste-title a)) + ,@(if (not (string= (paste-log-link a) "")) + `(" | " + ((a :href ,(paste-log-link a)) "Context in IRC logs"))))) (tr (td "By:") ((td :align "left") ,(encode-for-pre (paste-user a)))) From bmastenbrook at common-lisp.net Wed Feb 4 13:11:23 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Wed, 04 Feb 2004 08:11:23 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/irc-log-link.lisp lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: irc-log-link.lisp variable.lisp Log Message: Conditionalize meme links Date: Wed Feb 4 08:11:23 2004 Author: bmastenbrook Index: lisppaste2/irc-log-link.lisp diff -u lisppaste2/irc-log-link.lisp:1.3 lisppaste2/irc-log-link.lisp:1.4 --- lisppaste2/irc-log-link.lisp:1.3 Wed Feb 4 08:07:27 2004 +++ lisppaste2/irc-log-link.lisp Wed Feb 4 08:11:22 2004 @@ -58,7 +58,8 @@ (return-from log-return nil))))) (defun irc-log-link (channel) - (let ((link (fetch-irc-log-link (string-left-trim "#" channel)))) - (if (stringp link) - (araneida:urlstring (araneida:merge-url (araneida:make-url :scheme "http" :host *meme-host*) link)) - ""))) + (if *meme-links* + (let ((link (fetch-irc-log-link (string-left-trim "#" channel)))) + (if (stringp link) + (araneida:urlstring (araneida:merge-url (araneida:make-url :scheme "http" :host *meme-host*) link)) + "")))) Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.9 lisppaste2/variable.lisp:1.10 --- lisppaste2/variable.lisp:1.9 Fri Jan 30 11:36:37 2004 +++ lisppaste2/variable.lisp Wed Feb 4 08:11:22 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.9 2004/01/30 16:36:37 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.10 2004/02/04 13:11:22 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -7,10 +7,10 @@ (defparameter *internal-http-port* 8081 "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* "localhost" +(defparameter *paste-site-name* "www.common-lisp.net" "Website we are running on (used for creating links).") (defparameter *paste-url* @@ -23,7 +23,12 @@ (araneida:merge-url (araneida:make-url :scheme "http" :host *paste-site-name* - :port *external-http-port*) "/paste/")) + ) "/paste/")) + +(defvar *meme-links* t) ; whether meme links are enabled + +;; You should not have to edit below this line +;; LINE (defparameter *display-paste-url* (araneida:merge-url *paste-external-url* "display/")) @@ -45,7 +50,7 @@ (setf (araneida:url-port fwd-url) *internal-http-port*) (make-instance 'araneida:serve-event-reverse-proxy-listener :translations - `((,(araneida:urlstring *paste-url*) + `((,(araneida:urlstring *paste-external-url*) ,(araneida:urlstring fwd-url))) :address #(0 0 0 0) :port (araneida:url-port fwd-url)))) From bmastenbrook at common-lisp.net Wed Feb 4 13:23:53 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Wed, 04 Feb 2004 08:23:53 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/variable.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/tmp/cvs-serv32009 Modified Files: variable.lisp Log Message: trying to revert Date: Wed Feb 4 08:23:52 2004 Author: bmastenbrook Index: lisppaste2/variable.lisp diff -u lisppaste2/variable.lisp:1.10 lisppaste2/variable.lisp:1.11 --- lisppaste2/variable.lisp:1.10 Wed Feb 4 08:11:22 2004 +++ lisppaste2/variable.lisp Wed Feb 4 08:23:52 2004 @@ -1,4 +1,4 @@ -;;;; $Id: variable.lisp,v 1.10 2004/02/04 13:11:22 bmastenbrook Exp $ +;;;; $Id: variable.lisp,v 1.11 2004/02/04 13:23:52 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/variable.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -7,10 +7,10 @@ (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* "www.common-lisp.net" +(defparameter *paste-site-name* "localhost" "Website we are running on (used for creating links).") (defparameter *paste-url* @@ -23,11 +23,11 @@ (araneida:merge-url (araneida:make-url :scheme "http" :host *paste-site-name* - ) "/paste/")) + :port *external-http-port*) "/paste/")) -(defvar *meme-links* t) ; whether meme links are enabled +(defvar *meme-links* t) ; whether to link to meme IRC logs -;; You should not have to edit below this line +;; You shouldn't need to edit below this line. ;; LINE (defparameter *display-paste-url* @@ -50,7 +50,7 @@ (setf (araneida:url-port fwd-url) *internal-http-port*) (make-instance 'araneida:serve-event-reverse-proxy-listener :translations - `((,(araneida:urlstring *paste-external-url*) + `((,(araneida:urlstring *paste-url*) ,(araneida:urlstring fwd-url))) :address #(0 0 0 0) :port (araneida:url-port fwd-url)))) @@ -65,4 +65,4 @@ (defvar *connection* nil) (defvar *channels* nil) -(defvar *paste-file* "pastes.lisp-expr") \ No newline at end of file +(defvar *paste-file* "pastes.lisp-expr") From bmastenbrook at common-lisp.net Tue Feb 10 16:17:52 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 10 Feb 2004 11:17:52 -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: Better hup-connection Date: Tue Feb 10 11:17:52 2004 Author: bmastenbrook Index: lisppaste2/lisppaste.lisp diff -u lisppaste2/lisppaste.lisp:1.7 lisppaste2/lisppaste.lisp:1.8 --- lisppaste2/lisppaste.lisp:1.7 Tue Feb 3 18:52:04 2004 +++ lisppaste2/lisppaste.lisp Tue Feb 10 11:17:52 2004 @@ -1,4 +1,4 @@ -;;;; $Id: lisppaste.lisp,v 1.7 2004/02/03 23:52:04 bmastenbrook Exp $ +;;;; $Id: lisppaste.lisp,v 1.8 2004/02/10 16:17:52 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -27,7 +27,7 @@ (irc:join *connection* channel)) (defun hup-connection (nickname server) - (irc:quit *connection*) + (ignore-errors (irc:quit *connection*)) (setf *connection* (irc:connect :nickname nickname :realname (araneida:urlstring *new-paste-url*) :server server From bmastenbrook at common-lisp.net Tue Feb 10 16:18:18 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 10 Feb 2004 11:18:18 -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: HTML 4.01 Transitional! Date: Tue Feb 10 11:18:18 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.26 lisppaste2/web-server.lisp:1.27 --- lisppaste2/web-server.lisp:1.26 Wed Feb 4 08:07:27 2004 +++ lisppaste2/web-server.lisp Tue Feb 10 11:18:17 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.26 2004/02/04 13:07:27 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.27 2004/02/10 16:18:17 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -51,6 +51,11 @@ ((< delta (* 60 60)) (format nil "~A ago" (time-delta-primitive delta 1))) (t (format nil "~A ago" (time-delta-primitive delta level)))))) +(defun irc-log-link (utime channel) + (format nil "http://meme.b9.com/now?utime=~A&channel=~A" + utime + (string-left-trim "#" channel))) + (defun first-<-mod (n &rest nums) (some #'(lambda (n2) (if (< n2 n) (mod n n2) nil)) nums)) @@ -83,6 +88,7 @@ (defmethod araneida:handle-request-response ((handler list-paste-handler) method request) (araneida:request-send-headers request :expires 0) + (format (araneida:request-stream request) "") (araneida:html-stream (araneida:request-stream request) `(html @@ -93,13 +99,13 @@ ((table :width "100%" :cellpadding 2) (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))))) + `(tr ((td :nowrap "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))))) + ((td :nowrap "nowrap") ,(encode-for-pre (paste-user paste))) + ((td :nowrap "nowrap") ,(encode-for-pre (paste-channel paste))) + ((td :nowrap "nowrap") ,(time-delta (paste-universal-time paste) 1)) + ((td :width "100%" :bgcolor "#F4F4F4" :nowrap "nowrap") ,(encode-for-pre (paste-title paste))) + ((td :nowrap "nowrap") ,(length (paste-annotations paste))))) *pastes*))) ,@(bottom-links))))) @@ -113,7 +119,7 @@ "Lisppaste pastes~APastes in this pastebot~{~A~}~%" (araneida:urlstring *list-paste-url*) (mapcar #'(lambda (paste) - (format nil "~A~A\"~A\" by ~A~A" + (format nil "~A~A\"~A\" by ~A~A~%" (concatenate 'string (araneida:urlstring (araneida:merge-url *display-paste-url* @@ -125,6 +131,7 @@ *pastes*))))) (defun new-paste-form (request &key (message "") (annotate nil)) + (format (araneida:request-stream request) "") (araneida:html-stream (araneida:request-stream request) `(html @@ -183,8 +190,7 @@ (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)))) - (log-link (irc-log-link channel))) + (annotation-number (if annotate (incf (paste-annotation-counter paste-to-annotate))))) (let ((url (araneida:urlstring (araneida:merge-url *display-paste-url* (if annotate @@ -198,7 +204,7 @@ :contents text :universal-time (get-universal-time) :channel channel - :log-link log-link))) + ))) (irc:privmsg *connection* channel (if annotate (format nil "~A annotated #~A with \"~A\" at ~A" username paste-number title url) @@ -207,6 +213,7 @@ (push paste (paste-annotations paste-to-annotate)) (push paste *pastes*)) (save-pastes-to-file *paste-file*) + (format (araneida:request-stream request) "") (araneida:html-stream (araneida:request-stream request) `(html @@ -228,58 +235,60 @@ (and (eql paste-number (paste-number element)) element)) *pastes*))) (if paste - (araneida:html-stream - (araneida:request-stream request) - `(html - (head - (title "Paste number " ,paste-number) - ,(rss-link-header)) - (body - ((table :width "100%" :cellpadding 2) - (tr ((td :align "left" :width "0%" :nowrap) "Paste number " ,paste-number ": ") - ((td :align "left" :width "100%") (b ,(encode-for-pre (paste-title paste))))) - (tr ((td :align "left" :nowrap) "Pasted by: ") - ((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)) - ,@(if (not (string= (paste-log-link paste) "")) - `(" | " - ((a :href ,(paste-log-link paste)) "Context in IRC logs"))))) - (tr ((td :align "left" :valign "top" :nowrap) "Paste contents:") - ((td :width "100%"))) - (tr (td (p))) - (tr ((td :bgcolor "#F4F4F4" :colspan 2 :width "100%") (tt ,(encode-for-tt (paste-contents paste))))) - ,@(if (paste-annotations paste) - `((tr (td (p)) (td)) - (tr ((th :align "left" :colspan 2) "Annotations for this paste: ")) - ,@(reduce #'append (nreverse - (mapcar #'(lambda (a) - `((tr (td (p)) (td)) - (tr - (td ((a :name ,(prin1-to-string (paste-number a))) "Title:")) - ((td :align "left") ,(encode-for-pre (paste-title a)) - ,@(if (not (string= (paste-log-link a) "")) - `(" | " - ((a :href ,(paste-log-link a)) "Context in IRC logs"))))) - (tr - (td "By:") - ((td :align "left") ,(encode-for-pre (paste-user a)))) - (tr - (td) - ((td :align "left") ,(time-delta (paste-universal-time a)))) - (tr - ((td :valign "top" :nowrap) "Contents:") - ((td :bgcolor "#F4F4F4" :width "100%") (tt ,(encode-for-tt (paste-contents a))))))) - (paste-annotations paste))))) - `((tr (td (p)) (td)) - (tr ((td :align "left" :colspan 2 :nowrap) "This paste has no annotations."))))) - (p) - ((form :method post :action ,(araneida:urlstring *new-paste-url*)) - ((input :type hidden :name "annotate" :value ,(prin1-to-string (paste-number paste)))) - (center ((input :type submit :value "Annotate this paste")))) - ,@(bottom-links)))) + (progn + (format (araneida:request-stream request) "") + (araneida:html-stream + (araneida:request-stream request) + `(html + (head + (title "Paste number " ,paste-number) + ,(rss-link-header)) + (body + ((table :width "100%" :cellpadding 2) + (tr ((td :align "left" :width "0%" :nowrap "nowrap") "Paste number " ,paste-number ": ") + ((td :align "left" :width "100%") (b ,(encode-for-pre (paste-title paste))))) + (tr ((td :align "left" :nowrap "nowrap") "Pasted by: ") + ((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)) + " | " + ((a :href ,(irc-log-link (paste-universal-time paste) (paste-channel paste))) "Context in IRC logs"))) + (tr ((td :align "left" :valign "top" :nowrap "nowrap") "Paste contents:") + ((td :width "100%"))) + (tr (td (p))) + (tr ((td :bgcolor "#F4F4F4" :colspan 2 :width "100%") (tt ,(encode-for-tt (paste-contents paste))))) + ,@(if (paste-annotations paste) + `((tr (td (p)) (td)) + (tr ((th :align "left" :colspan 2) "Annotations for this paste: ")) + ,@(reduce #'append (nreverse + (mapcar #'(lambda (a) + `((tr (td (p)) (td)) + (tr + (td ((a :name ,(prin1-to-string (paste-number a))) "Title:")) + ((td :align "left") ,(encode-for-pre (paste-title a)) + " | " + ((a :href ,(irc-log-link (paste-universal-time paste) (paste-channel paste))) "Context in IRC logs"))) + (tr + (td "By:") + ((td :align "left") ,(encode-for-pre (paste-user a)))) + (tr + (td) + ((td :align "left") ,(time-delta (paste-universal-time a)))) + (tr + ((td :valign "top" :nowrap "nowrap") "Contents:") + ((td :bgcolor "#F4F4F4" :width "100%") (tt ,(encode-for-tt (paste-contents a))))))) + (paste-annotations paste))))) + `((tr (td (p)) (td)) + (tr ((td :align "left" :colspan 2 :nowrap "nowrap") "This paste has no annotations."))))) + (p) + ((form :method post :action ,(araneida:urlstring *new-paste-url*)) + ((input :type hidden :name "annotate" :value ,(prin1-to-string (paste-number paste)))) + (center ((input :type submit :value "Annotate this paste")))) + ,@(bottom-links))))) + (progn + (format (araneida:request-stream request) "") (araneida:html-stream (araneida:request-stream request) `(html @@ -288,7 +297,7 @@ ,(rss-link-header)) (body (h3 "No paste numbered " ,paste-number " could be found.") - ,@(bottom-links))))))) + ,@(bottom-links)))))))) (araneida:install-handler (araneida:http-listener-handler *paste-listener*) From bmastenbrook at common-lisp.net Tue Feb 17 23:56:42 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 17 Feb 2004 18:56:42 -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: Minor changes Date: Tue Feb 17 18:56:41 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.27 lisppaste2/web-server.lisp:1.28 --- lisppaste2/web-server.lisp:1.27 Tue Feb 10 11:18:17 2004 +++ lisppaste2/web-server.lisp Tue Feb 17 18:56:41 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.27 2004/02/10 16:18:17 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.28 2004/02/17 23:56:41 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -44,12 +44,12 @@ " | " ((a :href "http://common-lisp.net/project/lisppaste") "lisppaste home page"))) -(defun time-delta (time &optional (level 2)) +(defun time-delta (time &key (level 2) (ago-p t)) (let ((delta (- (get-universal-time) time))) (cond ((< delta 1) "<Doc Brown>From the future...</Doc Brown>") - ((< delta (* 60 60)) (format nil "~A ago" (time-delta-primitive delta 1))) - (t (format nil "~A ago" (time-delta-primitive delta level)))))) + ((< delta (* 60 60)) (format nil "~A~A" (time-delta-primitive delta 1) (if ago-p " ago" ""))) + (t (format nil "~A~A" (time-delta-primitive delta level) (if ago-p " ago" "")))))) (defun irc-log-link (utime channel) (format nil "http://meme.b9.com/now?utime=~A&channel=~A" @@ -86,6 +86,11 @@ (defun rss-link-header () `((link :rel "alternate" :type "application/rss+xml" :title "Lisppaste RSS" :href ,(araneida:urlstring *rss-url*)))) +(defun max-length (str n) + (if (> (length str) n) + (concatenate 'string (subseq str 0 (1- n)) "...") + str)) + (defmethod araneida:handle-request-response ((handler list-paste-handler) method request) (araneida:request-send-headers request :expires 0) (format (araneida:request-stream request) "") @@ -101,10 +106,10 @@ ,@(reverse (mapcar #'(lambda (paste) `(tr ((td :nowrap "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 "nowrap") ,(encode-for-pre (paste-user paste))) + ((td :nowrap "nowrap") ,(encode-for-pre (max-length (paste-user paste) 12))) ((td :nowrap "nowrap") ,(encode-for-pre (paste-channel paste))) - ((td :nowrap "nowrap") ,(time-delta (paste-universal-time paste) 1)) - ((td :width "100%" :bgcolor "#F4F4F4" :nowrap "nowrap") ,(encode-for-pre (paste-title paste))) + ((td :nowrap "nowrap") ,(time-delta (paste-universal-time paste) :level 1 :ago-p nil)) + ((td :width "100%" :bgcolor "#F4F4F4" :nowrap "nowrap") ,(encode-for-pre (max-length (paste-title paste) 50))) ((td :nowrap "nowrap") ,(length (paste-annotations paste))))) *pastes*))) ,@(bottom-links))))) From bmastenbrook at common-lisp.net Tue Feb 17 23:57:19 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 17 Feb 2004 18:57:19 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/lisppaste.asd Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Modified Files: lisppaste.asd Log Message: irc-log-link.lisp is toast Date: Tue Feb 17 18:57:19 2004 Author: bmastenbrook Index: lisppaste2/lisppaste.asd diff -u lisppaste2/lisppaste.asd:1.4 lisppaste2/lisppaste.asd:1.5 --- lisppaste2/lisppaste.asd:1.4 Tue Feb 3 21:41:12 2004 +++ lisppaste2/lisppaste.asd Tue Feb 17 18:57:19 2004 @@ -1,5 +1,5 @@ ;;;; Silly emacs, this is -*- Lisp -*- -;;;; $Id: lisppaste.asd,v 1.4 2004/02/04 02:41:12 bmastenbrook Exp $ +;;;; $Id: lisppaste.asd,v 1.5 2004/02/17 23:57:19 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/lisppaste.asd,v $ ;;;; See the LICENSE file for licensing information. @@ -27,7 +27,6 @@ :depends-on ("package")) (:file "encode-for-pre" :depends-on ("variable")) - (:file "irc-log-link") (:file "web-server" :depends-on ("encode-for-pre" "irc-log-link")) (:file "lisppaste" From bmastenbrook at common-lisp.net Tue Feb 17 23:57:42 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Tue, 17 Feb 2004 18:57:42 -0500 Subject: [Lisppaste-cvs] CVS update: lisppaste2/irc-log-link.lisp Message-ID: Update of /project/lisppaste/cvsroot/lisppaste2 In directory common-lisp.net:/home/bmastenbrook/lisppaste2 Removed Files: irc-log-link.lisp Log Message: Kapow! Date: Tue Feb 17 18:57:42 2004 Author: bmastenbrook From bmastenbrook at common-lisp.net Mon Feb 23 14:56:33 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Mon, 23 Feb 2004 09:56:33 -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-serv4480 Modified Files: index.html Log Message: Release, I think Date: Mon Feb 23 09:56:32 2004 Author: bmastenbrook Index: public_html/index.html diff -u public_html/index.html:1.5 public_html/index.html:1.6 --- public_html/index.html:1.5 Tue Feb 3 22:10:29 2004 +++ public_html/index.html Mon Feb 23 09:56:32 2004 @@ -21,7 +21,7 @@

Lisppaste 2 can be downloaded from here: lisppaste2-latest.tar.gz. The - latest version is 2.1, released February 3, 2004. + latest version is 2.1.3, released February 23, 2004.

New in lisppaste 2.1 is support for RSS and linking to IRC log context at meme.b9.com. @@ -52,7 +52,7 @@

Brian Mastenbrook
-Last modified: Tue Feb 3 22:13:23 EST 2004 +Last modified: Mon Feb 23 09:56:16 EST 2004 From bmastenbrook at common-lisp.net Mon Feb 23 19:56:50 2004 From: bmastenbrook at common-lisp.net (Brian Mastenbrook) Date: Mon, 23 Feb 2004 14:56:50 -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: MORE RAW SOURCE Date: Mon Feb 23 14:56:50 2004 Author: bmastenbrook Index: lisppaste2/web-server.lisp diff -u lisppaste2/web-server.lisp:1.28 lisppaste2/web-server.lisp:1.29 --- lisppaste2/web-server.lisp:1.28 Tue Feb 17 18:56:41 2004 +++ lisppaste2/web-server.lisp Mon Feb 23 14:56:49 2004 @@ -1,4 +1,4 @@ -;;;; $Id: web-server.lisp,v 1.28 2004/02/17 23:56:41 bmastenbrook Exp $ +;;;; $Id: web-server.lisp,v 1.29 2004/02/23 19:56:49 bmastenbrook Exp $ ;;;; $Source: /project/lisppaste/cvsroot/lisppaste2/web-server.lisp,v $ ;;;; See the LICENSE file for licensing information. @@ -230,69 +230,91 @@ (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)))))))))) +(defun ends-with (str end) + (let ((l1 (length str)) + (l2 (length end))) + (if (< l1 l2) nil + (string= (subseq str (- l1 l2) l1) end)))) + (defmethod araneida:handle-request-response ((handler display-paste-handler) method request) - (araneida:request-send-headers request :expires 0) ; XXX request-unhandled-part will be exported in 0.81 (let* ((paste-number (parse-integer (araneida::request-unhandled-part request) :junk-allowed t)) + (raw (ends-with (araneida::request-unhandled-part request) "/raw")) (paste (some #'(lambda (element) (and (eql paste-number (paste-number element)) element)) *pastes*))) (if paste - (progn - (format (araneida:request-stream request) "") - (araneida:html-stream - (araneida:request-stream request) - `(html - (head - (title "Paste number " ,paste-number) - ,(rss-link-header)) - (body - ((table :width "100%" :cellpadding 2) - (tr ((td :align "left" :width "0%" :nowrap "nowrap") "Paste number " ,paste-number ": ") - ((td :align "left" :width "100%") (b ,(encode-for-pre (paste-title paste))))) - (tr ((td :align "left" :nowrap "nowrap") "Pasted by: ") - ((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)) - " | " - ((a :href ,(irc-log-link (paste-universal-time paste) (paste-channel paste))) "Context in IRC logs"))) - (tr ((td :align "left" :valign "top" :nowrap "nowrap") "Paste contents:") - ((td :width "100%"))) - (tr (td (p))) - (tr ((td :bgcolor "#F4F4F4" :colspan 2 :width "100%") (tt ,(encode-for-tt (paste-contents paste))))) - ,@(if (paste-annotations paste) + (if raw + (let ((p (position #\, (araneida::request-unhandled-part request) :test #'char=))) + (if p (let ((ann (parse-integer (araneida::request-unhandled-part request) :start (1+ p) :junk-allowed t))) + (let ((theann (car (member ann (paste-annotations paste) :key #'paste-number :test #'=)))) + (if theann + (progn + (araneida:request-send-headers request :expires 0 :content-type "text/plain") + (write-string (paste-contents theann) (araneida:request-stream request)))))) + (progn + (araneida:request-send-headers request :expires 0 :content-type "text/plain") + (write-string (paste-contents paste) (araneida:request-stream request))))) + (progn + (araneida:request-send-headers request :expires 0) + (format (araneida:request-stream request) "") + (araneida:html-stream + (araneida:request-stream request) + `(html + (head + (title "Paste number " ,paste-number) + ,(rss-link-header)) + (body + ((table :width "100%" :cellpadding 2) + (tr ((td :align "left" :width "0%" :nowrap "nowrap") "Paste number " ,paste-number ": ") + ((td :align "left" :width "100%") (b ,(encode-for-pre (paste-title paste))))) + (tr ((td :align "left" :nowrap "nowrap") "Pasted by: ") + ((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)) + " | " + ((a :href ,(irc-log-link (paste-universal-time paste) (paste-channel paste))) "Context in IRC logs"))) + (tr ((td :align "left" :valign "top" :nowrap "nowrap") "Paste contents:") + ((td :width "100%") ((a :href ,(concatenate 'string (araneida:urlstring (araneida:request-url request)) "/raw")) "(raw source)"))) + (tr (td (p))) + (tr ((td :bgcolor "#F4F4F4" :colspan 2 :width "100%") (tt ,(encode-for-tt (paste-contents paste))))) + ,@(if (paste-annotations paste) + `((tr (td (p)) (td)) + (tr ((th :align "left" :colspan 2) "Annotations for this paste: ")) + ,@(reduce #'append (nreverse + (mapcar #'(lambda (a) + `((tr (td (p)) (td)) + (tr + (td ((a :name ,(prin1-to-string (paste-number a))) "Title:")) + ((td :align "left") ,(encode-for-pre (paste-title a)) + " | " + ((a :href ,(irc-log-link (paste-universal-time paste) (paste-channel paste))) "Context in IRC logs"))) + (tr + (td "By:") + ((td :align "left") ,(encode-for-pre (paste-user a)))) + (tr + (td) + ((td :align "left") ,(time-delta (paste-universal-time a)))) + (tr + (td) + ((td :align "left") ((a :href ,(format nil "~A,~A/raw" (araneida:urlstring (araneida:request-url request)) (paste-number a))) "(raw source)"))) + (tr + ((td :valign "top" :nowrap "nowrap") "Contents:") + ((td :bgcolor "#F4F4F4" :width "100%") (tt ,(encode-for-tt (paste-contents a))))))) + (paste-annotations paste))))) `((tr (td (p)) (td)) - (tr ((th :align "left" :colspan 2) "Annotations for this paste: ")) - ,@(reduce #'append (nreverse - (mapcar #'(lambda (a) - `((tr (td (p)) (td)) - (tr - (td ((a :name ,(prin1-to-string (paste-number a))) "Title:")) - ((td :align "left") ,(encode-for-pre (paste-title a)) - " | " - ((a :href ,(irc-log-link (paste-universal-time paste) (paste-channel paste))) "Context in IRC logs"))) - (tr - (td "By:") - ((td :align "left") ,(encode-for-pre (paste-user a)))) - (tr - (td) - ((td :align "left") ,(time-delta (paste-universal-time a)))) - (tr - ((td :valign "top" :nowrap "nowrap") "Contents:") - ((td :bgcolor "#F4F4F4" :width "100%") (tt ,(encode-for-tt (paste-contents a))))))) - (paste-annotations paste))))) - `((tr (td (p)) (td)) - (tr ((td :align "left" :colspan 2 :nowrap "nowrap") "This paste has no annotations."))))) - (p) - ((form :method post :action ,(araneida:urlstring *new-paste-url*)) - ((input :type hidden :name "annotate" :value ,(prin1-to-string (paste-number paste)))) - (center ((input :type submit :value "Annotate this paste")))) - ,@(bottom-links))))) + (tr ((td :align "left" :colspan 2 :nowrap "nowrap") "This paste has no annotations."))))) + (p) + ((form :method post :action ,(araneida:urlstring *new-paste-url*)) + ((input :type hidden :name "annotate" :value ,(prin1-to-string (paste-number paste)))) + (center ((input :type submit :value "Annotate this paste")))) + ,@(bottom-links)))))) (progn + (araneida:request-send-headers request :expires 0) (format (araneida:request-stream request) "") (araneida:html-stream (araneida:request-stream request)