Changeset d0752e8 for protocols/twitter
- Timestamp:
- 2012-09-22T12:12:12Z (12 years ago)
- Branches:
- master
- Children:
- 11ec078
- Parents:
- 55ccc9a0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter_lib.c
r55ccc9a0 rd0752e8 168 168 { 169 169 static char *ret = NULL; 170 struct xt_parser *xp = NULL; 171 struct xt_node *node, *err; 170 struct xt_node *root, *node, *err; 172 171 173 172 g_free(ret); … … 175 174 176 175 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); 179 177 180 for (node = xp->root; node; node = node->next)178 for (node = root; node; node = node->next) 181 179 if ((err = xt_find_node(node->children, "error")) && err->text_len > 0) { 182 180 ret = g_strdup_printf("%s (%s)", req->status_string, err->text); … … 184 182 } 185 183 186 xt_free (xp);184 xt_free_node(root); 187 185 } 188 186 … … 256 254 { 257 255 struct im_connection *ic; 258 struct xt_ parser *parser;256 struct xt_node *parsed; 259 257 struct twitter_xml_list *txl; 260 258 struct twitter_data *td; … … 292 290 293 291 // 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); 298 295 299 296 td->follow_ids = txl->list; … … 352 349 struct im_connection *ic = req->data; 353 350 struct twitter_data *td; 354 struct xt_ parser *parser;351 struct xt_node *parsed; 355 352 struct twitter_xml_list *txl; 356 353 GSList *l = NULL; … … 377 374 378 375 // 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); 381 377 382 378 // Get the user list from the parsed xml feed. 383 twitter_xt_get_users(parse r->root, txl);384 xt_free (parser);379 twitter_xt_get_users(parsed, txl); 380 xt_free_node(parsed); 385 381 386 382 // Add the users as buddies. … … 886 882 struct im_connection *ic = req->data; 887 883 struct twitter_data *td; 888 struct xt_ parser *parser;884 struct xt_node *parsed; 889 885 struct twitter_xml_list *txl; 890 886 … … 913 909 914 910 // Parse the data. 915 parser = xt_new(NULL, txl); 916 xt_feed(parser, req->reply_body, req->body_size); 911 parsed = xt_from_string(req->reply_body, req->body_size); 917 912 // The root <statuses> node should hold the list of statuses <status> 918 twitter_xt_get_status_list(ic, parse r->root, txl);919 xt_free (parser);913 twitter_xt_get_status_list(ic, parsed, txl); 914 xt_free_node(parsed); 920 915 921 916 td->home_timeline_obj = txl; … … 934 929 struct im_connection *ic = req->data; 935 930 struct twitter_data *td; 936 struct xt_ parser *parser;931 struct xt_node *parsed; 937 932 struct twitter_xml_list *txl; 938 933 … … 961 956 962 957 // Parse the data. 963 parser = xt_new(NULL, txl); 964 xt_feed(parser, req->reply_body, req->body_size); 958 parsed = xt_from_string(req->reply_body, req->body_size); 965 959 // The root <statuses> node should hold the list of statuses <status> 966 twitter_xt_get_status_list(ic, parse r->root, txl);967 xt_free (parser);960 twitter_xt_get_status_list(ic, parsed, txl); 961 xt_free_node(parsed); 968 962 969 963 td->mentions_obj = txl; … … 999 993 1000 994 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")) && 995 struct xt_node *parsed, *node; 996 997 parsed = xt_from_string(req->reply_body, req->body_size); 998 999 if ((node = xt_find_node(parsed, "status")) && 1008 1000 (node = xt_find_node(node->children, "id")) && node->text) 1009 1001 td->last_status_id = g_ascii_strtoull(node->text, NULL, 10); 1010 1002 1011 xt_free (xp);1003 xt_free_node(parsed); 1012 1004 } 1013 1005 }
Note: See TracChangeset
for help on using the changeset viewer.