summaryrefslogtreecommitdiff
path: root/plugins/MessageState/src/utils.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-04-22 16:53:14 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-04-22 16:53:14 +0000
commit17da1798498188c1f221e738866107e69d6af066 (patch)
tree64da750c77dcf7ab12654d3fe22d2abeb8f8f3e9 /plugins/MessageState/src/utils.cpp
parent2db93e0b278176b4dd68e8565ddab139d86c6e7b (diff)
MessageState: code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@16747 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MessageState/src/utils.cpp')
-rw-r--r--plugins/MessageState/src/utils.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/plugins/MessageState/src/utils.cpp b/plugins/MessageState/src/utils.cpp
index 27040cf3c2..7c285b42c7 100644
--- a/plugins/MessageState/src/utils.cpp
+++ b/plugins/MessageState/src/utils.cpp
@@ -1,12 +1,12 @@
#include "stdafx.h"
-LONGLONG GetLastSentMessageTime(MCONTACT hContact)
+time_t GetLastSentMessageTime(MCONTACT hContact)
{
for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent))
{
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
- if (FLAG_CONTAINS(dbei.flags, DBEF_SENT))
+ if (dbei.flags & DBEF_SENT)
return dbei.timestamp;
}
return -1;
@@ -14,11 +14,5 @@ LONGLONG GetLastSentMessageTime(MCONTACT hContact)
bool HasUnread(MCONTACT hContact)
{
- const char *szProto = GetContactProto(hContact);
- if (CheckProtoSupport(szProto))
- {
- return ((GetLastSentMessageTime(hContact) > db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0)) && db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0) != 0);
- }
-
- return false;
+ return (CheckProtoSupport(GetContactProto(hContact))) && ((GetLastSentMessageTime(hContact) > db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0)) && db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0) != 0);
}