Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
ce702f32
Commit
ce702f32
authored
7 years ago
by
Sébastien Blin
Committed by
Adrien Béraud
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
migration: add daemon's contacts from old conversations
Change-Id: Id3c506c932ae91ec767944fa1dc5d90584ba7157
parent
10c587d6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/database.cpp
+12
-4
12 additions, 4 deletions
src/database.cpp
with
12 additions
and
4 deletions
src/database.cpp
+
12
−
4
View file @
ce702f32
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include
"api/interaction.h"
#include
"api/interaction.h"
// Lrc for migrations
// Lrc for migrations
#include
"dbus/configurationmanager.h"
#include
"person.h"
#include
"person.h"
#include
"account.h"
#include
"account.h"
#include
"accountmodel.h"
#include
"accountmodel.h"
...
@@ -490,7 +491,8 @@ Database::migrateTextHistory()
...
@@ -490,7 +491,8 @@ Database::migrateTextHistory()
auto
account
=
AccountModel
::
instance
().
getById
(
peersObject
[
"accountId"
].
toString
().
toUtf8
());
auto
account
=
AccountModel
::
instance
().
getById
(
peersObject
[
"accountId"
].
toString
().
toUtf8
());
if
(
!
account
)
continue
;
if
(
!
account
)
continue
;
auto
accountUri
=
account
->
username
();
auto
accountUri
=
account
->
username
();
if
(
accountUri
.
startsWith
(
"ring:"
))
{
auto
isARingContact
=
accountUri
.
startsWith
(
"ring:"
);
if
(
isARingContact
)
{
accountUri
=
accountUri
.
mid
(
QString
(
"ring:"
).
length
());
accountUri
=
accountUri
.
mid
(
QString
(
"ring:"
).
length
());
}
}
auto
accountIds
=
select
(
"id"
,
"profiles"
,
"uri=:uri"
,
{{
":uri"
,
accountUri
.
toStdString
()}}).
payloads
;
auto
accountIds
=
select
(
"id"
,
"profiles"
,
"uri=:uri"
,
{{
":uri"
,
accountUri
.
toStdString
()}}).
payloads
;
...
@@ -501,9 +503,15 @@ Database::migrateTextHistory()
...
@@ -501,9 +503,15 @@ Database::migrateTextHistory()
{
":status"
,
"status"
}},
{
":status"
,
"status"
}},
{{
":uri"
,
peersObject
[
"uri"
].
toString
().
toStdString
()},
{
":alias"
,
""
},
{{
":uri"
,
peersObject
[
"uri"
].
toString
().
toStdString
()},
{
":alias"
,
""
},
{
":photo"
,
""
},
{
":type"
,
"RING"
},
{
":photo"
,
""
},
{
":type"
,
"RING"
},
{
":status"
,
"NONTRUSTED"
}});
{
":status"
,
"TRUSTED"
}});
// NOTE: this profile is in a case where it's not a contact for the daemon. So we choose to remove this contact from
// NOTE: this profile is in a case where it's not a contact for the daemon but a conversation with an account.
// conversations.
// So we choose to add the profile to daemon's contacts
if
(
isARingContact
)
{
ConfigurationManager
::
instance
().
addContact
(
peersObject
[
"accountId"
].
toString
(),
peersObject
[
"uri"
].
toString
()
);
}
contactIds
=
select
(
"id"
,
"profiles"
,
"uri=:uri"
,
{{
":uri"
,
peersObject
[
"uri"
].
toString
().
toStdString
()}}).
payloads
;
contactIds
=
select
(
"id"
,
"profiles"
,
"uri=:uri"
,
{{
":uri"
,
peersObject
[
"uri"
].
toString
().
toStdString
()}}).
payloads
;
}
}
if
(
accountIds
.
empty
())
{
if
(
accountIds
.
empty
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment