Commit e1123620 authored by Ronan's avatar Ronan

feat(vcard): add a clone method

parent b7dc359f
......@@ -118,6 +118,19 @@ void linphone_vcard_unref(LinphoneVcard *vCard) {
belle_sip_object_unref((belle_sip_object_t *)vCard);
}
LinphoneVcard *linphone_vcard_clone(const LinphoneVcard *vCard) {
LinphoneVcard *copy = belle_sip_object_new(LinphoneVcard);
copy->belCard = belcard::BelCardParser::getInstance()->parseOne(vCard->belCard->toFoldedString());
if (vCard->url) copy->url = ms_strdup(vCard->url);
if (vCard->etag) copy->etag = ms_strdup(vCard->etag);
memcpy(copy->md5, vCard->md5, sizeof *vCard->md5);
return copy;
}
bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *filename) {
bctbx_list_t *result = NULL;
if (context && filename) {
......
......@@ -65,6 +65,13 @@ LINPHONE_PUBLIC LinphoneVcard *linphone_vcard_ref(LinphoneVcard *vCard);
*/
LINPHONE_PUBLIC void linphone_vcard_unref(LinphoneVcard *vCard);
/**
* Clone a #LinphoneVcard.
* @param[in] vCard LinphoneVcard object
* @return a new LinphoneVcard object
*/
LINPHONE_PUBLIC LinphoneVcard *linphone_vcard_clone(const LinphoneVcard *vCard);
/**
* Returns the vCard4 representation of the LinphoneVcard.
* @param[in] vCard the LinphoneVcard
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment