From b20343c4402b9af5dfe8fc673fa2d1c683663b7a Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 14 Feb 2017 10:14:52 +0100 Subject: [PATCH] Fix linphone_chat_message_is_read() according to IM notif policy. --- coreapi/chat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 6609e895b..4e0128224 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -1534,8 +1534,12 @@ void linphone_chat_message_remove_custom_header(LinphoneChatMessage *msg, const } bool_t linphone_chat_message_is_read(LinphoneChatMessage *msg) { - // TODO : Only state == displayed when reception accused supported - return (msg->state == LinphoneChatMessageStateDisplayed || msg->state == LinphoneChatMessageStateDelivered) ? TRUE : FALSE; + LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg); + LinphoneCore *lc = linphone_chat_room_get_core(cr); + LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(lc); + if ((linphone_im_notif_policy_get_recv_imdn_displayed(policy) == TRUE) && (msg->state == LinphoneChatMessageStateDisplayed)) return TRUE; + if ((linphone_im_notif_policy_get_recv_imdn_delivered(policy) == TRUE) && (msg->state == LinphoneChatMessageStateDeliveredToUser)) return TRUE; + return (msg->state == LinphoneChatMessageStateDelivered); } bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage *msg) {