mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Prevent encryption of IMDN messages signaling an error.
This commit is contained in:
parent
64e74b6e80
commit
e2ca3cbbeb
2 changed files with 16 additions and 9 deletions
|
|
@ -93,6 +93,8 @@ public:
|
|||
|
||||
void setChatRoom (const std::shared_ptr<AbstractChatRoom> &chatRoom);
|
||||
|
||||
void setEncryptionPrevented (bool value) { encryptionPrevented = value; }
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Deprecated methods only used for C wrapper, to be removed some day...
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -169,6 +171,7 @@ private:
|
|||
ChatMessage::State state = ChatMessage::State::Idle;
|
||||
ChatMessage::Direction direction = ChatMessage::Direction::Incoming;
|
||||
|
||||
bool encryptionPrevented = false;
|
||||
bool toBeStored = true;
|
||||
|
||||
L_DECLARE_PUBLIC(ChatMessage);
|
||||
|
|
|
|||
|
|
@ -353,6 +353,8 @@ void ChatMessagePrivate::sendImdn (Imdn::Type imdnType, LinphoneReason reason) {
|
|||
content->setBody(Imdn::createXml(imdnId, time, imdnType, reason));
|
||||
msg->addContent(*content);
|
||||
|
||||
if (reason != LinphoneReasonNone)
|
||||
msg->getPrivate()->setEncryptionPrevented(true);
|
||||
msg->setToBeStored(false);
|
||||
|
||||
msg->getPrivate()->send();
|
||||
|
|
@ -628,15 +630,17 @@ void ChatMessagePrivate::send () {
|
|||
if ((currentSendStep &ChatMessagePrivate::Step::Encryption) == ChatMessagePrivate::Step::Encryption) {
|
||||
lInfo() << "Encryption step already done, skipping";
|
||||
} else {
|
||||
EncryptionChatMessageModifier ecmm;
|
||||
ChatMessageModifier::Result result = ecmm.encode(q->getSharedFromThis(), errorCode);
|
||||
if (result == ChatMessageModifier::Result::Error) {
|
||||
sal_error_info_set((SalErrorInfo *)op->get_error_info(), SalReasonNotAcceptable, "SIP", errorCode, "Unable to encrypt IM", nullptr);
|
||||
setState(ChatMessage::State::NotDelivered);
|
||||
return;
|
||||
} else if (result == ChatMessageModifier::Result::Suspended) {
|
||||
currentSendStep |= ChatMessagePrivate::Step::Encryption;
|
||||
return;
|
||||
if (!encryptionPrevented) {
|
||||
EncryptionChatMessageModifier ecmm;
|
||||
ChatMessageModifier::Result result = ecmm.encode(q->getSharedFromThis(), errorCode);
|
||||
if (result == ChatMessageModifier::Result::Error) {
|
||||
sal_error_info_set((SalErrorInfo *)op->get_error_info(), SalReasonNotAcceptable, "SIP", errorCode, "Unable to encrypt IM", nullptr);
|
||||
setState(ChatMessage::State::NotDelivered);
|
||||
return;
|
||||
} else if (result == ChatMessageModifier::Result::Suspended) {
|
||||
currentSendStep |= ChatMessagePrivate::Step::Encryption;
|
||||
return;
|
||||
}
|
||||
}
|
||||
currentSendStep |= ChatMessagePrivate::Step::Encryption;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue