summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-04-30 19:41:08 +0200
committerGravatar default2024-04-30 19:41:08 +0200
commit6a77c634ad9938744bae6d718b209557fa37018c (patch)
treef02676a9d4a11b034d01be6ceb545e65a8e17946
parentAdded more internal integrity checks. (diff)
downloadsnac2-6a77c634ad9938744bae6d718b209557fa37018c.tar.gz
snac2-6a77c634ad9938744bae6d718b209557fa37018c.tar.xz
snac2-6a77c634ad9938744bae6d718b209557fa37018c.zip
Also add announces to lists.
-rw-r--r--activitypub.c3
-rw-r--r--data.c15
-rw-r--r--snac.h2
3 files changed, 13 insertions, 7 deletions
diff --git a/activitypub.c b/activitypub.c
index 94c0d30..2691a6a 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -2099,6 +2099,9 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
2099 snac_log(snac, xs_fmt("repeated 'Announce' from %s to %s", 2099 snac_log(snac, xs_fmt("repeated 'Announce' from %s to %s",
2100 actor, object)); 2100 actor, object));
2101 2101
2102 /* distribute the post with the actor as 'proxy' */
2103 list_distribute(snac, actor, a_msg);
2104
2102 do_notify = 1; 2105 do_notify = 1;
2103 } 2106 }
2104 else 2107 else
diff --git a/data.c b/data.c
index 82d0acc..db544f4 100644
--- a/data.c
+++ b/data.c
@@ -1165,7 +1165,7 @@ int timeline_add(snac *snac, const char *id, const xs_dict *o_msg)
1165 1165
1166 tag_index(id, o_msg); 1166 tag_index(id, o_msg);
1167 1167
1168 list_distribute(snac, o_msg); 1168 list_distribute(snac, NULL, o_msg);
1169 1169
1170 snac_debug(snac, 1, xs_fmt("timeline_add %s", id)); 1170 snac_debug(snac, 1, xs_fmt("timeline_add %s", id));
1171 1171
@@ -1881,14 +1881,17 @@ xs_val *list_content(snac *user, const char *list, const char *actor_md5, int op
1881} 1881}
1882 1882
1883 1883
1884void list_distribute(snac *user, const xs_dict *post) 1884void list_distribute(snac *user, const char *who, const xs_dict *post)
1885/* distributes the post to all appropriate lists */ 1885/* distributes the post to all appropriate lists */
1886{ 1886{
1887 char *atto = get_atto(post); 1887 char *id = xs_dict_get(post, "id");
1888 char *id = xs_dict_get(post, "id");
1889 1888
1890 if (xs_type(atto) == XSTYPE_STRING && xs_type(id) == XSTYPE_STRING) { 1889 /* if who is not set, use the attributedTo in the message */
1891 xs *a_md5 = xs_md5_hex(atto, strlen(atto)); 1890 if (xs_is_null(who))
1891 who = get_atto(post);
1892
1893 if (xs_type(who) == XSTYPE_STRING && xs_type(id) == XSTYPE_STRING) {
1894 xs *a_md5 = xs_md5_hex(who, strlen(who));
1892 xs *i_md5 = xs_md5_hex(id, strlen(id)); 1895 xs *i_md5 = xs_md5_hex(id, strlen(id));
1893 xs *spec = xs_fmt("%s/list/" "*.lst", user->basedir); 1896 xs *spec = xs_fmt("%s/list/" "*.lst", user->basedir);
1894 xs *ls = xs_glob(spec, 0, 0); 1897 xs *ls = xs_glob(spec, 0, 0);
diff --git a/snac.h b/snac.h
index b478c7e..74e58cd 100644
--- a/snac.h
+++ b/snac.h
@@ -176,7 +176,7 @@ xs_list *tag_search(char *tag, int skip, int show);
176 176
177xs_val *list_maint(snac *user, const char *list, int op); 177xs_val *list_maint(snac *user, const char *list, int op);
178xs_val *list_content(snac *user, const char *list_id, const char *actor_md5, int op); 178xs_val *list_content(snac *user, const char *list_id, const char *actor_md5, int op);
179void list_distribute(snac *user, const xs_dict *post); 179void list_distribute(snac *user, const char *who, const xs_dict *post);
180 180
181int actor_add(const char *actor, xs_dict *msg); 181int actor_add(const char *actor, xs_dict *msg);
182int actor_get(const char *actor, xs_dict **data); 182int actor_get(const char *actor, xs_dict **data);