Skip to content

Commit

Permalink
Simplify `twittering-call-api'.
Browse files Browse the repository at this point in the history
* twittering-mode.el: Simplify `twittering-call-api'.
(twittering-call-api): reduce calls of `twittering-api-path'.
  • Loading branch information
cvmat committed Aug 20, 2010
1 parent 8d0e513 commit c8f4e4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Expand Up @@ -18,6 +18,9 @@
(twittering-atom-xmltree-to-status-datum): switch ways to parse
XML depending on `twittering-service-method'.

* twittering-mode.el: Simplify `twittering-call-api'.
(twittering-call-api): reduce calls of `twittering-api-path'.

2010-08-20 Takashi Masuda <masutaka@nifty.com>

* twittering-mode.el: Support StatusNet.
Expand Down
25 changes: 13 additions & 12 deletions twittering-mode.el
Expand Up @@ -418,17 +418,16 @@ StatusNet Service.")
"atom"
"xml"))
(simple-spec-list
`((direct_messages . ,(twittering-api-path "direct_messages"))
(direct_messages_sent . ,(twittering-api-path "direct_messages/sent"))
(friends . ,(twittering-api-path "statuses/friends_timeline"))
(home . ,(twittering-api-path "statuses/home_timeline"))
(mentions . ,(twittering-api-path "statuses/mentions"))
(public . ,(twittering-api-path "statuses/public_timeline"))
(replies . ,(twittering-api-path "statuses/replies"))
(retweeted_by_me . ,(twittering-api-path "statuses/retweeted_by_me"))
(retweeted_to_me . ,(twittering-api-path "statuses/retweeted_to_me"))
(retweets_of_me . ,(twittering-api-path "statuses/retweets_of_me"))
(search . ,twittering-search-api-method)))
'((direct_messages . "direct_messages")
(direct_messages_sent . "direct_messages/sent")
(friends . "statuses/friends_timeline")
(home . "statuses/home_timeline")
(mentions . "statuses/mentions")
(public . "statuses/public_timeline")
(replies . "statuses/replies")
(retweeted_by_me . "statuses/retweeted_by_me")
(retweeted_to_me . "statuses/retweeted_to_me")
(retweets_of_me . "statuses/retweets_of_me")))
(host (cond ((eq spec-type 'search) twittering-api-search-host)
(t twittering-api-host)))
(method
Expand All @@ -440,8 +439,10 @@ StatusNet Service.")
(let ((username (elt spec 1))
(list-name (elt spec 2)))
(twittering-api-path username "/lists/" list-name "/statuses")))
((eq spec-type 'search)
twittering-search-api-method)
((assq spec-type simple-spec-list)
(cdr (assq spec-type simple-spec-list)))
(twittering-api-path (cdr (assq spec-type simple-spec-list))))
(t nil))))
(if (and host method)
(twittering-http-get host method noninteractive parameters format)
Expand Down

0 comments on commit c8f4e4b

Please sign in to comment.