Skip to content

Commit

Permalink
jmap_contact.c: place paired phonetic and value in the same component
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed Aug 23, 2023
1 parent 7097551 commit f7d4f78
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions imap/jmap_contact.c
Original file line number Diff line number Diff line change
Expand Up @@ -6252,7 +6252,8 @@ static void jscomps_from_vcard(json_t *obj, vcardproperty *prop,
vcardparameter *param;
vcardstrarray *sa;
const char *val, *val_prop_name = "value";
size_t i;
json_t *comps, *comp;
size_t i, j = 0;

param = vcardproperty_get_first_parameter(prop, VCARD_PHONETIC_PARAMETER);
if (param) {
Expand Down Expand Up @@ -6355,12 +6356,16 @@ static void jscomps_from_vcard(json_t *obj, vcardproperty *prop,
continue;
}

json_array_append_new(json_object_get_vanew(obj,
"components", "[]"),
json_pack("{s:s s:o}",
"kind", ckind->name,
val_prop_name,
jmap_utf8string(val)));
comps = json_object_get_vanew(obj, "components", "[]");
if (json_array_size(comps) > j) {
comp = json_array_get(comps, j);
}
else {
comp = json_pack("{s:s}", "kind", ckind->name);
json_array_append_new(comps, comp);
}
json_object_set_new(comp, val_prop_name, jmap_utf8string(val));
j++;
}
}
}
Expand Down

0 comments on commit f7d4f78

Please sign in to comment.