Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
b88693f4
Commit
b88693f4
authored
Mar 09, 2016
by
Sylvain Berfini
🐮
Browse files
Fix contacts migration from rc to db
parent
0feee4b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
coreapi/friend.c
coreapi/friend.c
+7
-0
coreapi/friendlist.c
coreapi/friendlist.c
+3
-1
tester/vcard_tester.c
tester/vcard_tester.c
+11
-3
No files found.
coreapi/friend.c
View file @
b88693f4
...
...
@@ -1366,6 +1366,13 @@ void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc) {
return
;
}
if
(
ms_list_size
(
linphone_friend_list_get_friends
(
lfl
))
>
0
)
{
linphone_core_remove_friend_list
(
lc
,
lfl
);
lfl
=
linphone_core_create_friend_list
(
lc
);
linphone_core_add_friend_list
(
lc
,
lfl
);
linphone_friend_list_unref
(
lfl
);
}
for
(
i
=
0
;
(
lf
=
linphone_friend_new_from_config_file
(
lc
,
i
))
!=
NULL
;
i
++
)
{
char
friend_section
[
32
];
...
...
coreapi/friendlist.c
View file @
b88693f4
...
...
@@ -445,7 +445,9 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
if
(
elem
==
NULL
)
return
LinphoneFriendListNonExistentFriend
;
#ifdef FRIENDS_SQL_STORAGE_ENABLED
linphone_core_remove_friend_from_db
(
lf
->
lc
,
lf
);
if
(
lf
&&
lf
->
lc
&&
lf
->
lc
->
friends_db
)
{
linphone_core_remove_friend_from_db
(
lf
->
lc
,
lf
);
}
#endif
if
(
remove_from_server
)
{
LinphoneVcard
*
lvc
=
linphone_friend_get_vcard
(
lf
);
...
...
tester/vcard_tester.c
View file @
b88693f4
...
...
@@ -155,18 +155,22 @@ static void friends_if_no_db_set(void) {
#ifdef FRIENDS_SQL_STORAGE_ENABLED
static
void
friends_migration
(
void
)
{
LinphoneCoreManager
*
manager
=
linphone_core_manager_new2
(
"friends_rc"
,
FALSE
);
LpConfig
*
lpc
=
linphone_core_get_config
(
manager
->
lc
);
LinphoneFriendList
*
lfl
=
linphone_core_get_default_friend_list
(
manager
->
lc
);
const
MSList
*
friends
=
linphone_friend_list_get_friends
(
lfl
);
MSList
*
friends_from_db
=
NULL
;
char
*
friends_db
=
create_filepath
(
bc_tester_get_writable_dir_prefix
(),
"friends"
,
"db"
);
BC_ASSERT_EQUAL
(
ms_list_size
(
friends
),
0
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
ms_list_size
(
friends
),
3
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
lp_config_get_int
(
lpc
,
"misc"
,
"friends_migration_done"
,
0
),
0
,
int
,
"%i"
);
unlink
(
friends_db
);
linphone_core_set_friends_database_path
(
manager
->
lc
,
friends_db
);
lfl
=
linphone_core_get_default_friend_list
(
manager
->
lc
);
friends
=
linphone_friend_list_get_friends
(
lfl
);
BC_ASSERT_EQUAL
(
ms_list_size
(
friends
),
3
,
int
,
"%d"
);
friends_from_db
=
linphone_core_fetch_friends_from_db
(
manager
->
lc
,
lfl
);
BC_ASSERT_EQUAL
(
ms_list_size
(
friends_from_db
),
3
,
int
,
"%d"
);
BC_ASSERT_EQUAL
(
lp_config_get_int
(
lpc
,
"misc"
,
"friends_migration_done"
,
0
),
1
,
int
,
"%i"
);
friends_from_db
=
ms_list_free_with_data
(
friends_from_db
,
(
void
(
*
)(
void
*
))
linphone_friend_unref
);
unlink
(
friends_db
);
...
...
@@ -181,12 +185,16 @@ typedef struct _LinphoneFriendListStats {
static
void
friend_list_created_cb
(
LinphoneCore
*
lc
,
LinphoneFriendList
*
list
)
{
LinphoneFriendListStats
*
stats
=
(
LinphoneFriendListStats
*
)
linphone_friend_list_get_user_data
(
list
);
stats
->
new_list_count
++
;
if
(
stats
)
{
stats
->
new_list_count
++
;
}
}
static
void
friend_list_removed_cb
(
LinphoneCore
*
lc
,
LinphoneFriendList
*
list
)
{
LinphoneFriendListStats
*
stats
=
(
LinphoneFriendListStats
*
)
linphone_friend_list_get_user_data
(
list
);
stats
->
removed_list_count
++
;
if
(
stats
)
{
stats
->
removed_list_count
++
;
}
}
static
void
friends_sqlite_storage
(
void
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment