Changeset 2cd8540


Ignore:
Timestamp:
2012-11-25T12:05:48Z (8 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
96dd574
Parents:
898c08e
Message:

Show DMs the right way. With mode=many and show_ids=off they'll look just
like tweets but that's what you get with bad settings.. Also, don't show
DMs from ourselves.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter_lib.c

    r898c08e r2cd8540  
    515515 * Function to fill a twitter_xml_status struct (DM variant).
    516516 */
    517 static gboolean twitter_xt_get_dm(const json_value *node, struct twitter_xml_status *txs)
    518 {
     517static struct twitter_xml_status *twitter_xt_get_dm(const json_value *node)
     518{
     519        struct twitter_xml_status *txs;
    519520        const json_value *entities = NULL;
    520521       
    521522        if (node->type != json_object)
    522523                return FALSE;
     524        txs = g_new0(struct twitter_xml_status, 1);
    523525
    524526        JSON_O_FOREACH (node, k, v) {
     
    544546        }
    545547
    546         return txs->text && txs->user && txs->id;
     548        if (txs->text && txs->user && txs->id)
     549                return txs;
     550       
     551        txs_free(txs);
     552        return NULL;
    547553}
    548554
     
    847853                return twitter_stream_handle_status(ic, txs);
    848854        } else if ((c = json_o_get(o, "direct_message")) &&
    849                    twitter_xt_get_dm(c, txs)) {
    850                 GSList *output = g_slist_append(NULL, txs);
    851                 twitter_private_message_chat(ic, output);
     855                   (txs = twitter_xt_get_dm(c))) {
     856                if (strcmp(txs->user->screen_name, td->user) != 0)
     857                        imcb_buddy_msg(ic, txs->user->screen_name,
     858                                       txs->text, 0, txs->created_at);
    852859                txs_free(txs);
    853                 g_slist_free(output);
    854860                return TRUE;
    855861        } else if ((c = json_o_get(o, "event")) && c->type == json_string) {
Note: See TracChangeset for help on using the changeset viewer.