Changeset 9ed8175


Ignore:
Timestamp:
2015-05-02T21:03:35Z (5 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
cd60710
Parents:
40cfbc5
Message:

Add "url" command to Twitter module to get web URL for a Tweet.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/user-guide/commands.xml

    r40cfbc5 r9ed8175  
    121121                        <description>
    122122                                <para>
    123                                         This commands deletes an account from your account list. You should signoff the account before deleting it.
     123                                        This command deletes an account from your account list. You should signoff the account before deleting it.
    124124                                </para>
    125125
     
    853853                                <varlistentry><term>favourite &lt;screenname|#id&gt;</term><listitem><para>Favo<emphasis>u</emphasis>rite the given user's most recent tweet, or the given tweet ID.</para></listitem></varlistentry>
    854854                                <varlistentry><term>post &lt;message&gt;</term><listitem><para>Post a tweet</para></listitem></varlistentry>
     855                                <varlistentry><term>url &lt;screenname|#id&gt;</term><listitem><para>Show URL for a tweet to open it in a browser (and see context)</para></listitem></varlistentry>
    855856                        </variablelist>
    856857
  • protocols/twitter/twitter.c

    r40cfbc5 r9ed8175  
    10031003                in_reply_to = id;
    10041004                allow_post = TRUE;
     1005        } else if (g_strcasecmp(cmd[0], "url") == 0) {
     1006                id = twitter_message_id_from_command_arg(ic, cmd[1], &bu);
     1007                if (!id) {
     1008                        twitter_log(ic, "Tweet `%s' does not exist", cmd[1]);
     1009                } else {
     1010                        /* More common link is twitter.com/$UID/status/$ID (and that's
     1011                         * what this will 302 to) but can't generate that since for RTs,
     1012                         * bu here points at the retweeter while id contains the id of
     1013                         * the original message. */
     1014                        twitter_log(ic, "https://twitter.com/statuses/%lld", id);
     1015                }
     1016                goto eof;
     1017
    10051018        } else if (g_strcasecmp(cmd[0], "post") == 0) {
    10061019                message += 5;
Note: See TracChangeset for help on using the changeset viewer.