mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-28 05:46:22 +00:00
fix(MainDb): fetch correctly chat messages (no contents), no all chat messages for one message!!!
This commit is contained in:
parent
dc00b58e98
commit
9f2db02565
3 changed files with 14 additions and 12 deletions
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
void setDirection (ChatMessage::Direction dir);
|
void setDirection (ChatMessage::Direction dir);
|
||||||
|
|
||||||
void setState(ChatMessage::State state);
|
void setState(ChatMessage::State state, bool force = false);
|
||||||
|
|
||||||
void setTime(time_t time);
|
void setTime(time_t time);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,12 @@ void ChatMessagePrivate::setIsReadOnly (bool readOnly) {
|
||||||
isReadOnly = readOnly;
|
isReadOnly = readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatMessagePrivate::setState (ChatMessage::State s) {
|
void ChatMessagePrivate::setState (ChatMessage::State s, bool force) {
|
||||||
L_Q();
|
L_Q();
|
||||||
|
|
||||||
|
if (force)
|
||||||
|
state = s;
|
||||||
|
|
||||||
if (s == state || !q->getChatRoom())
|
if (s == state || !q->getChatRoom())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -300,18 +300,17 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
|
||||||
*session << "SELECT local_sip_address.value, remote_sip_address.value, imdn_message_id, state, direction, is_secured"
|
*session << "SELECT local_sip_address.value, remote_sip_address.value, imdn_message_id, state, direction, is_secured"
|
||||||
" FROM event, conference_chat_message_event, sip_address AS local_sip_address,"
|
" FROM event, conference_chat_message_event, sip_address AS local_sip_address,"
|
||||||
" sip_address AS remote_sip_address"
|
" sip_address AS remote_sip_address"
|
||||||
" WHERE event_id = event.id"
|
" WHERE event_id = :eventId"
|
||||||
|
" AND event_id = event.id"
|
||||||
" AND local_sip_address_id = local_sip_address.id"
|
" AND local_sip_address_id = local_sip_address.id"
|
||||||
" AND remote_sip_address_id = remote_sip_address.id"
|
" AND remote_sip_address_id = remote_sip_address.id", soci::into(localSipAddress), soci::into(remoteSipAddress),
|
||||||
" AND remote_sip_address.value = :peerAddress", soci::into(localSipAddress), soci::into(remoteSipAddress),
|
soci::into(imdnMessageId), soci::into(state), soci::into(direction), soci::into(isSecured), soci::use(eventId);
|
||||||
soci::into(imdnMessageId), soci::into(state), soci::into(direction), soci::into(isSecured),
|
|
||||||
soci::use(peerAddress);
|
|
||||||
|
|
||||||
// TODO: Create me.
|
// TODO: Create me.
|
||||||
// TODO: Use cache, do not fetch the same message twice.
|
// TODO: Use cache, do not fetch the same message twice.
|
||||||
shared_ptr<ChatMessage> chatMessage = make_shared<ChatMessage>(chatRoom);
|
shared_ptr<ChatMessage> chatMessage = make_shared<ChatMessage>(chatRoom);
|
||||||
|
|
||||||
chatMessage->getPrivate()->setState(static_cast<ChatMessage::State>(state));
|
chatMessage->getPrivate()->setState(static_cast<ChatMessage::State>(state), true);
|
||||||
chatMessage->getPrivate()->setDirection(static_cast<ChatMessage::Direction>(direction));
|
chatMessage->getPrivate()->setDirection(static_cast<ChatMessage::Direction>(direction));
|
||||||
chatMessage->setIsSecured(static_cast<bool>(isSecured));
|
chatMessage->setIsSecured(static_cast<bool>(isSecured));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue