mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 13:08:08 +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 setState(ChatMessage::State state);
|
||||
void setState(ChatMessage::State state, bool force = false);
|
||||
|
||||
void setTime(time_t time);
|
||||
|
||||
|
|
@ -100,16 +100,16 @@ public:
|
|||
void setAppdata (const std::string &appData);
|
||||
|
||||
const std::string &getExternalBodyUrl () const;
|
||||
|
||||
|
||||
bool hasTextContent() const;
|
||||
const Content* getTextContent() const;
|
||||
|
||||
|
||||
bool hasFileTransferContent() const;
|
||||
const Content* getFileTransferContent() const;
|
||||
|
||||
LinphoneContent *getFileTransferInformation() const;
|
||||
void setFileTransferInformation(const LinphoneContent *content);
|
||||
|
||||
|
||||
int downloadFile ();
|
||||
|
||||
void sendImdn(Imdn::Type imdnType, LinphoneReason reason);
|
||||
|
|
@ -148,7 +148,7 @@ private:
|
|||
std::string cText;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
std::string createImdnXml(Imdn::Type imdnType, LinphoneReason reason);
|
||||
|
||||
L_DECLARE_PUBLIC(ChatMessage);
|
||||
|
|
|
|||
|
|
@ -75,9 +75,12 @@ void ChatMessagePrivate::setIsReadOnly (bool readOnly) {
|
|||
isReadOnly = readOnly;
|
||||
}
|
||||
|
||||
void ChatMessagePrivate::setState (ChatMessage::State s) {
|
||||
void ChatMessagePrivate::setState (ChatMessage::State s, bool force) {
|
||||
L_Q();
|
||||
|
||||
if (force)
|
||||
state = s;
|
||||
|
||||
if (s == state || !q->getChatRoom())
|
||||
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"
|
||||
" FROM event, conference_chat_message_event, sip_address AS local_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 remote_sip_address_id = remote_sip_address.id"
|
||||
" 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(peerAddress);
|
||||
" AND remote_sip_address_id = remote_sip_address.id", soci::into(localSipAddress), soci::into(remoteSipAddress),
|
||||
soci::into(imdnMessageId), soci::into(state), soci::into(direction), soci::into(isSecured), soci::use(eventId);
|
||||
|
||||
// TODO: Create me.
|
||||
// TODO: Use cache, do not fetch the same message twice.
|
||||
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->setIsSecured(static_cast<bool>(isSecured));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue