diff options
| author | byte <byte@noreply.codeberg.org> | 2026-01-24 21:33:30 +0100 |
|---|---|---|
| committer | byte <byte@noreply.codeberg.org> | 2026-01-24 21:33:30 +0100 |
| commit | bfd071c63826f4d13d48614cedebfb2f8ea20cf6 (patch) | |
| tree | 8cc9b766b88fa66d051e55d65d6694570553a17b /rss.c | |
| parent | d4137522487235180528281ee64b7c5963f63ebe (diff) | |
| parent | c6b411ac34e80505517bf120153017ec42943d4e (diff) | |
Merge pull request 'master' (#7) from grunfink/snac2:master into main
Reviewed-on: https://codeberg.org/byte/snac2/pulls/7
Diffstat (limited to 'rss.c')
| -rw-r--r-- | rss.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* snac - A simple, minimalistic ActivityPub instance */ -/* copyright (c) 2025 grunfink et al. / MIT license */ +/* copyright (c) 2025 - 2026 grunfink et al. / MIT license */ #include "xs.h" #include "xs_html.h" @@ -10,6 +10,7 @@ #include "xs_openssl.h" #include "xs_json.h" #include "xs_http.h" +#include "xs_unicode.h" #include "snac.h" @@ -59,7 +60,7 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline, const char *content = xs_dict_get(msg, "content"); const char *published = xs_dict_get(msg, "published"); - if (user && !xs_startswith(id, user->actor)) + if (user && !is_msg_mine(user, id)) continue; if (!id || !content || !published) @@ -74,7 +75,14 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline, title = xs_regex_replace_i(title, "&[^;]+;", " "); int i; - for (i = 0; title[i] && title[i] != '\n' && i < 50; i++); + for (i = 0; title[i] && title[i] != '\n' && i < 50; ) { + const char *p = &title[i]; + unsigned int cp = xs_utf8_dec(&p); + int n = p - title; + if (cp == 0xfffd || n > 50) + break; + i = n; + } if (title[i] != '\0') { title[i] = '\0'; |