diff options
Diffstat (limited to '')
| -rw-r--r-- | html.c | 32 |
1 files changed, 30 insertions, 2 deletions
| @@ -1975,6 +1975,31 @@ xs_html *html_entry_controls(snac *user, const char *actor, | |||
| 1975 | } | 1975 | } |
| 1976 | 1976 | ||
| 1977 | 1977 | ||
| 1978 | static void | ||
| 1979 | addQuoteUrl(xs_html* snac_content, xs_dict* msg, const char* content) | ||
| 1980 | { | ||
| 1981 | /* https://www.w3.org/ns/activitystreams#quoteUrl */ | ||
| 1982 | const char* quoteUri = xs_dict_get(msg, "quoteUrl"); | ||
| 1983 | if (!xs_is_string(quoteUri)) { | ||
| 1984 | /* http://fedibird.com/ns#quoteUri */ | ||
| 1985 | quoteUri = xs_dict_get(msg, "quoteUri"); | ||
| 1986 | } | ||
| 1987 | |||
| 1988 | // TODO: This should probably be a better check | ||
| 1989 | if (!xs_is_string(quoteUri) || xs_str_in(content, quoteUri) != -1) { | ||
| 1990 | return; | ||
| 1991 | } | ||
| 1992 | |||
| 1993 | xs_html_add(snac_content, | ||
| 1994 | xs_html_sctag("hr", NULL), | ||
| 1995 | xs_html_tag("p", | ||
| 1996 | xs_html_tag("a", | ||
| 1997 | xs_html_attr("href", quoteUri), | ||
| 1998 | xs_html_attr("target", "_blank"), | ||
| 1999 | xs_html_text("THIS FUCKER'S INSTANCE CAN'T DO “RE: URL”!")))); | ||
| 2000 | } | ||
| 2001 | |||
| 2002 | |||
| 1978 | xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | 2003 | xs_html *html_entry(snac *user, xs_dict *msg, int read_only, |
| 1979 | int level, const char *md5, int hide_children) | 2004 | int level, const char *md5, int hide_children) |
| 1980 | { | 2005 | { |
| @@ -2472,6 +2497,11 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2472 | poll); | 2497 | poll); |
| 2473 | } | 2498 | } |
| 2474 | 2499 | ||
| 2500 | const char *content = xs_dict_get(msg, "content"); | ||
| 2501 | |||
| 2502 | /* Add a RE: <quoted post URL> if it doesn't exist already */ | ||
| 2503 | addQuoteUrl(snac_content, msg, content); | ||
| 2504 | |||
| 2475 | /** attachments **/ | 2505 | /** attachments **/ |
| 2476 | xs *attach = get_attachments(msg); | 2506 | xs *attach = get_attachments(msg); |
| 2477 | 2507 | ||
| @@ -2483,8 +2513,6 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2483 | xs_html_add(snac_content, | 2513 | xs_html_add(snac_content, |
| 2484 | content_attachments); | 2514 | content_attachments); |
| 2485 | 2515 | ||
| 2486 | const char *content = xs_dict_get(msg, "content"); | ||
| 2487 | |||
| 2488 | int c = 0; | 2516 | int c = 0; |
| 2489 | const xs_dict *a; | 2517 | const xs_dict *a; |
| 2490 | while (xs_list_next(attach, &a, &c)) { | 2518 | while (xs_list_next(attach, &a, &c)) { |