blob: dceba2b9674158baad76cd91672f7f6078a301b4 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 | #ifndef __contact_cache__
#define __contact_cache__
class CContactCache
{
public:
	enum { INFOSIZE = 1024 };
	struct TContactInfo
	{
		MCONTACT hContact;
		float rate;
		bool infoLoaded;
		TCHAR info[INFOSIZE];
	
		TContactInfo()
		{
			info[0] = info[1] = 0;
			infoLoaded = false;
		}
		void LoadInfo();
	};
private:
	LIST<TContactInfo> m_cache;
	unsigned long m_lastUpdate;
	CRITICAL_SECTION m_cs;
	int __cdecl OnDbEventAdded(WPARAM wParam, LPARAM lParam);
	float GetEventWeight(unsigned long age);
	float GetTimeWeight(unsigned long age);
public:
	CContactCache();
	~CContactCache();
	void Rebuild();
	MCONTACT get(int rate);
	float getWeight(int rate);
	bool filter(int rate, TCHAR *str);
};
#endif // __contact_cache__
 |