diff options
author | Marius Halden <marius.h@lden.org> | 2016-11-27 16:36:20 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2016-11-27 16:36:20 +0100 |
commit | 979082a36fe648b81711373c62311bcd7d9d3b54 (patch) | |
tree | 536cf6b12f9de86c037441f43b53e6be820beb59 | |
parent | 434336755175aa390c64e34206b58b8954b3fffe (diff) | |
parent | ed1f5e8de07be7c90e2e8cd9020727d53d6b04c7 (diff) |
Merge branch 'master' into patched-master
-rw-r--r-- | protocols/twitter/twitter_lib.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 59e7bfdd..303523b2 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -233,7 +233,7 @@ static json_value *twitter_parse_response(struct im_connection *ic, struct http_ if ((ret = json_parse(req->reply_body, req->body_size)) == NULL) { imcb_error(ic, "Could not retrieve %s: %s", - path, "XML parse error"); + path, "JSON parse error"); } return ret; } @@ -742,8 +742,7 @@ static void expand_entities(char **text, const json_value *node, const json_valu if (!((entities = json_o_get(node, "entities")) && entities->type == json_object)) return; if ((quoted = json_o_get(node, "quoted_status")) && quoted->type == json_object) { - /* New "retweets with comments" feature. Note that this info - * seems to be included in the streaming API only! Grab the + /* New "retweets with comments" feature. Grab the * full message and try to insert it when we run into the * Tweet entity. */ struct twitter_xml_status *txs = twitter_xt_get_status(quoted); @@ -783,7 +782,10 @@ static void expand_entities(char **text, const json_value *node, const json_valu const char *full = json_o_str(v->u.array.values[i], "expanded_url"); char *pos, *new; - if (!kort || !disp || !(pos = strstr(*text, kort))) { + /* Skip if a required field is missing, if the t.co URL is not in fact + in the Tweet at all, or if the full-ish one *is* in it already + (dupes appear, especially in streaming API). */ + if (!kort || !disp || !(pos = strstr(*text, kort)) || strstr(*text, disp)) { continue; } if (quote_url && strstr(full, quote_url)) { |