mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Added support for lemmy-style "Link" attachments.
This commit is contained in:
parent
8d7f329007
commit
c4bb189d99
15
html.c
15
html.c
@ -1155,7 +1155,10 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
|
|||||||
s = xs_str_cat(s, "<p class=\"snac-content-attachments\">\n");
|
s = xs_str_cat(s, "<p class=\"snac-content-attachments\">\n");
|
||||||
|
|
||||||
while (xs_list_iter(&attach, &v)) {
|
while (xs_list_iter(&attach, &v)) {
|
||||||
char *t = xs_dict_get(v, "mediaType");
|
const char *t = xs_dict_get(v, "mediaType");
|
||||||
|
|
||||||
|
if (xs_is_null(t))
|
||||||
|
t = xs_dict_get(v, "type");
|
||||||
|
|
||||||
if (xs_is_null(t))
|
if (xs_is_null(t))
|
||||||
continue;
|
continue;
|
||||||
@ -1210,6 +1213,16 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
|
|||||||
s = xs_str_cat(s, s1);
|
s = xs_str_cat(s, s1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (strcmp(t, "Link") == 0) {
|
||||||
|
const char *url = xs_dict_get(v, "href");
|
||||||
|
|
||||||
|
if (!xs_is_null(url)) {
|
||||||
|
xs *es1 = encode_html(url);
|
||||||
|
xs *s1 = xs_fmt("<p><a href=\"%s\">%s</p>", url, es1);
|
||||||
|
s = xs_str_cat(s, s1);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
char *url = xs_dict_get(v, "url");
|
char *url = xs_dict_get(v, "url");
|
||||||
char *name = xs_dict_get(v, "name");
|
char *name = xs_dict_get(v, "name");
|
||||||
|
Loading…
Reference in New Issue
Block a user