Skip to content

Commit

Permalink
jmap_contact.c: parse OnlineService/vCardName property
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed Aug 11, 2023
1 parent b8a80ed commit 725fd12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions cassandane/tiny-tests/JMAPContacts/card-set-create-online
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sub test_card_set_create_online
x1 => {
'@type' => 'OnlineService',
uri => 'xmpp:[email protected]',
vCardName => 'impp',
pref => 1
},
x2 => {
Expand Down
13 changes: 13 additions & 0 deletions imap/jmap_contact.c
Original file line number Diff line number Diff line change
Expand Up @@ -9392,6 +9392,18 @@ static vcardproperty *_jsonline_to_vcard(struct jmap_parser *parser, json_t *obj
user = NULL;
}

jprop = json_object_get(obj, "vCardName");
if (json_is_string(jprop)) {
kind = vcardproperty_string_to_kind(json_string_value(jprop));

if (kind == VCARD_NO_PROPERTY) {
jmap_parser_invalid(parser, "vCardName");
}
}
else if (jprop) {
jmap_parser_invalid(parser, "vCardName");
}

if (val) {
prop = vcardproperty_new(kind);
vcardproperty_set_value_from_string(prop, val, val_kind);
Expand All @@ -9408,6 +9420,7 @@ static vcardproperty *_jsonline_to_vcard(struct jmap_parser *parser, json_t *obj
json_object_del(obj, "service");
json_object_del(obj, "user");
json_object_del(obj, "uri");
json_object_del(obj, "vCardName");

return prop;
}
Expand Down

0 comments on commit 725fd12

Please sign in to comment.