summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorGravatar default2023-09-18 11:24:30 +0200
committerGravatar default2023-09-18 11:24:30 +0200
commitc4b2d3bc692f39ddca814b104e52939261a0bf6e (patch)
treec2c2328e679722d293a6abde40789222e5350328 /activitypub.c
parentAdded web UI to store profile metadata (as key/value pairs). (diff)
downloadsnac2-c4b2d3bc692f39ddca814b104e52939261a0bf6e.tar.gz
snac2-c4b2d3bc692f39ddca814b104e52939261a0bf6e.tar.xz
snac2-c4b2d3bc692f39ddca814b104e52939261a0bf6e.zip
If an account has metadata, return them as attachment PropertyValues in msg_actor().
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c
index 32d0697..6770039 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -972,6 +972,26 @@ xs_dict *msg_actor(snac *snac)
972 msg = xs_dict_set(msg, "image", d); 972 msg = xs_dict_set(msg, "image", d);
973 } 973 }
974 974
975 /* add the metadata as attachments of PropertyValue */
976 xs_dict *metadata = xs_dict_get(snac->config, "metadata");
977 if (xs_type(metadata) == XSTYPE_DICT) {
978 xs *attach = xs_list_new();
979 xs_str *k;
980 xs_str *v;
981
982 while (xs_dict_iter(&metadata, &k, &v)) {
983 xs *d = xs_dict_new();
984
985 d = xs_dict_append(d, "type", "PropertyValue");
986 d = xs_dict_append(d, "name", k);
987 d = xs_dict_append(d, "value", v);
988
989 attach = xs_list_append(attach, d);
990 }
991
992 msg = xs_dict_set(msg, "attachment", attach);
993 }
994
975 return msg; 995 return msg;
976} 996}
977 997