[Lisppaste-cvs] CVS update: lisppaste2/variable.lisp lisppaste2/web-server.lisp
Brian Mastenbrook
bmastenbrook at common-lisp.net
Fri Jan 30 16:08:31 UTC 2004
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) "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>~%")
+ (araneida:html-stream
+ (araneida:request-stream request)
+ `((|rss| :|version| "2.0")
+ ,(format nil
+ "<channel><title>Lisppaste pastes</title><link>~A</link><description>Pastes in this pastebot</description>~{~A~}</channel>~%"
+ (araneida:urlstring *list-paste-url*)
+ (reverse (mapcar #'(lambda (paste)
+ (format nil "<item><link>~A</link><pubDate>~A</pubDate><title>\"~A\" by ~A</title><description>~A</description></item>"
+ (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
More information about the Lisppaste-cvs
mailing list