Also add announces to lists.

This commit is contained in:
default 2024-04-30 19:41:08 +02:00
parent 4e23570c21
commit 6a77c634ad
3 changed files with 13 additions and 7 deletions

View File

@ -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

13
data.c
View File

@ -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");
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);

2
snac.h
View File

@ -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);