From 0a289dfb53afd6f0c70b980b730e2f411f84a1f4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Feb 2020 20:29:24 +0300 Subject: MessageState: code cleaning --- plugins/MessageState/src/utils.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'plugins/MessageState') diff --git a/plugins/MessageState/src/utils.cpp b/plugins/MessageState/src/utils.cpp index e8006141a3..9dd3110133 100644 --- a/plugins/MessageState/src/utils.cpp +++ b/plugins/MessageState/src/utils.cpp @@ -13,5 +13,11 @@ time_t GetLastSentMessageTime(MCONTACT hContact) bool HasUnread(MCONTACT hContact) { - return (CheckProtoSupport(Proto_GetBaseAccountName(hContact))) && ((GetLastSentMessageTime(hContact) > g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0)) && g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0) != 0); + if (!CheckProtoSupport(Proto_GetBaseAccountName(hContact))) + return false; + + if (GetLastSentMessageTime(hContact) <= g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0)) + return false; + + return g_plugin.getDword(hContact, DBKEY_MESSAGE_READ_TIME, 0) != 0; } -- cgit v1.2.3