summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'data.c')
-rw-r--r--data.c15
1 files changed, 9 insertions, 6 deletions
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);