commit c8ee70f
grunfink
·
2025-12-18 07:20:15 +0000 UTC
parent ce667ad
Fixed some xs_fmt() usages.
2 files changed,
+13,
-7
M
html.c
M
html.c
+7,
-4
1@@ -55,7 +55,7 @@ int login(snac *user, const xs_dict *headers)
2 }
3
4 xs_str *_replace_shortnames(xs_str *s, const xs_list *tag, int ems,
5- const char *proxy, const xs_list *cl, const char *act)
6+ const char *proxy, const xs_list *cl, const char *act_o)
7 /* replace but also adds a class list and an actor in its alt text.
8 * Used for emoji reactions */
9 {
10@@ -107,7 +107,7 @@ xs_str *_replace_shortnames(xs_str *s, const xs_list *tag, int ems,
11 if (!xs_is_string(mt))
12 mt = xs_mime_by_ext(u);
13
14- act = act ? xs_fmt("%s\n%s", n, act) : xs_fmt("%s", n);
15+ xs *act = act_o ? xs_fmt("%s\n%s", n, act) : xs_fmt("%s", n);
16
17 if (strcmp(mt, "image/svg+xml") == 0 && !xs_is_true(xs_dict_get(srv_config, "enable_svg")))
18 s = xs_replace_i(s, n, "");
19@@ -2479,7 +2479,9 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
20 }
21
22 xs *fl = xs_list_new();
23- fl = xs_list_append(fl, xs_fmt("%d", count), actors, xs_fmt("%d", me));
24+ xs *c1 = xs_fmt("%d", count);
25+ xs *c2 = xs_fmt("%d", me);
26+ fl = xs_list_append(fl, c1, actors, c2);
27 sfrl = xs_dict_append(sfrl, content, fl);
28 }
29 }
30@@ -2545,11 +2547,12 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
31 if (me)
32 class = xs_list_append(class, "snac-reacted");
33 xs *l1 = xs_join(class, " ");
34+ xs *s1 = xs_fmt("&#%d", utf);
35 ret = xs_html_tag("button",
36 xs_html_attr("type", "submit"),
37 xs_html_attr("name", "action"),
38 xs_html_attr("value", me ? L("EmojiUnreact") : L("EmojiReact")),
39- xs_html_raw(xs_fmt("&#%d", utf)),
40+ xs_html_raw(s1),
41 xs_html_tag("span",
42 xs_html_raw(nb),
43 xs_html_attr("style", "font-size: initial; padding-left: 5px;")),
+6,
-3
1@@ -1185,7 +1185,8 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
2 }
3
4 xs *fl = xs_list_new();
5- fl = xs_list_append(fl, xs_fmt("%d", count), me);
6+ xs *c1 = xs_fmt("%d", count);
7+ fl = xs_list_append(fl, c1, me);
8 sfrl = xs_dict_append(sfrl, content, fl);
9 }
10 }
11@@ -2399,8 +2400,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
12 mn = xs_dict_append(mn, "emoji_url", url);
13 }
14
15- if (xs_is_emoji((utf = xs_utf8_dec(&content))))
16- mn = xs_dict_append(mn, "name", xs_fmt("&#%d;", utf));
17+ if (xs_is_emoji((utf = xs_utf8_dec(&content)))) {
18+ xs *s1 = xs_fmt("&#%d;", utf);
19+ mn = xs_dict_append(mn, "name", s1);
20+ }
21 }
22 }
23 }