Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
57687e1b
Commit
57687e1b
authored
Feb 13, 2018
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle fetching a participant device's state from database.
parent
79c5e8e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
src/db/main-db.cpp
src/db/main-db.cpp
+9
-3
No files found.
src/db/main-db.cpp
View file @
57687e1b
...
...
@@ -2421,13 +2421,19 @@ list<shared_ptr<AbstractChatRoom>> MainDb::getChatRooms () const {
// Fetch devices.
{
const
long
long
&
participantId
=
d
->
resolveId
(
row
,
0
);
static
const
string
query
=
"SELECT sip_address.value FROM chat_room_participant_device, sip_address"
static
const
string
query
=
"SELECT sip_address.value
, state
FROM chat_room_participant_device, sip_address"
" WHERE chat_room_participant_id = :participantId"
" AND participant_device_sip_address_id = sip_address.id"
;
soci
::
rowset
<
soci
::
row
>
rows
=
(
session
->
prepare
<<
query
,
soci
::
use
(
participantId
));
for
(
const
auto
&
row
:
rows
)
dParticipant
->
addDevice
(
IdentityAddress
(
row
.
get
<
string
>
(
0
)));
for
(
const
auto
&
row
:
rows
)
{
shared_ptr
<
ParticipantDevice
>
device
=
dParticipant
->
addDevice
(
IdentityAddress
(
row
.
get
<
string
>
(
0
)));
ParticipantDevice
::
State
state
=
static_cast
<
ParticipantDevice
::
State
>
(
getBackend
()
==
Backend
::
Mysql
?
row
.
get
<
unsigned
int
>
(
1
,
0
)
:
static_cast
<
unsigned
int
>
(
row
.
get
<
int
>
(
1
,
0
))
);
device
->
setState
(
state
);
}
}
if
(
participant
->
getAddress
()
==
chatRoomId
.
getLocalAddress
().
getAddressWithoutGruu
())
...
...
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