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) snac_log(snac, xs_fmt("repeated 'Announce' from %s to %s", actor, object)); + /* distribute the post with the actor as 'proxy' */ + list_distribute(snac, actor, a_msg); + do_notify = 1; } 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) tag_index(id, o_msg); - list_distribute(snac, o_msg); + list_distribute(snac, NULL, o_msg); snac_debug(snac, 1, xs_fmt("timeline_add %s", id)); @@ -1881,14 +1881,17 @@ xs_val *list_content(snac *user, const char *list, const char *actor_md5, int op } -void list_distribute(snac *user, const xs_dict *post) +void list_distribute(snac *user, const char *who, const xs_dict *post) /* distributes the post to all appropriate lists */ { - char *atto = get_atto(post); - char *id = xs_dict_get(post, "id"); + char *id = xs_dict_get(post, "id"); - if (xs_type(atto) == XSTYPE_STRING && xs_type(id) == XSTYPE_STRING) { - xs *a_md5 = xs_md5_hex(atto, strlen(atto)); + /* if who is not set, use the attributedTo in the message */ + if (xs_is_null(who)) + who = get_atto(post); + + if (xs_type(who) == XSTYPE_STRING && xs_type(id) == XSTYPE_STRING) { + xs *a_md5 = xs_md5_hex(who, strlen(who)); xs *i_md5 = xs_md5_hex(id, strlen(id)); xs *spec = xs_fmt("%s/list/" "*.lst", user->basedir); 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); xs_val *list_maint(snac *user, const char *list, int op); xs_val *list_content(snac *user, const char *list_id, const char *actor_md5, int op); -void list_distribute(snac *user, const xs_dict *post); +void list_distribute(snac *user, const char *who, const xs_dict *post); int actor_add(const char *actor, xs_dict *msg); int actor_get(const char *actor, xs_dict **data);