Changeset d18dee42


Ignore:
Timestamp:
2012-03-12T22:36:35Z (13 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
fda194f
Parents:
57a65600
Message:

Merging report-spam patch for Twitter from Flexo. #923

Files:
4 edited

Legend:

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

    r57a65600 rd18dee42  
    845845                                <varlistentry><term>rt &lt;screenname|#id&gt;</term><listitem><para>Retweet someone's last Tweet (or one with the given ID)</para></listitem></varlistentry>
    846846                                <varlistentry><term>reply &lt;screenname|#id&gt;</term><listitem><para>Reply to a Tweet (with a reply-to reference)</para></listitem></varlistentry>
     847                                <varlistentry><term>report &lt;screenname|#id&gt;</term><listitem><para>Report the given user (or the user who posted the tweet with the given ID) for sending spam. This will also block them.</para></listitem></varlistentry>
    847848                                <varlistentry><term>follow &lt;screenname&gt;</term><listitem><para>Start following a person</para></listitem></varlistentry>
    848849                                <varlistentry><term>unfollow &lt;screenname&gt;</term><listitem><para>Stop following a person</para></listitem></varlistentry>
  • protocols/twitter/twitter.c

    r57a65600 rd18dee42  
    530530                g_free(cmds);
    531531                return;
     532        } else if ((g_strcasecmp(cmd[0], "report") == 0 ||
     533                    g_strcasecmp(cmd[0], "spam") == 0) && cmd[1]) {
     534                char * screen_name;
     535                guint64 id;
     536                /* Report nominally works on users but look up the user who
     537                   posted the given ID if the user wants to do it that way */
     538                if (g_str_has_prefix(cmd[1], "#") &&
     539                    sscanf(cmd[1] + 1, "%" G_GUINT64_FORMAT, &id) == 1) {
     540                        if (id < TWITTER_LOG_LENGTH && td->log) {
     541                                if (g_slist_find(ic->bee->users, td->log[id].bu)) {
     542                                        screen_name = td->log[id].bu->handle;
     543                                }
     544                        }
     545                } else {
     546                        screen_name = cmd[1];
     547                }
     548                twitter_report_spam(ic, screen_name);
     549                g_free(cmds);
     550                return;
    532551        } else if (g_strcasecmp(cmd[0], "rt") == 0 && cmd[1]) {
    533552                struct twitter_user_data *tud;
  • protocols/twitter/twitter_lib.c

    r57a65600 rd18dee42  
    10621062        g_free(url);
    10631063}
     1064
     1065/**
     1066 * Report a user for sending spam.
     1067 */
     1068void twitter_report_spam(struct im_connection *ic, char *screen_name)
     1069{
     1070        char *args[2] = {
     1071                "screen_name",
     1072                NULL,
     1073        };
     1074        args[1] = screen_name;
     1075        twitter_http(ic, TWITTER_REPORT_SPAM_URL, twitter_http_post,
     1076                     ic, 1, args, 2);
     1077}
  • protocols/twitter/twitter_lib.h

    r57a65600 rd18dee42  
    7676#define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/"
    7777
     78/* Report spam */
     79#define TWITTER_REPORT_SPAM_URL "/report_spam.xml"
     80
    7881void twitter_get_timeline(struct im_connection *ic, gint64 next_cursor);
    7982void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor);
     
    8790void twitter_status_destroy(struct im_connection *ic, guint64 id);
    8891void twitter_status_retweet(struct im_connection *ic, guint64 id);
     92void twitter_report_spam(struct im_connection *ic, char *screen_name);
    8993
    9094#endif //_TWITTER_LIB_H
Note: See TracChangeset for help on using the changeset viewer.