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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
#ifndef _MIRFOXDATA_INC
#define _MIRFOXDATA_INC
enum MFENUM_PLUGIN_STATE {
MFENUM_PLUGIN_STATE_NEW, //just started - unstable
MFENUM_PLUGIN_STATE_INIT, //inicializing inner data
MFENUM_PLUGIN_STATE_WORK, //inited and ready to work
MFENUM_PLUGIN_STATE_ERROR //error occured, plugin doesn't work
};
enum MFENUM_OPTIONS_STATE {
MFENUM_OPTIONS_NEW, //just started - unstable
MFENUM_OPTIONS_INIT, //inicializing inner data
MFENUM_OPTIONS_WORK //inited and ready to work
};
enum MFENUM_MIRANDAACCOUNT_STATE {
MFENUM_MIRANDAACCOUNT_STATE_UNKNOWN, //just loaded - unstable
MFENUM_MIRANDAACCOUNT_STATE_ON, //miranda account checked in options
MFENUM_MIRANDAACCOUNT_STATE_OFF //miranda account not checked in options
};
enum MFENUM_MIRANDACONTACT_STATE {
MFENUM_MIRANDACONTACT_STATE_UNKNOWN, //just loaded - unstable
MFENUM_MIRANDACONTACT_STATE_ON, //miranda contact checked in options
MFENUM_MIRANDACONTACT_STATE_OFF //miranda contact not checked in options
};
enum MFENUM_SEND_MESSAGE_MODE {
MFENUM_SMM_ONLY_SEND = 1, // 1 - only send message, show popup
MFENUM_SMM_SEND_AND_SHOW_MW = 2, // 2 - send message and open message window, no show popup
MFENUM_SMM_ONLY_SHOW_MW = 3 // 3 - only show message window with pasted message, no show popup
};
class MirandaAccount;
class MirandaContact;
class MirfoxData
{
public:
MirfoxData(void);
~MirfoxData(void);
//Miranda handles to open message window hook procedure
HANDLE hhook_EventOpenMW;
HANDLE hhook_OpenMW;
bool volatile Plugin_Terminated;
int volatile workerThreadsCount;
MFENUM_SEND_MESSAGE_MODE leftClickSendMode;
MFENUM_SEND_MESSAGE_MODE rightClickSendMode;
MFENUM_SEND_MESSAGE_MODE middleClickSendMode;
/*
* getters, setters, adding
*/
//inline
//get current plugin state MFENUM_PLUGINSTATE
MFENUM_PLUGIN_STATE getPluginState() const {
return pluginState;
}
//inline
//set current plugin state MFENUM_PLUGINSTATE
void setPluginState(MFENUM_PLUGIN_STATE pluginStateL){
pluginState = pluginStateL;
}
//inline
//get current tab1 options state MFENUM_OPTIONS_STATE
MFENUM_OPTIONS_STATE getTab1OptionsState() const {
return tab1OptionsState;
}
//inline
//set current tab1 options state MFENUM_OPTIONS_STATE
void setTab1OptionsState(MFENUM_OPTIONS_STATE tab1OptionsStateL){
tab1OptionsState = tab1OptionsStateL;
}
//inline
//get current tab2 options state MFENUM_OPTIONS_STATE
MFENUM_OPTIONS_STATE getTab2OptionsState() const {
return tab2OptionsState;
}
//inline
//set current tab2 options state MFENUM_OPTIONS_STATE
void setTab2OptionsState(MFENUM_OPTIONS_STATE tab2OptionsStateL){
tab2OptionsState = tab2OptionsStateL;
}
//inline
//get current tab1 options state MFENUM_OPTIONS_STATE
MFENUM_OPTIONS_STATE getTab3OptionsState() const {
return tab3OptionsState;
}
//inline
//set current tab1 options state MFENUM_OPTIONS_STATE
void setTab3OptionsState(MFENUM_OPTIONS_STATE tab3OptionsStateL){
tab3OptionsState = tab3OptionsStateL;
}
static bool shouldProtoBeActiveByName(std::string protoName);
int getAccountDefaultState(MirandaAccount* account);
int getContactDefaultState(MirandaContact* hContact);
//Contacts
//add MirandaContact item to list of MirandaContacts
void addMirandaContact(MirandaContact* mirandaContactL);
//get list of MirandaAContacts
boost::ptr_list<MirandaContact>* getMirandaContacts();
//clears list of MirandaContacts
void clearMirandaContacts();
//update MirandaContact's state by id
//return 0 - ok,
int updateMirandaContactState(MCONTACT contactHandle, MFENUM_MIRANDACONTACT_STATE & contactState);
//return MirandaContact* by HANDLE
MirandaContact* getMirandaContactPtrByHandle(MCONTACT contactHandle);
//Accounts
//add MirandaAccount item to list of MirandaAccounts
void addMirandaAccount(MirandaAccount* mirandaAccountL);
//get list of MirandaAccounts
boost::ptr_list<MirandaAccount>* getMirandaAccounts();
//clears list of MirandaAccounts
void clearMirandaAccounts();
//update MirandaAccount's state by id
//return 0 - ok,
int updateMirandaAccountState(char* szModuleName, MFENUM_MIRANDAACCOUNT_STATE& accountState);
//you MUST delete returned char* (if it is not NULL)
char* getAccountSzModuleNameById(uint64_t id);
//return MirandaAccount* by szModuleName
MirandaAccount* getMirandaAccountPtrBySzModuleName(char* szModuleName);
//options
//inline
//get clientsProfilesFilterCheckbox bool
bool getClientsProfilesFilterCheckbox() const {
return clientsProfilesFilterCheckbox;
}
//inline
//set clientsProfilesFilterCheckbox bool
void setClientsProfilesFilterCheckbox(bool clientsProfilesFilterCheckboxL){
clientsProfilesFilterCheckbox = clientsProfilesFilterCheckboxL;
}
//inline
//get ptr to clientsProfilesFilterWString std::string
std::wstring * getClientsProfilesFilterStringPtr();
//normalize clientsProfilesFilterString
void normalizeClientsProfilesFilterString(std::size_t maxCSize);
//id of process record in csm
uint16_t processCsmId;
/*
* functions
*/
void initializeMirfoxData();
void releaseMirfoxData();
private:
// current plugin state
// @see MFENUM_PLUGINSTATE
MFENUM_PLUGIN_STATE pluginState;
MFENUM_OPTIONS_STATE tab1OptionsState;
MFENUM_OPTIONS_STATE tab2OptionsState;
MFENUM_OPTIONS_STATE tab3OptionsState;
// list of pointers to MirandaAccount class instances
boost::ptr_list<MirandaAccount> mirandaAccounts;
//initialize accounts list
void initializeMirandaAccounts();
// list of pointers to MirandaContact class instances
boost::ptr_list<MirandaContact> mirandaContacts;
//initialize contacts list
void initializeMirandaContacts();
//options
bool clientsProfilesFilterCheckbox;
std::wstring clientsProfilesFilterString;
void initializeOptions();
};
class MirandaAccount
{
public:
MirandaAccount(uint64_t idL, char* szModuleNameL, TCHAR* tszAccountNameL, char* szProtoNameL, int displayOrderL);
~MirandaAccount(void);
MirandaAccount* getObjectPtr();
uint64_t id; //selfgenerated id, used in sm
char* szModuleName; //unique string id of account
TCHAR* tszAccountName; //account name
char* szProtoName; //physical protocol name
int displayOrder; //presentation order - not used now
MFENUM_MIRANDAACCOUNT_STATE accountState; //state in options
};
class MirandaContact
{
public:
MirandaContact(MCONTACT contactHandleL);
~MirandaContact(void);
MirandaContact* getObjectPtr();
MCONTACT contactHandle; //HANDLE to contact in miranda (unikalne)
std::wstring contactNameW; //presented name
MFENUM_MIRANDACONTACT_STATE contactState; //state in options
MirandaAccount* mirandaAccountPtr; //account of hContact
};
#endif //#ifndef _MIRFOXDATA_INC
|