diff options
| author | 2024-11-23 17:08:57 +0100 | |
|---|---|---|
| committer | 2024-11-23 17:08:57 +0100 | |
| commit | 09d268495c12d3c00a7293fbf445830bcc9d74c3 (patch) | |
| tree | 6a0f3838336ecc8679bedc78ff713c76ec4ef5c8 /activitypub.c | |
| parent | Version 2.64 RELEASED. (diff) | |
| download | penes-snac2-09d268495c12d3c00a7293fbf445830bcc9d74c3.tar.gz penes-snac2-09d268495c12d3c00a7293fbf445830bcc9d74c3.tar.xz penes-snac2-09d268495c12d3c00a7293fbf445830bcc9d74c3.zip | |
The 'metadata' field in user.json is now a string instead of a dict.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 25 |
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; |