From 35f2e70d53eaccb8f50b5f8dbd1f20cc78282901 Mon Sep 17 00:00:00 2001 From: "Michael D. Ivey" Date: Fri, 8 Jan 2010 14:15:34 -0600 Subject: [PATCH] Display native retweets from the original user, instead of as RTs --- twittering-mode.el | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/twittering-mode.el b/twittering-mode.el index a24180ee..30ac2348 100644 --- a/twittering-mode.el +++ b/twittering-mode.el @@ -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 @@ -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? @@ -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 @@ -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) @@ -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 @@ -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))