diff options
Diffstat (limited to 'plugins/Watrack/proto/proto.pas')
-rw-r--r-- | plugins/Watrack/proto/proto.pas | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas index e0e3a94dcf..f1c6eff06b 100644 --- a/plugins/Watrack/proto/proto.pas +++ b/plugins/Watrack/proto/proto.pas @@ -45,12 +45,12 @@ const hmISend = $0080;
var
- Icons : tIconItem = (szDescr: 'Context Menu'; szName: @IcoBtnContext; defIconID: BTN_CONTEXT; size: 0; hIcolib: 0;);
-
-var
hSRM,
hGCI,
- hContactMenuItem:THANDLE;
+ icchangedhook,
+ hAddUserHook,
+ hContactMenuItem,
+ contexthook:THANDLE;
ProtoText:pWideChar;
HistMask:cardinal;
@@ -446,6 +446,39 @@ begin CallService(MS_PROTO_REGISTERMODULE,0,lparam(@desc));
hSRM:=CreateProtoServiceFunction(PluginShort,PSR_MESSAGE ,@ReceiveMessageProcW);
+// CreateProtoServiceFunction(PluginShort,PSR_MESSAGEW,@ReceiveMessageProcW);
+end;
+
+function IconChanged(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ mi:TCListMenuItem;
+begin
+ result:=0;
+ FillChar(mi,SizeOf(mi),0);
+ mi.cbSize:=sizeof(mi);
+ mi.flags :=CMIM_ICON;
+
+ mi.hIcon:=CallService(MS_SKIN2_GETICON,0,tlparam(IcoBtnContext));
+ CallService(MS_CLIST_MODIFYMENUITEM,hContactMenuItem,tlparam(@mi));
+end;
+
+procedure RegisterIcons;
+var
+ sid:TSKINICONDESC;
+begin
+ FillChar(sid,SizeOf(TSKINICONDESC),0);
+ sid.cbSize:=SizeOf(TSKINICONDESC);
+ sid.cx:=16;
+ sid.cy:=16;
+ sid.szSection.a:=PluginShort;
+
+ sid.hDefaultIcon :=LoadImage(hInstance,MAKEINTRESOURCE(BTN_CONTEXT),IMAGE_ICON,16,16,0);
+ sid.pszName :=IcoBtnContext;
+ sid.szDescription.a:='Context Menu';
+ Skin_AddIcon(@sid);
+ DestroyIcon(sid.hDefaultIcon);
+//!!
+ icchangedhook:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
end;
// ------------ base interface functions -------------
@@ -468,14 +501,14 @@ begin ReadOptions;
- Icon_Register(hInstance,PluginShort,@Icons,1);
+ RegisterIcons;
FillChar(mi, sizeof(mi), 0);
mi.cbSize :=sizeof(mi);
mi.szPopupName.a:=PluginShort;
mi.flags :=CMIF_NOTOFFLINE or CMIF_NOTOFFLIST;
// mi.popupPosition:=MenuUserInfoPos;
- mi.hIcon :=Icons.hIcolib;
+ mi.hIcon :=CallService(MS_SKIN2_GETICON,0,lparam(IcoBtnContext));
mi.szName.a :='Get user''s Music Info';
mi.pszService :=MS_WAT_GETCONTACTINFO;
hContactMenuItem:=Menu_AddContactMenuItem(@mi);
@@ -483,14 +516,17 @@ begin SetProtocol;
RegisterContacts;
hGCI:=CreateServiceFunction(MS_WAT_GETCONTACTINFO,@SendRequest);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
- HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
+ contexthook :=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
+ hAddUserHook:=HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
end;
procedure DeInitProc(aSetDisable:boolean);
begin
if aSetDisable then
SetModStatus(0);
+ UnhookEvent(hAddUserHook);
+ UnhookEvent(contexthook);
+ UnhookEvent(icchangedhook);
DestroyServiceFunction(hSRM);
DestroyServiceFunction(hGCI);
|