Changeset 3b0c1c3


Ignore:
Timestamp:
2018-07-31T06:17:21Z (6 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0b1448f
Parents:
fa1bc1d (diff), 921ea8b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into develop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter_lib.c

    rfa1bc1d r3b0c1c3  
    704704static void expand_entities(char **text, const json_value *node, const json_value *extended_node)
    705705{
    706         json_value *entities, *extended_entities, *quoted;
    707         char *quote_url = NULL, *quote_text = NULL;
     706        json_value *entities, *extended_entities, *quoted, *quoted_permalink;
     707        char *quote_url = NULL, *quote_text = NULL, *quote_kort = NULL;
     708        gboolean quote_used = FALSE;
    708709
    709710        if (!((entities = json_o_get(node, "entities")) && entities->type == json_object))
     
    716717                quote_text = g_strdup_printf("@%s: %s", txs->user->screen_name, txs->text);
    717718                quote_url = g_strdup_printf("%s/status/%" G_GUINT64_FORMAT, txs->user->screen_name, txs->id);
     719                if ((quoted_permalink = json_o_get(node, "quoted_status_permalink")) && quoted->type == json_object) {
     720                        quote_kort = json_o_strdup(quoted_permalink, "url");
     721                }
    718722                txs_free(txs);
    719723        } else {
     
    759763                                format = "%s<%s> [%s]%s";
    760764                                disp = quote_text;
     765                                quote_used = TRUE;
    761766                        }
    762767
     
    769774                }
    770775        }
     776
     777        if (quote_text && !quote_used) {
     778                const char *url = quote_kort ?: quote_url;
     779                char *new = g_strdup_printf("%s <%s>[%s]", *text, url, quote_text);
     780                g_free(*text);
     781                *text = new;
     782        }
     783
    771784        g_free(quote_text);
    772785        g_free(quote_url);
     786        g_free(quote_kort);
    773787}
    774788
Note: See TracChangeset for help on using the changeset viewer.