* riece-twitter.el (riece-twitter-sentinel): New function.
authorueno <ueno>
Wed, 6 Jun 2007 09:07:31 +0000 (09:07 +0000)
committerueno <ueno>
Wed, 6 Jun 2007 09:07:31 +0000 (09:07 +0000)
lisp/ChangeLog
lisp/riece-twitter.el

index a4ca687..bdebb66 100644 (file)
@@ -3,6 +3,7 @@
        * riece-twitter.el (riece-twitter-set-credential): New command.
        (riece-twitter-update): New command.
        (riece-twitter-message-filter): Use it.
+       (riece-twitter-sentinel): New function.
 
 2007-06-05  Daiki Ueno  <ueno@unixuser.org>
 
index 84e7722..9726069 100644 (file)
 (defun riece-twitter-update (status)
   "Update your status."
   (interactive "sStatus: ")
-  (start-process
-        "curl" nil "curl"
-        "-H" "X-Twitter-Client: Riece"
-        "-H" (concat "X-Twitter-Client-Version: " riece-version-number)
-        "-H" "X-Twitter-Client-URL: http://riece.nongnu.org/twitter.xml"
-        "-u" credential
-        "-d" "source=riece"
-        "-d" (concat "status="
-                     (riece-twitter-escape-string
-                      (encode-coding-string status 'utf-8)))
-        "-s"
-        "http://twitter.com/statuses/update.json"))
+  (message "Sending to Twitter...")
+  (let ((process
+        (start-process
+         "curl" nil "curl"
+         "-H" "X-Twitter-Client: Riece"
+         "-H" (concat "X-Twitter-Client-Version: " riece-version-number)
+         "-H" "X-Twitter-Client-URL: http://riece.nongnu.org/twitter.xml"
+         "-u" credential
+         "-d" "source=riece"
+         "-d" (concat "status="
+                      (riece-twitter-escape-string
+                       (encode-coding-string status 'utf-8)))
+         "-s"
+         "http://twitter.com/statuses/update.json")))
+    (set-process-sentinel process #'riece-twitter-sentinel)))
+
+(defun riece-twitter-sentinel (process status)
+  (if (equal status "finished\n")
+      (message "Sending to Twitter...done")
+    (message "Sending to Twitter...failed: %s"
+            (substring status 0 (1- (length status))))))
 
 (defun riece-twitter-message-filter (message)
   (if (and (riece-message-own-p message)