Added ChatMessageModifiers chain in reception

This commit is contained in:
Sylvain Berfini 2017-10-03 11:13:35 +02:00
parent 61d1cdd8b0
commit 28e77ff2e6
3 changed files with 15 additions and 3 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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);