Changeset 1201fcb for protocols/twitter
- Timestamp:
- 2015-06-08T03:42:11Z (10 years ago)
- Branches:
- master
- Children:
- 53c7799
- Parents:
- 61e7e02
- Location:
- protocols/twitter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r61e7e02 r1201fcb 1012 1012 twitter_log(ic, "Tweet `%s' does not exist", cmd[1]); 1013 1013 } else { 1014 /* More common link is twitter.com/$UID/status/$ID (and that's 1015 * what this will 302 to) but can't generate that since for RTs, 1016 * bu here points at the retweeter while id contains the id of 1017 * the original message. */ 1018 twitter_log(ic, "https://twitter.com/statuses/%lld", id); 1014 twitter_status_show_url(ic, id); 1019 1015 } 1020 1016 goto eof; -
protocols/twitter/twitter_lib.c
r61e7e02 r1201fcb 1573 1573 g_free(args[1]); 1574 1574 } 1575 1576 static void twitter_http_status_show_url(struct http_request *req) 1577 { 1578 struct im_connection *ic = req->data; 1579 json_value *parsed, *id; 1580 const char *name; 1581 1582 // Check if the connection is still active. 1583 if (!g_slist_find(twitter_connections, ic)) { 1584 return; 1585 } 1586 1587 if (!(parsed = twitter_parse_response(ic, req))) { 1588 return; 1589 } 1590 1591 /* for the parson branch: 1592 name = json_object_dotget_string(json_object(parsed), "user.screen_name"); 1593 id = json_object_get_integer(json_object(parsed), "id"); 1594 */ 1595 1596 name = json_o_str(json_o_get(parsed, "user"), "screen_name"); 1597 id = json_o_get(parsed, "id"); 1598 1599 if (name && id && id->type == json_integer) { 1600 twitter_log(ic, "https://twitter.com/%s/status/%" G_GUINT64_FORMAT, name, id->u.integer); 1601 } else { 1602 twitter_log(ic, "Error: could not fetch tweet url."); 1603 } 1604 1605 json_value_free(parsed); 1606 } 1607 1608 void twitter_status_show_url(struct im_connection *ic, guint64 id) 1609 { 1610 char *url = g_strdup_printf("%s%" G_GUINT64_FORMAT "%s", TWITTER_STATUS_SHOW_URL, id, ".json"); 1611 twitter_http(ic, url, twitter_http_status_show_url, ic, 0, NULL, 0); 1612 g_free(url); 1613 } -
protocols/twitter/twitter_lib.h
r61e7e02 r1201fcb 96 96 void twitter_report_spam(struct im_connection *ic, char *screen_name); 97 97 void twitter_favourite_tweet(struct im_connection *ic, guint64 id); 98 void twitter_status_show_url(struct im_connection *ic, guint64 id); 98 99 99 100 #endif //_TWITTER_LIB_H
Note: See TracChangeset
for help on using the changeset viewer.