Skip to content

Commit

Permalink
Display native retweets from the original user, instead of as RTs
Browse files Browse the repository at this point in the history
  • Loading branch information
ivey authored and hayamiz committed Jan 8, 2010
1 parent 050f5ed commit 35f2e70
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions twittering-mode.el
Expand Up @@ -143,9 +143,9 @@ tweets received when this hook is run.")
(defvar twittering-jojo-mode nil)
(make-variable-buffer-local 'twittering-jojo-mode)

(defvar twittering-status-format "%i %s, %@:\n %t // from %f%L%r"
(defvar twittering-status-format "%i %s, %@:\n %t // from %f%L%r%R"
"Format string for rendering statuses.
Ex. \"%i %s, %@:\\n %t // from %f%L%r\"
Ex. \"%i %s, %@:\\n %t // from %f%L%r%R\"
Items:
%s - screen_name
Expand All @@ -155,6 +155,7 @@ Items:
%l - location
%L - \" [location]\"
%r - \" in reply to user\"
%R - \" retweeted by user\"
%u - url
%j - user.id
%p - protected?
Expand Down Expand Up @@ -1380,7 +1381,23 @@ If STATUS-DATUM is already in DATA-VAR, return nil. If not, return t."
user-profile-image-url
user-url
user-protected
regex-index)
regex-index
original-user-name
original-user-screen-name)

(setq retweeted-status-data (cddr (assq 'retweeted_status status-data)))
(setq retweet? (and retweeted-status-data twittering-use-native-retweets))

(if retweet?
(progn
(setq original-status-data status-data
original-user-data user-data
status-data retweeted-status-data
user-data (cddr (assq 'user status-data))
original-user-screen-name (twittering-decode-html-entities
(assq-get 'screen_name original-user-data))
original-user-name (twittering-decode-html-entities
(assq-get 'name original-user-data)))))

(setq id (assq-get 'id status-data))
(setq text (twittering-decode-html-entities
Expand All @@ -1407,7 +1424,7 @@ If STATUS-DATUM is already in DATA-VAR, return nil. If not, return t."
(setq user-profile-image-url (assq-get 'profile_image_url user-data))
(setq user-url (assq-get 'url user-data))
(setq user-protected (assq-get 'protected user-data))

;; make username clickable
(add-text-properties
0 (length user-name)
Expand Down Expand Up @@ -1498,7 +1515,9 @@ If STATUS-DATUM is already in DATA-VAR, return nil. If not, return t."
user-description
user-profile-image-url
user-url
user-protected)))))
user-protected
original-user-name
original-user-screen-name)))))

(defun twittering-xmltree-to-status (xmltree)
(mapcar #'twittering-status-to-status-datum
Expand Down Expand Up @@ -1778,6 +1797,12 @@ following symbols;
(concat " "
(make-string-with-url-property
in-reply-to-string url))))))
("R" .
,(let ((retweeted-by (attr 'original-user-screen-name)))
(if retweeted-by
(concat " (retweeted by " retweeted-by ")")
"")))

("S" . ,(attr 'user-name))
("s" . ,(attr 'user-screen-name))
("t" . ,(attr 'text))
Expand Down

0 comments on commit 35f2e70

Please sign in to comment.