Changeset ad54149 for protocols/twitter
- Timestamp:
- 2016-09-21T03:03:15Z (8 years ago)
- Branches:
- master
- Children:
- 524e931
- Parents:
- 35401cd
- git-author:
- dequis <dx@…> (21-09-16 00:53:40)
- git-committer:
- dequis <dx@…> (21-09-16 03:03:15)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter_lib.c
r35401cd rad54149 599 599 static struct twitter_xml_status *twitter_xt_get_status(const json_value *node) 600 600 { 601 struct twitter_xml_status *txs ;601 struct twitter_xml_status *txs = {0}; 602 602 const json_value *rt = NULL; 603 const json_value *text_value = NULL; 603 604 604 605 if (node->type != json_object) { … … 608 609 609 610 JSON_O_FOREACH(node, k, v) { 610 if (strcmp("text", k) == 0 && v->type == json_string) { 611 txs->text = g_memdup(v->u.string.ptr, v->u.string.length + 1); 612 strip_html(txs->text); 611 if (strcmp("text", k) == 0 && v->type == json_string && text_value == NULL) { 612 text_value = v; 613 } else if (strcmp("full_text", k) == 0 && v->type == json_string) { 614 text_value = v; 615 } else if (strcmp("extended_tweet", k) == 0 && v->type == json_object) { 616 text_value = json_o_get(v, "full_text"); 613 617 } else if (strcmp("retweeted_status", k) == 0 && v->type == json_object) { 614 618 rt = v; … … 636 640 struct twitter_xml_status *rtxs = twitter_xt_get_status(rt); 637 641 if (rtxs) { 638 g_free(txs->text);639 642 txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text); 640 643 txs->id = rtxs->id; 641 644 txs_free(rtxs); 642 645 } 643 } else { 646 } else if (text_value && text_value->type == json_string) { 647 txs->text = g_memdup(text_value->u.string.ptr, text_value->u.string.length + 1); 648 strip_html(txs->text); 644 649 expand_entities(&txs->text, node); 645 650 } … … 1479 1484 td->flags &= ~TWITTER_GOT_TIMELINE; 1480 1485 1481 char *args[ 6];1486 char *args[8]; 1482 1487 args[0] = "cursor"; 1483 1488 args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); 1484 1489 args[2] = "include_entities"; 1485 1490 args[3] = "true"; 1491 args[4] = "tweet_mode"; 1492 args[5] = "extended"; 1486 1493 if (td->timeline_id) { 1487 args[ 4] = "since_id";1488 args[ 5] = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id);1494 args[6] = "since_id"; 1495 args[7] = g_strdup_printf("%" G_GUINT64_FORMAT, td->timeline_id); 1489 1496 } 1490 1497 1491 1498 if (twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args, 1492 td->timeline_id ? 6 : 4) == NULL) {1499 td->timeline_id ? 8 : 6) == NULL) { 1493 1500 if (++td->http_fails >= 5) { 1494 1501 imcb_error(ic, "Could not retrieve %s: %s", … … 1501 1508 g_free(args[1]); 1502 1509 if (td->timeline_id) { 1503 g_free(args[ 5]);1510 g_free(args[7]); 1504 1511 } 1505 1512 } … … 1516 1523 td->flags &= ~TWITTER_GOT_MENTIONS; 1517 1524 1518 char *args[ 6];1525 char *args[8]; 1519 1526 args[0] = "cursor"; 1520 1527 args[1] = g_strdup_printf("%" G_GINT64_FORMAT, next_cursor); … … 1528 1535 args[5] = g_strdup_printf("%d", set_getint(&ic->acc->set, "show_old_mentions")); 1529 1536 } 1537 args[6] = "tweet_mode"; 1538 args[7] = "extended"; 1530 1539 1531 1540 if (twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, 1532 ic, 0, args, 6) == NULL) {1541 ic, 0, args, 8) == NULL) { 1533 1542 if (++td->http_fails >= 5) { 1534 1543 imcb_error(ic, "Could not retrieve %s: %s",
Note: See TracChangeset
for help on using the changeset viewer.