mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 06:25:04 +00:00
Moved make_url() to data.c.
This commit is contained in:
parent
34dbddb2b5
commit
c7e8f3783b
3 changed files with 18 additions and 16 deletions
16
data.c
16
data.c
|
@ -3650,3 +3650,19 @@ t_announcement *announcement(const double after)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xs_str *make_url(const char *href, const char *proxy)
|
||||||
|
/* makes an URL, possibly including proxying */
|
||||||
|
{
|
||||||
|
xs_str *url = NULL;
|
||||||
|
|
||||||
|
if (proxy && !xs_startswith(href, srv_baseurl)) {
|
||||||
|
xs *p = xs_str_cat(xs_dup(proxy), "/proxy/");
|
||||||
|
url = xs_replace(href, "https:/" "/", p);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
url = xs_dup(href);
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
16
html.c
16
html.c
|
@ -42,22 +42,6 @@ int login(snac *snac, const xs_dict *headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xs_str *make_url(const char *href, const char *proxy)
|
|
||||||
/* makes an URL, possibly including proxying */
|
|
||||||
{
|
|
||||||
xs_str *url = NULL;
|
|
||||||
|
|
||||||
if (proxy && !xs_startswith(href, srv_baseurl)) {
|
|
||||||
xs *p = xs_str_cat(xs_dup(proxy), "/proxy/");
|
|
||||||
url = xs_replace(href, "https:/" "/", p);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
url = xs_dup(href);
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *proxy)
|
xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *proxy)
|
||||||
/* replaces all the :shortnames: with the emojis in tag */
|
/* replaces all the :shortnames: with the emojis in tag */
|
||||||
{
|
{
|
||||||
|
|
2
snac.h
2
snac.h
|
@ -409,3 +409,5 @@ typedef struct {
|
||||||
char *text;
|
char *text;
|
||||||
} t_announcement;
|
} t_announcement;
|
||||||
t_announcement *announcement(double after);
|
t_announcement *announcement(double after);
|
||||||
|
|
||||||
|
xs_str *make_url(const char *href, const char *proxy);
|
||||||
|
|
Loading…
Reference in a new issue