mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 15:48:09 +00:00
Store ChatMessage in db after sending and upon reception
This commit is contained in:
parent
60915d8a15
commit
ec7fd6d258
3 changed files with 17 additions and 2 deletions
|
|
@ -121,6 +121,8 @@ public:
|
|||
LinphoneReason receive();
|
||||
void send();
|
||||
|
||||
void store();
|
||||
|
||||
private:
|
||||
// TODO: Clean attributes.
|
||||
unsigned int storageId = 0;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@
|
|||
#include "content/file-content.h"
|
||||
#include "content/content.h"
|
||||
#include "core/core.h"
|
||||
#include "core/core-p.h"
|
||||
#include "event-log/conference/conference-chat-message-event.h"
|
||||
#include "logger/logger.h"
|
||||
#include "chat/notification/imdn.h"
|
||||
|
||||
|
|
@ -428,8 +430,9 @@ LinphoneReason ChatMessagePrivate::receive () {
|
|||
messageToBeStored = true;
|
||||
}
|
||||
}
|
||||
if (messageToBeStored)
|
||||
q->store();
|
||||
if (messageToBeStored) {
|
||||
store();
|
||||
}
|
||||
|
||||
return reason;
|
||||
}
|
||||
|
|
@ -560,6 +563,8 @@ void ChatMessagePrivate::send () {
|
|||
|
||||
q->setImdnMessageId(op->get_call_id()); /* must be known at that time */
|
||||
|
||||
store();
|
||||
|
||||
if (call && linphone_call_get_op(call) == op) {
|
||||
/* In this case, chat delivery status is not notified, so unrefing chat message right now */
|
||||
/* Might be better fixed by delivering status, but too costly for now */
|
||||
|
|
@ -573,6 +578,12 @@ void ChatMessagePrivate::send () {
|
|||
}
|
||||
}
|
||||
|
||||
void ChatMessagePrivate::store() {
|
||||
L_Q();
|
||||
shared_ptr<ConferenceChatMessageEvent> eventLog = make_shared<ConferenceChatMessageEvent>(time, q->getSharedFromThis());
|
||||
q->getChatRoom()->getCore()->getPrivate()->mainDb->addEvent(eventLog);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
ChatMessage::ChatMessage (const shared_ptr<ChatRoom> &chatRoom, ChatMessage::Direction direction) :
|
||||
|
|
|
|||
|
|
@ -32,12 +32,14 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
class Address;
|
||||
class ChatRoom;
|
||||
class ChatMessagePrivate;
|
||||
class ChatRoomId;
|
||||
class CorePrivate;
|
||||
class IdentityAddress;
|
||||
|
||||
class LINPHONE_PUBLIC Core : public Object {
|
||||
friend class ChatRoom;
|
||||
friend class ChatMessagePrivate;
|
||||
friend class ClientGroupChatRoom;
|
||||
friend class LocalConferenceEventHandlerPrivate;
|
||||
friend class MainDb;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue