diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-30 11:16:37 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-30 11:16:37 +0100 |
commit | ba3233ce0b1fc34f3ad0a450bb1b661909dafb79 (patch) | |
tree | f911910937f8519198add3f8dea77f7863742ab0 /protocols/twitter/twitter_lib.c | |
parent | 3d93aed32d49bae6c608a71858f00127dccd28e9 (diff) | |
parent | 7d53efb7ec5310b2710757cef03d7f53c94a7797 (diff) |
Merge from Geert: Added ability to follow/unfollow Twitter people. (Unfollow
won't work with mode=one.)
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r-- | protocols/twitter/twitter_lib.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index e4dfc595..585bdd43 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -655,9 +655,9 @@ void twitter_get_statuses_friends(struct im_connection *ic, int next_cursor) } /** - * Callback after sending a new update to twitter. + * Callback to use after sending a post request to twitter. */ -static void twitter_http_post_status(struct http_request *req) +static void twitter_http_post(struct http_request *req) { struct im_connection *ic = req->data; @@ -668,7 +668,7 @@ static void twitter_http_post_status(struct http_request *req) // Check if the HTTP request went well. if (req->status_code != 200) { // It didn't go well, output the error and return. - imcb_error(ic, "Could not post message: %s", twitter_parse_error(req)); + imcb_error(ic, "HTTP error: %s", twitter_parse_error(req)); return; } } @@ -681,7 +681,7 @@ void twitter_post_status(struct im_connection *ic, char* msg) char* args[2]; args[0] = "status"; args[1] = msg; - twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post_status, ic, 1, args, 2); + twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, args, 2); // g_free(args[1]); } @@ -697,7 +697,15 @@ void twitter_direct_messages_new(struct im_connection *ic, char *who, char *msg) args[2] = "text"; args[3] = msg; // Use the same callback as for twitter_post_status, since it does basically the same. - twitter_http(ic, TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post_status, ic, 1, args, 4); + twitter_http(ic, TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post, ic, 1, args, 4); // g_free(args[1]); // g_free(args[3]); } + +void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create) +{ + char* args[2]; + args[0] = "screen_name"; + args[1] = who; + twitter_http(ic, create ? TWITTER_FRIENDSHIPS_CREATE_URL : TWITTER_FRIENDSHIPS_DESTROY_URL, twitter_http_post, ic, 1, args, 2); +}
\ No newline at end of file |