aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--protocols/twitter/twitter_lib.c10
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)) {