From 28e77ff2e65a2dc4427abee0be18658c450ad504 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 3 Oct 2017 11:13:35 +0200 Subject: [PATCH] Added ChatMessageModifiers chain in reception --- src/chat/chat-message.cpp | 13 ++++++++++--- src/content/content-type.cpp | 4 ++++ src/content/content-type.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/chat/chat-message.cpp b/src/chat/chat-message.cpp index d06008c2f..7e5716b30 100644 --- a/src/chat/chat-message.cpp +++ b/src/chat/chat-message.cpp @@ -904,6 +904,11 @@ LinphoneReason ChatMessagePrivate::receive() { // Start of message modification // --------------------------------------- + if (ContentType::isCPIM(getContentType())) { + CpimChatMessageModifier ccmm; + ccmm.decode(this); + } + EncryptionChatMessageModifier ecmm; int retval = 0; retval = ecmm.decode(this); @@ -914,8 +919,11 @@ LinphoneReason ChatMessagePrivate::receive() { q->sendDeliveryNotification(reason); /* Return LinphoneReasonNone to avoid flexisip resending us a message we can't decrypt */ reason = LinphoneReasonNone; - goto end; + return reason; } + + MultipartChatMessageModifier mcmm; + mcmm.decode(this); // --------------------------------------- // End of message modification @@ -929,7 +937,7 @@ LinphoneReason ChatMessagePrivate::receive() { if (retval > 0) { reason = linphone_error_code_to_reason(retval); q->sendDeliveryNotification(reason); - goto end; + return reason; } if (ContentType::isFileTransfer(getContentType())) { @@ -943,7 +951,6 @@ LinphoneReason ChatMessagePrivate::receive() { q->store(); } -end: return reason; } diff --git a/src/content/content-type.cpp b/src/content/content-type.cpp index 8df3a234b..eb558a1c1 100644 --- a/src/content/content-type.cpp +++ b/src/content/content-type.cpp @@ -152,4 +152,8 @@ bool ContentType::isText (const string &contentType) { return contentType == "text/plain"; } +bool ContentType::isCPIM(const string &contentType) { + return contentType == "Message/CPIM"; +} + LINPHONE_END_NAMESPACE diff --git a/src/content/content-type.h b/src/content/content-type.h index 8e3851cbf..1f16ed289 100644 --- a/src/content/content-type.h +++ b/src/content/content-type.h @@ -59,6 +59,7 @@ public: static bool isImIsComposing (const std::string &contentType); static bool isImdn (const std::string &contentType); static bool isText (const std::string &contentType); + static bool isCPIM (const std::string &contentType); private: L_DECLARE_PRIVATE(ContentType);