Ignore:
Timestamp:
2010-08-07T21:06:24Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
b890626
Parents:
7b87539
Message:

Allow protocol modules to keep per-contact protocol-specific data. Use
this in the Twitter module to remember the id and timestamp of a contact's
last tweet, which can later be used for simple replies/retweets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter_lib.c

    r7b87539 r203a2d2  
    431431 *  - the next_cursor.
    432432 */
    433 static xt_status twitter_xt_get_status_list( struct xt_node *node, struct twitter_xml_list *txl )
     433static xt_status twitter_xt_get_status_list( struct im_connection *ic, struct xt_node *node, struct twitter_xml_list *txl )
    434434{
    435435        struct twitter_xml_status *txs;
    436436        struct xt_node *child;
     437        bee_user_t *bu;
    437438
    438439        // Set the type of the list.
     
    449450                        // Put the item in the front of the list.
    450451                        txl->list = g_slist_prepend (txl->list, txs);
     452                       
     453                        if (txs->user && txs->user->screen_name &&
     454                            (bu = bee_user_by_handle(ic->bee, ic, txs->user->screen_name)))
     455                        {
     456                                struct twitter_user_data *tud = bu->data;
     457                               
     458                                if (txs->id > tud->last_id)
     459                                {
     460                                        tud->last_id = txs->id;
     461                                        tud->last_time = txs->created_at;
     462                                }
     463                        }
    451464                }
    452465                else if ( g_strcasecmp( "next_cursor", child->name ) == 0)
     
    627640        xt_feed( parser, req->reply_body, req->body_size );
    628641        // The root <statuses> node should hold the list of statuses <status>
    629         twitter_xt_get_status_list(parser->root, txl);
     642        twitter_xt_get_status_list(ic, parser->root, txl);
    630643        xt_free( parser );
    631644
Note: See TracChangeset for help on using the changeset viewer.