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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
|
/*
Miranda NG: the free IM client for Microsoft* Windows*
Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
Copyright (c) 2000-08 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../hdr/modern_commonheaders.h"
#include "m_clui.h"
#include "../hdr/modern_clist.h"
#include "../hdr/modern_clc.h"
//////////////////////////////Group MENU/////////////////////////
HANDLE hGroupMenuObject;
HGENMENU hGroupMainMenuItemProxy;
HGENMENU hHideShowMainMenuItem;
HGENMENU hGroupStatusMenuItemProxy;
HGENMENU hHideOfflineUsersMenuItem;
HGENMENU hHideOfflineUsersOutHereMenuItem;
HGENMENU hHideEmptyGroupsMenuItem;
HGENMENU hDisableGroupsMenuItem;
HGENMENU hNewGroupMenuItem;
HGENMENU hNewSubGroupMenuItem;
int NewGroupIconidx;
void InitSubGroupMenus(void);
//Groupmenu exec param(ownerdata)
typedef struct
{
char *szServiceName;
int Param1,Param2;
}
GroupMenuExecParam,*lpGroupMenuExecParam;
/*
wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM
return 0 on success.
*/
static INT_PTR RemoveGroupMenuItem(WPARAM wParam, LPARAM lParam)
{
CallService(MO_REMOVEMENUITEM,wParam,0);
return 0;
}
INT_PTR BuildGroupMenu(WPARAM wParam, LPARAM lParam)
{
ListParam param = { 0 };
param.MenuObjectHandle = hGroupMenuObject;
//hMenu = hMainMenu;
HMENU hMenu = CreatePopupMenu();
//hMenu = wParam;
int tick = GetTickCount();
NotifyEventHooks(g_CluiData.hEventPreBuildGroupMenu, 0, 0);
CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m);
//DrawMenuBar((HWND)CallService("CLUI/GetHwnd", 0, 0));
tick = GetTickCount()-tick;
return (INT_PTR)hMenu;
}
static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam)
{
TMO_MenuItem tmi;
CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
if (!pcli->pfnConvertMenu(mi, &tmi))
return NULL;
lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_calloc(sizeof(GroupMenuExecParam));
if (mmep == NULL)
return 0;
//we need just one parametr.
mmep->szServiceName = mir_strdup(mi->pszService);
mmep->Param1 = mi->popupPosition;
lpGroupMenuParam gmp = (lpGroupMenuParam)wParam;
if (gmp != NULL) {
mmep->Param1 = gmp->wParam;
mmep->Param2 = gmp->lParam;
}
tmi.ownerdata = mmep;
char buf[1024];
mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName);
OptParam op;
op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi);
op.Setting = OPT_MENUITEMSETUNIQNAME;
op.Value = (INT_PTR)buf;
CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op);
return (INT_PTR)op.Handle;
}
int GroupMenuCheckService(WPARAM wParam, LPARAM lParam) {
//not used
return 0;
};
INT_PTR GroupMenuonAddService(WPARAM wParam, LPARAM lParam) {
MENUITEMINFO *mii = (MENUITEMINFO* )wParam;
if (mii == NULL)
return 0;
if (hHideShowMainMenuItem == (HANDLE)lParam) {
mii->fMask |= MIIM_STATE;
mii->fState |= MFS_DEFAULT;
}
if (hGroupMainMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
}
if (hGroupStatusMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
}
return TRUE;
}
//called with:
//wparam - ownerdata
//lparam - lparam from winproc
INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam)
{
if (wParam != 0) {
lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)wParam;
if (!mir_strcmp(mmep->szServiceName,"Help/AboutCommand")) {
//bug in help.c,it used wparam as parent window handle without reason.
mmep->Param1 = 0;
CallService(mmep->szServiceName,mmep->Param1,lParam);
}
else CallService(mmep->szServiceName,mmep->Param1,mmep->Param2);
}
return 1;
}
INT_PTR FreeOwnerDataGroupMenu (WPARAM wParam, LPARAM lParam)
{
lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)lParam;
if (mmep != NULL) {
mir_free(mmep->szServiceName);
mir_free(mmep);
}
return 0;
}
INT_PTR HideGroupsHelper(WPARAM wParam, LPARAM lParam)
{
int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS);
db_set_b(NULL,"CList","HideEmptyGroups",(BYTE)newVal);
SendMessage(pcli->hwndContactTree,CLM_SETHIDEEMPTYGROUPS,newVal,0);
return 0;
}
INT_PTR UseGroupsHelper(WPARAM wParam, LPARAM lParam)
{
int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS);
db_set_b(NULL,"CList","UseGroups",(BYTE)newVal);
SendMessage(pcli->hwndContactTree,CLM_SETUSEGROUPS,newVal,0);
return 0;
}
INT_PTR HideOfflineRootHelper(WPARAM wParam, LPARAM lParam)
{
SendMessage(
(HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0),
CLM_SETHIDEOFFLINEROOT,
!SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0),CLM_GETHIDEOFFLINEROOT, 0, 0),
0);
return 0;
}
INT_PTR CreateGroupHelper(WPARAM wParam, LPARAM lParam)
{
SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEEMPTYGROUPS, 0, 0);
SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETUSEGROUPS, 1, 0);
Clist_CreateGroup(0, 0);
return 0;
};
static int OnBuildGroupMenu(WPARAM wParam, LPARAM lParam)
{
if (MirandaExiting()) return 0;
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | ( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0);
Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi);
mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT, 0, 0)?CMIF_CHECKED:0);
Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, &mi);
mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0);
Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);
mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED);
Menu_ModifyItem(hDisableGroupsMenuItem, &mi);
return 0;
}
static IconItem iconItem = { "New Group", "NewGroup", IDI_NEWGROUP2 };
int static OnIconLibIconChanged(WPARAM wParam, LPARAM lParam)
{
if (MirandaExiting()) return 0;
HICON hIcon = Skin_GetIconByHandle(iconItem.hIcolib);
NewGroupIconidx = ImageList_ReplaceIcon(hCListImages, NewGroupIconidx, hIcon);
Skin_ReleaseIcon(hIcon);
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_ICON;
clmi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
Menu_ModifyItem(hNewSubGroupMenuItem, &clmi);
Menu_ModifyItem(hNewGroupMenuItem, &clmi);
return 0;
}
void GroupMenus_Init(void)
{
Icon_Register(g_hInst, "Contact List", &iconItem, 1);
HICON hIcon = Skin_GetIconByHandle(iconItem.hIcolib);
NewGroupIconidx = hIcon ? ImageList_AddIcon(hCListImages, hIcon) : -1;
Skin_ReleaseIcon(hIcon);
CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService);
CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu",FreeOwnerDataGroupMenu);
CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService",GroupMenuonAddService);
CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper",HideGroupsHelper);
CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper",UseGroupsHelper);
CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper",HideOfflineRootHelper);
CreateServiceFunction("CLISTMENUSGroup/CreateGroupHelper",CreateGroupHelper);
CreateServiceFunction("CList/AddGroupMenuItem",AddGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu);
HookEvent(ME_CLIST_PREBUILDGROUPMENU,OnBuildGroupMenu);
InitSubGroupMenus();
// Group menu
hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
//add exit command to menu
GroupMenuParam gmp;
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 1900000;
mi.pszService = "CloseAction";
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_EXIT);
mi.pszName = LPGEN("E&xit");
AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 500;
mi.pszService = MS_CLIST_SHOWHIDE;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_SHOWHIDE);
mi.pszName = LPGEN("&Hide/Show");
hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 200000;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_FINDUSER);
mi.pszService = "FindAdd/FindAddCommand";
mi.pszName = LPGEN("&Find/Add Contacts...");
AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 300000;
mi.pszService = "";
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MAINMENU); // eternity #004
mi.pszName = LPGEN("&Main menu");
hGroupMainMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 300100;
mi.pszService = "";
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_STATUS); // eternity #004
mi.pszName = LPGEN("&Status");
hGroupStatusMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 400000;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS);
mi.pszService = "Options/OptionsCommand";
mi.pszName = LPGEN("&Options...");
AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 500000;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA);
mi.pszService = "Help/AboutCommand";
mi.pszName = LPGEN("&About");
AddGroupMenuItem(0, (LPARAM)&mi);
mi.flags = 0;
mi.position = 100000;
mi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
mi.pszService = "CLISTMENUSGroup/CreateGroupHelper";
mi.pszName = LPGEN("&New Group");
hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
DestroyIcon_protect(mi.hIcon);
mi.position = 100001;
mi.hIcon = NULL;
mi.pszService = MS_CLIST_SETHIDEOFFLINE;
mi.pszName = LPGEN("&Hide Offline Users");
gmp.lParam = 0;gmp.wParam = -1;
hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
mi.position = 100002;
mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
mi.pszName = LPGEN("Hide &Offline Users out here");
hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 100003;
mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
mi.pszName = LPGEN("Hide &Empty Groups");
hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 100004;
mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
mi.pszName = LPGEN("Disable &Groups");
hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibIconChanged);
}
//////////////////////////////END Group MENU/////////////////////////
//////////////////////////////SubGroup MENU/////////////////////////
HANDLE hSubGroupMenuObject;
HANDLE hSubGroupMainMenuItemProxy;
HANDLE hSubGroupStatusMenuItemProxy;
HGENMENU hHideOfflineUsersHereMenuItem, hShowOfflineUsersHereMenuItem;
//SubGroupmenu exec param(ownerdata)
typedef struct{
char *szServiceName;
int Param1,Param2;
}SubGroupMenuExecParam,*lpSubGroupMenuExecParam;
/*
wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM
return 0 on success.
*/
static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam, LPARAM lParam)
{
CallService(MO_REMOVEMENUITEM,wParam,0);
return 0;
}
static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM lParam)
{
BOOL gray1 = FALSE;
BOOL gray2 = FALSE;
BOOL showOfflineinGroup = FALSE;
ClcGroup *group = (ClcGroup *)wParam;
if (wParam == 0) return 0;
if (MirandaExiting()) return 0;
//contact->group
showOfflineinGroup = CLCItems_IsShowOfflineGroup(group);
gray1 = (showOfflineinGroup != FALSE);
gray2 = (group->hideOffline != FALSE);
if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | ((group->hideOffline && !gray1)?CMIF_CHECKED:0)| (gray1?CMIF_GRAYED:0);
Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi);
mi.flags = CMIM_FLAGS | ((showOfflineinGroup && !gray2) ? CMIF_CHECKED:0)| (gray2?CMIF_GRAYED:0);
Menu_ModifyItem(hShowOfflineUsersHereMenuItem, &mi);
return 0;
}
INT_PTR BuildSubGroupMenu(WPARAM wParam, LPARAM lParam)
{
ListParam param = { 0 };
param.MenuObjectHandle = hSubGroupMenuObject;
param.wParam = wParam;
param.lParam = lParam;
//hMenu = hMainMenu;
HMENU hMenu = CreatePopupMenu();
//hMenu = wParam;
int tick = GetTickCount();
NotifyEventHooks(g_CluiData.hEventPreBuildSubGroupMenu,wParam,0);
CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m);
//DrawMenuBar((HWND)CallService("CLUI/GetHwnd", 0, 0));
tick = GetTickCount()-tick;
return (INT_PTR)hMenu;
}
HMENU cliBuildGroupPopupMenu(ClcGroup *group)
{
//HWND wnd = GetForegroundWindow();
return (HMENU)CallService(MS_CLIST_MENUBUILDSUBGROUP,(WPARAM)group,0);
}
static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam)
{
TMO_MenuItem tmi;
CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
if (!pcli->pfnConvertMenu(mi, &tmi))
return NULL;
lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_calloc(sizeof(SubGroupMenuExecParam));
if ( mmep == NULL)
return 0;
//we need just one parametr.
mmep->szServiceName = mir_strdup(mi->pszService);
mmep->Param1 = mi->popupPosition;
lpGroupMenuParam gmp = (lpGroupMenuParam)wParam;
if (gmp != NULL) {
mmep->Param1 = gmp->wParam;
mmep->Param2 = gmp->lParam;
}
tmi.ownerdata = mmep;
char buf[1024];
mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName);
OptParam op;
op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi);
op.Setting = OPT_MENUITEMSETUNIQNAME;
op.Value = (INT_PTR)buf;
CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op);
return (INT_PTR)op.Handle;
}
INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM lParam)
{
TCheckProcParam * CParam = (TCheckProcParam*)wParam;
if (CParam) {
lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)(CParam->MenuItemOwnerData);
if (mmep)
mmep->Param2 = CParam->lParam;
}
return 1;
}
INT_PTR SubGroupMenuonAddService(WPARAM wParam, LPARAM lParam)
{
MENUITEMINFO *mii = (MENUITEMINFO* )wParam;
if (mii == NULL)
return 0;
return TRUE;
}
//called with:
//wparam - ownerdata
//lparam - lparam from winproc
INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam)
{
if (wParam != 0) {
lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)wParam;
if (!mir_strcmp(mmep->szServiceName, "Help/AboutCommand")) {
//bug in help.c,it used wparam as parent window handle without reason.
mmep->Param1 = 0;
CallService(mmep->szServiceName,mmep->Param1,lParam);
}
else CallService(mmep->szServiceName,mmep->Param1,lParam);
}
return 1;
}
INT_PTR FreeOwnerDataSubGroupMenu (WPARAM wParam, LPARAM lParam)
{
lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)lParam;
if (mmep != NULL){
mir_free(mmep->szServiceName);
mir_free(mmep);
}
return 0;
}
//wparam menu handle to pass to clc.c
//lparam WM_COMMAND HWND
INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam)
{
SendMessage(lParam?(HWND)lParam:(HWND)pcli->hwndContactTree,WM_COMMAND,wParam,0);
return 0;
}
void InitSubGroupMenus(void)
{
CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService);
CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu);
CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService);
CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuCheckService",SubGroupMenuCheckService);
CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy);
CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu);
HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu);
// SubGroup menu
hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService");
// add exit command to menu
GroupMenuParam gmp;
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 1000;
mi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
mi.pszName = LPGEN("&New SubGroup");
gmp.lParam = 0;gmp.wParam = POPUP_NEWSUBGROUP;
hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
DestroyIcon_protect(mi.hIcon);
mi.position = 1001;
mi.hIcon = NULL;
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
mi.pszName = LPGEN("&Hide Offline Users in here");
gmp.lParam = 0;
gmp.wParam = POPUP_GROUPHIDEOFFLINE;
hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
mi.position = 1002;
mi.hIcon = NULL;
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
mi.pszName = LPGEN("&Show Offline Users in here");
gmp.lParam = 0;
gmp.wParam = POPUP_GROUPSHOWOFFLINE;
hShowOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.position = 900001;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_RENAME);
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
mi.pszName = LPGEN("&Rename Group");
gmp.lParam = 0;gmp.wParam = POPUP_RENAMEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
DestroyIcon_protect(mi.hIcon);
mi.position = 900002;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE);
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
mi.pszName = LPGEN("&Delete Group");
gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
DestroyIcon_protect(mi.hIcon);
}
//////////////////////////////END SubGroup MENU/////////////////////////
|