aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter_lib.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-08-08 14:42:57 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-08-08 14:42:57 +0100
commitb8906261293b34d8c792bd1f48df10144a8a8f10 (patch)
tree22cb15d6c5081b1d310721f625c1a82282039d0b /protocols/twitter/twitter_lib.c
parent203a2d2e8857e4c83f8f5e1a89de03ea08538cb2 (diff)
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.
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r--protocols/twitter/twitter_lib.c23
1 files changed, 17 insertions, 6 deletions
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);
+}