From d6b690624885f6bc34e5dfb9a84daa34a1adb7e6 Mon Sep 17 00:00:00 2001 From: Jasper Spaans Date: Wed, 3 Aug 2011 23:45:49 +0200 Subject: Make it easier to retweet by id. Currently, typing "rt 24" would retweet the last message from @24. This patch allows one to retweet the tweet with id 24 by typing "rt #24". --- protocols/twitter/twitter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'protocols/twitter/twitter.c') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 57a1ed80..7cf8a239 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -490,7 +490,11 @@ static void twitter_handle_command(struct im_connection *ic, char *message) bee_user_t *bu; guint64 id; - if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && + if (g_str_has_prefix(cmd[1], "#")) { + id = g_ascii_strtoull(cmd[1] + 1, NULL, 10); + if (id < TWITTER_LOG_LENGTH && td->log) + id = td->log[id].id; + } else if ((bu = bee_user_by_handle(ic->bee, ic, cmd[1])) && (tud = bu->data) && tud->last_id) id = tud->last_id; else { -- cgit v1.2.3