diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2015-05-02 23:03:35 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2015-05-02 23:03:35 +0200 |
commit | 9ed817598e0f46b786ab988098ea25294a53e151 (patch) | |
tree | 3ce82d388c657f7549f9b240a69c1a5d0626f2c9 /protocols/twitter/twitter.c | |
parent | 40cfbc54088702d4887ccfb761eafe65b4376d59 (diff) |
Add "url" command to Twitter module to get web URL for a Tweet.
Diffstat (limited to 'protocols/twitter/twitter.c')
-rw-r--r-- | protocols/twitter/twitter.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 95384573..4dc1785e 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -1002,6 +1002,19 @@ static void twitter_handle_command(struct im_connection *ic, char *message) message = cmd[2]; in_reply_to = id; allow_post = TRUE; + } else if (g_strcasecmp(cmd[0], "url") == 0) { + id = twitter_message_id_from_command_arg(ic, cmd[1], &bu); + if (!id) { + twitter_log(ic, "Tweet `%s' does not exist", cmd[1]); + } else { + /* More common link is twitter.com/$UID/status/$ID (and that's + * what this will 302 to) but can't generate that since for RTs, + * bu here points at the retweeter while id contains the id of + * the original message. */ + twitter_log(ic, "https://twitter.com/statuses/%lld", id); + } + goto eof; + } else if (g_strcasecmp(cmd[0], "post") == 0) { message += 5; allow_post = TRUE; |