From 43f7ca1d555dbeeacd068925596ab0cbcd84ab71 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 8 Jun 2025 03:20:18 +0000 Subject: Add missing quoteUrl to the body of the message. --- html.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/html.c b/html.c index 9677dea..2df4032 100644 --- a/html.c +++ b/html.c @@ -1901,6 +1901,31 @@ xs_html *html_entry_controls(snac *user, const char *actor, } +static void +addQuoteUrl(xs_html* snac_content, xs_dict* msg, const char* content) +{ + /* https://www.w3.org/ns/activitystreams#quoteUrl */ + const char* quoteUri = xs_dict_get(msg, "quoteUrl"); + if (!xs_is_string(quoteUri)) { + /* http://fedibird.com/ns#quoteUri */ + quoteUri = xs_dict_get(msg, "quoteUri"); + } + + // TODO: This should probably be a better check + if (!xs_is_string(quoteUri) || xs_str_in(content, quoteUri) != -1) { + return; + } + + xs_html_add(snac_content, + xs_html_sctag("hr", NULL), + xs_html_tag("p", + xs_html_tag("a", + xs_html_attr("href", quoteUri), + xs_html_attr("target", "_blank"), + xs_html_text("THIS FUCKER'S INSTANCE CAN'T DO “RE: URL”!")))); +} + + xs_html *html_entry(snac *user, xs_dict *msg, int read_only, int level, const char *md5, int hide_children) { @@ -2393,6 +2418,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, poll); } + const char *content = xs_dict_get(msg, "content"); + + /* Add a RE: if it doesn't exist already */ + addQuoteUrl(snac_content, msg, content); + /** attachments **/ xs *attach = get_attachments(msg); @@ -2404,8 +2434,6 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, xs_html_add(snac_content, content_attachments); - const char *content = xs_dict_get(msg, "content"); - int c = 0; const xs_dict *a; while (xs_list_next(attach, &a, &c)) { -- cgit v1.2.3