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 --- protocols/IRCG/src/irc.h | 1 - protocols/IRCG/src/ircproto.cpp | 35 +++++------------------------------ 2 files changed, 5 insertions(+), 31 deletions(-) (limited to 'protocols/IRCG/src') diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 6928d21dda..82663a58bb 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -238,7 +238,6 @@ struct CIrcProto : public PROTO_INTERFACE, public MZeroedObject virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ); virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual HICON __cdecl GetIcon( int iconIndex ); virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id ); diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 0c384234c0..f77bd5505d 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -29,16 +29,14 @@ static int CompareSessions( const CDccSession* p1, const CDccSession* p2 ) return INT_PTR( p1->di->hContact ) - INT_PTR( p2->di->hContact ); } -CIrcProto::CIrcProto( const char* szModuleName, const TCHAR* tszUserName ) : +CIrcProto::CIrcProto(const char* szModuleName, const TCHAR* tszUserName) : m_dcc_chats( 10, CompareSessions ), m_dcc_xfers( 10, CompareSessions ), m_ignoreItems( 10 ), vUserhostReasons( 10 ), vWhoInProgress( 10 ) { - m_iVersion = 2; - m_tszUserName = mir_tstrdup( tszUserName ); - m_szModuleName = mir_strdup( szModuleName ); + ProtoConstructor(this, szModuleName, tszUserName); InitializeCriticalSection(&cs); InitializeCriticalSection(&m_gchook); @@ -165,14 +163,14 @@ CIrcProto::~CIrcProto() CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )hMenuRoot, 0 ); mir_free( m_alias ); - mir_free( m_szModuleName ); - mir_free( m_tszUserName ); CloseHandle( m_evWndCreate ); DeleteCriticalSection(&m_resolve); DeleteCriticalSection(&m_dcc); KillChatTimer(OnlineNotifTimer); KillChatTimer(OnlineNotifTimer3); + + ProtoDestructor(this); } //////////////////////////////////////////////////////////////////////////////////////// @@ -551,29 +549,6 @@ DWORD_PTR __cdecl CIrcProto::GetCaps( int type, HANDLE ) return 0; } -//////////////////////////////////////////////////////////////////////////////////////// -// GetIcon - loads an icon for the contact list - -HICON __cdecl CIrcProto::GetIcon( int iconIndex ) -{ - if (LOWORD(iconIndex) == PLI_PROTOCOL) - { - if (iconIndex & PLIF_ICOLIBHANDLE) - return (HICON)GetIconHandle(IDI_MAIN); - - bool big = (iconIndex & PLIF_SMALL) == 0; - HICON hIcon = LoadIconEx(IDI_MAIN, big); - - if (iconIndex & PLIF_ICOLIB) - return hIcon; - - HICON hIcon2 = CopyIcon(hIcon); - ReleaseIconEx(hIcon); - return hIcon2; - } - return NULL; -} - //////////////////////////////////////////////////////////////////////////////////////// // GetInfo - retrieves a contact info @@ -605,7 +580,7 @@ void __cdecl CIrcProto::AckBasicSearch( void* param ) HANDLE __cdecl CIrcProto::SearchBasic( const PROTOCHAR* szId ) { if ( szId ) { - if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING && + if (m_iStatus != ID_STATUS_OFFLINE && m_iStatus != ID_STATUS_CONNECTING && szId && szId[0] && !IsChannel(szId)) { AckBasicSearchParam* param = new AckBasicSearchParam; lstrcpyn( param->buf, szId, 50 ); -- cgit v1.2.3