diff options
author | Jasper Spaans <j@jasper.es> | 2011-08-03 23:45:49 +0200 |
---|---|---|
committer | Jasper Spaans <j@jasper.es> | 2011-08-03 23:45:49 +0200 |
commit | d6b690624885f6bc34e5dfb9a84daa34a1adb7e6 (patch) | |
tree | d76e2ce3685d0b79380f75190aee66b416a5205b /protocols/twitter/twitter.c | |
parent | 3d952b5cd5562889aa3b9594b7b88352ea30f78c (diff) |
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".
Diffstat (limited to 'protocols/twitter/twitter.c')
-rw-r--r-- | protocols/twitter/twitter.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 { |