From b8906261293b34d8c792bd1f48df10144a8a8f10 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 8 Aug 2010 14:42:57 +0100 Subject: Add a few more commands (including RT) and the ability to send replies. That's it for now, this is already not very pretty, but just offers the bare basic functionality. --- protocols/twitter/twitter_lib.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'protocols/twitter/twitter_lib.c') diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 699558b2..f9e808f7 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -783,13 +783,16 @@ static void twitter_http_post(struct http_request *req) /** * Function to POST a new status to twitter. */ -void twitter_post_status(struct im_connection *ic, char* msg) +void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to) { - char* args[2]; - args[0] = "status"; - args[1] = msg; - twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, args, 2); -// g_free(args[1]); + char* args[4] = { + "status", msg, + "in_reply_to_status_id", + g_strdup_printf("%llu", (unsigned long long) in_reply_to) + }; + twitter_http(ic, TWITTER_STATUS_UPDATE_URL, twitter_http_post, ic, 1, + args, in_reply_to ? 4 : 2); + g_free(args[3]); } @@ -824,3 +827,11 @@ void twitter_status_destroy(struct im_connection *ic, guint64 id) twitter_http(ic, url, twitter_http_post, ic, 1, NULL, 0); g_free(url); } + +void twitter_status_retweet(struct im_connection *ic, guint64 id) +{ + char *url; + url = g_strdup_printf("%s%llu%s", TWITTER_STATUS_RETWEET_URL, (unsigned long long) id, ".xml"); + twitter_http(ic, url, twitter_http_post, ic, 1, NULL, 0); + g_free(url); +} -- cgit v1.2.3