commit f625d88

default  ·  2023-04-24 15:25:32 +0000 UTC
parent 9456a57
Added custom emojis to Statuses.
1 files changed,  +22, -0
+22, -0
 1@@ -604,6 +604,28 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
 2                     htl = xs_list_append(htl, d1);
 3                 }
 4             }
 5+            else
 6+            if (strcmp(type, "Emoji") == 0) {
 7+                const char *name    = xs_dict_get(v, "name");
 8+                const xs_dict *icon = xs_dict_get(v, "icon");
 9+
10+                if (!xs_is_null(name) && !xs_is_null(icon)) {
11+                    const char *url = xs_dict_get(icon, "url");
12+
13+                    if (!xs_is_null(url)) {
14+                        xs *nm = xs_strip_chars_i(xs_dup(name), ":");
15+                        xs *t  = xs_val_new(XSTYPE_TRUE);
16+
17+                        d1 = xs_dict_append(d1, "shortcode", nm);
18+                        d1 = xs_dict_append(d1, "url", url);
19+                        d1 = xs_dict_append(d1, "static_url", url);
20+                        d1 = xs_dict_append(d1, "visible_in_picker", t);
21+                        d1 = xs_dict_append(d1, "category", "Emojis");
22+
23+                        eml = xs_list_append(eml, d1);
24+                    }
25+                }
26+            }
27         }
28 
29         st = xs_dict_append(st, "mentions", ml);