Changeset fb351ce for protocols/twitter
- Timestamp:
- 2012-11-09T00:07:23Z (12 years ago)
- Branches:
- master
- Children:
- 5246133
- Parents:
- 8e3b7ac
- Location:
- protocols/twitter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter_lib.c
r8e3b7ac rfb351ce 174 174 ret = NULL; 175 175 176 /* EX: 177 {"errors":[{"message":"Rate limit exceeded","code":88}]} */ 176 178 if (req->body_size > 0) { 177 179 root = xt_from_string(req->reply_body, req->body_size); … … 189 191 } 190 192 191 /* TODO: NULL means failure, but not always that the connection is dead. This sucks for callers. */ 193 /* WATCH OUT: This function might or might not destroy your connection. 194 Sub-optimal indeed, but just be careful when this returns NULL! */ 192 195 static json_value *twitter_parse_response(struct im_connection *ic, struct http_request *req) 193 196 { … … 457 460 static xt_status twitter_xt_get_status(const json_value *node, struct twitter_xml_status *txs) 458 461 { 459 const json_value * c, *rt = NULL, *entities = NULL;462 const json_value *rt = NULL, *entities = NULL; 460 463 int i; 461 464 … … 468 471 469 472 if (strcmp("text", k) == 0 && v->type == json_string) { 470 txs->text = g_memdup(v->u.string.ptr, v->u.string.length );473 txs->text = g_memdup(v->u.string.ptr, v->u.string.length + 1); 471 474 } else if (strcmp("retweeted_status", k) == 0 && v->type == json_object) { 472 475 rt = v; … … 486 489 txs->reply_to = v->u.integer; 487 490 } else if (strcmp("entities", k) == 0 && v->type == json_object) { 488 txs->reply_to = v->u.integer;491 entities = v; 489 492 } 490 493 } … … 502 505 txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text); 503 506 txs_free(rtxs); 504 } else if (entities && NULL) {507 } else if (entities) { 505 508 JSON_O_FOREACH (entities, k, v) { 506 509 int i; … … 545 548 { 546 549 struct twitter_xml_status *txs; 547 json_value *c;548 550 bee_user_t *bu; 549 551 int i; … … 917 919 918 920 end: 921 if (!g_slist_find(twitter_connections, ic)) 922 return; 923 919 924 td->flags |= TWITTER_GOT_TIMELINE; 920 925 … … 950 955 951 956 end: 957 if (!g_slist_find(twitter_connections, ic)) 958 return; 959 952 960 td->flags |= TWITTER_GOT_MENTIONS; 953 961 -
protocols/twitter/twitter_lib.h
r8e3b7ac rfb351ce 43 43 #define TWITTER_FRIENDS_TIMELINE_URL "/statuses/friends_timeline.json" 44 44 #define TWITTER_HOME_TIMELINE_URL "/statuses/home_timeline.json" 45 #define TWITTER_MENTIONS_URL "/statuses/mentions .json"45 #define TWITTER_MENTIONS_URL "/statuses/mentions_timeline.json" 46 46 #define TWITTER_USER_TIMELINE_URL "/statuses/user_timeline.json" 47 47
Note: See TracChangeset
for help on using the changeset viewer.