diff options
| author | 2026-01-24 21:33:30 +0100 | |
|---|---|---|
| committer | 2026-01-24 21:33:30 +0100 | |
| commit | bfd071c63826f4d13d48614cedebfb2f8ea20cf6 (patch) | |
| tree | 8cc9b766b88fa66d051e55d65d6694570553a17b /snac.h | |
| parent | Added a Follow/Unfollow button next to a new follow notification. (diff) | |
| parent | Merge pull request 'add susie-q (qr) to artwork' (#528) from pmjv/snac2:maste... (diff) | |
| download | snac2-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 'snac.h')
| -rw-r--r-- | snac.h | 23 |
1 files changed, 19 insertions, 4 deletions
| @@ -1,7 +1,7 @@ | |||
| 1 | /* snac - A simple, minimalistic ActivityPub instance */ | 1 | /* snac - A simple, minimalistic ActivityPub instance */ |
| 2 | /* copyright (c) 2022 - 2025 grunfink et al. / MIT license */ | 2 | /* copyright (c) 2022 - 2026 grunfink et al. / MIT license */ |
| 3 | 3 | ||
| 4 | #define VERSION "2.85-dev" | 4 | #define VERSION "2.89" |
| 5 | 5 | ||
| 6 | #define USER_AGENT "snac/" VERSION | 6 | #define USER_AGENT "snac/" VERSION |
| 7 | 7 | ||
| @@ -105,6 +105,9 @@ int validate_uid(const char *uid); | |||
| 105 | xs_str *hash_password(const char *uid, const char *passwd, const char *nonce); | 105 | xs_str *hash_password(const char *uid, const char *passwd, const char *nonce); |
| 106 | int check_password(const char *uid, const char *passwd, const char *hash); | 106 | int check_password(const char *uid, const char *passwd, const char *hash); |
| 107 | 107 | ||
| 108 | int strip_media(const char *fn); | ||
| 109 | int check_strip_tool(void); | ||
| 110 | |||
| 108 | void srv_archive(const char *direction, const char *url, xs_dict *req, | 111 | void srv_archive(const char *direction, const char *url, xs_dict *req, |
| 109 | const char *payload, int p_size, | 112 | const char *payload, int p_size, |
| 110 | int status, xs_dict *headers, | 113 | int status, xs_dict *headers, |
| @@ -146,12 +149,15 @@ void object_touch(const char *id); | |||
| 146 | int object_admire(const char *id, const char *actor, int like); | 149 | int object_admire(const char *id, const char *actor, int like); |
| 147 | int object_unadmire(const char *id, const char *actor, int like); | 150 | int object_unadmire(const char *id, const char *actor, int like); |
| 148 | 151 | ||
| 152 | int object_emoji_react(const char *mid, const char *eid); | ||
| 153 | int object_rm_emoji_react(const char *mid, const char *eid); | ||
| 149 | int object_likes_len(const char *id); | 154 | int object_likes_len(const char *id); |
| 150 | int object_announces_len(const char *id); | 155 | int object_announces_len(const char *id); |
| 151 | 156 | ||
| 152 | xs_list *object_children(const char *id); | 157 | xs_list *object_children(const char *id); |
| 153 | xs_list *object_likes(const char *id); | 158 | xs_list *object_likes(const char *id); |
| 154 | xs_list *object_announces(const char *id); | 159 | xs_list *object_announces(const char *id); |
| 160 | xs_list *object_get_emoji_reacts(const char *id); | ||
| 155 | int object_parent(const char *md5, char parent[MD5_HEX_SIZE]); | 161 | int object_parent(const char *md5, char parent[MD5_HEX_SIZE]); |
| 156 | 162 | ||
| 157 | int object_user_cache_add(snac *snac, const char *id, const char *cachedir); | 163 | int object_user_cache_add(snac *snac, const char *id, const char *cachedir); |
| @@ -180,7 +186,8 @@ xs_str *user_index_fn(snac *user, const char *idx_name); | |||
| 180 | xs_list *timeline_simple_list(snac *user, const char *idx_name, int skip, int show, int *more); | 186 | xs_list *timeline_simple_list(snac *user, const char *idx_name, int skip, int show, int *more); |
| 181 | xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show, int *more); | 187 | xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show, int *more); |
| 182 | int timeline_add(snac *snac, const char *id, const xs_dict *o_msg); | 188 | int timeline_add(snac *snac, const char *id, const xs_dict *o_msg); |
| 183 | int timeline_admire(snac *snac, const char *id, const char *admirer, int like); | 189 | int timeline_admire(snac *snac, const char *id, const char *admirer, int like, const xs_dict *msg); |
| 190 | int timeline_emoji_react(const char *atto, const char *id, const xs_dict *o_msg); | ||
| 184 | 191 | ||
| 185 | xs_list *timeline_top_level(snac *snac, const xs_list *list); | 192 | xs_list *timeline_top_level(snac *snac, const xs_list *list); |
| 186 | void timeline_add_mark(snac *user); | 193 | void timeline_add_mark(snac *user); |
| @@ -201,6 +208,8 @@ void unmute(snac *snac, const char *actor); | |||
| 201 | int is_muted(snac *snac, const char *actor); | 208 | int is_muted(snac *snac, const char *actor); |
| 202 | xs_list *muted_list(snac *user); | 209 | xs_list *muted_list(snac *user); |
| 203 | 210 | ||
| 211 | xs_str *emoji_reacted(snac *user, const char *id); | ||
| 212 | |||
| 204 | int is_bookmarked(snac *user, const char *id); | 213 | int is_bookmarked(snac *user, const char *id); |
| 205 | int bookmark(snac *user, const char *id); | 214 | int bookmark(snac *user, const char *id); |
| 206 | int unbookmark(snac *user, const char *id); | 215 | int unbookmark(snac *user, const char *id); |
| @@ -358,6 +367,8 @@ xs_list *get_attachments(const xs_dict *msg); | |||
| 358 | 367 | ||
| 359 | xs_dict *msg_admiration(snac *snac, const char *object, const char *type); | 368 | xs_dict *msg_admiration(snac *snac, const char *object, const char *type); |
| 360 | xs_dict *msg_repulsion(snac *user, const char *id, const char *type); | 369 | xs_dict *msg_repulsion(snac *user, const char *id, const char *type); |
| 370 | xs_dict *msg_emoji_init(snac *user, const char *mid, const char *eid); | ||
| 371 | xs_dict *msg_emoji_unreact(snac *user, const char *id, const char *type); | ||
| 361 | xs_dict *msg_create(snac *snac, const xs_dict *object); | 372 | xs_dict *msg_create(snac *snac, const xs_dict *object); |
| 362 | xs_dict *msg_follow(snac *snac, const char *actor); | 373 | xs_dict *msg_follow(snac *snac, const char *actor); |
| 363 | 374 | ||
| @@ -388,6 +399,7 @@ int send_to_inbox(snac *snac, const xs_str *inbox, const xs_dict *msg, | |||
| 388 | xs_str *get_actor_inbox(const char *actor, int shared); | 399 | xs_str *get_actor_inbox(const char *actor, int shared); |
| 389 | int send_to_actor(snac *snac, const char *actor, const xs_dict *msg, | 400 | int send_to_actor(snac *snac, const char *actor, const xs_dict *msg, |
| 390 | xs_val **payload, int *p_size, int timeout); | 401 | xs_val **payload, int *p_size, int timeout); |
| 402 | int is_msg_mine(snac *user, const char *id); | ||
| 391 | int is_msg_public(const xs_dict *msg); | 403 | int is_msg_public(const xs_dict *msg); |
| 392 | int is_msg_from_private_user(const xs_dict *msg); | 404 | int is_msg_from_private_user(const xs_dict *msg); |
| 393 | int is_msg_for_me(snac *snac, const xs_dict *msg); | 405 | int is_msg_for_me(snac *snac, const xs_dict *msg); |
| @@ -403,6 +415,7 @@ int activitypub_post_handler(const xs_dict *req, const char *q_path, | |||
| 403 | char **body, int *b_size, char **ctype); | 415 | char **body, int *b_size, char **ctype); |
| 404 | 416 | ||
| 405 | xs_dict *emojis(void); | 417 | xs_dict *emojis(void); |
| 418 | xs_dict *emojis_rm_categories(void); | ||
| 406 | xs_str *format_text_with_emoji(snac *user, const char *text, int ems, const char *proxy); | 419 | xs_str *format_text_with_emoji(snac *user, const char *text, int ems, const char *proxy); |
| 407 | xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag); | 420 | xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag); |
| 408 | xs_str *sanitize(const char *content); | 421 | xs_str *sanitize(const char *content); |
| @@ -410,7 +423,7 @@ xs_str *encode_html(const char *str); | |||
| 410 | 423 | ||
| 411 | xs_str *html_timeline(snac *user, const xs_list *list, int read_only, | 424 | xs_str *html_timeline(snac *user, const xs_list *list, int read_only, |
| 412 | int skip, int show, int show_more, | 425 | int skip, int show, int show_more, |
| 413 | const char *title, const char *page, int utl, const char *error); | 426 | const char *title, const char *page, int utl, const char *error, int terse); |
| 414 | 427 | ||
| 415 | int html_get_handler(const xs_dict *req, const char *q_path, | 428 | int html_get_handler(const xs_dict *req, const char *q_path, |
| 416 | char **body, int *b_size, char **ctype, | 429 | char **body, int *b_size, char **ctype, |
| @@ -485,3 +498,5 @@ void rss_to_timeline(snac *user, const char *url); | |||
| 485 | void rss_poll_hashtags(void); | 498 | void rss_poll_hashtags(void); |
| 486 | 499 | ||
| 487 | void data_fsck(void); | 500 | void data_fsck(void); |
| 501 | |||
| 502 | xs_list *user_top_ten(snac *user, int count); | ||