mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 06:08:07 +00:00
fix(MainDb): use chat room id in get unread chat messages function
This commit is contained in:
parent
57f638266d
commit
55e62ee091
1 changed files with 9 additions and 7 deletions
|
|
@ -1565,14 +1565,16 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
|
|||
return chatMessages;
|
||||
}
|
||||
|
||||
string query = "SELECT event_id, creation_time FROM conference_chat_message_event WHERE";
|
||||
string query = "SELECT id, creation_time FROM event WHERE"
|
||||
" id IN ("
|
||||
" SELECT conference_event.event_id FROM conference_event, conference_chat_message_event" +
|
||||
" WHERE";
|
||||
if (chatRoomId.isValid())
|
||||
query += " event_id IN ("
|
||||
" SELECT event_id FROM conference_event WHERE chat_room_id = :chatRoomId"
|
||||
") AND";
|
||||
|
||||
query += " direction = " + Utils::toString(static_cast<int>(ChatMessage::Direction::Incoming)) +
|
||||
+ " AND state <> " + Utils::toString(static_cast<int>(ChatMessage::State::Displayed));
|
||||
query += " chat_room_id = :chatRoomId AND ";
|
||||
" conference_event.event_id = conference_chat_message_event.event_id"
|
||||
" AND direction = " + Utils::toString(static_cast<int>(ChatMessage::Direction::Incoming)) +
|
||||
" AND state <> " + Utils::toString(static_cast<int>(ChatMessage::State::Displayed));
|
||||
")";
|
||||
|
||||
DurationLogger durationLogger(
|
||||
"Get unread chat messages: (peer=" + chatRoomId.getPeerAddress().asString() +
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue