summaryrefslogtreecommitdiff
path: root/plugins/MirFox/src/MirfoxMiranda.h
blob: 31cb61f99cd6cd5a18a670bdfe08959f50b3326d (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef _MIRFOXMIRANDA_INC
#define _MIRFOXMIRANDA_INC

#include "MirfoxData.h"
#include "MirandaUtils.h"


class CMirfoxMiranda;


struct OnContactAsyncThreadArgStruct {
	MCONTACT hContact;
	CMirfoxMiranda* mirfoxMiranda;
};


class CMirfoxMiranda
{

public:
	CMirfoxMiranda();
	~CMirfoxMiranda();


	//functions needed by MirandaInterface and Miranda Options

	MirfoxData& getMirfoxData();

	SharedMemoryUtils& getSharedMemoryUtils();

	int onMirandaInterfaceLoad();

	int onMirandaInterfaceUnload();

	//hooks support - to refresh data
	void onAccListChanged(WPARAM wParam, LPARAM lParam);
	static void onContactAdded_async(void* threadArg); //at async new thread
	void onContactDeleted(MCONTACT hContact);
	void onContactSettingChanged(MCONTACT hContact, LPARAM lParam);
	static void onContactSettingChanged_async(void* threadArg); //at async new thread


	//csm maintanance thread function (threadArg - pointer to this CMirfoxMiranda class instance)
	static void csmThread(void* threadArg);

	//message queue thread function (threadArg - pointer to this CMirfoxMiranda class instance)
	static void msgQueueThread(void* threadArg);



private:

	void initializeSharedMemory(MirfoxData& mirfoxData);
	void initializeSharedMemoryData(MirfoxData& mirfoxData, SharedMemoryUtils* sharedMemoryUtils);
	void commitSharedMemory();
	void unloadSharedMemory();

	void initializeMessageQueue(MirfoxData& mirfoxData);
	void unloadMessageQueue(uint16_t unloadedMQProcessId);



	MirfoxData mirfoxData;

	SharedMemoryUtils* sharedMemoryUtils;
	MirandaUtils* mirandaUtils;

	MFLogger* logger;

};



#endif //#IFNDEF _MIRFOXMIRANDA_INC