1 #ifndef _PIDGIN_TWITTER_TWITTER_API_H_
2 #define _PIDGIN_TWITTER_TWITTER_API_H_
3 
4 #include <cipher.h> /* from libpurple */
5 #include <request.h>
6 #include <math.h>
7 
8 /* twitter API specific macros */
9 #define TWITTER_BASE_URL  "http://twitter.com"
10 #define TWITTER_API_BASE_URL "http://api.twitter.com"
11 #define REQUEST_TOKEN_URL "http://twitter.com/oauth/request_token"
12 #define ACCESS_TOKEN_URL  "http://twitter.com/oauth/access_token"
13 #define AUTHORIZE_URL     "http://twitter.com/oauth/authorize"
14 
15 #define TWITTER_STATUS_GET "GET /1/statuses/home_timeline.xml?%s HTTP/1.1\r\n" \
16     "Host: api.twitter.com\r\n"                                          \
17     "User-Agent: pidgin-twitter\r\n"
18 
19 #define TWITTER_STATUS_POST "POST /1/statuses/update.xml HTTP/1.1\r\n" \
20     "Host: api.twitter.com\r\n"                                          \
21     "User-Agent: pidgin-twitter\r\n"                                 \
22     "Content-Length: %d\r\n"
23 
24 #define TWITTER_FAV_POST "POST /1/favorites/create/%llu.xml HTTP/1.1\r\n" \
25     "Host: api.twitter.com\r\n"                                          \
26     "User-Agent: pidgin-twitter\r\n" \
27     "Content-Length: %d\r\n"
28 
29 #define TWITTER_RETWEET_POST "POST /1/statuses/retweet/%llu.xml HTTP/1.1\r\n" \
30     "Host: api.twitter.com\r\n"                                          \
31     "User-Agent: pidgin-twitter\r\n" \
32     "Content-Length: %d\r\n"
33 
34 #define TWITTER_STATUS_FORMAT "&source=pidgintwitter&status=%s"
35 
36 #define TWITTER_DEFAULT_INTERVAL (60)
37 #define TWITTER_OLD_DEFAULT_ICON_URL "http://static.twitter.com/images/default_profile_bigger.png"
38 #define TWITTER_DEFAULT_ICON_URL "http://s.twimg.com/images/default_profile_3_bigger.png"
39 
40 #define TWITTER_DEFAULT_RETRIEVE_COUNT (20)
41 
42 
43 /* prototypes */
44 void post_status_with_api(PurpleAccount *account, char **buffer);
45 gboolean get_status_with_api(gpointer data);
46 void fav_with_api(guint64 id);
47 void retweet_with_api(guint64 id);
48 void signed_on_cb(PurpleConnection *gc);
49 
50 #endif
51