Commit 7d6fc054 authored by Benjamin REIS's avatar Benjamin REIS

setImdnMessageId is now private

parent f31f9150
......@@ -151,7 +151,7 @@ const char* linphone_chat_message_get_message_id(const LinphoneChatMessage *msg)
}
void linphone_chat_message_set_message_id(LinphoneChatMessage *msg, char *id) {
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->setImdnMessageId(L_C_TO_STRING(id));
L_GET_PRIVATE_FROM_C_OBJECT(msg)->setImdnMessageId(L_C_TO_STRING(id));
}
bool_t linphone_chat_message_is_read(LinphoneChatMessage *msg) {
......
......@@ -65,6 +65,8 @@ public:
void setIsReadOnly(bool readOnly);
void setImdnMessageId (const std::string &imdnMessageId);
inline void forceFromAddress (const IdentityAddress &fromAddress) {
this->fromAddress = fromAddress;
}
......@@ -127,7 +129,7 @@ public:
private:
// TODO: Clean attributes.
time_t time = ::ms_time(0); // TODO: Change me in all files.
std::string id;
std::string imdnId;
std::string rttMessage;
bool isSecured = false;
bool isReadOnly = false;
......
......@@ -320,7 +320,7 @@ void ChatMessagePrivate::sendImdn (Imdn::Type imdnType, LinphoneReason reason) {
Content *content = new Content();
content->setContentType("message/imdn+xml");
content->setBody(Imdn::createXml(id, time, imdnType, reason));
content->setBody(Imdn::createXml(imdnId, time, imdnType, reason));
msg->addContent(*content);
msg->getPrivate()->send();
......@@ -416,7 +416,7 @@ LinphoneReason ChatMessagePrivate::receive () {
setDirection(ChatMessage::Direction::Outgoing);
// Check if this is a duplicate message.
if (chatRoom && chatRoom->findMessageWithDirection(q->getImdnMessageId(), direction))
if (chatRoom && chatRoom->findMessageWithDirection(imdnId, direction))
return core->getCCore()->chat_deny_code;
if (errorCode > 0) {
......@@ -558,8 +558,8 @@ void ChatMessagePrivate::send () {
}
}
if (q->getImdnMessageId().empty())
q->setImdnMessageId(op->get_call_id()); /* must be known at that time */
if (imdnId.empty())
setImdnMessageId(op->get_call_id()); /* must be known at that time */
//store(); // Store will be done right below in the setState(InProgress)
......@@ -692,12 +692,11 @@ ChatMessage::State ChatMessage::getState () const {
const string &ChatMessage::getImdnMessageId () const {
L_D();
return d->id;
return d->imdnId;
}
void ChatMessage::setImdnMessageId (const string &id) {
L_D();
d->id = id;
void ChatMessagePrivate::setImdnMessageId (const string &id) {
imdnId = id;
}
bool ChatMessage::isRead () const {
......
......@@ -64,7 +64,6 @@ public:
void updateState (State state);
void sendDeliveryNotification (LinphoneReason reason);
void sendDisplayNotification ();
void setImdnMessageId (const std::string &imdnMessageId);
void setIsSecured (bool isSecured);
// ----- TODO: Remove me.
......
......@@ -147,7 +147,7 @@ LinphoneReason ChatRoomPrivate::messageReceived (SalOp *op, const SalMessage *sa
msg->setInternalContent(content);
msg->getPrivate()->setTime(salMsg->time);
msg->setImdnMessageId(op->get_call_id());
msg->getPrivate()->setImdnMessageId(op->get_call_id());
const SalCustomHeader *ch = op->get_recv_custom_header();
if (ch)
......
......@@ -50,7 +50,7 @@ ChatMessageModifier::Result CpimChatMessageModifier::encode (const shared_ptr<Ch
Cpim::MessageIdHeader cpimMessageIdHeader;
cpimMessageIdHeader.setValue(token);
cpimMessage.addMessageHeader(cpimMessageIdHeader);
message->setImdnMessageId(token);
message->getPrivate()->setImdnMessageId(token);
const Content *content;
if (!message->getInternalContent().isEmpty()) {
......@@ -134,7 +134,7 @@ ChatMessageModifier::Result CpimChatMessageModifier::decode (const shared_ptr<Ch
else if (header->getName() == "To")
cpimToAddress = Address(header->getValue());
else if (header->getName() == "Message-ID")
message->setImdnMessageId(header->getValue());
message->getPrivate()->setImdnMessageId(header->getValue());
}
}
......
......@@ -520,7 +520,6 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
static_cast<ChatMessage::Direction>(direction)
));
chatMessage->setIsSecured(static_cast<bool>(isSecured));
chatMessage->setImdnMessageId(imdnMessageId);
ChatMessagePrivate *dChatMessage = chatMessage->getPrivate();
dChatMessage->setState(static_cast<ChatMessage::State>(state), true);
......@@ -528,6 +527,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
dChatMessage->forceToAddress(IdentityAddress(toSipAddress));
dChatMessage->setTime(Utils::getTmAsTimeT(messageTime));
dChatMessage->setImdnMessageId(imdnMessageId);
}
// 2 - Fetch contents.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment