[bknr-cvs] hans changed trunk/projects/quickhoney/src/handlers.lisp

BKNR Commits bknr at bknr.net
Wed Sep 17 13:31:04 UTC 2008


Revision: 3913
Author: hans
URL: http://bknr.net/trac/changeset/3913

Make URLs tiny instead of relying on Twitter to do so, as that won't always
work.

U   trunk/projects/quickhoney/src/handlers.lisp

Modified: trunk/projects/quickhoney/src/handlers.lisp
===================================================================
--- trunk/projects/quickhoney/src/handlers.lisp	2008-09-17 11:47:43 UTC (rev 3912)
+++ trunk/projects/quickhoney/src/handlers.lisp	2008-09-17 13:31:04 UTC (rev 3913)
@@ -305,9 +305,13 @@
                                                                 :spider-keywords spider-keywords))))
 		  (with-http-response ()
 		    (with-http-body ()
-                      (twitter:update-status (bknr-session-user)
-                                             (format nil "Uploaded new image ~A: http://quickhoney.com~A/~A"
-                                                     image-name (handler-path handler) image-name))
+                      (let ((tinyurl (drakma:http-request
+                                      (format nil "http://tinyurl.com/api-create.php?url=~A"
+                                              (hunchentoot:url-encode (format nil "http://quickhoney.com~A/~A"
+                                                                              (handler-path handler) image-name))))))
+                        (twitter:update-status (bknr-session-user)
+                                               (format nil "Uploaded new image ~A: ~A"
+                                                       image-name tinyurl)))
 		      (html (:html
 			     (:head
 			      (:title "Upload successful")




More information about the Bknr-cvs mailing list