diff options
Diffstat (limited to 'protocols/Yahoo')
-rw-r--r-- | protocols/Yahoo/src/avatar.cpp | 4 | ||||
-rw-r--r-- | protocols/Yahoo/src/chat.cpp | 4 | ||||
-rw-r--r-- | protocols/Yahoo/src/file_transfer.cpp | 6 | ||||
-rw-r--r-- | protocols/Yahoo/src/im.cpp | 10 | ||||
-rw-r--r-- | protocols/Yahoo/src/proto.cpp | 17 | ||||
-rw-r--r-- | protocols/Yahoo/src/proto.h | 27 | ||||
-rw-r--r-- | protocols/Yahoo/src/search.cpp | 4 | ||||
-rw-r--r-- | protocols/Yahoo/src/services.cpp | 36 | ||||
-rw-r--r-- | protocols/Yahoo/src/util.cpp | 27 |
9 files changed, 41 insertions, 94 deletions
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index bfd8743ebe..5aa80eb389 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -141,7 +141,7 @@ void CYahooProto::SendAvatar(const TCHAR *szFile) DebugLog("[Uploading avatar] filename: %s size: %ld", sf->filename, sf->filesize);
- YForkThread(&CYahooProto::send_avt_thread, sf);
+ ForkThread(&CYahooProto::send_avt_thread, sf);
}
struct avatar_info{
@@ -365,7 +365,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p avt->pic_url = strdup(pic_url);
avt->cksum = cksum;
- YForkThread(&CYahooProto::recv_avatarthread, avt);
+ ForkThread(&CYahooProto::recv_avatarthread, avt);
}
}
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 03bfa66d5a..638d669de7 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -190,8 +190,8 @@ void CYahooProto::ChatRegister(void) gcr.pszModule = m_szModuleName;
CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
- YHookEvent(ME_GC_EVENT, &CYahooProto::OnGCEventHook);
- YHookEvent(ME_GC_BUILDMENU, &CYahooProto::OnGCMenuHook);
+ HookEvent(ME_GC_EVENT, &CYahooProto::OnGCEventHook);
+ HookEvent(ME_GC_BUILDMENU, &CYahooProto::OnGCMenuHook);
}
void CYahooProto::ChatStart(const char* room)
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index 552eed7a96..b1cdd00da8 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -603,7 +603,7 @@ void CYahooProto::ext_got_file7info(const char *me, const char *who, const char ft->url = strdup(url);
- YForkThread(&CYahooProto::recv_filethread, ft);
+ ForkThread(&CYahooProto::recv_filethread, ft);
}
void ext_yahoo_send_file7info(int id, const char *me, const char *who, const char *ft_token)
@@ -670,7 +670,7 @@ void CYahooProto::ext_ft7_send_file(const char *me, const char *who, const char s->token = strdup(token);
s->sf = sf;
- YForkThread(&CYahooProto::send_filethread, s);
+ ForkThread(&CYahooProto::send_filethread, s);
}
/**************** Send File ********************/
@@ -799,7 +799,7 @@ HANDLE __cdecl CYahooProto::FileAllow( HANDLE /*hContact*/, HANDLE hTransfer, co return hTransfer;
}
- YForkThread(&CYahooProto::recv_filethread, ft);
+ ForkThread(&CYahooProto::recv_filethread, ft);
return hTransfer;
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 44bd39be16..65232c733a 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -176,7 +176,7 @@ void __cdecl CYahooProto::im_sendackfail_longmsg(HANDLE hContact) int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc )
{
if (!m_bLoggedIn) {/* don't send message if we not connected! */
- YForkThread( &CYahooProto::im_sendackfail, hContact );
+ ForkThread( &CYahooProto::im_sendackfail, hContact );
return 1;
}
@@ -189,7 +189,7 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc msg = mir_utf8encode(pszSrc);
if (lstrlenA(msg) > 800) {
- YForkThread( &CYahooProto::im_sendackfail_longmsg, hContact );
+ ForkThread( &CYahooProto::im_sendackfail_longmsg, hContact );
return 1;
}
@@ -197,7 +197,7 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc if (!GetString( hContact, YAHOO_LOGINID, &dbv)) {
send_msg(dbv.pszVal, GetWord( hContact, "yprotoid", 0), msg, 1);
- YForkThread( &CYahooProto::im_sendacksuccess, hContact );
+ ForkThread( &CYahooProto::im_sendacksuccess, hContact );
db_free(&dbv);
return 1;
@@ -234,7 +234,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) DebugLog("[YAHOO_SENDNUDGE]");
if (!m_bLoggedIn) {/* don't send nudge if we not connected! */
- YForkThread( &CYahooProto::im_sendackfail, hContact );
+ ForkThread( &CYahooProto::im_sendackfail, hContact );
return 1;
}
@@ -243,7 +243,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) send_msg(dbv.pszVal, GetWord(hContact, "yprotoid", 0), "<ding>", 0);
db_free(&dbv);
- YForkThread( &CYahooProto::im_sendacksuccess, hContact );
+ ForkThread( &CYahooProto::im_sendacksuccess, hContact );
return 1;
}
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 4ab4dfe26d..35444e3486 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -27,12 +27,11 @@ #endif
CYahooProto::CYahooProto( const char* aProtoName, const TCHAR* aUserName ) :
+ PROTO<CYahooProto>(aProtoName, aUserName),
m_bLoggedIn( FALSE ),
poll_loop( 0),
m_chatrooms(3, ChatRoom::compare)
{
- ProtoConstructor(this, aProtoName, aUserName);
-
m_connections = NULL;
m_connection_tags = 0;
@@ -62,8 +61,6 @@ CYahooProto::~CYahooProto() FREE(m_pw_token);
Netlib_CloseHandle( m_hNetlibUser );
-
- ProtoDestructor(this);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -71,9 +68,9 @@ CYahooProto::~CYahooProto() int CYahooProto::OnModulesLoadedEx( WPARAM, LPARAM )
{
- YHookEvent( ME_USERINFO_INITIALISE, &CYahooProto::OnUserInfoInit );
- YHookEvent( ME_IDLE_CHANGED, &CYahooProto::OnIdleEvent);
- YHookEvent( ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu );
+ HookEvent( ME_USERINFO_INITIALISE, &CYahooProto::OnUserInfoInit );
+ HookEvent( ME_IDLE_CHANGED, &CYahooProto::OnIdleEvent);
+ HookEvent( ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu );
TCHAR tModuleDescr[ 100 ];
mir_sntprintf(tModuleDescr, SIZEOF(tModuleDescr), TranslateT("%s plugin connections"), m_tszUserName);
@@ -345,7 +342,7 @@ void __cdecl CYahooProto::get_info_thread(HANDLE hContact) int __cdecl CYahooProto::GetInfo( HANDLE hContact, int /*infoType*/ )
{
- YForkThread(&CYahooProto::get_info_thread, hContact);
+ ForkThread(&CYahooProto::get_info_thread, hContact);
return 0;
}
@@ -505,7 +502,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) BroadcastStatus(ID_STATUS_CONNECTING);
iNewStatus = (iNewStatus == ID_STATUS_INVISIBLE) ? YAHOO_STATUS_INVISIBLE: YAHOO_STATUS_AVAILABLE;
- YForkThread(&CYahooProto::server_main, (void *)iNewStatus);
+ ForkThread(&CYahooProto::server_main, (void *)iNewStatus);
}
else if (iNewStatus == ID_STATUS_INVISIBLE) { /* other normal away statuses are set via setaway */
BroadcastStatus(iNewStatus);
@@ -594,7 +591,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg( HANDLE hContact ) if (GetWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
return 0; /* user offline, what Status message? */
- YForkThread(&CYahooProto::get_status_thread, hContact);
+ ForkThread(&CYahooProto::get_status_thread, hContact);
return (HANDLE)1; //Success
}
diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index 4aa8ddc86f..c7f139743b 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -16,26 +16,9 @@ #include <m_protoint.h>
-struct CYahooProto;
-
-#ifdef __GNUC__
-extern "C"
+struct CYahooProto : public PROTO<CYahooProto>
{
- typedef void ( CYahooProto::*YThreadFunc )( void* );
- typedef INT_PTR ( CYahooProto::*YEventFunc )( WPARAM, LPARAM );
- typedef INT_PTR ( CYahooProto::*YServiceFunc )( WPARAM, LPARAM );
- typedef INT_PTR ( CYahooProto::*YServiceFuncParam )( WPARAM, LPARAM, LPARAM );
-}
-#else
- typedef void ( __cdecl CYahooProto::*YThreadFunc )( void* );
- typedef int ( __cdecl CYahooProto::*YEventFunc )( WPARAM, LPARAM );
- typedef INT_PTR ( __cdecl CYahooProto::*YServiceFunc )( WPARAM, LPARAM );
- typedef INT_PTR ( __cdecl CYahooProto::*YServiceFuncParam )( WPARAM, LPARAM, LPARAM );
-#endif
-
-struct CYahooProto : public PROTO_INTERFACE
-{
- CYahooProto( const char*, const TCHAR* );
+ CYahooProto(const char*, const TCHAR*);
virtual ~CYahooProto();
//====================================================================================
@@ -339,12 +322,6 @@ private: HANDLE hYahooAvatarsFolder;
bool InitCstFldRan;
void InitCustomFolders(void);
-
- void YCreateService( const char* szService, YServiceFunc serviceProc );
- void YCreateServiceParam( const char* szService, YServiceFuncParam serviceProc, LPARAM lParam );
- HANDLE YCreateHookableEvent( const char* szService );
- void YForkThread( YThreadFunc pFunc, void *param );
- void YHookEvent( const char* szEvent, YEventFunc handler );
};
extern LIST<CYahooProto> g_instances;
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index 9d9b53b892..d809bf496f 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -53,7 +53,7 @@ HANDLE __cdecl CYahooProto::SearchBasic( const TCHAR* nick ) if ( !m_bLoggedIn )
return 0;
- YForkThread(&CYahooProto::search_simplethread, _tcsdup( nick ));
+ ForkThread(&CYahooProto::search_simplethread, _tcsdup( nick ));
return ( HANDLE )1;
}
@@ -202,6 +202,6 @@ HWND __cdecl CYahooProto::SearchAdvanced( HWND owner ) if ( !m_bLoggedIn )
return 0;
- YForkThread( &CYahooProto::searchadv_thread, owner );
+ ForkThread( &CYahooProto::searchadv_thread, owner );
return ( HWND )1;
}
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index af4f300282..5c6f90433c 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -393,7 +393,7 @@ void CYahooProto::MenuMainInit( void ) // Show custom status menu
lstrcpyA( tDest, YAHOO_SET_CUST_STAT );
- YCreateService( YAHOO_SET_CUST_STAT, &CYahooProto::SetCustomStatCommand );
+ CreateService( YAHOO_SET_CUST_STAT, &CYahooProto::SetCustomStatCommand );
mi.position = 290000;
mi.icolibItem = GetIconHandle( IDI_SET_STATUS );
@@ -403,7 +403,7 @@ void CYahooProto::MenuMainInit( void ) // Edit My profile
lstrcpyA( tDest, YAHOO_EDIT_MY_PROFILE );
- YCreateService( YAHOO_EDIT_MY_PROFILE, &CYahooProto::OnEditMyProfile );
+ CreateService( YAHOO_EDIT_MY_PROFILE, &CYahooProto::OnEditMyProfile );
mi.position = 290005;
mi.icolibItem = GetIconHandle( IDI_PROFILE );
@@ -412,7 +412,7 @@ void CYahooProto::MenuMainInit( void ) // Show My profile
lstrcpyA( tDest, YAHOO_SHOW_MY_PROFILE );
- YCreateService( YAHOO_SHOW_MY_PROFILE, &CYahooProto::OnShowMyProfileCommand );
+ CreateService( YAHOO_SHOW_MY_PROFILE, &CYahooProto::OnShowMyProfileCommand );
mi.position = 290006;
mi.icolibItem = GetIconHandle( IDI_PROFILE );
@@ -421,7 +421,7 @@ void CYahooProto::MenuMainInit( void ) // Show Yahoo mail
strcpy( tDest, YAHOO_YAHOO_MAIL );
- YCreateService( YAHOO_YAHOO_MAIL, &CYahooProto::OnGotoMailboxCommand );
+ CreateService( YAHOO_YAHOO_MAIL, &CYahooProto::OnGotoMailboxCommand );
mi.position = 290010;
mi.icolibItem = GetIconHandle( IDI_INBOX );
@@ -430,7 +430,7 @@ void CYahooProto::MenuMainInit( void ) // Show Address Book
strcpy( tDest, YAHOO_AB );
- YCreateService( YAHOO_AB, &CYahooProto::OnABCommand );
+ CreateService( YAHOO_AB, &CYahooProto::OnABCommand );
mi.position = 290015;
mi.icolibItem = GetIconHandle( IDI_YAB );
@@ -439,14 +439,14 @@ void CYahooProto::MenuMainInit( void ) // Show Calendar
strcpy( tDest, YAHOO_CALENDAR );
- YCreateService( YAHOO_CALENDAR, &CYahooProto::OnCalendarCommand );
+ CreateService( YAHOO_CALENDAR, &CYahooProto::OnCalendarCommand );
mi.position = 290017;
mi.icolibItem = GetIconHandle( IDI_CALENDAR );
mi.pszName = LPGEN("&Calendar");
menuItemsAll[5] = Menu_AddProtoMenuItem(&mi);
strcpy( tDest, "/JoinChatRoom");
- YCreateService("/JoinChatRoom", &CYahooProto::CreateConference);
+ CreateService("/JoinChatRoom", &CYahooProto::CreateConference);
mi.position = 290018;
mi.icolibItem = GetIconHandle(IDI_YAHOO);
@@ -456,7 +456,7 @@ void CYahooProto::MenuMainInit( void ) // Show Refresh
/*strcpy( tDest, YAHOO_REFRESH );
- YCreateService( YAHOO_REFRESH, &CYahooProto::OnRefreshCommand );
+ CreateService( YAHOO_REFRESH, &CYahooProto::OnRefreshCommand );
mi.position = 500090015;
mi.icolibItem = GetIconHandle( IDI_REFRESH );
@@ -477,7 +477,7 @@ void CYahooProto::MenuContactInit( void ) // Show Profile
strcpy( tDest, YAHOO_SHOW_PROFILE );
- YCreateService( YAHOO_SHOW_PROFILE, &CYahooProto::OnShowProfileCommand );
+ CreateService( YAHOO_SHOW_PROFILE, &CYahooProto::OnShowProfileCommand );
mi.position = -2000006000;
mi.icolibItem = GetIconHandle( IDI_PROFILE );
@@ -515,24 +515,24 @@ void CYahooProto::LoadYahooServices( void ) char path[MAX_PATH];
//----| Events hooking |--------------------------------------------------------------
- YHookEvent( ME_OPT_INITIALISE, &CYahooProto::OnOptionsInit );
+ HookEvent( ME_OPT_INITIALISE, &CYahooProto::OnOptionsInit );
//----| Create nudge event |----------------------------------------------------------
mir_snprintf(path, SIZEOF(path), "%s/Nudge", m_szModuleName);
hYahooNudge = CreateHookableEvent( path );
//----| Service creation |------------------------------------------------------------
- YCreateService( PS_CREATEACCMGRUI, &CYahooProto::SvcCreateAccMgrUI);
+ CreateService( PS_CREATEACCMGRUI, &CYahooProto::SvcCreateAccMgrUI);
- YCreateService( PS_GETAVATARINFOT, &CYahooProto::GetAvatarInfo );
- YCreateService( PS_GETMYAVATART, &CYahooProto::GetMyAvatar );
- YCreateService( PS_SETMYAVATART, &CYahooProto::SetMyAvatar );
- YCreateService( PS_GETAVATARCAPS, &CYahooProto::GetAvatarCaps );
+ CreateService( PS_GETAVATARINFOT, &CYahooProto::GetAvatarInfo );
+ CreateService( PS_GETMYAVATART, &CYahooProto::GetMyAvatar );
+ CreateService( PS_SETMYAVATART, &CYahooProto::SetMyAvatar );
+ CreateService( PS_GETAVATARCAPS, &CYahooProto::GetAvatarCaps );
- YCreateService( PS_GETMYAWAYMSG, &CYahooProto::GetMyAwayMsg);
- YCreateService( YAHOO_SEND_NUDGE, &CYahooProto::SendNudge );
+ CreateService( PS_GETMYAWAYMSG, &CYahooProto::GetMyAwayMsg);
+ CreateService( YAHOO_SEND_NUDGE, &CYahooProto::SendNudge );
- YCreateService( YAHOO_GETUNREAD_EMAILCOUNT, &CYahooProto::GetUnreadEmailCount);
+ CreateService( YAHOO_GETUNREAD_EMAILCOUNT, &CYahooProto::GetUnreadEmailCount);
//----| Set resident variables |------------------------------------------------------
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index e4e4511cd4..9813d2c825 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -22,33 +22,6 @@ #include "resource.h"
-void CYahooProto::YCreateService( const char* szService, YServiceFunc serviceProc )
-{
- char str[ 255 ];
- unsigned int len;
-
- len = snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
-
- if (len >= sizeof(str)) {
- DebugLog("[YCreateService] Failed Registering Service: %s. Reason: buffer too small?", szService);
- return;
- }
-
- ::CreateServiceFunctionObj( str, ( MIRANDASERVICEOBJ )*( void** )&serviceProc, this );
-}
-
-void CYahooProto::YForkThread( YThreadFunc pFunc, void *param )
-{
- UINT lthreadID;
-
- CloseHandle(( HANDLE )::mir_forkthreadowner(( pThreadFuncOwner ) *( void** )&pFunc, this, param, <hreadID));
-}
-
-void CYahooProto::YHookEvent( const char* szEvent, YEventFunc handler )
-{
- ::HookEventObj( szEvent, ( MIRANDAHOOKOBJ )*( void** )&handler, this );
-}
-
int CYahooProto::DebugLog( const char *fmt, ... )
{
char str[ 4096 ];
|