diff options
Diffstat (limited to 'protocols')
31 files changed, 136 insertions, 426 deletions
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index db7b574e10..cd36490c21 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -20,9 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName)
: chat_rooms(5)
{
- m_iVersion = 2;
- m_tszUserName = mir_tstrdup(aUserName);
- m_szModuleName = mir_strdup(aProtoName);
+ ProtoConstructor(this, aProtoName, aUserName);
m_szProtoName = mir_strdup(aProtoName);
_strlwr(m_szProtoName);
m_szProtoName[0] = (char)toupper(m_szProtoName[0]);
@@ -115,9 +113,8 @@ CAimProto::~CAimProto() mir_free(ADMIN_COOKIE);
mir_free(username);
- mir_free(m_szModuleName);
- mir_free(m_tszUserName);
mir_free(m_szProtoName);
+ ProtoDestructor(this);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -355,29 +352,6 @@ DWORD_PTR __cdecl CAimProto::GetCaps(int type, HANDLE hContact) }
////////////////////////////////////////////////////////////////////////////////////////
-// GetIcon - loads an icon for the contact list
-
-HICON __cdecl CAimProto::GetIcon(int iconIndex)
-{
- if (LOWORD(iconIndex) == PLI_PROTOCOL)
- {
- if (iconIndex & PLIF_ICOLIBHANDLE)
- return (HICON)GetIconHandle("aim");
-
- bool big = (iconIndex & PLIF_SMALL) == 0;
- HICON hIcon = LoadIconEx("aim", big);
-
- if (iconIndex & PLIF_ICOLIB)
- return hIcon;
-
- hIcon = CopyIcon(hIcon);
- ReleaseIconEx("aim", big);
- return hIcon;
- }
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
// GetInfo - retrieves a contact info
int __cdecl CAimProto::GetInfo(HANDLE hContact, int infoType)
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index bb4dc3c601..b964c3ce17 100644 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -52,7 +52,6 @@ struct CAimProto : public PROTO_INTERFACE, public MZeroedObject virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** 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/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index 22fe3e70a8..ee99787029 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -63,7 +63,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa PUDeletePopUp(hwnd);
} break;
- case WM_CONTEXTMENU:
+ case WM_CONTEXTMENU:
PUDeletePopUp(hwnd);
break;
@@ -76,7 +76,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa } return FALSE;
default:
- break;
+ break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -149,7 +149,7 @@ void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD pd.colorText = colorText;
pd.iSeconds = timeout;
pd.lchContact = contact;
- pd.lchIcon = GetIcon(1); // TODO: Icon test
+ pd.lchIcon = Skin_GetIconByHandle(m_hProtoIcon); // TODO: Icon test
pd.PluginData = szUrl;
pd.PluginWindowProc = (WNDPROC)PopupDlgProc;
lstrcpy(pd.lptzContactName, title);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 136073f306..eb4971b77e 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -24,10 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username)
{
- m_iVersion = 2;
- m_szProtoName = mir_strdup( proto_name );
- m_szModuleName = mir_strdup( proto_name );
- m_tszUserName = mir_tstrdup( username );
+ ProtoConstructor(this, proto_name, username);
+ m_szProtoName = mir_strdup(proto_name);
facy.parent = this;
@@ -100,9 +98,8 @@ FacebookProto::~FacebookProto( ) CloseHandle( facy.send_message_lock_ );
CloseHandle( facy.fcb_conn_lock_ );
- mir_free( m_tszUserName );
- mir_free( m_szModuleName );
mir_free( m_szProtoName );
+ ProtoDestructor(this);
}
//////////////////////////////////////////////////////////////////////////////
@@ -114,7 +111,7 @@ DWORD_PTR FacebookProto::GetCaps( int type, HANDLE hContact ) case PFLAGNUM_1:
{
DWORD_PTR flags = PF1_IM | PF1_CHAT | PF1_SERVERCLIST | PF1_AUTHREQ | /*PF1_ADDED |*/ PF1_BASICSEARCH | PF1_USERIDISEMAIL | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_ADDSEARCHRES; // | PF1_VISLIST | PF1_INVISLIST;
-
+
if ( getByte( FACEBOOK_KEY_SET_MIRANDA_STATUS, 0 ))
return flags |= PF1_MODEMSG;
else
@@ -141,28 +138,17 @@ DWORD_PTR FacebookProto::GetCaps( int type, HANDLE hContact ) return 0;
}
-HICON FacebookProto::GetIcon(int index)
-{
- if (LOWORD(index) == PLI_PROTOCOL)
- {
- HICON ico = Skin_GetIcon("Facebook_facebook");
- return CopyIcon(ico);
- } else {
- return 0;
- }
-}
-
//////////////////////////////////////////////////////////////////////////////
int FacebookProto::SetStatus( int new_status )
{
LOG("===== Beginning SetStatus process");
-
+
// Routing statuses not supported by Facebook
switch ( new_status )
{
case ID_STATUS_INVISIBLE:
- case ID_STATUS_OFFLINE:
+ case ID_STATUS_OFFLINE:
m_iDesiredStatus = new_status;
break;
@@ -171,7 +157,7 @@ int FacebookProto::SetStatus( int new_status ) m_iDesiredStatus = ID_STATUS_OFFLINE;
break;
- case ID_STATUS_IDLE:
+ case ID_STATUS_IDLE:
default:
m_iDesiredStatus = ID_STATUS_INVISIBLE;
if (DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES))
@@ -195,7 +181,7 @@ int FacebookProto::SetStatus( int new_status ) }
facy.invisible_ = ( new_status == ID_STATUS_INVISIBLE );
-
+
ForkThread( &FacebookProto::ChangeStatus, this );
return 0;
@@ -230,7 +216,7 @@ HANDLE FacebookProto::SearchBasic( const PROTOCHAR* id ) {
if (isOffline())
return 0;
-
+
TCHAR* email = mir_tstrdup(id);
ForkThread(&FacebookProto::SearchAckThread, this, (void*)email);
@@ -298,12 +284,12 @@ int FacebookProto::Authorize(HANDLE hDbEvent) return ApproveFriendship((WPARAM)hContact, NULL);
}
- return 1;
+ return 1;
}
int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason)
{
-
+
if (!isOffline() && hDbEvent)
{
HANDLE hContact = HContactFromAuthEvent(hDbEvent);
@@ -370,7 +356,7 @@ int FacebookProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam) case EV_PROTO_ONEXIT:
return OnPreShutdown(wParam,lParam);
-
+
case EV_PROTO_ONOPTIONS:
return OnOptionsInit(wParam,lParam);
@@ -386,7 +372,7 @@ int FacebookProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam) int FacebookProto::SvcCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
{
- return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT),
+ return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_FACEBOOKACCOUNT),
(HWND)lParam, FBAccountProc, (LPARAM)this );
}
@@ -425,7 +411,7 @@ int FacebookProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = FBOptionsProc;
Options_AddPage(wParam, &odp);
-
+
odp.position = 271829;
odp.ptszTab = LPGENT("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_ADVANCED);
@@ -480,8 +466,8 @@ int FacebookProto::RefreshBuddyList(WPARAM, LPARAM) int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam)
-{
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+{
+ HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
std::string url = FACEBOOK_URL_PROFILE;
DBVARIANT dbv;
@@ -531,7 +517,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) }
if (MessageBox( 0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) {
-
+
if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string* id = new std::string(dbv.pszVal);
@@ -546,7 +532,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
DBFreeVariant(&dbv);
}
-
+
}
return 0;
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 2c989891ce..d7dd494c95 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -66,7 +66,6 @@ public: virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** 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/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index c7571f7255..3dba2f5552 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -23,6 +23,8 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName)
{
+ ProtoConstructor(this, pszProtoName, tszUserName);
+
#ifdef DEBUGMODE
extendedLogging = 0;
#endif
@@ -36,10 +38,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) InitializeCriticalSection(&sessions_mutex);
// Init instance names
- m_szModuleName = mir_strdup(pszProtoName);
- m_tszUserName = mir_tstrdup(tszUserName);
m_szProtoName = GGDEF_PROTONAME;
- m_iVersion = 2;
// Register netlib user
TCHAR name[128];
@@ -126,8 +125,7 @@ GGPROTO::~GGPROTO() if (modemsg.invisible) mir_free(modemsg.invisible);
if (modemsg.offline) mir_free(modemsg.offline);
- mir_free(m_szModuleName);
- mir_free(m_tszUserName);
+ ProtoDestructor(this);
}
//////////////////////////////////////////////////////////
@@ -194,30 +192,6 @@ DWORD_PTR GGPROTO::GetCaps(int type, HANDLE hContact) }
//////////////////////////////////////////////////////////
-// loads protocol icon
-
-HICON GGPROTO::GetIcon(int iconIndex)
-{
- if (LOWORD(iconIndex) == PLI_PROTOCOL)
- {
- if (iconIndex & PLIF_ICOLIBHANDLE)
- return (HICON)GetIconHandle(IDI_GG);
-
- BOOL big = (iconIndex & PLIF_SMALL) == 0;
- HICON hIcon = LoadIconEx("main", big);
-
- if (iconIndex & PLIF_ICOLIB)
- return hIcon;
-
- hIcon = CopyIcon(hIcon);
- ReleaseIconEx("main", big);
- return hIcon;
- }
-
- return (HICON)NULL;
-}
-
-//////////////////////////////////////////////////////////
// user info request
void __cdecl GGPROTO::cmdgetinfothread(void *hContact)
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index de9c3af0e1..e59f8424e5 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -52,7 +52,6 @@ struct GGPROTO : 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 TCHAR* id );
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);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -552,29 +550,6 @@ DWORD_PTR __cdecl CIrcProto::GetCaps( int type, HANDLE ) }
////////////////////////////////////////////////////////////////////////////////////////
-// 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
int __cdecl CIrcProto::GetInfo( HANDLE, int )
@@ -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 );
diff --git a/protocols/IcqOscarJ/src/UI/loginpassword.cpp b/protocols/IcqOscarJ/src/UI/loginpassword.cpp index be7c4717bb..0699a686b4 100644 --- a/protocols/IcqOscarJ/src/UI/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/UI/loginpassword.cpp @@ -41,8 +41,8 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ppro = (CIcqProto*)lParam;
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol, true));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
{
DWORD dwUin = ppro->getContactUin(NULL);
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index a80557cba4..9903719a22 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -57,8 +57,8 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ppro = (CIcqProto*)lParam;
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol, true));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hIconProtocol));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp index cee5509a7c..fe2337daca 100644 --- a/protocols/IcqOscarJ/src/icq_popups.cpp +++ b/protocols/IcqOscarJ/src/icq_popups.cpp @@ -251,7 +251,7 @@ int CIcqProto::ShowPopUpMsg(HANDLE hContact, const char *szTitle, const char *sz return -1;
}
if (!getSettingByte(NULL, "PopupsSysIcons", DEFAULT_POPUPS_SYS_ICONS))
- ppd.lchIcon = Skin_GetIconByHandle(m_hIconProtocol);
+ ppd.lchIcon = Skin_GetIconByHandle(m_hProtoIcon);
else
ppd.lchIcon = (HICON)LoadImage( NULL, rsIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
if (getSettingByte(NULL, "PopupsWinColors", DEFAULT_POPUPS_WIN_COLORS))
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index e00ed256f2..cf2d9bf790 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -77,11 +77,8 @@ expectedFileRecvs(10, CompareFT), contactsCache(10, CompareContactsCache),
cheekySearchId( -1 )
{
- m_iVersion = 2;
- m_iStatus = ID_STATUS_OFFLINE;
- m_tszUserName = mir_tstrdup( aUserName );
- m_szModuleName = mir_strdup( aProtoName );
- m_szProtoName = mir_strdup( aProtoName );
+ ProtoConstructor(this, aProtoName, aUserName);
+ m_szProtoName = mir_strdup(aProtoName);
_strlwr( m_szProtoName );
m_szProtoName[0] = toupper( m_szProtoName[0] );
NetLog_Server( "Setting protocol/module name to '%s/%s'", m_szProtoName, m_szModuleName );
@@ -165,8 +162,6 @@ cheekySearchId( -1 ) CreateProtoService(PS_ICQ_ADDCAPABILITY, &CIcqProto::IcqAddCapability);
CreateProtoService(PS_ICQ_CHECKCAPABILITY, &CIcqProto::IcqCheckCapability);
- m_hIconProtocol = (HANDLE)CallService(MS_SKIN2_ISMANAGEDICON, (WPARAM)LoadSkinnedProtoIcon(m_szModuleName, ID_STATUS_ONLINE), 0);
-
// Reset a bunch of session specific settings
UpdateGlobalSettings();
ResetSettingsOnLoad();
@@ -271,14 +266,10 @@ CIcqProto::~CIcqProto() SAFE_FREE(&m_modeMsgs.szDnd);
SAFE_FREE(&m_modeMsgs.szFfc);
- // Remove account icons
- Skin_RemoveIconHandle(m_hIconProtocol);
-
NetLog_Server("%s: Protocol instance '%s' destroyed.", ICQ_PROTOCOL_NAME, m_szModuleName);
mir_free( m_szProtoName );
- mir_free( m_szModuleName );
- mir_free( m_tszUserName );
+ ProtoDestructor(this);
}
@@ -788,29 +779,6 @@ DWORD_PTR __cdecl CIcqProto::GetCaps( int type, HANDLE hContact ) }
////////////////////////////////////////////////////////////////////////////////////////
-// GetIcon - loads an icon for the contact list
-
-HICON __cdecl CIcqProto::GetIcon( int iconIndex )
-{
- if (LOWORD(iconIndex) == PLI_PROTOCOL)
- {
- if (iconIndex & PLIF_ICOLIBHANDLE)
- return (HICON)m_hIconProtocol;
-
- bool big = (iconIndex & PLIF_SMALL) == 0;
- HICON hIcon = Skin_GetIconByHandle(m_hIconProtocol, big);
-
- if (iconIndex & PLIF_ICOLIB)
- return hIcon;
-
- HICON hIconNew = CopyIcon(hIcon);
- Skin_ReleaseIcon(hIcon);
- return hIconNew;
- }
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
// GetInfo - retrieves a contact info
int __cdecl CIcqProto::GetInfo(HANDLE hContact, int infoType)
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 5fdf411387..11a880884f 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -76,7 +76,6 @@ struct CIcqProto : 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 );
@@ -153,7 +152,6 @@ struct CIcqProto : public PROTO_INTERFACE, public MZeroedObject int __cdecl OnPreBuildStatusMenu( WPARAM, LPARAM );
//====| Data |========================================================================
- HANDLE m_hIconProtocol;
HANDLE m_hServerNetlibUser, m_hDirectNetlibUser;
BYTE m_bGatewayMode;
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 71bfea3dc6..23a704f48c 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -180,8 +180,6 @@ void CJabberProto::IconsInit(void) m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * SIZEOF(TransportProtoTable));
for (int i = 0; i < SIZEOF(TransportProtoTable); i++)
m_transportProtoTableStartIndex[i] = -1;
-
- m_hProtoIcon = (HANDLE)CallService(MS_SKIN2_ISMANAGEDICON, (WPARAM)LoadSkinnedProtoIcon(m_szModuleName, ID_STATUS_ONLINE), 0);
}
HANDLE CJabberProto::GetIconHandle(int iconId)
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 520c0b9954..29e17f7444 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -85,15 +85,14 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : m_lstJabberFeatCapPairsDynamic(2),
m_uEnabledFeatCapsDynamic(0)
{
+ ProtoConstructor(this, aProtoName, aUserName);
+
InitializeCriticalSection(&m_csModeMsgMutex);
InitializeCriticalSection(&m_csLists);
InitializeCriticalSection(&m_csLastResourceMap);
m_szXmlStreamToBeInitialized = NULL;
- m_iVersion = 2;
- m_tszUserName = mir_tstrdup(aUserName);
- m_szModuleName = mir_strdup(aProtoName);
m_szProtoName = mir_strdup(aProtoName);
_strlwr(m_szProtoName);
m_szProtoName[0] = toupper(m_szProtoName[0]);
@@ -221,8 +220,6 @@ CJabberProto::~CJabberProto() delete m_pInfoFrame;
- Skin_RemoveIconHandle(m_hProtoIcon);
-
DestroyHookableEvent(m_hEventNudge);
DestroyHookableEvent(m_hEventXStatusIconChanged);
DestroyHookableEvent(m_hEventXStatusChanged);
@@ -249,8 +246,6 @@ CJabberProto::~CJabberProto() mir_free(m_szStreamId);
mir_free(m_szProtoName);
- mir_free(m_szModuleName);
- mir_free(m_tszUserName);
int i;
for (i=0; i < m_lstTransports.getCount(); i++)
@@ -266,6 +261,8 @@ CJabberProto::~CJabberProto() }
m_lstJabberFeatCapPairsDynamic.destroy();
m_hPrivacyMenuItems.destroy();
+
+ ProtoDestructor(this);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -705,28 +702,6 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, HANDLE hContact) }
////////////////////////////////////////////////////////////////////////////////////////
-// GetIcon - loads an icon for the contact list
-
-HICON __cdecl CJabberProto::GetIcon(int iconIndex)
-{
- if (LOWORD(iconIndex) == PLI_PROTOCOL) {
- if (iconIndex & PLIF_ICOLIBHANDLE)
- return (HICON)m_hProtoIcon;
-
- bool big = (iconIndex & PLIF_SMALL) == 0;
- HICON hIcon = Skin_GetIconByHandle(m_hProtoIcon, big);
-
- if (iconIndex & PLIF_ICOLIB)
- return hIcon;
-
- HICON hIcon2 = CopyIcon(hIcon);
- g_ReleaseIcon(hIcon);
- return hIcon2;
- }
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
// GetInfo - retrieves a contact info
int __cdecl CJabberProto::GetInfo(HANDLE hContact, int /*infoType*/)
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 799f97a90e..9f0a9f286a 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -172,7 +172,6 @@ struct CJabberProto : 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 TCHAR *id);
@@ -1001,8 +1000,6 @@ private: int m_nMenuResourceItems;
HANDLE* m_phMenuResourceItems;
-
- HANDLE m_hProtoIcon;
};
extern LIST<CJabberProto> g_Instances;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 05a592fa25..42e6b29ada 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -10,10 +10,7 @@ static int MraExtraIconsApplyAll(WPARAM, LPARAM) CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
m_bLoggedIn(false)
{
- m_iVersion = 2;
- m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
- m_szModuleName = mir_strdup(_module);
- m_tszUserName = mir_tstrdup(_displayName);
+ ProtoConstructor(this, _module, _displayName);
InitializeCriticalSectionAndSpinCount(&csCriticalSectionSend, 0);
MraSendQueueInitialize(0, &hSendQueueHandle);
@@ -41,8 +38,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : TCHAR name[128];
mir_sntprintf( name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
- NETLIBUSER nlu = {0};
- nlu.cbSize = sizeof(nlu);
+ NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szSettingsModule = m_szModuleName;
nlu.ptszDescriptiveName = name;
@@ -87,6 +83,8 @@ CMraProto::~CMraProto() MraFilesQueueDestroy(hFilesQueueHandle);
MraSendQueueDestroy(hSendQueueHandle);
DeleteCriticalSection(&csCriticalSectionSend);
+
+ ProtoDestructor(this);
}
INT_PTR CMraProto::MraCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
@@ -375,20 +373,6 @@ DWORD_PTR CMraProto::GetCaps(int type, HANDLE hContact) }
}
-HICON CMraProto::GetIcon(int iconIndex)
-{
- UINT id;
-
- switch (iconIndex & 0xFFFF) {
- case PLI_PROTOCOL: id = IDI_MRA; break; // IDI_TM is the main icon for the protocol
- default: return NULL;
- }
-
- return (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(id), IMAGE_ICON,
- GetSystemMetrics((iconIndex & PLIF_SMALL) ? SM_CXSMICON : SM_CXICON),
- GetSystemMetrics((iconIndex & PLIF_SMALL) ? SM_CYSMICON : SM_CYICON), 0);
-}
-
int CMraProto::GetInfo(HANDLE hContact, int infoType)
{
return MraUpdateContactInfo(hContact) != 0;
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 641938162a..5576640571 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -58,7 +58,6 @@ struct CMraProto : 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 TCHAR* id);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index bea00b586f..6673bb554f 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -45,9 +45,8 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : {
char path[MAX_PATH];
- m_iVersion = 2;
- m_tszUserName = mir_tstrdup(aUserName);
- m_szModuleName = mir_strdup(aProtoName);
+ ProtoConstructor(this, aProtoName, aUserName);
+
m_szProtoName = mir_strdup(aProtoName);
_strlwr(m_szProtoName);
m_szProtoName[0] = (char)toupper(m_szProtoName[0]);
@@ -133,8 +132,6 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : mir_snprintf(alertsoundname, 64, "%s:Alerts", m_szModuleName);
SkinAddNewSoundExT(alertsoundname, m_tszUserName, LPGENT("Live Alert"));
- m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
-
MSN_InitThreads();
Lists_Init();
MsgQueue_Init();
@@ -189,8 +186,6 @@ CMsnProto::~CMsnProto() mir_free(mailsoundname);
mir_free(alertsoundname);
- mir_free(m_tszUserName);
- mir_free(m_szModuleName);
mir_free(m_szProtoName);
for (int i=0; i < MSN_NUM_MODES; i++)
@@ -205,6 +200,7 @@ CMsnProto::~CMsnProto() mir_free(storageCacheKey);
FreeAuthTokens();
+ ProtoDestructor(this);
}
@@ -755,29 +751,6 @@ int __cdecl CMsnProto::GetInfo(HANDLE hContact, int infoType) return 1;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// MsnLoadIcon - obtain the protocol icon
-
-HICON __cdecl CMsnProto::GetIcon(int iconIndex)
-{
- if (LOWORD(iconIndex) == PLI_PROTOCOL)
- {
- if (iconIndex & PLIF_ICOLIBHANDLE)
- return (HICON)GetIconHandle(IDI_MSN);
-
- bool big = (iconIndex & PLIF_SMALL) == 0;
- HICON hIcon = LoadIconEx("main", big);
-
- if (iconIndex & PLIF_ICOLIB)
- return hIcon;
-
- hIcon = CopyIcon(hIcon);
- ReleaseIconEx("main", big);
- return hIcon;
- }
- return NULL;
-}
-
////////////////////////////////////////////////////////////////////////////////////////
// RecvContacts
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 2db55f0ee1..1c0bd41fcf 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -55,7 +55,6 @@ struct CMsnProto : public PROTO_INTERFACE, public MZeroedObject virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** 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/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index c58d431a4c..2a28589e61 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -24,10 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username)
{
- m_iVersion = 2;
+ ProtoConstructor(this, aProtoName, aUserName);
m_szProtoName = mir_strdup( proto_name );
- m_szModuleName = mir_strdup( proto_name );
- m_tszUserName = mir_tstrdup( username );
this->facy.parent = this;
@@ -41,7 +39,7 @@ OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username) CreateProtoService(m_szModuleName, PS_LEAVECHAT, &OmegleProto::OnLeaveChat, this);
CreateProtoService(m_szModuleName, PS_CREATEACCMGRUI, &OmegleProto::SvcCreateAccMgrUI, this);
-
+
HookProtoEvent(ME_OPT_INITIALISE, &OmegleProto::OnOptionsInit, this);
HookProtoEvent(ME_GC_EVENT, &OmegleProto::OnChatEvent, this);
@@ -83,9 +81,8 @@ OmegleProto::~OmegleProto( ) mir_free( this->facy.nick_ );
- mir_free( m_tszUserName );
- mir_free( m_szModuleName );
- mir_free( m_szProtoName );
+ mir_free( m_szProtoName );
+ ProtoDestructor(this);
}
//////////////////////////////////////////////////////////////////////////////
@@ -110,17 +107,6 @@ DWORD_PTR OmegleProto::GetCaps( int type, HANDLE hContact ) return 0;
}
-HICON OmegleProto::GetIcon(int index)
-{
- if(LOWORD(index) == PLI_PROTOCOL)
- {
- HICON ico = Skin_GetIcon("Omegle_omegle");
- return CopyIcon(ico);
- } else {
- return 0;
- }
-}
-
//////////////////////////////////////////////////////////////////////////////
int OmegleProto::SetStatus( int new_status )
@@ -146,7 +132,7 @@ int OmegleProto::SetStatus( int new_status ) if ( m_iStatus == ID_STATUS_CONNECTING && new_status != ID_STATUS_OFFLINE )
{
- return 0;
+ return 0;
}
if ( new_status == ID_STATUS_OFFLINE )
@@ -171,7 +157,7 @@ int OmegleProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam) case EV_PROTO_ONEXIT:
return OnPreShutdown (wParam,lParam);
-
+
case EV_PROTO_ONOPTIONS:
return OnOptionsInit (wParam,lParam);
diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 053071aac8..3f1703c70b 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -60,7 +60,6 @@ public: virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** 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/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index f9a94fc96a..1650a82c76 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -2,11 +2,8 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName)
{
- this->m_iVersion = 2;
- this->m_iStatus = ID_STATUS_OFFLINE;
+ ProtoConstructor(this, aProtoName, aUserName);
- this->m_tszUserName = ::mir_tstrdup(userName);
- this->m_szModuleName = ::mir_strdup(protoName);
this->m_szProtoName = ::mir_strdup(protoName);
::strlwr(m_szProtoName);
this->m_szProtoName[0] = ::toupper(this->m_szProtoName[0]);
@@ -37,27 +34,26 @@ CSkypeProto::~CSkypeProto() ::mir_free(this->password);
::mir_free(this->m_szProtoName);
- ::mir_free(this->m_szModuleName);
- ::mir_free(this->m_tszUserName);
+ ProtoDestructor(this);
}
-HANDLE __cdecl CSkypeProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
+HANDLE __cdecl CSkypeProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
//todo:ref
return this->AddContactBySid(::mir_u2a(psr->id), ::mir_u2a(psr->nick), 0);
}
-HANDLE __cdecl CSkypeProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
+HANDLE __cdecl CSkypeProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
{
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
- /*if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) != -1)
+ /*if ((dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0)) != -1)
{
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei) == 0 &&
!strcmp(dbei.szModule, m_szModuleName) &&
- (dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_CONTACTS))
+ (dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_CONTACTS))
{
char *nick = (char*)(dbei.pBlob + sizeof(DWORD) * 2);
char *firstName = nick + strlen(nick) + 1;
@@ -69,7 +65,7 @@ HANDLE __cdecl CSkypeProto::AddToListByEvent(int flags, int iContact, HANDLE hDb return 0;
}
-int __cdecl CSkypeProto::Authorize(HANDLE hDbEvent)
+int __cdecl CSkypeProto::Authorize(HANDLE hDbEvent)
{
if (this->IsOnline() && hDbEvent)
{
@@ -83,7 +79,7 @@ int __cdecl CSkypeProto::Authorize(HANDLE hDbEvent) return 1;
}
-int __cdecl CSkypeProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason)
+int __cdecl CSkypeProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason)
{
if (this->IsOnline())
{
@@ -94,42 +90,42 @@ int __cdecl CSkypeProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) return CSkypeProto::RevokeAuth((WPARAM)hContact, NULL);
}
- return 1;
+ return 1;
}
-int __cdecl CSkypeProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre)
+int __cdecl CSkypeProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre)
{
DWORD flags = 0;
- if (pre->flags & PREF_CREATEREAD)
+ if (pre->flags & PREF_CREATEREAD)
flags |= DBEF_READ;
- if (pre->flags & PREF_UTF)
+ if (pre->flags & PREF_UTF)
flags |= DBEF_UTF;
this->AddDataBaseEvent(
- hContact,
- EVENTTYPE_AUTHREQUEST,
- pre->timestamp,
- flags,
- pre->lParam,
+ hContact,
+ EVENTTYPE_AUTHREQUEST,
+ pre->timestamp,
+ flags,
+ pre->lParam,
(PBYTE)pre->szMessage);
return 0;
}
-int __cdecl CSkypeProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage)
+int __cdecl CSkypeProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage)
{
if (this->IsOnline() && hContact)
{
CContact::Ref contact;
SEString sid(::mir_u2a(this->GetSettingString(hContact, "sid")));
- if (this->skype->GetContact(sid, contact))
+ if (this->skype->GetContact(sid, contact))
{
contact->SetBuddyStatus(Contact::AUTHORIZED_BY_ME);
contact->SendAuthRequest(::mir_utf8encodeW(szMessage));
}
-
+
return 0;
}
@@ -143,17 +139,17 @@ int __cdecl CSkypeProto::FileCancel( HANDLE hContact, HANDLE hTransfer ) { re int __cdecl CSkypeProto::FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ) { return 0; }
int __cdecl CSkypeProto::FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ) { return 0; }
-DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact)
-{
+DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact)
+{
switch(type)
- {
+ {
case PFLAGNUM_1:
return PF1_IM | PF1_BASICSEARCH | PF1_ADDSEARCHRES | PF1_SEARCHBYEMAIL/* | PF1_SEARCHBYNAME*/;
case PFLAGNUM_2:
case PFLAGNUM_3:
return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_INVISIBLE;
case PFLAGNUM_4:
- return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS |
+ return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS |
PF4_OFFLINEFILES | PF4_IMSENDUTF | PF4_IMSENDOFFLINE;
case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR)Translate("Skype Name");
@@ -164,20 +160,10 @@ DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact) }
}
-HICON __cdecl CSkypeProto::GetIcon( int iconIndex )
-{
- if (LOWORD(iconIndex) == PLI_PROTOCOL)
- {
- HICON ico = Skin_GetIcon("Skype_main");
- return CopyIcon(ico);
- } else
- return 0;
-}
-
int __cdecl CSkypeProto::GetInfo( HANDLE hContact, int infoType ) { return 0; }
-HANDLE __cdecl CSkypeProto::SearchBasic(const TCHAR* id)
-{
+HANDLE __cdecl CSkypeProto::SearchBasic(const TCHAR* id)
+{
if ( !this->IsOnline())
return 0;
@@ -187,8 +173,8 @@ HANDLE __cdecl CSkypeProto::SearchBasic(const TCHAR* id) return (HANDLE)SKYPE_SEARCH_BYSID;
}
-HANDLE __cdecl CSkypeProto::SearchByEmail(const TCHAR* email)
-{
+HANDLE __cdecl CSkypeProto::SearchByEmail(const TCHAR* email)
+{
if ( !this->IsOnline())
return 0;
@@ -198,8 +184,8 @@ HANDLE __cdecl CSkypeProto::SearchByEmail(const TCHAR* email) return (HANDLE)SKYPE_SEARCH_BYEMAIL;
}
-HANDLE __cdecl CSkypeProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
-{
+HANDLE __cdecl CSkypeProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
+{
PROTOSEARCHRESULT isr = {0};
isr.cbSize = sizeof(isr);
isr.flags = PSR_TCHAR;
@@ -219,8 +205,8 @@ HWND __cdecl CSkypeProto::CreateExtendedSearchUI( HWND owner ){ return 0; } int __cdecl CSkypeProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* ) { return 0; }
int __cdecl CSkypeProto::RecvFile( HANDLE hContact, PROTORECVFILET* ) { return 0; }
-int __cdecl CSkypeProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre)
-{
+int __cdecl CSkypeProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre)
+{
this->UserIsTyping(hContact, PROTOTYPE_SELFTYPING_OFF);
return ::Proto_RecvMessage(hContact, pre);
}
@@ -230,14 +216,14 @@ int __cdecl CSkypeProto::RecvUrl( HANDLE hContact, PROTORECVEVENT* ) { return int __cdecl CSkypeProto::SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ) { return 0; }
HANDLE __cdecl CSkypeProto::SendFile( HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles ) { return 0; }
-int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char* msg)
-{
+int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char* msg)
+{
int result = ::InterlockedIncrement((LONG volatile*)&dwCMDNum);
CConversation::Ref conversation = CConversation::FindBySid(
this->skype,
::DBGetString(hContact, this->m_szModuleName, "sid"));
- if (conversation)
+ if (conversation)
{
Message::Ref message;
conversation->PostText(msg, message);
@@ -248,8 +234,8 @@ int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char* msg) ACKTYPE_MESSAGE,
ACKRESULT_SUCCESS,
(HANDLE)result, 0);
-
- return result;
+
+ return result;
}
int __cdecl CSkypeProto::SendUrl( HANDLE hContact, int flags, const char* url ) { return 0; }
@@ -282,7 +268,7 @@ int CSkypeProto::SetStatus(int new_status) switch (new_status)
{
case ID_STATUS_OFFLINE:
- if (this->IsOnline() || this->m_iStatus == ID_STATUS_CONNECTING)
+ if (this->IsOnline() || this->m_iStatus == ID_STATUS_CONNECTING)
{
this->account->SetAvailability(CContact::OFFLINE);
this->account->Logout(true);
@@ -311,7 +297,7 @@ int CSkypeProto::SetStatus(int new_status) }
this->SetSettingWord("Status", this->m_iStatus);
- this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, this->m_iStatus);
+ this->SendBroadcast(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, this->m_iStatus);
return 0;
}
@@ -320,8 +306,8 @@ int __cdecl CSkypeProto::RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVE int __cdecl CSkypeProto::SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg ) { return 0; }
int __cdecl CSkypeProto::SetAwayMsg( int m_iStatus, const TCHAR* msg ) { return 0; }
-int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type )
-{
+int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type )
+{
if (hContact && this->IsOnline() && this->m_iStatus != ID_STATUS_INVISIBLE)
{
if (::strcmp(::DBGetString(hContact, this->m_szModuleName, "sid"), this->login) != 0)
@@ -329,9 +315,9 @@ int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) CConversation::Ref conversation = CConversation::FindBySid(
this->skype,
::DBGetString(hContact, this->m_szModuleName, "sid"));
- if (conversation)
+ if (conversation)
{
- switch (type)
+ switch (type)
{
case PROTOTYPE_SELFTYPING_ON:
conversation->SetMyTextStatusTo(Participant::WRITING);
@@ -345,17 +331,17 @@ int __cdecl CSkypeProto::UserIsTyping( HANDLE hContact, int type ) }
}
- return 1;
+ return 1;
}
int __cdecl CSkypeProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
{
- switch (eventType)
+ switch (eventType)
{
case EV_PROTO_ONLOAD:
return this->OnModulesLoaded(wParam, lParam);
-
- case EV_PROTO_ONEXIT:
+
+ case EV_PROTO_ONEXIT:
return this->OnPreShutdown(wParam, lParam);
case EV_PROTO_ONMENU:
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index e081bf4874..cdf9128912 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -17,7 +17,7 @@ struct StringList : public LIST<char> { return _stricmp(p1, p2); }
StringList() : LIST<char>(2, compare) {}
- StringList(const char* string, const char *delimeters) : LIST<char>(2, compare)
+ StringList(const char* string, const char *delimeters) : LIST<char>(2, compare)
{
char *data = ::mir_strdup(string);
if (data)
@@ -155,13 +155,13 @@ struct PasswordRequestBoxParam PasswordRequestBoxParam(const char *login, bool showRememberPasswordBox = true, bool rememberPassword = false) :
login(::mir_strdup(login)),
password(NULL),
- rememberPassword(rememberPassword),
+ rememberPassword(rememberPassword),
showRememberPasswordBox(showRememberPasswordBox) { }
~PasswordRequestBoxParam()
- {
+ {
if (login) ::mir_free(login);
- if (password) ::mir_free(password);
+ if (password) ::mir_free(password);
}
};
@@ -173,8 +173,8 @@ struct PasswordChangeBoxParam PasswordChangeBoxParam() { }
~PasswordChangeBoxParam()
- {
- if (password) ::mir_free(password);
+ {
+ if (password) ::mir_free(password);
if (password2) ::mir_free(password2);
}
};
@@ -202,7 +202,6 @@ public: 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 TCHAR* id );
@@ -306,14 +305,14 @@ protected: bool IsChatRoom(HANDLE hContact);
HANDLE GetChatRoomByID(const char *cid);
HANDLE AddChatRoomByID(const char* cid, const char* name, DWORD flags = 0);
-
+
char *CSkypeProto::GetChatUsers(const char *cid);
void ChatValidateContact(HANDLE hItem, HWND hwndList, const char *contacts);
void ChatPrepare(HANDLE hItem, HWND hwndList, const char *contacts);
void GetInviteContacts(HANDLE hItem, HWND hwndList, SEStringList &invitedContacts);
-
+
void InitChat();
char *StartChat(const char *cid, const SEStringList &invitedContacts);
void JoinToChat(const char *cid, bool showWindow = true);
@@ -343,7 +342,7 @@ protected: void OnContactChanged(CContact::Ref contact, int prop);
void OnContactListChanged(const ContactRef& contact);
-
+
bool IsProtoContact(HANDLE hContact);
HANDLE GetContactBySid(const char* sid);
HANDLE GetContactFromAuthEvent(HANDLE hEvent);
@@ -374,7 +373,7 @@ protected: void UpdateProfileStatusMessage(SEObject *obj, HANDLE hContact = NULL);
void UpdateProfileTimezone(SEObject *obj, HANDLE hContact = NULL);
- void UpdateProfile(SEObject *obj, HANDLE hContact = NULL);
+ void UpdateProfile(SEObject *obj, HANDLE hContact = NULL);
void __cdecl LoadOwnInfo(void*);
@@ -408,7 +407,7 @@ protected: void CreateService(const char* szService, SkypeServiceFunc serviceProc);
void CreateServiceParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam);
-
+
HANDLE CreateEvent(const char* szService);
void HookEvent(const char*, SkypeEventFunc);
@@ -445,24 +444,24 @@ protected: static HANDLE g_hContactMenuSvc[CMITEMS_COUNT];
static INT_PTR MenuChooseService(WPARAM wParam, LPARAM lParam);
int OnPrebuildContactMenu(WPARAM wParam, LPARAM);
-
+
// database
HANDLE AddDataBaseEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags, DWORD cbBlob, PBYTE pBlob);
void RaiseMessageReceivedEvent(
- DWORD timestamp,
- const char* sid,
- const char* nick,
+ DWORD timestamp,
+ const char* sid,
+ const char* nick,
const char* message = "");
void RaiseMessageSendedEvent(
- DWORD timestamp,
- const char* sid,
- const char* nick,
+ DWORD timestamp,
+ const char* sid,
+ const char* nick,
const char* message = "");
void RaiseAuthRequestEvent(
- DWORD timestamp,
- const char* sid,
- const char* nick,
+ DWORD timestamp,
+ const char* sid,
+ const char* nick,
const char* firstName = "",
const char* lastName = "",
const char* reason = "");
diff --git a/protocols/Tlen/src/jabber.h b/protocols/Tlen/src/jabber.h index 450b84c1f8..caade83f3a 100644 --- a/protocols/Tlen/src/jabber.h +++ b/protocols/Tlen/src/jabber.h @@ -242,7 +242,6 @@ struct TlenProtocol : public PROTO_INTERFACE, public MZeroedObject virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** 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);
@@ -504,4 +503,3 @@ char *TlenAdvSearchCreateQuery(HWND hwndDlg, int iqId); #endif
-
diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp index 450446f640..b0a284c9e1 100644 --- a/protocols/Tlen/src/jabber_svc.cpp +++ b/protocols/Tlen/src/jabber_svc.cpp @@ -64,17 +64,6 @@ INT_PTR TlenGetName(void *ptr, LPARAM wParam, LPARAM lParam) return 0;
}
-HICON __cdecl TlenProtocol::GetIcon(int iconIndex)
-{
- if ((iconIndex&0xffff) == PLI_PROTOCOL) {
- HICON hIcon = GetIcolibIcon(IDI_TLEN);
- HICON hIconCopy = CopyIcon(hIcon);
- ReleaseIcolibIcon(hIcon);
- return hIconCopy;
- }
- return (HICON) NULL;
-}
-
int TlenRunSearch(TlenProtocol *proto) {
int iqId = 0;
if (!proto->isOnline) return 0;
@@ -1286,14 +1275,11 @@ void TlenInitServicesVTbl(TlenProtocol *proto) { TlenProtocol::TlenProtocol( const char* aProtoName, const TCHAR* aUserName )
{
+ ProtoConstructor(this, aProtoName, aUserName);
- m_iVersion = 2;
- m_tszUserName = mir_tstrdup(aUserName);
- m_szModuleName = mir_strdup(aProtoName);
m_szProtoName = mir_strdup(aProtoName);
_strlwr( m_szProtoName );
m_szProtoName[0] = toupper( m_szProtoName[0] );
- m_iStatus = ID_STATUS_OFFLINE;
TlenInitServicesVTbl(this);
@@ -1358,6 +1344,5 @@ TlenProtocol::~TlenProtocol() mir_free(modeMsgs.szFreechat);
mir_free(modeMsgs.szInvisible);
+ ProtoDestructor(this);
}
-
-
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 9437d01fce..6f143ba501 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -125,17 +125,6 @@ DWORD_PTR TwitterProto::GetCaps(int type,HANDLE hContact) return 0;
}
-HICON TwitterProto::GetIcon(int index)
-{
- if(LOWORD(index) == PLI_PROTOCOL)
- {
- HICON ico = Skin_GetIcon("Twitter_twitter");
- return CopyIcon(ico);
- }
- else
- return 0;
-}
-
// *************************
int TwitterProto::RecvMsg(HANDLE hContact,PROTORECVEVENT *pre)
@@ -179,7 +168,7 @@ int TwitterProto::SendMsg(HANDLE hContact,int flags,const char *msg) return 0;
TCHAR* tszMsg;
- if ( flags & PREF_UTF )
+ if ( flags & PREF_UTF )
tszMsg = mir_utf8decodeT( msg );
else if ( flags & PREF_UNICODE )
tszMsg = mir_u2t(( wchar_t* )&msg[ strlen( msg )+1 ] );
@@ -252,7 +241,7 @@ int TwitterProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam) int TwitterProto::SvcCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
{
- return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_TWITTERACCOUNT),
+ return (int)CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_TWITTERACCOUNT),
(HWND)lParam, first_run_dialog, (LPARAM)this );
}
@@ -361,7 +350,7 @@ int TwitterProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = options_proc;
Options_AddPage(wParam, &odp);
- if(ServiceExists(MS_POPUP_ADDPOPUPT))
+ if(ServiceExists(MS_POPUP_ADDPOPUPT))
{
odp.ptszTab = LPGENT("PopUps");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
@@ -412,7 +401,7 @@ int TwitterProto::OnModulesLoaded(WPARAM wParam,LPARAM lParam) GCREGISTER gcr = {sizeof(gcr)};
gcr.pszModule = m_szModuleName;
gcr.pszModuleDispName = m_szModuleName;
- gcr.iMaxText = 159;
+ gcr.iMaxText = 159;
CallService(MS_GC_REGISTER,0,reinterpret_cast<LPARAM>(&gcr));
if (ServiceExists(MS_HISTORYEVENTS_REGISTER))
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index 0aa4920f83..a07e2f16ce 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -54,7 +54,6 @@ public: virtual int __cdecl FileResume(HANDLE,int *,const TCHAR **);
virtual DWORD_PTR __cdecl GetCaps(int,HANDLE = 0);
- virtual HICON __cdecl GetIcon(int);
virtual int __cdecl GetInfo(HANDLE,int);
virtual HANDLE __cdecl SearchBasic(const TCHAR *);
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 05d6484548..d78943f4b7 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -28,15 +28,12 @@ #endif
CYahooProto::CYahooProto( const char* aProtoName, const TCHAR* aUserName ) :
- m_bLoggedIn( FALSE ),
+ m_bLoggedIn( FALSE ),
poll_loop( 0),
- m_chatrooms(3, ChatRoom::compare)
+ m_chatrooms(3, ChatRoom::compare)
{
- m_iVersion = 2;
- m_tszUserName = mir_tstrdup( aUserName );
- m_szModuleName = mir_strdup( aProtoName );
+ ProtoConstructor(this, aProtoName, aUserName);
- m_startStatus = ID_STATUS_ONLINE;
m_connections = NULL;
m_connection_tags = 0;
@@ -59,15 +56,15 @@ CYahooProto::~CYahooProto() DestroyHookableEvent(hYahooNudge);
MenuUninit();
-
+
m_chatrooms.destroy();
- mir_free( m_szModuleName );
- mir_free( m_tszUserName );
FREE(m_startMsg);
FREE(m_pw_token);
Netlib_CloseHandle( m_hNetlibUser );
+
+ ProtoDestructor(this);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -347,29 +344,6 @@ DWORD_PTR __cdecl CYahooProto::GetCaps( int type, HANDLE /*hContact*/ ) }
////////////////////////////////////////////////////////////////////////////////////////
-// GetIcon - loads an icon for the contact list
-
-HICON __cdecl CYahooProto::GetIcon( int iconIndex )
-{
- if (LOWORD(iconIndex) == PLI_PROTOCOL)
- {
- if (iconIndex & PLIF_ICOLIBHANDLE)
- return (HICON)GetIconHandle(IDI_YAHOO);
-
- bool big = (iconIndex & PLIF_SMALL) == 0;
- HICON hIcon = LoadIconEx("yahoo", big);
-
- if (iconIndex & PLIF_ICOLIB)
- return hIcon;
-
- hIcon = CopyIcon(hIcon);
- ReleaseIconEx("yahoo", big);
- return hIcon;
- }
- return NULL;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
// GetInfo - retrieves a contact info
void __cdecl CYahooProto::get_info_thread(HANDLE hContact)
diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index 7c6150f1aa..9d70cbd9d5 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -58,7 +58,6 @@ struct CYahooProto : public PROTO_INTERFACE, public MZeroedObject virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** 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 );
|