mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-26 06:53:37 +00:00
Merge pull request 'html.c: Fix non-list tag object for external custom emoji' (#77) from yonle/snac2:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/77
This commit is contained in:
commit
b22786bd55
1 changed files with 26 additions and 2 deletions
28
html.c
28
html.c
|
@ -56,8 +56,20 @@ xs_str *actor_name(xs_dict *actor)
|
||||||
|
|
||||||
/* replace the :shortnames: */
|
/* replace the :shortnames: */
|
||||||
if (!xs_is_null(p = xs_dict_get(actor, "tag"))) {
|
if (!xs_is_null(p = xs_dict_get(actor, "tag"))) {
|
||||||
|
xs *tag = NULL;
|
||||||
|
if (xs_type(p) == XSTYPE_DICT) {
|
||||||
|
/* not a list */
|
||||||
|
tag = xs_list_new();
|
||||||
|
tag = xs_list_append(tag, p);
|
||||||
|
} else {
|
||||||
|
/* is a list */
|
||||||
|
tag = xs_dup(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
xs_list *tags = tag;
|
||||||
|
|
||||||
/* iterate the tags */
|
/* iterate the tags */
|
||||||
while (xs_list_iter(&p, &v)) {
|
while (xs_list_iter(&tags, &v)) {
|
||||||
char *t = xs_dict_get(v, "type");
|
char *t = xs_dict_get(v, "type");
|
||||||
|
|
||||||
if (t && strcmp(t, "Emoji") == 0) {
|
if (t && strcmp(t, "Emoji") == 0) {
|
||||||
|
@ -1031,8 +1043,20 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
|
||||||
|
|
||||||
/* replace the :shortnames: */
|
/* replace the :shortnames: */
|
||||||
if (!xs_is_null(p = xs_dict_get(msg, "tag"))) {
|
if (!xs_is_null(p = xs_dict_get(msg, "tag"))) {
|
||||||
|
xs *tag = NULL;
|
||||||
|
if (xs_type(p) == XSTYPE_DICT) {
|
||||||
|
/* not a list */
|
||||||
|
tag = xs_list_new();
|
||||||
|
tag = xs_list_append(tag, p);
|
||||||
|
} else {
|
||||||
|
/* is a list */
|
||||||
|
tag = xs_dup(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
xs_list *tags = tag;
|
||||||
|
|
||||||
/* iterate the tags */
|
/* iterate the tags */
|
||||||
while (xs_list_iter(&p, &v)) {
|
while (xs_list_iter(&tags, &v)) {
|
||||||
char *t = xs_dict_get(v, "type");
|
char *t = xs_dict_get(v, "type");
|
||||||
|
|
||||||
if (t && strcmp(t, "Emoji") == 0) {
|
if (t && strcmp(t, "Emoji") == 0) {
|
||||||
|
|
Loading…
Reference in a new issue