Index: /lang/elisp/twittering-mode/branches/tsuyoshi/twittering-mode.el
===================================================================
--- /lang/elisp/twittering-mode/branches/tsuyoshi/twittering-mode.el (revision 48)
+++ /lang/elisp/twittering-mode/branches/tsuyoshi/twittering-mode.el (revision 49)
@@ -59,5 +59,7 @@
 (defvar twittering-mode-map (make-sparse-keymap))
 
-(defvar twittering-timer nil "Timer object for timeline refreshing will be stored here. DO NOT SET VALUE MANUALLY.")
+(defvar twittering-timer nil
+  "Timer object for timeline refreshing will be stored here. DO NOT SET VALUE
+MANUALLY.")
 
 (defvar twittering-idle-time 20)
@@ -75,22 +77,22 @@
 (make-variable-buffer-local 'twittering-jojo-mode)
 
-(defvar twittering-status-format nil)
-(setq twittering-status-format "%i %s,  %@:\n  %t // from %f%L")
-;; %s - screen_name
-;; %S - name
-;; %i - profile_image
-;; %d - description
-;; %l - location
-;; %L - " [location]"
-;; %u - url
-;; %j - user.id
-;; %p - protected?
-;; %c - created_at (raw UTC string)
-;; %C{time-format-str} - created_at (formatted with time-format-str)
-;; %@ - X seconds ago
-;; %t - text
-;; %' - truncated
-;; %f - source
-;; %# - id
+(defvar twittering-status-format "%i %s,  %@:\n  %t // from %f%L"
+  "Formatt Rule:
+ %s - screen_name
+ %S - name
+ %i - profile_image
+ %d - description
+ %l - location
+ %L - \" [location]\"
+ %u - url
+ %j - user.id
+ %p - protected?
+ %c - created_at (raw UTC string)
+ %C{time-format-str} - created_at (formatted with time-format-str)
+ %@ - X seconds ago
+ %t - text
+ %' - truncated
+ %f - source
+ %# - id")
 
 (defvar twittering-buffer "*twittering*")
@@ -253,4 +255,5 @@
       (define-key km "s" 'twittering-scroll-mode)
       (define-key km "t" 'twittering-toggle-proxy)
+      (define-key km "F" 'twittering-status-toggle-favorite)
       (define-key km "\C-c\C-p" 'twittering-toggle-proxy)
       nil))
@@ -541,5 +544,7 @@
       (let ((formatted-status (apply 'concat (nreverse result))))
 	(add-text-properties 0 (length formatted-status)
-			     `(username ,(attr 'user-screen-name))
+			     `(username ,(attr 'user-screen-name)
+					id ,(attr 'id)
+					favorited ,(attr 'favorited))
 			     formatted-status)
 	formatted-status)
@@ -678,4 +683,5 @@
     (let* ((status-data (cddr status))
 	   id text source created-at truncated
+	   favorited in_reply_to_status_id in_reply_to_user_id
 	   (user-data (cddr (assq 'user status-data)))
 	   user-id user-name
@@ -695,4 +701,7 @@
       (setq created-at (assq-get 'created_at status-data))
       (setq truncated (assq-get 'truncated status-data))
+      (setq favorited (assq-get 'favorited status-data))
+      (setq in_reply_to_user_id (assq-get 'in_reply_to_user_id status-data))
+      (setq in_reply_to_user_id (assq-get 'in_reply_to_status_id status-data))
       (setq user-id (string-to-number (assq-get 'id user-data)))
       (setq user-name (twittering-decode-html-entities
@@ -771,4 +780,5 @@
 	 `(,sym . ,(symbol-value sym)))
        '(id text source created-at truncated
+	    favorited in_reply_to_status_id in_reply_to_user_id
 	    user-id user-name user-screen-name user-location
 	    user-description
@@ -878,4 +888,46 @@
 	 ("source" . "twmode")))))
 
+(defun twittering-http-get-fav-sentinel (proc stat &optional suc-msg)
+  (flet ((assq-get (item seq)
+		   (car (cddr (assq item seq)))))
+    (let ((header (twittering-get-response-header))
+	  (body (twittering-get-response-body))
+	  (status nil))
+      (if (string-match "HTTP/1\.[01] \\([a-z0-9 ]+\\)\r?\n" header)
+	  (progn
+	    (setq status (match-string-no-properties 1 header))
+	    (case-string
+	     status
+	     (("200 OK")
+	      (let ((status-data (assq-get 'status body)))
+		(message "status %s: favorited - %s"
+			 (assq-get 'id status-data)
+			 (assq-get 'favorited status-data))))
+	     (t (message status))))
+	(message "Failure: Bad http response.")))))
+
+(defun twittering-status-set-favorite (id)
+  (with-temp-buffer
+    (twittering-http-get "favourings" (format "create/%d" id)
+			 'twittering-http-get-fav-sentinel)))
+
+(defun twittering-status-destroy-favorite (id)
+  (with-temp-buffer
+    (twittering-http-get "favourings" (format "destroy/%d" id)
+			 'twittering-http-get-fav-sentinel)))
+
+(defun twittering-status-toggle-favorite ()
+  (interactive)
+  (let ((id (get-text-property (point) 'id))
+	(favorite-status
+	 (string-equal "true" (get-text-property (point) 'favorited))))
+    (if favorite-status
+	;; destroy
+	(progn
+	  (twittering-status-destroy-favorite id)
+	  (message "Destory favorite : %d" id))
+      (twittering-status-set-favorite id)
+      (message "Set favorite : %d" id))))
+
 ;;;
 ;;; Commands
