diff options
Diffstat (limited to 'snac.h')
| -rw-r--r-- | snac.h | 31 |
1 files changed, 18 insertions, 13 deletions
| @@ -1,7 +1,7 @@ | |||
| 1 | /* snac - A simple, minimalistic ActivityPub instance */ | 1 | /* snac - A simple, minimalistic ActivityPub instance */ |
| 2 | /* copyright (c) 2022 - 2023 grunfink / MIT license */ | 2 | /* copyright (c) 2022 - 2023 grunfink / MIT license */ |
| 3 | 3 | ||
| 4 | #define VERSION "2.29" | 4 | #define VERSION "2.30" |
| 5 | 5 | ||
| 6 | #define USER_AGENT "snac/" VERSION | 6 | #define USER_AGENT "snac/" VERSION |
| 7 | 7 | ||
| @@ -83,6 +83,7 @@ int object_del_if_unref(const char *id); | |||
| 83 | double object_ctime_by_md5(const char *md5); | 83 | double object_ctime_by_md5(const char *md5); |
| 84 | double object_ctime(const char *id); | 84 | double object_ctime(const char *id); |
| 85 | int object_admire(const char *id, const char *actor, int like); | 85 | int object_admire(const char *id, const char *actor, int like); |
| 86 | int object_unadmire(const char *id, const char *actor, int like); | ||
| 86 | 87 | ||
| 87 | int object_likes_len(const char *id); | 88 | int object_likes_len(const char *id); |
| 88 | int object_announces_len(const char *id); | 89 | int object_announces_len(const char *id); |
| @@ -105,14 +106,14 @@ int timeline_touch(snac *snac); | |||
| 105 | int timeline_here(snac *snac, const char *md5); | 106 | int timeline_here(snac *snac, const char *md5); |
| 106 | int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg); | 107 | int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg); |
| 107 | int timeline_del(snac *snac, char *id); | 108 | int timeline_del(snac *snac, char *id); |
| 108 | d_char *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show); | 109 | xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show); |
| 109 | d_char *timeline_list(snac *snac, const char *idx_name, int skip, int show); | 110 | xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show); |
| 110 | int timeline_add(snac *snac, char *id, char *o_msg); | 111 | int timeline_add(snac *snac, char *id, char *o_msg); |
| 111 | void timeline_admire(snac *snac, char *id, char *admirer, int like); | 112 | void timeline_admire(snac *snac, char *id, char *admirer, int like); |
| 112 | 113 | ||
| 113 | xs_list *timeline_top_level(snac *snac, xs_list *list); | 114 | xs_list *timeline_top_level(snac *snac, xs_list *list); |
| 114 | 115 | xs_list *local_list(snac *snac, int max); | |
| 115 | d_char *local_list(snac *snac, int max); | 116 | xs_list *timeline_instance_list(int skip, int show); |
| 116 | 117 | ||
| 117 | int following_add(snac *snac, const char *actor, const xs_dict *msg); | 118 | int following_add(snac *snac, const char *actor, const xs_dict *msg); |
| 118 | int following_del(snac *snac, const char *actor); | 119 | int following_del(snac *snac, const char *actor); |
| @@ -127,8 +128,8 @@ int is_muted(snac *snac, const char *actor); | |||
| 127 | void hide(snac *snac, const char *id); | 128 | void hide(snac *snac, const char *id); |
| 128 | int is_hidden(snac *snac, const char *id); | 129 | int is_hidden(snac *snac, const char *id); |
| 129 | 130 | ||
| 130 | int actor_add(snac *snac, const char *actor, d_char *msg); | 131 | int actor_add(const char *actor, xs_dict *msg); |
| 131 | int actor_get(snac *snac, const char *actor, d_char **data); | 132 | int actor_get(snac *snac, const char *actor, xs_dict **data); |
| 132 | 133 | ||
| 133 | int static_get(snac *snac, const char *id, d_char **data, int *size); | 134 | int static_get(snac *snac, const char *id, d_char **data, int *size); |
| 134 | void static_put(snac *snac, const char *id, const char *data, int size); | 135 | void static_put(snac *snac, const char *id, const char *data, int size); |
| @@ -154,7 +155,7 @@ void inbox_add(const char *inbox); | |||
| 154 | void inbox_add_by_actor(const xs_dict *actor); | 155 | void inbox_add_by_actor(const xs_dict *actor); |
| 155 | xs_list *inbox_list(void); | 156 | xs_list *inbox_list(void); |
| 156 | 157 | ||
| 157 | void enqueue_input(snac *snac, xs_dict *msg, xs_dict *req, int retries); | 158 | void enqueue_input(snac *snac, const xs_dict *msg, const xs_dict *req, int retries); |
| 158 | void enqueue_output_raw(const char *keyid, const char *seckey, | 159 | void enqueue_output_raw(const char *keyid, const char *seckey, |
| 159 | xs_dict *msg, xs_str *inbox, int retries); | 160 | xs_dict *msg, xs_str *inbox, int retries); |
| 160 | void enqueue_output(snac *snac, xs_dict *msg, xs_str *inbox, int retries); | 161 | void enqueue_output(snac *snac, xs_dict *msg, xs_str *inbox, int retries); |
| @@ -186,7 +187,7 @@ int check_signature(snac *snac, xs_dict *req, xs_str **err); | |||
| 186 | void httpd(void); | 187 | void httpd(void); |
| 187 | 188 | ||
| 188 | int webfinger_request(const char *qs, char **actor, char **user); | 189 | int webfinger_request(const char *qs, char **actor, char **user); |
| 189 | int webfinger_get_handler(d_char *req, char *q_path, | 190 | int webfinger_get_handler(xs_dict *req, char *q_path, |
| 190 | char **body, int *b_size, char **ctype); | 191 | char **body, int *b_size, char **ctype); |
| 191 | 192 | ||
| 192 | const char *default_avatar_base64(void); | 193 | const char *default_avatar_base64(void); |
| @@ -202,6 +203,8 @@ d_char *msg_undo(snac *snac, char *object); | |||
| 202 | d_char *msg_delete(snac *snac, char *id); | 203 | d_char *msg_delete(snac *snac, char *id); |
| 203 | d_char *msg_actor(snac *snac); | 204 | d_char *msg_actor(snac *snac); |
| 204 | xs_dict *msg_update(snac *snac, xs_dict *object); | 205 | xs_dict *msg_update(snac *snac, xs_dict *object); |
| 206 | xs_dict *msg_ping(snac *user, const char *rcpt); | ||
| 207 | xs_dict *msg_pong(snac *user, const char *rcpt, const char *object); | ||
| 205 | 208 | ||
| 206 | int activitypub_request(snac *snac, const char *url, xs_dict **data); | 209 | int activitypub_request(snac *snac, const char *url, xs_dict **data); |
| 207 | int actor_request(snac *snac, const char *actor, xs_dict **data); | 210 | int actor_request(snac *snac, const char *actor, xs_dict **data); |
| @@ -219,17 +222,19 @@ int process_user_queue(snac *snac); | |||
| 219 | void process_queue_item(xs_dict *q_item); | 222 | void process_queue_item(xs_dict *q_item); |
| 220 | int process_queue(void); | 223 | int process_queue(void); |
| 221 | 224 | ||
| 222 | int activitypub_get_handler(d_char *req, char *q_path, | 225 | int activitypub_get_handler(const xs_dict *req, const char *q_path, |
| 223 | char **body, int *b_size, char **ctype); | 226 | char **body, int *b_size, char **ctype); |
| 224 | int activitypub_post_handler(d_char *req, char *q_path, | 227 | int activitypub_post_handler(const xs_dict *req, const char *q_path, |
| 225 | char *payload, int p_size, | 228 | char *payload, int p_size, |
| 226 | char **body, int *b_size, char **ctype); | 229 | char **body, int *b_size, char **ctype); |
| 227 | 230 | ||
| 228 | d_char *not_really_markdown(const char *content); | 231 | d_char *not_really_markdown(const char *content); |
| 229 | d_char *sanitize(const char *str); | 232 | d_char *sanitize(const char *str); |
| 230 | 233 | ||
| 231 | int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype); | 234 | int html_get_handler(const xs_dict *req, const char *q_path, |
| 232 | int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | 235 | char **body, int *b_size, char **ctype); |
| 236 | int html_post_handler(const xs_dict *req, const char *q_path, | ||
| 237 | char *payload, int p_size, | ||
| 233 | char **body, int *b_size, char **ctype); | 238 | char **body, int *b_size, char **ctype); |
| 234 | 239 | ||
| 235 | int snac_init(const char *_basedir); | 240 | int snac_init(const char *_basedir); |