Ignore:
Timestamp:
2016-03-31T22:25:49Z (8 years ago)
Author:
Flexo <nick@…>
Branches:
master
Children:
166a571
Parents:
9cf63ac
git-author:
Flexo <nick@…> (31-03-16 22:04:33)
git-committer:
Flexo <nick@…> (31-03-16 22:25:49)
Message:

Receive mute/unmute notifications from the stream.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter_lib.c

    r9cf63ac r0d581bd  
    954954       
    955955        /* Check this is not a tweet that should be muted */
    956         uid_str = g_strdup_printf("%" PRIu64, status->user->uid);
     956        uid_str = g_strdup_printf("%" G_GINT64_FORMAT, status->user->uid);
    957957        if (g_slist_find_custom(td->mutes_ids, uid_str, (GCompareFunc)strcmp)) {
    958958                g_free(uid_str);
     
    11221122        json_value *target = json_o_get(o, "target");
    11231123        const char *type = json_o_str(o, "event");
     1124        struct twitter_xml_user *us = NULL;
     1125        struct twitter_xml_user *ut = NULL;
    11241126
    11251127        if (!type || !source || source->type != json_object
     
    11291131
    11301132        if (strcmp(type, "follow") == 0) {
    1131                 struct twitter_xml_user *us = twitter_xt_get_user(source);
    1132                 struct twitter_xml_user *ut = twitter_xt_get_user(target);
     1133                us = twitter_xt_get_user(source);
     1134                ut = twitter_xt_get_user(target);
    11331135                if (g_strcasecmp(us->screen_name, td->user) == 0) {
    11341136                        twitter_add_buddy(ic, ut->screen_name, ut->name);
    11351137                }
    1136                 txu_free(us);
    1137                 txu_free(ut);
    1138         }
     1138        } else if (strcmp(type, "mute") == 0) {
     1139                GSList *ids = td->mutes_ids;
     1140                ut = twitter_xt_get_user(target);
     1141                ids = g_slist_prepend(ids,
     1142                                      g_strdup_printf("%" G_GINT64_FORMAT, ut->uid));
     1143       
     1144                td->mutes_ids = ids;
     1145        } else if (strcmp(type, "unmute") == 0) {
     1146                GSList *found;
     1147                char *uid_str;
     1148                ut = twitter_xt_get_user(target);
     1149                uid_str = g_strdup_printf("%" G_GINT64_FORMAT, ut->uid);
     1150                if ((found = g_slist_find_custom(td->mutes_ids, uid_str,
     1151                                                (GCompareFunc)strcmp))) {
     1152                        td->mutes_ids = g_slist_remove(td->mutes_ids, found);
     1153                }
     1154                g_free(uid_str);
     1155        }
     1156
     1157        txu_free(us);
     1158        txu_free(ut);
    11391159
    11401160        return TRUE;
Note: See TracChangeset for help on using the changeset viewer.