diff options
| author | Geert Mulders <g.c.w.m.mulders@gmail.com> | 2010-05-29 14:40:17 +0200 | 
|---|---|---|
| committer | Geert Mulders <g.c.w.m.mulders@gmail.com> | 2010-05-29 14:40:17 +0200 | 
| commit | 7d53efb7ec5310b2710757cef03d7f53c94a7797 (patch) | |
| tree | 973e638fffabe19d8609e83f83257060f62bcefd /protocols/twitter/twitter_lib.c | |
| parent | 999769119e85518cc46b3ed64cb8781695fefbdc (diff) | |
Added functionality to add and remove friendships.
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
| -rw-r--r-- | protocols/twitter/twitter_lib.c | 23 | 
1 files changed, 18 insertions, 5 deletions
| diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index ee6e39fe..3ea694e6 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -625,9 +625,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; @@ -638,7 +638,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... HTTP STATUS: %d", req->status_code); +		imcb_error(ic, "HTTP Error... STATUS: %d", req->status_code);  		return;  	}  } @@ -653,7 +653,7 @@ void twitter_post_status(struct im_connection *ic, char* msg)  	char* args[2];  	args[0] = "status";  	args[1] = msg; -	twitter_http(TWITTER_STATUS_UPDATE_URL, twitter_http_post_status, ic, 1, td->user, td->pass, td->oauth_info, args, 2); +	twitter_http(TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, td->user, td->pass, td->oauth_info, args, 2);  //	g_free(args[1]);  } @@ -671,7 +671,20 @@ 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(TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post_status, ic, 1, td->user, td->pass, td->oauth_info, args, 4); +	twitter_http(TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post, ic, 1, td->user, td->pass, td->oauth_info, args, 4);  //	g_free(args[1]);  //	g_free(args[3]);  } + +void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create) +{ +	struct twitter_data *td = ic->proto_data; + +	char* args[2]; +	args[0] = "screen_name"; +	args[1] = who; +	twitter_http(create ? TWITTER_FRIENDSHIPS_CREATE_URL : TWITTER_FRIENDSHIPS_DESTROY_URL, twitter_http_post, ic, 1, td->user, td->pass, td->oauth_info, args, 2); +} + + + | 
