summaryrefslogtreecommitdiff
path: root/plugins/Watrack/proto
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-10 19:12:33 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-10 19:12:33 +0000
commit6ad65c4d4fce1d5ce1a1873ee84feaff753c9d48 (patch)
tree94e232bdd680291eb7192851d71935f89b196fd2 /plugins/Watrack/proto
parent9a4be1a673e76cb205a11076b7d8162eb593feab (diff)
Watrack:
- event hooks wiped out; - icons & menus optimization; - merge of memory leak fix git-svn-id: http://svn.miranda-ng.org/main/trunk@3963 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack/proto')
-rw-r--r--plugins/Watrack/proto/proto.pas62
1 files changed, 12 insertions, 50 deletions
diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas
index 254a02bac6..44efda6ec8 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,
- icchangedhook,
- hAddUserHook,
- hContactMenuItem,
- contexthook:THANDLE;
+ hContactMenuItem:THANDLE;
ProtoText:pWideChar;
HistMask:cardinal;
@@ -231,7 +231,7 @@ begin
isNewRequest:=StrCmp(PPROTORECVEVENT(ccs^.lParam)^.szMessage.a,
wpRequestNew,Length(wpRequestNew))=0;
- if isNewRequest or
+ if isNewRequest or
(StrCmp(PPROTORECVEVENT(ccs^.lParam)^.szMessage.a,
wpRequest,Length(wpRequest))=0) then
begin
@@ -255,7 +255,7 @@ begin
curpos:=nil;
if DisablePlugin<>dsPermanent then
begin
- if CallService(MS_WAT_GETMUSICINFO,0,0)=WAT_PLS_NOTFOUND then
+ if CallService(MS_WAT_GETMUSICINFO,0,0)=uint_ptr(WAT_PLS_NOTFOUND) then
begin
s:=#0#0#0'No player found at this time';
textpos:=s+3;
@@ -448,42 +448,7 @@ begin
desc._type :=PROTOTYPE_TRANSLATION;
CallService(MS_PROTO_REGISTERMODULE,0,lparam(@desc));
-// CreateProtoServiceFunction(PluginShort,PSS_MESSAGE ,@SendMessageProcW);
-// CreateProtoServiceFunction(PluginShort,PSS_MESSAGEW,@SendMessageProcW);
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 -------------
@@ -505,14 +470,15 @@ begin
result:=1;
ReadOptions;
- RegisterIcons;
+
+ Icon_Register(hInstance,PluginShort,@Icons,1);
FillChar(mi, sizeof(mi), 0);
mi.cbSize :=sizeof(mi);
mi.szPopupName.a:=PluginShort;
- mi.flags :=CMIF_NOTOFFLINE or CMIF_NOTOFFLIST;
+ mi.flags :=CMIF_NOTOFFLINE or CMIF_NOTOFFLIST or CMIF_ICONFROMICOLIB;
// mi.popupPosition:=MenuUserInfoPos;
- mi.hIcon :=CallService(MS_SKIN2_GETICON,0,lparam(IcoBtnContext));
+ mi.hIcon :=Icons.hIcolib;
mi.szName.a :='Get user''s Music Info';
mi.pszService :=MS_WAT_GETCONTACTINFO;
hContactMenuItem:=Menu_AddContactMenuItem(@mi);
@@ -520,8 +486,8 @@ begin
SetProtocol;
RegisterContacts;
hGCI:=CreateServiceFunction(MS_WAT_GETCONTACTINFO,@SendRequest);
- contexthook :=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
- hAddUserHook:=HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
+ HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -529,10 +495,6 @@ begin
if aSetDisable then
SetModStatus(0);
- UnhookEvent(hAddUserHook);
- UnhookEvent(contexthook);
- UnhookEvent(icchangedhook);
-
DestroyServiceFunction(hSRM);
DestroyServiceFunction(hGCI);
mFreeMem(ProtoText);