From c446f1f424cbd5399e2279eaee8f97adddf65346 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 25 Jan 2017 11:39:06 +0100 Subject: [PATCH] Do not send IM notification is the chat message does not have a message id. --- coreapi/chat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index b4f7c78dc..d46f9751e 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -1049,6 +1049,11 @@ static char *linphone_chat_message_create_imdn_xml(LinphoneChatMessage *cm, enum int err; char *content = NULL; char *datetime = NULL; + const char *message_id; + + /* Check that the chat message has a message id */ + message_id = linphone_chat_message_get_message_id(cm); + if (message_id == NULL) return NULL; buf = xmlBufferCreate(); if (buf == NULL) { @@ -1071,7 +1076,7 @@ static char *linphone_chat_message_create_imdn_xml(LinphoneChatMessage *cm, enum err = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)"xmlns", (const xmlChar *)"linphoneimdn", NULL, (const xmlChar *)"http://www.linphone.org/xsds/imdn.xsd"); } if (err >= 0) { - err = xmlTextWriterWriteElement(writer, (const xmlChar *)"message-id", (const xmlChar *)linphone_chat_message_get_message_id(cm)); + err = xmlTextWriterWriteElement(writer, (const xmlChar *)"message-id", (const xmlChar *)message_id); } if (err >= 0) { err = xmlTextWriterWriteElement(writer, (const xmlChar *)"datetime", (const xmlChar *)datetime);