summaryrefslogtreecommitdiff
path: root/plugins/MessageState/src/services.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-09-09 12:51:17 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-09-09 12:51:17 +0000
commiteff5259d6dac303fafa0e661a181428680197584 (patch)
tree73a89e1d6636b2b154a9e7f24c98a60ed27fa2d6 /plugins/MessageState/src/services.cpp
parent2ce8833450aa05cdc598abd2f7ca1b68afa3ae5d (diff)
MessageState: code optimization; leaks fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15314 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MessageState/src/services.cpp')
-rw-r--r--plugins/MessageState/src/services.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/MessageState/src/services.cpp b/plugins/MessageState/src/services.cpp
new file mode 100644
index 0000000000..11beec6d04
--- /dev/null
+++ b/plugins/MessageState/src/services.cpp
@@ -0,0 +1,27 @@
+#include "stdafx.h"
+
+extern HANDLE hUpdateService;
+
+void InitServices()
+{
+ hUpdateService = CreateServiceFunction(MS_MESSAGESTATE_UPDATE, UpdateService);
+}
+
+void DestroyServices()
+{
+ if (hUpdateService)
+ DestroyServiceFunction(hUpdateService);
+}
+
+INT_PTR UpdateService(WPARAM hContact, LPARAM lParam)
+{
+ MessageReadData *mrd = (MessageReadData*)lParam;
+ if (mrd->dw_lastTime > db_get_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, 0))
+ {
+ db_set_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME, mrd->dw_lastTime);
+ db_set_dw(hContact, MODULENAME, DBKEY_MESSAGE_READ_TIME_TYPE, mrd->iTimeType);
+ IconsUpdate(hContact, mrd->dw_lastTime);
+ ExtraIconsApply(hContact, 0);
+ }
+ return 0;
+} \ No newline at end of file