From aa387fa04aa096d163932d3f5f9711a2f146c6f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 23 Feb 2013 19:43:21 +0000 Subject: - PROTO_INTERFACE::GetIcon removed and replaced with the standard implementation; - PS_LOADICON also replaced with the standard function; - ProtoConstructor() & ProtoDestructor() macroses are introduced to simplify protocols' code; - GetIcon() method implementation removed from all protocols git-svn-id: http://svn.miranda-ng.org/main/trunk@3739 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_protoint.inc | 13 +++---------- include/m_protoint.h | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/delphi/m_protoint.inc b/include/delphi/m_protoint.inc index 5031c1b3e7..0b41d5450b 100644 --- a/include/delphi/m_protoint.inc +++ b/include/delphi/m_protoint.inc @@ -30,7 +30,7 @@ type EV_PROTO_ONEXIT, EV_PROTO_ONRENAME, EV_PROTO_ONOPTIONS, - EV_PROTO_ONERASE, + EV_PROTO_ONERASE, EV_PROTO_ONMENU, EV_PROTO_ONCONTACTDELETED, EV_PROTO_DBSETTINGSCHANGED); @@ -46,17 +46,11 @@ type iDesiredStatus:int; iXStatus :int; iVersion :int; // version 2 or higher designate support of Unicode services -{ - bOldProto :Bool; - szPhysName :PAnsiChar; - szProtoName :PAnsiChar; - tszUserName :TChar; -} + tszUserName :TChar; szProtoName :PAnsiChar; szModuleName :PAnsiChar; - - reserved :array [0..39] of dword; + hProtoIcon :THandle; AddToList :function(intf:PPROTO_INTERFACE;flags:int; var psr:TPROTOSEARCHRESULT):THANDLE; cdecl; AddToListByEvent:function(intf:PPROTO_INTERFACE;flags:int; iContact:int; hDbEvent:THANDLE):THANDLE; cdecl; @@ -74,7 +68,6 @@ type FileResume:function(intf:PPROTO_INTERFACE;hTransfer:THANDLE;var action:Integer; var szFilename:PROTOCHAR):int; cdecl; GetCaps:function(intf:PPROTO_INTERFACE;_type:int):dword_ptr; cdecl; - GetIcon:function(intf:PPROTO_INTERFACE;iconIndex:int):HICON; cdecl; GetInfo:function(intf:PPROTO_INTERFACE;hContact:THANDLE;infoType:int):int; cdecl; SearchBasic :function(intf:PPROTO_INTERFACE;id:PAnsiChar):THANDLE; cdecl; diff --git a/include/m_protoint.h b/include/m_protoint.h index 2e412e759c..a042a018e9 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -50,8 +50,7 @@ struct PROTO_INTERFACE TCHAR* m_tszUserName; char* m_szProtoName; char* m_szModuleName; - - DWORD reserved[ 40 ]; + HANDLE m_hProtoIcon; virtual HANDLE __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr) = 0; virtual HANDLE __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) = 0; @@ -69,7 +68,6 @@ struct PROTO_INTERFACE virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename) = 0; virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL) = 0; - virtual HICON __cdecl GetIcon(int iconIndex) = 0; virtual int __cdecl GetInfo(HANDLE hContact, int infoType) = 0; virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id) = 0; @@ -101,4 +99,17 @@ struct PROTO_INTERFACE virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) = 0; }; +// Call it in the very beginning of your proto's constructor +__forceinline void ProtoConstructor(PROTO_INTERFACE *pThis, LPCSTR pszModuleName, LPCTSTR ptszUserName) +{ + CallService("Proto/Constructor", (WPARAM)pThis, (LPARAM)pszModuleName); + pThis->m_tszUserName = mir_tstrdup(ptszUserName); +} + +// Call it in the very end of your proto's destructor +__forceinline void ProtoDestructor(PROTO_INTERFACE *pThis) +{ + CallService("Proto/Destructor", (WPARAM)pThis, 0); +} + #endif // M_PROTOINT_H__ -- cgit v1.2.3