commit c7e8f37
default
·
2024-11-07 21:00:25 +0000 UTC
parent 34dbddb
Moved make_url() to data.c.
M
data.c
+16,
-0
1@@ -3650,3 +3650,19 @@ t_announcement *announcement(const double after)
2
3 return NULL;
4 }
5+
6+
7+xs_str *make_url(const char *href, const char *proxy)
8+/* makes an URL, possibly including proxying */
9+{
10+ xs_str *url = NULL;
11+
12+ if (proxy && !xs_startswith(href, srv_baseurl)) {
13+ xs *p = xs_str_cat(xs_dup(proxy), "/proxy/");
14+ url = xs_replace(href, "https:/" "/", p);
15+ }
16+ else
17+ url = xs_dup(href);
18+
19+ return url;
20+}
M
html.c
+0,
-16
1@@ -42,22 +42,6 @@ int login(snac *snac, const xs_dict *headers)
2 }
3
4
5-xs_str *make_url(const char *href, const char *proxy)
6-/* makes an URL, possibly including proxying */
7-{
8- xs_str *url = NULL;
9-
10- if (proxy && !xs_startswith(href, srv_baseurl)) {
11- xs *p = xs_str_cat(xs_dup(proxy), "/proxy/");
12- url = xs_replace(href, "https:/" "/", p);
13- }
14- else
15- url = xs_dup(href);
16-
17- return url;
18-}
19-
20-
21 xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *proxy)
22 /* replaces all the :shortnames: with the emojis in tag */
23 {
M
snac.h
+2,
-0
1@@ -409,3 +409,5 @@ typedef struct {
2 char *text;
3 } t_announcement;
4 t_announcement *announcement(double after);
5+
6+xs_str *make_url(const char *href, const char *proxy);