mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Export a few symbols requiered for win32 tester + reworked a few APIs
This commit is contained in:
parent
1f776d1f1c
commit
42d8d775b9
6 changed files with 42 additions and 61 deletions
|
|
@ -837,6 +837,7 @@ void linphone_friend_set_vcard(LinphoneFriend *fr, LinphoneVCard *vcard) {
|
|||
linphone_vcard_free(fr->vcard);
|
||||
}
|
||||
fr->vcard = vcard;
|
||||
linphone_friend_save(fr, fr->lc);
|
||||
}
|
||||
|
||||
bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
|
||||
|
|
@ -922,7 +923,7 @@ int linphone_core_import_friends_from_vcard4_file(LinphoneCore *lc, const char *
|
|||
LinphoneVCard *vcard = (LinphoneVCard *)vcards->data;
|
||||
LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard);
|
||||
if (lf) {
|
||||
if (LinphoneFriendListOK == linphone_friend_list_import_friend(linphone_core_get_default_friend_list(lc), lf)) {
|
||||
if (LinphoneFriendListOK == linphone_friend_list_import_friend(linphone_core_get_default_friend_list(lc), lf, TRUE)) {
|
||||
count++;
|
||||
}
|
||||
linphone_friend_unref(lf);
|
||||
|
|
|
|||
|
|
@ -375,23 +375,6 @@ void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_
|
|||
}
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
if (lf->uri == NULL || lf->friend_list) {
|
||||
if (!lf->uri)
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend, no sip uri");
|
||||
if (lf->friend_list)
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend, already in list");
|
||||
return LinphoneFriendListInvalidFriend;
|
||||
}
|
||||
list->friends = ms_list_append(list->friends, linphone_friend_ref(lf));
|
||||
lf->friend_list = list;
|
||||
lf->lc = list->lc;
|
||||
#ifdef FRIENDS_SQL_STORAGE_ENABLED
|
||||
linphone_core_store_friend_in_db(lf->lc, lf);
|
||||
#endif
|
||||
return LinphoneFriendListOK;
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
if (!list || !lf->uri || lf->friend_list) {
|
||||
if (!list)
|
||||
|
|
@ -409,20 +392,25 @@ LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *lis
|
|||
ms_warning("Friend %s already in list [%s], ignored.", tmp ? tmp : "unknown", list->display_name);
|
||||
if (tmp) ms_free(tmp);
|
||||
} else {
|
||||
return linphone_friend_list_import_friend(list, lf);
|
||||
return linphone_friend_list_import_friend(list, lf, TRUE);
|
||||
}
|
||||
return LinphoneFriendListOK;
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
if (!lf->uri) {
|
||||
ms_error("linphone_friend_list_import_friend(): invalid friend, no sip uri");
|
||||
LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize) {
|
||||
if (!lf->uri || lf->friend_list) {
|
||||
if (!lf->uri)
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend, no sip uri");
|
||||
if (lf->friend_list)
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend, already in list");
|
||||
return LinphoneFriendListInvalidFriend;
|
||||
}
|
||||
lf->friend_list = list;
|
||||
lf->lc = list->lc;
|
||||
list->friends = ms_list_append(list->friends, linphone_friend_ref(lf));
|
||||
list->dirty_friends_to_update = ms_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
|
||||
if (synchronize) {
|
||||
list->dirty_friends_to_update = ms_list_append(list->dirty_friends_to_update, linphone_friend_ref(lf));
|
||||
}
|
||||
#ifdef FRIENDS_SQL_STORAGE_ENABLED
|
||||
linphone_core_store_friend_in_db(lf->lc, lf);
|
||||
#endif
|
||||
|
|
@ -433,16 +421,6 @@ static void carddav_done(LinphoneCardDavContext *cdc, bool_t success, const char
|
|||
linphone_carddav_context_destroy(cdc);
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFriendList *list, MSList *elem, LinphoneFriend *lf) {
|
||||
if (!elem) {
|
||||
return LinphoneFriendListNonExistentFriend;
|
||||
}
|
||||
lf->friend_list = NULL;
|
||||
linphone_friend_unref(lf);
|
||||
list->friends = ms_list_remove_link(list->friends, elem);
|
||||
return LinphoneFriendListOK;
|
||||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_remove_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
MSList *elem = ms_list_find(list->friends, lf);
|
||||
LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
|
||||
|
|
@ -456,7 +434,10 @@ LinphoneFriendListStatus linphone_friend_list_remove_friend(LinphoneFriendList *
|
|||
linphone_carddav_delete_vcard(cdc, lf);
|
||||
}
|
||||
|
||||
return _linphone_friend_list_remove_friend(list, elem, lf);
|
||||
lf->friend_list = NULL;
|
||||
linphone_friend_unref(lf);
|
||||
list->friends = ms_list_remove_link(list->friends, elem);
|
||||
return LinphoneFriendListOK;
|
||||
}
|
||||
|
||||
void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) {
|
||||
|
|
@ -479,7 +460,7 @@ void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) {
|
|||
static void carddav_created(LinphoneCardDavContext *cdc, LinphoneFriend *lf) {
|
||||
if (cdc) {
|
||||
LinphoneFriendList *lfl = cdc->friend_list;
|
||||
_linphone_friend_list_add_friend(lfl, lf);
|
||||
linphone_friend_list_import_friend(lfl, lf, FALSE);
|
||||
if (cdc->friend_list->cbs->contact_created_cb) {
|
||||
cdc->friend_list->cbs->contact_created_cb(lfl, lf);
|
||||
}
|
||||
|
|
@ -501,9 +482,11 @@ static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new,
|
|||
LinphoneFriendList *lfl = cdc->friend_list;
|
||||
MSList *elem = ms_list_find(lfl->friends, lf_old);
|
||||
if (elem) {
|
||||
_linphone_friend_list_remove_friend(lfl, elem, lf_old);
|
||||
lf_old->friend_list = NULL;
|
||||
linphone_friend_unref(lf_old);
|
||||
lfl->friends = ms_list_remove_link(lfl->friends, elem);
|
||||
}
|
||||
_linphone_friend_list_add_friend(lfl, lf_new);
|
||||
linphone_friend_list_import_friend(lfl, lf_new, FALSE);
|
||||
if (cdc->friend_list->cbs->contact_updated_cb) {
|
||||
cdc->friend_list->cbs->contact_updated_cb(lfl, lf_new, lf_old);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,6 @@ LINPHONE_PUBLIC void linphone_friend_list_set_rls_uri(LinphoneFriendList *list,
|
|||
* @return LinphoneFriendListOK if successfully added, LinphoneFriendListInvalidFriend if the friend is not valid.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *afriend);
|
||||
LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *afriend);
|
||||
|
||||
/**
|
||||
* Remove a friend from a friend list.
|
||||
|
|
@ -160,7 +159,6 @@ LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendList *li
|
|||
* @return LinphoneFriendListOK if removed successfully, LinphoneFriendListNonExistentFriend if the friend is not in the list.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_remove_friend(LinphoneFriendList *list, LinphoneFriend *afriend);
|
||||
LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFriendList *list, MSList *elem, LinphoneFriend *lf);
|
||||
|
||||
/**
|
||||
* Find a friend in the friend list using a LinphoneAddress.
|
||||
|
|
|
|||
|
|
@ -425,10 +425,9 @@ void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf);
|
|||
void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf);
|
||||
void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList *list);
|
||||
void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendList *list);
|
||||
MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list);
|
||||
MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc);
|
||||
LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf);
|
||||
LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf);
|
||||
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list);
|
||||
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc);
|
||||
LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize);
|
||||
|
||||
int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen, int default_port);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,55 +41,55 @@ typedef struct _LinphoneVCard LinphoneVCard;
|
|||
/**
|
||||
* Creates a LinphoneVCard object that has a pointer to an empty vCard
|
||||
*/
|
||||
LinphoneVCard* linphone_vcard_new(void);
|
||||
LINPHONE_PUBLIC LinphoneVCard* linphone_vcard_new(void);
|
||||
|
||||
/**
|
||||
* Deletes a LinphoneVCard object properly
|
||||
* @param[in] vCard the LinphoneVCard to destroy
|
||||
*/
|
||||
void linphone_vcard_free(LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Uses belcard to parse the content of a file and returns all the vcards it contains as LinphoneVCards, or NULL if it contains none.
|
||||
* @param[in] file the path to the file to parse
|
||||
* @return \mslist{LinphoneVCard}
|
||||
*/
|
||||
MSList* linphone_vcard_list_from_vcard4_file(const char *file);
|
||||
LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_file(const char *file);
|
||||
|
||||
/**
|
||||
* Uses belcard to parse the content of a buffer and returns all the vcards it contains as LinphoneVCards, or NULL if it contains none.
|
||||
* @param[in] buffer the buffer to parse
|
||||
* @return \mslist{LinphoneVCard}
|
||||
*/
|
||||
MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer);
|
||||
LINPHONE_PUBLIC MSList* linphone_vcard_list_from_vcard4_buffer(const char *buffer);
|
||||
|
||||
/**
|
||||
* Uses belcard to parse the content of a buffer and returns one vCard if possible, or NULL otherwise.
|
||||
* @param[in] buffer the buffer to parse
|
||||
* @return a LinphoneVCard if one could be parsed, or NULL otherwise
|
||||
*/
|
||||
LinphoneVCard* linphone_vcard_new_from_vcard4_buffer(const char *buffer);
|
||||
LINPHONE_PUBLIC LinphoneVCard* linphone_vcard_new_from_vcard4_buffer(const char *buffer);
|
||||
|
||||
/**
|
||||
* Returns the vCard4 representation of the LinphoneVCard.
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @return a const char * that represents the vCard
|
||||
*/
|
||||
const char* linphone_vcard_as_vcard4_string(LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC const char* linphone_vcard_as_vcard4_string(LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Sets the FN attribute of the vCard (which is mandatory).
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @param[in] name the display name to set for the vCard
|
||||
*/
|
||||
void linphone_vcard_set_full_name(LinphoneVCard *vCard, const char *name);
|
||||
LINPHONE_PUBLIC void linphone_vcard_set_full_name(LinphoneVCard *vCard, const char *name);
|
||||
|
||||
/**
|
||||
* Returns the FN attribute of the vCard, or NULL if it isn't set yet.
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @return the display name of the vCard, or NULL
|
||||
*/
|
||||
const char* linphone_vcard_get_full_name(const LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC const char* linphone_vcard_get_full_name(const LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Adds a SIP address in the vCard, using the IMPP property
|
||||
|
|
@ -117,7 +117,7 @@ void linphone_vcard_edit_main_sip_address(LinphoneVCard *vCard, const char *sip_
|
|||
* @param[in] vCard the LinphoneVCard
|
||||
* @return \mslist{const char *}
|
||||
*/
|
||||
MSList* linphone_vcard_get_sip_addresses(const LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC MSList* linphone_vcard_get_sip_addresses(const LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Generates a random unique id for the vCard.
|
||||
|
|
@ -125,49 +125,49 @@ MSList* linphone_vcard_get_sip_addresses(const LinphoneVCard *vCard);
|
|||
* @param[in] vCard the LinphoneVCard
|
||||
* @return TRUE if operation is successful, otherwise FALSE (for example if it already has an unique ID)
|
||||
*/
|
||||
bool_t linphone_vcard_generate_unique_id(LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC bool_t linphone_vcard_generate_unique_id(LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Sets the unique ID of the vCard
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @param[in] uid the unique id
|
||||
*/
|
||||
void linphone_vcard_set_uid(LinphoneVCard *vCard, const char *uid);
|
||||
LINPHONE_PUBLIC void linphone_vcard_set_uid(LinphoneVCard *vCard, const char *uid);
|
||||
|
||||
/**
|
||||
* Gets the UID of the vCard
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @return the UID of the vCard, otherwise NULL
|
||||
*/
|
||||
const char* linphone_vcard_get_uid(const LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC const char* linphone_vcard_get_uid(const LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Sets the eTAG of the vCard
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @param[in] etag the eTAG
|
||||
*/
|
||||
void linphone_vcard_set_etag(LinphoneVCard *vCard, const char * etag);
|
||||
LINPHONE_PUBLIC void linphone_vcard_set_etag(LinphoneVCard *vCard, const char * etag);
|
||||
|
||||
/**
|
||||
* Gets the eTag of the vCard
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @return the eTag of the vCard in the CardDAV server, otherwise NULL
|
||||
*/
|
||||
const char* linphone_vcard_get_etag(const LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC const char* linphone_vcard_get_etag(const LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Sets the URL of the vCard
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @param[in] url the URL
|
||||
*/
|
||||
void linphone_vcard_set_url(LinphoneVCard *vCard, const char * url);
|
||||
LINPHONE_PUBLIC void linphone_vcard_set_url(LinphoneVCard *vCard, const char * url);
|
||||
|
||||
/**
|
||||
* Gets the URL of the vCard
|
||||
* @param[in] vCard the LinphoneVCard
|
||||
* @return the URL of the vCard in the CardDAV server, otherwise NULL
|
||||
*/
|
||||
const char* linphone_vcard_get_url(const LinphoneVCard *vCard);
|
||||
LINPHONE_PUBLIC const char* linphone_vcard_get_url(const LinphoneVCard *vCard);
|
||||
|
||||
/**
|
||||
* Computes the md5 hash for the vCard
|
||||
|
|
|
|||
|
|
@ -431,14 +431,14 @@ static void carddav_integration(void) {
|
|||
|
||||
lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
|
||||
lf = linphone_friend_new_from_vcard(lvc);
|
||||
BC_ASSERT_EQUAL_FATAL(_linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d");
|
||||
BC_ASSERT_EQUAL_FATAL(linphone_friend_list_import_friend(lfl, lf, FALSE), LinphoneFriendListOK, int, "%d");
|
||||
linphone_friend_unref(lf);
|
||||
|
||||
lvc2 = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
|
||||
linphone_vcard_set_url(lvc2, "/sabredav/addressbookserver.php/addressbooks/sylvain/default/me.vcf");
|
||||
lf2 = linphone_friend_new_from_vcard(lvc2);
|
||||
linphone_friend_set_ref_key(lf2, refkey);
|
||||
BC_ASSERT_EQUAL_FATAL(_linphone_friend_list_add_friend(lfl, lf2), LinphoneFriendListOK, int, "%d");
|
||||
BC_ASSERT_EQUAL_FATAL(linphone_friend_list_import_friend(lfl, lf2, FALSE), LinphoneFriendListOK, int, "%d");
|
||||
linphone_friend_unref(lf2);
|
||||
|
||||
BC_ASSERT_EQUAL(lfl->revision, 0, int, "%i");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue