summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c
index 473675d..8c0c423 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1218,7 +1218,30 @@ xs_dict *msg_actor(snac *snac)
1218 } 1218 }
1219 1219
1220 /* add the metadata as attachments of PropertyValue */ 1220 /* add the metadata as attachments of PropertyValue */
1221 const xs_dict *metadata = xs_dict_get(snac->config, "metadata"); 1221 xs *metadata = NULL;
1222 const xs_dict *md = xs_dict_get(snac->config, "metadata");
1223
1224 if (xs_type(md) == XSTYPE_DICT)
1225 metadata = xs_dup(md);
1226 else
1227 if (xs_type(md) == XSTYPE_STRING) {
1228 metadata = xs_dict_new();
1229 xs *l = xs_split(md, "\r\n");
1230 const char *ll;
1231
1232 xs_list_foreach(l, ll) {
1233 xs *kv = xs_split_n(ll, "=", 1);
1234 const char *k = xs_list_get(kv, 0);
1235 const char *v = xs_list_get(kv, 1);
1236
1237 if (k && v) {
1238 xs *kk = xs_strip_i(xs_dup(k));
1239 xs *vv = xs_strip_i(xs_dup(v));
1240 metadata = xs_dict_set(metadata, kk, vv);
1241 }
1242 }
1243 }
1244
1222 if (xs_type(metadata) == XSTYPE_DICT) { 1245 if (xs_type(metadata) == XSTYPE_DICT) {
1223 xs *attach = xs_list_new(); 1246 xs *attach = xs_list_new();
1224 const xs_str *k; 1247 const xs_str *k;