void linphone_core_friends_storage_init(LinphoneCore *lc) { int ret; const char *errmsg; sqlite3 *db; const bctbx_list_t *friends_lists = NULL; linphone_core_friends_storage_close(lc); ret = _linphone_sqlite3_open(lc->friends_db_file, &db); if (ret != SQLITE_OK) { errmsg = sqlite3_errmsg(db); ms_error("Error in the opening: %s.\n", errmsg); sqlite3_close(db); return; } linphone_create_table(db); linphone_update_table(db); lc->friends_db = db; friends_lists = linphone_core_fetch_friends_lists_from_db(lc); if (friends_lists) { ms_warning("Replacing current default friend list by the one(s) from the database"); lc->friends_lists = bctbx_list_free_with_data(lc->friends_lists, (void (*)(void*))linphone_friend_list_unref); lc->friends_lists = NULL; while (friends_lists) { LinphoneFriendList *list = (LinphoneFriendList *)friends_lists->data; linphone_core_add_friend_list(lc, list); friends_lists = bctbx_list_next(friends_lists); } } }
void linphone_core_call_log_storage_init(LinphoneCore *lc) { int ret; const char *errmsg; sqlite3 *db; linphone_core_call_log_storage_close(lc); ret=_linphone_sqlite3_open(lc->logs_db_file, &db); if(ret != SQLITE_OK) { errmsg = sqlite3_errmsg(db); ms_error("Error in the opening: %s.\n", errmsg); sqlite3_close(db); return; } linphone_create_table(db); linphone_update_call_log_table(db); lc->logs_db = db; // Load the existing call logs linphone_core_get_call_history(lc); }
void linphone_core_message_storage_init(LinphoneCore *lc){ int ret; const char *errmsg; sqlite3 *db; linphone_core_message_storage_close(lc); ret=sqlite3_open(lc->chat_db_file,&db); if(ret != SQLITE_OK) { errmsg=sqlite3_errmsg(db); ms_error("Error in the opening: %s.\n", errmsg); sqlite3_close(db); } linphone_message_storage_activate_debug(db, lc->debug_storage); linphone_create_table(db); linphone_update_table(db); lc->db=db; // Create a chatroom for each contact in the chat history linphone_message_storage_init_chat_rooms(lc); }