summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/html.c b/html.c
index c9a93aa..075876f 100644
--- a/html.c
+++ b/html.c
@@ -1921,6 +1921,31 @@ xs_html *html_entry_controls(snac *user, const char *actor,
1921} 1921}
1922 1922
1923 1923
1924static void
1925addQuoteUrl(xs_html* snac_content, xs_dict* msg, const char* content)
1926{
1927 /* https://www.w3.org/ns/activitystreams#quoteUrl */
1928 const char* quoteUri = xs_dict_get(msg, "quoteUrl");
1929 if (!xs_is_string(quoteUri)) {
1930 /* http://fedibird.com/ns#quoteUri */
1931 quoteUri = xs_dict_get(msg, "quoteUri");
1932 }
1933
1934 // TODO: This should probably be a better check
1935 if (!xs_is_string(quoteUri) || xs_str_in(content, quoteUri) != -1) {
1936 return;
1937 }
1938
1939 xs_html_add(snac_content,
1940 xs_html_sctag("hr", NULL),
1941 xs_html_tag("p",
1942 xs_html_tag("a",
1943 xs_html_attr("href", quoteUri),
1944 xs_html_attr("target", "_blank"),
1945 xs_html_text("THIS FUCKER'S INSTANCE CAN'T DO “RE: URL”!"))));
1946}
1947
1948
1924xs_html *html_entry(snac *user, xs_dict *msg, int read_only, 1949xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1925 int level, const char *md5, int hide_children) 1950 int level, const char *md5, int hide_children)
1926{ 1951{
@@ -2418,6 +2443,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2418 poll); 2443 poll);
2419 } 2444 }
2420 2445
2446 const char *content = xs_dict_get(msg, "content");
2447
2448 /* Add a RE: <quoted post URL> if it doesn't exist already */
2449 addQuoteUrl(snac_content, msg, content);
2450
2421 /** attachments **/ 2451 /** attachments **/
2422 xs *attach = get_attachments(msg); 2452 xs *attach = get_attachments(msg);
2423 2453
@@ -2429,8 +2459,6 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2429 xs_html_add(snac_content, 2459 xs_html_add(snac_content,
2430 content_attachments); 2460 content_attachments);
2431 2461
2432 const char *content = xs_dict_get(msg, "content");
2433
2434 int c = 0; 2462 int c = 0;
2435 const xs_dict *a; 2463 const xs_dict *a;
2436 while (xs_list_next(attach, &a, &c)) { 2464 while (xs_list_next(attach, &a, &c)) {