summaryrefslogtreecommitdiff
path: root/plugins/MessageState/src/services.cpp
blob: 11beec6d04c4882ece80e00faf8155c6b4987fe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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; 
}