diff options
| -rw-r--r-- | activitypub.c | 3 | ||||
| -rw-r--r-- | data.c | 15 | ||||
| -rw-r--r-- | snac.h | 2 |
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 |
| @@ -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 | ||
| 1884 | void list_distribute(snac *user, const xs_dict *post) | 1884 | void 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); |
| @@ -176,7 +176,7 @@ xs_list *tag_search(char *tag, int skip, int show); | |||
| 176 | 176 | ||
| 177 | xs_val *list_maint(snac *user, const char *list, int op); | 177 | xs_val *list_maint(snac *user, const char *list, int op); |
| 178 | xs_val *list_content(snac *user, const char *list_id, const char *actor_md5, int op); | 178 | xs_val *list_content(snac *user, const char *list_id, const char *actor_md5, int op); |
| 179 | void list_distribute(snac *user, const xs_dict *post); | 179 | void list_distribute(snac *user, const char *who, const xs_dict *post); |
| 180 | 180 | ||
| 181 | int actor_add(const char *actor, xs_dict *msg); | 181 | int actor_add(const char *actor, xs_dict *msg); |
| 182 | int actor_get(const char *actor, xs_dict **data); | 182 | int actor_get(const char *actor, xs_dict **data); |