diff --git a/coreapi/friend.c b/coreapi/friend.c index b43c2206d..e0dce2831 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -1083,6 +1083,8 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) { } vcard = linphone_vcard_new(); + bool_t skip = 1 - lp_config_get_int(fr->lc->config, "misc", "store_friends", 1); + linphone_vcard_set_skip_validation(vcard, skip); linphone_vcard_set_full_name(vcard, name); linphone_friend_set_vcard(fr, vcard); return TRUE; diff --git a/coreapi/vcard.cc b/coreapi/vcard.cc index 010b61f68..0f4afc6ed 100644 --- a/coreapi/vcard.cc +++ b/coreapi/vcard.cc @@ -201,6 +201,19 @@ const char* linphone_vcard_get_full_name(const LinphoneVcard *vCard) { return result; } +void linphone_vcard_set_skip_validation(LinphoneVcard *vCard, bool_t skip) { + if (!vCard || !vCard->belCard) return; + + vCard->belCard->setSkipFieldValidation(skip); +} + +bool_t linphone_vcard_get_skip_validation(const LinphoneVcard *vCard) { + if (!vCard) return FALSE; + + bool_t result = vCard->belCard->getSkipFieldValidation(); + return result; +} + void linphone_vcard_set_family_name(LinphoneVcard *vCard, const char *name) { if (!vCard || !name) return; diff --git a/coreapi/vcard_stubs.c b/coreapi/vcard_stubs.c index 68c6bd9f2..5223143f9 100644 --- a/coreapi/vcard_stubs.c +++ b/coreapi/vcard_stubs.c @@ -79,6 +79,13 @@ const char* linphone_vcard_get_full_name(const LinphoneVcard *vCard) { return NULL; } +void linphone_vcard_set_skip_validation(LinphoneVcard *vCard, bool_t skip) { +} + +bool_t linphone_vcard_get_skip_validation(const LinphoneVcard *vCard) { + return FALSE; +} + void linphone_vcard_set_family_name(LinphoneVcard *vCard, const char *name) { } @@ -133,7 +140,7 @@ void linphone_vcard_set_uid(LinphoneVcard *vCard, const char *uid) { const char* linphone_vcard_get_uid(const LinphoneVcard *vCard) { return NULL; } - + void linphone_vcard_set_etag(LinphoneVcard *vCard, const char * etag) { } diff --git a/include/linphone/vcard.h b/include/linphone/vcard.h index db7397605..79ae0f24f 100644 --- a/include/linphone/vcard.h +++ b/include/linphone/vcard.h @@ -95,6 +95,20 @@ LINPHONE_PUBLIC void linphone_vcard_set_full_name(LinphoneVcard *vCard, const ch */ LINPHONE_PUBLIC const char* linphone_vcard_get_full_name(const LinphoneVcard *vCard); +/** + * Sets the skipFieldValidation property of the vcard + * @param[in] vCard the LinphoneVcard + * @param[in] skip skipFieldValidation property of the vcard + */ +LINPHONE_PUBLIC void linphone_vcard_set_skip_validation(LinphoneVcard *vCard, bool_t skip); + +/** + * Returns the skipFieldValidation property of the vcard. + * @param[in] vCard the LinphoneVcard + * @return the skipFieldValidation property of the vcard + */ +LINPHONE_PUBLIC bool_t linphone_vcard_get_skip_validation(const LinphoneVcard *vCard); + /** * Sets the family name in the N attribute of the vCard. * @param[in] vCard the LinphoneVcard