summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2023-07-26 06:13:55 +0000
committerGravatar grunfink2023-07-26 06:13:55 +0000
commitb22786bd55d5e9638710567a311e9855c31db681 (patch)
tree642c4974ea7370bdd07141f84709fa080c45ed92
parentCall fflush() after admin prompts without newlines. (diff)
parenthtml.c: Fix non-list tag object for external custom emoji (diff)
downloadsnac2-b22786bd55d5e9638710567a311e9855c31db681.tar.gz
snac2-b22786bd55d5e9638710567a311e9855c31db681.tar.xz
snac2-b22786bd55d5e9638710567a311e9855c31db681.zip
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
-rw-r--r--html.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/html.c b/html.c
index 976a244..bf2f181 100644
--- a/html.c
+++ b/html.c
@@ -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) {