diff options
| author | 2025-05-28 09:07:19 +0200 | |
|---|---|---|
| committer | 2025-05-28 09:07:19 +0200 | |
| commit | a1369b39c1bd3d2036af12368997648454ca5564 (patch) | |
| tree | fb18610c75bbda7b80b6726ebd80373fedd606c9 /rss.c | |
| parent | Don't prepend a # before a hashtag that is really an URL. (diff) | |
| download | penes-snac2-a1369b39c1bd3d2036af12368997648454ca5564.tar.gz penes-snac2-a1369b39c1bd3d2036af12368997648454ca5564.tar.xz penes-snac2-a1369b39c1bd3d2036af12368997648454ca5564.zip | |
Activated hashtag RSS polling.
Diffstat (limited to 'rss.c')
| -rw-r--r-- | rss.c | 9 |
1 files changed, 5 insertions, 4 deletions
| @@ -110,6 +110,9 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline, | |||
| 110 | void rss_to_timeline(snac *user, const char *url) | 110 | void rss_to_timeline(snac *user, const char *url) |
| 111 | /* reads an RSS and inserts all ActivityPub posts into the user's timeline */ | 111 | /* reads an RSS and inserts all ActivityPub posts into the user's timeline */ |
| 112 | { | 112 | { |
| 113 | if (!xs_startswith(url, "https:/") && !xs_startswith(url, "http:/")) | ||
| 114 | return; | ||
| 115 | |||
| 113 | xs *hdrs = xs_dict_new(); | 116 | xs *hdrs = xs_dict_new(); |
| 114 | hdrs = xs_dict_set(hdrs, "accept", "application/rss+xml"); | 117 | hdrs = xs_dict_set(hdrs, "accept", "application/rss+xml"); |
| 115 | hdrs = xs_dict_set(hdrs, "user-agent", USER_AGENT); | 118 | hdrs = xs_dict_set(hdrs, "user-agent", USER_AGENT); |
| @@ -204,10 +207,9 @@ void rss_to_timeline(snac *user, const char *url) | |||
| 204 | } | 207 | } |
| 205 | 208 | ||
| 206 | 209 | ||
| 207 | void rss_process(void) | 210 | void rss_poll_hashtags(void) |
| 208 | /* parses all RSS from all users */ | 211 | /* parses all RSS from all users */ |
| 209 | { | 212 | { |
| 210 | #if 0 | ||
| 211 | xs *list = user_list(); | 213 | xs *list = user_list(); |
| 212 | const char *uid; | 214 | const char *uid; |
| 213 | 215 | ||
| @@ -215,7 +217,7 @@ void rss_process(void) | |||
| 215 | snac user; | 217 | snac user; |
| 216 | 218 | ||
| 217 | if (user_open(&user, uid)) { | 219 | if (user_open(&user, uid)) { |
| 218 | const xs_list *rss = xs_dict_get(user.config, "rss"); | 220 | const xs_list *rss = xs_dict_get(user.config, "followed_hashtags"); |
| 219 | 221 | ||
| 220 | if (xs_is_list(rss)) { | 222 | if (xs_is_list(rss)) { |
| 221 | const char *url; | 223 | const char *url; |
| @@ -227,5 +229,4 @@ void rss_process(void) | |||
| 227 | user_free(&user); | 229 | user_free(&user); |
| 228 | } | 230 | } |
| 229 | } | 231 | } |
| 230 | #endif | ||
| 231 | } | 232 | } |