summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/activitypub.c b/activitypub.c
index f4b4eac..6e40a88 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -163,7 +163,7 @@ const char *get_atto(const xs_dict *msg)
163 if (xs_type(actor) == XSTYPE_LIST) { 163 if (xs_type(actor) == XSTYPE_LIST) {
164 const xs_list *p = actor; 164 const xs_list *p = actor;
165 int c = 0; 165 int c = 0;
166 xs_dict *v; 166 const xs_dict *v;
167 actor = NULL; 167 actor = NULL;
168 168
169 while (actor == NULL && xs_list_next(p, &v, &c)) { 169 while (actor == NULL && xs_list_next(p, &v, &c)) {
@@ -192,7 +192,7 @@ xs_list *get_attachments(const xs_dict *msg)
192 /* try first the attachments list */ 192 /* try first the attachments list */
193 if (!xs_is_null(p = xs_dict_get(msg, "attachment"))) { 193 if (!xs_is_null(p = xs_dict_get(msg, "attachment"))) {
194 xs *attach = NULL; 194 xs *attach = NULL;
195 xs_val *v; 195 const xs_val *v;
196 196
197 /* ensure it's a list */ 197 /* ensure it's a list */
198 if (xs_type(p) == XSTYPE_DICT) { 198 if (xs_type(p) == XSTYPE_DICT) {
@@ -257,7 +257,7 @@ xs_list *get_attachments(const xs_dict *msg)
257 const char *href = NULL; 257 const char *href = NULL;
258 const char *type = NULL; 258 const char *type = NULL;
259 int c = 0; 259 int c = 0;
260 xs_val *v; 260 const xs_val *v;
261 261
262 while (href == NULL && xs_list_next(p, &v, &c)) { 262 while (href == NULL && xs_list_next(p, &v, &c)) {
263 if (xs_type(v) == XSTYPE_DICT) { 263 if (xs_type(v) == XSTYPE_DICT) {
@@ -271,7 +271,7 @@ xs_list *get_attachments(const xs_dict *msg)
271 strcmp(mtype, "application/x-mpegURL") == 0 && 271 strcmp(mtype, "application/x-mpegURL") == 0 &&
272 xs_type(tag) == XSTYPE_LIST) { 272 xs_type(tag) == XSTYPE_LIST) {
273 /* now iterate the tag list, looking for a video URL */ 273 /* now iterate the tag list, looking for a video URL */
274 xs_dict *d; 274 const xs_dict *d;
275 int c = 0; 275 int c = 0;
276 276
277 while (href == NULL && xs_list_next(tag, &d, &c)) { 277 while (href == NULL && xs_list_next(tag, &d, &c)) {
@@ -482,7 +482,7 @@ xs_list *recipient_list(snac *snac, const xs_dict *msg, int expand_public)
482 const xs_list *lists[] = { to, cc, NULL }; 482 const xs_list *lists[] = { to, cc, NULL };
483 for (n = 0; lists[n]; n++) { 483 for (n = 0; lists[n]; n++) {
484 xs_list *l = (xs_list *)lists[n]; 484 xs_list *l = (xs_list *)lists[n];
485 char *v; 485 const char *v;
486 xs *tl = NULL; 486 xs *tl = NULL;
487 487
488 /* if it's a string, create a list with only one element */ 488 /* if it's a string, create a list with only one element */
@@ -497,7 +497,7 @@ xs_list *recipient_list(snac *snac, const xs_dict *msg, int expand_public)
497 if (expand_public && strcmp(v, public_address) == 0) { 497 if (expand_public && strcmp(v, public_address) == 0) {
498 /* iterate the followers and add them */ 498 /* iterate the followers and add them */
499 xs *fwers = follower_list(snac); 499 xs *fwers = follower_list(snac);
500 char *actor; 500 const char *actor;
501 501
502 char *p = fwers; 502 char *p = fwers;
503 while (xs_list_iter(&p, &actor)) 503 while (xs_list_iter(&p, &actor))
@@ -628,7 +628,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
628 const xs_dict *msg = xs_dict_get(c_msg, "object"); 628 const xs_dict *msg = xs_dict_get(c_msg, "object");
629 xs *rcpts = recipient_list(snac, msg, 0); 629 xs *rcpts = recipient_list(snac, msg, 0);
630 xs_list *p = rcpts; 630 xs_list *p = rcpts;
631 xs_str *v; 631 const xs_str *v;
632 632
633 xs *actor_followers = NULL; 633 xs *actor_followers = NULL;
634 634
@@ -693,7 +693,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag)
693 xs_list *tl = *tag; 693 xs_list *tl = *tag;
694 xs *split; 694 xs *split;
695 xs_list *p; 695 xs_list *p;
696 xs_val *v; 696 const xs_val *v;
697 int n = 0; 697 int n = 0;
698 698
699 /* create a default server for incomplete mentions */ 699 /* create a default server for incomplete mentions */
@@ -1205,8 +1205,8 @@ xs_dict *msg_actor(snac *snac)
1205 const xs_dict *metadata = xs_dict_get(snac->config, "metadata"); 1205 const xs_dict *metadata = xs_dict_get(snac->config, "metadata");
1206 if (xs_type(metadata) == XSTYPE_DICT) { 1206 if (xs_type(metadata) == XSTYPE_DICT) {
1207 xs *attach = xs_list_new(); 1207 xs *attach = xs_list_new();
1208 xs_str *k; 1208 const xs_str *k;
1209 xs_str *v; 1209 const xs_str *v;
1210 1210
1211 int c = 0; 1211 int c = 0;
1212 while (xs_dict_next(metadata, &k, &v, &c)) { 1212 while (xs_dict_next(metadata, &k, &v, &c)) {
@@ -1351,7 +1351,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
1351 xs *atls = xs_list_new(); 1351 xs *atls = xs_list_new();
1352 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL); 1352 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL);
1353 xs_list *p; 1353 xs_list *p;
1354 xs_val *v; 1354 const xs_val *v;
1355 1355
1356 if (rcpts == NULL) 1356 if (rcpts == NULL)
1357 to = xs_list_new(); 1357 to = xs_list_new();
@@ -1528,7 +1528,7 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach,
1528 1528
1529 xs *o = xs_list_new(); 1529 xs *o = xs_list_new();
1530 xs_list *p = (xs_list *)opts; 1530 xs_list *p = (xs_list *)opts;
1531 xs_str *v; 1531 const xs_str *v;
1532 xs *replies = xs_json_loads("{\"type\":\"Collection\",\"totalItems\":0}"); 1532 xs *replies = xs_json_loads("{\"type\":\"Collection\",\"totalItems\":0}");
1533 1533
1534 xs_set_init(&seen); 1534 xs_set_init(&seen);
@@ -1576,7 +1576,7 @@ int update_question(snac *user, const char *id)
1576 xs *lopts = xs_list_new(); 1576 xs *lopts = xs_list_new();
1577 const xs_list *opts; 1577 const xs_list *opts;
1578 xs_list *p; 1578 xs_list *p;
1579 xs_val *v; 1579 const xs_val *v;
1580 1580
1581 /* get the object */ 1581 /* get the object */
1582 if (!valid_status(object_get(id, &msg))) 1582 if (!valid_status(object_get(id, &msg)))
@@ -2190,7 +2190,7 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
2190 xs *rcpts = recipient_list(snac, msg, 1); 2190 xs *rcpts = recipient_list(snac, msg, 1);
2191 xs_set inboxes; 2191 xs_set inboxes;
2192 xs_list *p; 2192 xs_list *p;
2193 xs_str *actor; 2193 const xs_str *actor;
2194 2194
2195 xs_set_init(&inboxes); 2195 xs_set_init(&inboxes);
2196 2196
@@ -2212,7 +2212,7 @@ void process_user_queue_item(snac *snac, xs_dict *q_item)
2212 if (is_msg_public(msg)) { 2212 if (is_msg_public(msg)) {
2213 if (xs_type(xs_dict_get(srv_config, "disable_inbox_collection")) != XSTYPE_TRUE) { 2213 if (xs_type(xs_dict_get(srv_config, "disable_inbox_collection")) != XSTYPE_TRUE) {
2214 xs *shibx = inbox_list(); 2214 xs *shibx = inbox_list();
2215 xs_str *inbox; 2215 const xs_str *inbox;
2216 2216
2217 p = shibx; 2217 p = shibx;
2218 while (xs_list_iter(&p, &inbox)) { 2218 while (xs_list_iter(&p, &inbox)) {
@@ -2304,7 +2304,7 @@ int process_user_queue(snac *snac)
2304 xs *list = user_queue(snac); 2304 xs *list = user_queue(snac);
2305 2305
2306 xs_list *p = list; 2306 xs_list *p = list;
2307 xs_str *fn; 2307 const xs_str *fn;
2308 2308
2309 while (xs_list_iter(&p, &fn)) { 2309 while (xs_list_iter(&p, &fn)) {
2310 xs *q_item = dequeue(fn); 2310 xs *q_item = dequeue(fn);
@@ -2511,7 +2511,7 @@ void process_queue_item(xs_dict *q_item)
2511 2511
2512 xs *users = user_list(); 2512 xs *users = user_list();
2513 xs_list *p = users; 2513 xs_list *p = users;
2514 char *v; 2514 const char *v;
2515 int cnt = 0; 2515 int cnt = 0;
2516 2516
2517 while (xs_list_iter(&p, &v)) { 2517 while (xs_list_iter(&p, &v)) {
@@ -2554,7 +2554,7 @@ int process_queue(void)
2554 xs *list = queue(); 2554 xs *list = queue();
2555 2555
2556 xs_list *p = list; 2556 xs_list *p = list;
2557 xs_str *fn; 2557 const xs_str *fn;
2558 2558
2559 while (xs_list_iter(&p, &fn)) { 2559 while (xs_list_iter(&p, &fn)) {
2560 xs *q_item = dequeue(fn); 2560 xs *q_item = dequeue(fn);
@@ -2616,7 +2616,8 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
2616 xs *elems = timeline_simple_list(&snac, "public", 0, 20); 2616 xs *elems = timeline_simple_list(&snac, "public", 0, 20);
2617 xs *list = xs_list_new(); 2617 xs *list = xs_list_new();
2618 msg = msg_collection(&snac, id); 2618 msg = msg_collection(&snac, id);
2619 char *p, *v; 2619 char *p;
2620 const char *v;
2620 2621
2621 p = elems; 2622 p = elems;
2622 while (xs_list_iter(&p, &v)) { 2623 while (xs_list_iter(&p, &v)) {