summaryrefslogtreecommitdiff
path: root/rss.c
diff options
context:
space:
mode:
authorGravatar byte2026-01-24 21:33:30 +0100
committerGravatar byte2026-01-24 21:33:30 +0100
commitbfd071c63826f4d13d48614cedebfb2f8ea20cf6 (patch)
tree8cc9b766b88fa66d051e55d65d6694570553a17b /rss.c
parentAdded a Follow/Unfollow button next to a new follow notification. (diff)
parentMerge pull request 'add susie-q (qr) to artwork' (#528) from pmjv/snac2:maste... (diff)
downloadsnac2-bfd071c63826f4d13d48614cedebfb2f8ea20cf6.tar.gz
snac2-bfd071c63826f4d13d48614cedebfb2f8ea20cf6.tar.xz
snac2-bfd071c63826f4d13d48614cedebfb2f8ea20cf6.zip
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.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/rss.c b/rss.c
index 6e77205..dc26071 100644
--- a/rss.c
+++ b/rss.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2025 grunfink et al. / MIT license */ 2/* copyright (c) 2025 - 2026 grunfink et al. / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_html.h" 5#include "xs_html.h"
@@ -10,6 +10,7 @@
10#include "xs_openssl.h" 10#include "xs_openssl.h"
11#include "xs_json.h" 11#include "xs_json.h"
12#include "xs_http.h" 12#include "xs_http.h"
13#include "xs_unicode.h"
13 14
14#include "snac.h" 15#include "snac.h"
15 16
@@ -59,7 +60,7 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline,
59 const char *content = xs_dict_get(msg, "content"); 60 const char *content = xs_dict_get(msg, "content");
60 const char *published = xs_dict_get(msg, "published"); 61 const char *published = xs_dict_get(msg, "published");
61 62
62 if (user && !xs_startswith(id, user->actor)) 63 if (user && !is_msg_mine(user, id))
63 continue; 64 continue;
64 65
65 if (!id || !content || !published) 66 if (!id || !content || !published)
@@ -74,7 +75,14 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline,
74 title = xs_regex_replace_i(title, "&[^;]+;", " "); 75 title = xs_regex_replace_i(title, "&[^;]+;", " ");
75 int i; 76 int i;
76 77
77 for (i = 0; title[i] && title[i] != '\n' && i < 50; i++); 78 for (i = 0; title[i] && title[i] != '\n' && i < 50; ) {
79 const char *p = &title[i];
80 unsigned int cp = xs_utf8_dec(&p);
81 int n = p - title;
82 if (cp == 0xfffd || n > 50)
83 break;
84 i = n;
85 }
78 86
79 if (title[i] != '\0') { 87 if (title[i] != '\0') {
80 title[i] = '\0'; 88 title[i] = '\0';