diff options
| author | 2023-07-25 23:33:14 +0700 | |
|---|---|---|
| committer | 2023-07-26 06:10:08 +0000 | |
| commit | b2a274df763da005f208f07574d1cb7d082834b1 (patch) | |
| tree | 642c4974ea7370bdd07141f84709fa080c45ed92 | |
| parent | Call fflush() after admin prompts without newlines. (diff) | |
| download | snac2-b2a274df763da005f208f07574d1cb7d082834b1.tar.gz snac2-b2a274df763da005f208f07574d1cb7d082834b1.tar.xz snac2-b2a274df763da005f208f07574d1cb7d082834b1.zip | |
html.c: Fix non-list tag object for external custom emoji
Signed-off-by: Yonle <yonle@lecturify.net>
| -rw-r--r-- | html.c | 28 |
1 files changed, 26 insertions, 2 deletions
| @@ -56,8 +56,20 @@ xs_str *actor_name(xs_dict *actor) | |||
| 56 | 56 | ||
| 57 | /* replace the :shortnames: */ | 57 | /* replace the :shortnames: */ |
| 58 | if (!xs_is_null(p = xs_dict_get(actor, "tag"))) { | 58 | if (!xs_is_null(p = xs_dict_get(actor, "tag"))) { |
| 59 | xs *tag = NULL; | ||
| 60 | if (xs_type(p) == XSTYPE_DICT) { | ||
| 61 | /* not a list */ | ||
| 62 | tag = xs_list_new(); | ||
| 63 | tag = xs_list_append(tag, p); | ||
| 64 | } else { | ||
| 65 | /* is a list */ | ||
| 66 | tag = xs_dup(p); | ||
| 67 | } | ||
| 68 | |||
| 69 | xs_list *tags = tag; | ||
| 70 | |||
| 59 | /* iterate the tags */ | 71 | /* iterate the tags */ |
| 60 | while (xs_list_iter(&p, &v)) { | 72 | while (xs_list_iter(&tags, &v)) { |
| 61 | char *t = xs_dict_get(v, "type"); | 73 | char *t = xs_dict_get(v, "type"); |
| 62 | 74 | ||
| 63 | if (t && strcmp(t, "Emoji") == 0) { | 75 | 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, | |||
| 1031 | 1043 | ||
| 1032 | /* replace the :shortnames: */ | 1044 | /* replace the :shortnames: */ |
| 1033 | if (!xs_is_null(p = xs_dict_get(msg, "tag"))) { | 1045 | if (!xs_is_null(p = xs_dict_get(msg, "tag"))) { |
| 1046 | xs *tag = NULL; | ||
| 1047 | if (xs_type(p) == XSTYPE_DICT) { | ||
| 1048 | /* not a list */ | ||
| 1049 | tag = xs_list_new(); | ||
| 1050 | tag = xs_list_append(tag, p); | ||
| 1051 | } else { | ||
| 1052 | /* is a list */ | ||
| 1053 | tag = xs_dup(p); | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | xs_list *tags = tag; | ||
| 1057 | |||
| 1034 | /* iterate the tags */ | 1058 | /* iterate the tags */ |
| 1035 | while (xs_list_iter(&p, &v)) { | 1059 | while (xs_list_iter(&tags, &v)) { |
| 1036 | char *t = xs_dict_get(v, "type"); | 1060 | char *t = xs_dict_get(v, "type"); |
| 1037 | 1061 | ||
| 1038 | if (t && strcmp(t, "Emoji") == 0) { | 1062 | if (t && strcmp(t, "Emoji") == 0) { |