Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter_lib.c

    rb61c74c r11ec078  
    168168{
    169169        static char *ret = NULL;
    170         struct xt_parser *xp = NULL;
    171         struct xt_node *node, *err;
     170        struct xt_node *root, *node, *err;
    172171
    173172        g_free(ret);
     
    175174
    176175        if (req->body_size > 0) {
    177                 xp = xt_new(NULL, NULL);
    178                 xt_feed(xp, req->reply_body, req->body_size);
     176                root = xt_from_string(req->reply_body, req->body_size);
    179177               
    180                 for (node = xp->root; node; node = node->next)
     178                for (node = root; node; node = node->next)
    181179                        if ((err = xt_find_node(node->children, "error")) && err->text_len > 0) {
    182180                                ret = g_strdup_printf("%s (%s)", req->status_string, err->text);
     
    184182                        }
    185183
    186                 xt_free(xp);
     184                xt_free_node(root);
    187185        }
    188186
     
    256254{
    257255        struct im_connection *ic;
    258         struct xt_parser *parser;
     256        struct xt_node *parsed;
    259257        struct twitter_xml_list *txl;
    260258        struct twitter_data *td;
     
    292290
    293291        // Parse the data.
    294         parser = xt_new(NULL, txl);
    295         xt_feed(parser, req->reply_body, req->body_size);
    296         twitter_xt_get_friends_id_list(parser->root, txl);
    297         xt_free(parser);
     292        parsed = xt_from_string(req->reply_body, req->body_size);
     293        twitter_xt_get_friends_id_list(parsed, txl);
     294        xt_free_node(parsed);
    298295
    299296        td->follow_ids = txl->list;
     
    352349        struct im_connection *ic = req->data;
    353350        struct twitter_data *td;
    354         struct xt_parser *parser;
     351        struct xt_node *parsed;
    355352        struct twitter_xml_list *txl;
    356353        GSList *l = NULL;
     
    377374
    378375        // Parse the data.
    379         parser = xt_new(NULL, txl);
    380         xt_feed(parser, req->reply_body, req->body_size);
     376        parsed = xt_from_string(req->reply_body, req->body_size);
    381377
    382378        // Get the user list from the parsed xml feed.
    383         twitter_xt_get_users(parser->root, txl);
    384         xt_free(parser);
     379        twitter_xt_get_users(parsed, txl);
     380        xt_free_node(parsed);
    385381
    386382        // Add the users as buddies.
     
    739735
    740736        if (td->flags & TWITTER_DOING_TIMELINE) {
    741                 return;
     737                if (++td->http_fails >= 5) {
     738                        imcb_error(ic, "Fetch timeout (%d)", td->flags);
     739                        imc_logout(ic, TRUE);
     740                }
    742741        }
    743742
     
    886885        struct im_connection *ic = req->data;
    887886        struct twitter_data *td;
    888         struct xt_parser *parser;
     887        struct xt_node *parsed;
    889888        struct twitter_xml_list *txl;
    890889
     
    913912
    914913        // Parse the data.
    915         parser = xt_new(NULL, txl);
    916         xt_feed(parser, req->reply_body, req->body_size);
     914        parsed = xt_from_string(req->reply_body, req->body_size);
    917915        // The root <statuses> node should hold the list of statuses <status>
    918         twitter_xt_get_status_list(ic, parser->root, txl);
    919         xt_free(parser);
     916        twitter_xt_get_status_list(ic, parsed, txl);
     917        xt_free_node(parsed);
    920918
    921919        td->home_timeline_obj = txl;
     
    934932        struct im_connection *ic = req->data;
    935933        struct twitter_data *td;
    936         struct xt_parser *parser;
     934        struct xt_node *parsed;
    937935        struct twitter_xml_list *txl;
    938936
     
    961959
    962960        // Parse the data.
    963         parser = xt_new(NULL, txl);
    964         xt_feed(parser, req->reply_body, req->body_size);
     961        parsed = xt_from_string(req->reply_body, req->body_size);
    965962        // The root <statuses> node should hold the list of statuses <status>
    966         twitter_xt_get_status_list(ic, parser->root, txl);
    967         xt_free(parser);
     963        twitter_xt_get_status_list(ic, parsed, txl);
     964        xt_free_node(parsed);
    968965
    969966        td->mentions_obj = txl;
     
    999996
    1000997        if (req->body_size > 0) {
    1001                 struct xt_parser *xp = NULL;
    1002                 struct xt_node *node;
    1003 
    1004                 xp = xt_new(NULL, NULL);
    1005                 xt_feed(xp, req->reply_body, req->body_size);
    1006 
    1007                 if ((node = xt_find_node(xp->root, "status")) &&
     998                struct xt_node *parsed, *node;
     999
     1000                parsed = xt_from_string(req->reply_body, req->body_size);
     1001
     1002                if ((node = xt_find_node(parsed, "status")) &&
    10081003                    (node = xt_find_node(node->children, "id")) && node->text)
    10091004                        td->last_status_id = g_ascii_strtoull(node->text, NULL, 10);
    10101005
    1011                 xt_free(xp);
     1006                xt_free_node(parsed);
    10121007        }
    10131008}
Note: See TracChangeset for help on using the changeset viewer.