Commit 6cbaaf68 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Forgot to commit a few things in previous commit

parent 1d262248
...@@ -430,30 +430,41 @@ void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) { ...@@ -430,30 +430,41 @@ void linphone_friend_list_update_dirty_friends(LinphoneFriendList *list) {
} }
static void carddav_created(LinphoneCardDavContext *cdc, LinphoneFriend *lf) { static void carddav_created(LinphoneCardDavContext *cdc, LinphoneFriend *lf) {
if (cdc && cdc->friend_list->cbs->contact_created_cb) { if (cdc) {
LinphoneFriendList *lfl = cdc->friend_list; LinphoneFriendList *lfl = cdc->friend_list;
lfl->friends = ms_list_append(lfl->friends, linphone_friend_ref(lf)); lfl->friends = ms_list_append(lfl->friends, linphone_friend_ref(lf));
cdc->friend_list->cbs->contact_created_cb(lfl, linphone_friend_ref(lf)); if (cdc->friend_list->cbs->contact_created_cb) {
cdc->friend_list->cbs->contact_created_cb(lfl, linphone_friend_ref(lf));
}
} }
linphone_friend_unref(lf); linphone_friend_unref(lf);
} }
static void carddav_removed(LinphoneCardDavContext *cdc, LinphoneFriend *lf) { static void carddav_removed(LinphoneCardDavContext *cdc, LinphoneFriend *lf) {
if (cdc && cdc->friend_list->cbs->contact_deleted_cb) { if (cdc) {
LinphoneFriendList *lfl = cdc->friend_list; LinphoneFriendList *lfl = cdc->friend_list;
MSList *elem = ms_list_find(lfl->friends, lf); MSList *elem = ms_list_find(lfl->friends, lf);
lfl->friends = ms_list_remove_link(lfl->friends, elem); if (elem) {
cdc->friend_list->cbs->contact_deleted_cb(lfl, linphone_friend_ref(lf)); lfl->friends = ms_list_remove_link(lfl->friends, elem);
}
if (cdc->friend_list->cbs->contact_deleted_cb) {
cdc->friend_list->cbs->contact_deleted_cb(lfl, linphone_friend_ref(lf));
}
} }
linphone_friend_unref(lf); linphone_friend_unref(lf);
} }
static void carddav_updated(LinphoneCardDavContext *cdc, LinphoneFriend *lf_new, LinphoneFriend *lf_old) {
//TODO
}
void linphone_friend_list_synchronize_friends_from_server(LinphoneFriendList *list) { void linphone_friend_list_synchronize_friends_from_server(LinphoneFriendList *list) {
LinphoneCardDavContext *cdc = linphone_carddav_context_new(list); LinphoneCardDavContext *cdc = linphone_carddav_context_new(list);
if (cdc) { if (cdc) {
cdc->contact_created_cb = carddav_created; cdc->contact_created_cb = carddav_created;
cdc->contact_removed_cb = carddav_removed; cdc->contact_removed_cb = carddav_removed;
cdc->contact_updated_cb = carddav_updated;
cdc->sync_done_cb = carddav_done; cdc->sync_done_cb = carddav_done;
linphone_carddav_synchronize(cdc); linphone_carddav_synchronize(cdc);
} }
......
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