diff options
Diffstat (limited to '')
| -rw-r--r-- | data.c | 16 | ||||
| -rw-r--r-- | html.c | 16 | ||||
| -rw-r--r-- | snac.h | 2 |
3 files changed, 18 insertions, 16 deletions
| @@ -3650,3 +3650,19 @@ t_announcement *announcement(const double after) | |||
| 3650 | 3650 | ||
| 3651 | return NULL; | 3651 | return NULL; |
| 3652 | } | 3652 | } |
| 3653 | |||
| 3654 | |||
| 3655 | xs_str *make_url(const char *href, const char *proxy) | ||
| 3656 | /* makes an URL, possibly including proxying */ | ||
| 3657 | { | ||
| 3658 | xs_str *url = NULL; | ||
| 3659 | |||
| 3660 | if (proxy && !xs_startswith(href, srv_baseurl)) { | ||
| 3661 | xs *p = xs_str_cat(xs_dup(proxy), "/proxy/"); | ||
| 3662 | url = xs_replace(href, "https:/" "/", p); | ||
| 3663 | } | ||
| 3664 | else | ||
| 3665 | url = xs_dup(href); | ||
| 3666 | |||
| 3667 | return url; | ||
| 3668 | } | ||
| @@ -42,22 +42,6 @@ int login(snac *snac, const xs_dict *headers) | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | xs_str *make_url(const char *href, const char *proxy) | ||
| 46 | /* makes an URL, possibly including proxying */ | ||
| 47 | { | ||
| 48 | xs_str *url = NULL; | ||
| 49 | |||
| 50 | if (proxy && !xs_startswith(href, srv_baseurl)) { | ||
| 51 | xs *p = xs_str_cat(xs_dup(proxy), "/proxy/"); | ||
| 52 | url = xs_replace(href, "https:/" "/", p); | ||
| 53 | } | ||
| 54 | else | ||
| 55 | url = xs_dup(href); | ||
| 56 | |||
| 57 | return url; | ||
| 58 | } | ||
| 59 | |||
| 60 | |||
| 61 | xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *proxy) | 45 | xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *proxy) |
| 62 | /* replaces all the :shortnames: with the emojis in tag */ | 46 | /* replaces all the :shortnames: with the emojis in tag */ |
| 63 | { | 47 | { |
| @@ -409,3 +409,5 @@ typedef struct { | |||
| 409 | char *text; | 409 | char *text; |
| 410 | } t_announcement; | 410 | } t_announcement; |
| 411 | t_announcement *announcement(double after); | 411 | t_announcement *announcement(double after); |
| 412 | |||
| 413 | xs_str *make_url(const char *href, const char *proxy); | ||