diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-11 14:01:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-11 14:01:25 +0000 |
commit | 773421e8ba17637d994088c393d406226b516a30 (patch) | |
tree | 130c0bf529e30f493ae4f2abbe1230d31fecdeed /protocols/IRCG | |
parent | 3fc8b6f686262e8a595fc10b2bd947526ca77bdc (diff) |
- m_hNetlibUser moved to PROTO_INTERFACE;
- unified protocol loggers
git-svn-id: http://svn.miranda-ng.org/main/trunk@6435 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IRCG')
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 28 | ||||
-rw-r--r-- | protocols/IRCG/src/input.cpp | 8 | ||||
-rw-r--r-- | protocols/IRCG/src/irc.h | 3 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 18 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/main.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 24 | ||||
-rw-r--r-- | protocols/IRCG/src/tools.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/userinfo.cpp | 2 |
9 files changed, 40 insertions, 53 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index a280009923..9e4218f3dd 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -28,8 +28,8 @@ using namespace irc; VOID CALLBACK IdentTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
ppro->KillChatTimer( ppro->IdentTimer );
@@ -42,8 +42,8 @@ VOID CALLBACK IdentTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK TimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
ppro->KillChatTimer( ppro->InitTimer );
@@ -59,8 +59,8 @@ VOID CALLBACK TimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK KeepAliveTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( !ppro->m_sendKeepAlive || ( ppro->m_iStatus == ID_STATUS_OFFLINE || ppro->m_iStatus == ID_STATUS_CONNECTING )) {
@@ -80,8 +80,8 @@ VOID CALLBACK KeepAliveTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK OnlineNotifTimerProc3( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( !ppro->m_channelAwayNotification ||
@@ -123,8 +123,8 @@ VOID CALLBACK OnlineNotifTimerProc3( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( ppro->m_iStatus == ID_STATUS_OFFLINE || ppro->m_iStatus == ID_STATUS_CONNECTING ||
@@ -1484,7 +1484,7 @@ bool CIrcProto::OnIrc_TOPIC(const CIrcMessage* pmsg) static void __stdcall sttShowDlgList( void* param )
{
- CIrcProto* ppro = ( CIrcProto* )param;
+ CIrcProto *ppro = ( CIrcProto* )param;
if ( ppro->m_listDlg == NULL ) {
ppro->m_listDlg = new CListDlg( ppro );
ppro->m_listDlg->Show();
@@ -1640,7 +1640,7 @@ bool CIrcProto::OnIrc_BANLISTEND(const CIrcMessage* pmsg) static void __stdcall sttShowWhoisWnd( void* param )
{
CIrcMessage* pmsg = ( CIrcMessage* )param;
- CIrcProto* ppro = ( CIrcProto* )pmsg->m_proto;
+ CIrcProto *ppro = ( CIrcProto* )pmsg->m_proto;
if ( ppro->m_whoisDlg == NULL ) {
ppro->m_whoisDlg = new CWhoisDlg( ppro );
ppro->m_whoisDlg->Show();
@@ -1805,7 +1805,7 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg) static void __stdcall sttShowNickWnd( void* param )
{
CIrcMessage* pmsg = ( CIrcMessage* )param;
- CIrcProto* ppro = pmsg->m_proto;
+ CIrcProto *ppro = pmsg->m_proto;
if ( ppro->m_nickDlg == NULL ) {
ppro->m_nickDlg = new CNickDlg( ppro );
ppro->m_nickDlg->Show();
@@ -2340,7 +2340,7 @@ void CIrcProto::OnIrcDisconnected() static void __stdcall sttMainThrdOnConnect( void* param )
{
- CIrcProto* ppro = ( CIrcProto* )param;
+ CIrcProto *ppro = ( CIrcProto* )param;
ppro->SetChatTimer( ppro->InitTimer, 1*1000, TimerProc );
if ( ppro->m_identTimer )
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 156932e8b8..01bccf2925 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -196,7 +196,7 @@ CMString CIrcProto::DoIdentifiers( CMString text, const TCHAR* ) static void __stdcall sttSetTimerOn( void* _pro )
{
- CIrcProto* ppro = ( CIrcProto* )_pro;
+ CIrcProto *ppro = ( CIrcProto* )_pro;
ppro->DoEvent( GC_EVENT_INFORMATION, NULL, ppro->m_info.sNick.c_str(), TranslateT( "The buddy check function is enabled"), NULL, NULL, NULL, true, false);
ppro->SetChatTimer( ppro->OnlineNotifTimer, 500, OnlineNotifTimerProc );
if ( ppro->m_channelAwayNotification )
@@ -205,7 +205,7 @@ static void __stdcall sttSetTimerOn( void* _pro ) static void __stdcall sttSetTimerOff( void* _pro )
{
- CIrcProto* ppro = ( CIrcProto* )_pro;
+ CIrcProto *ppro = ( CIrcProto* )_pro;
ppro->DoEvent( GC_EVENT_INFORMATION, NULL, ppro->m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), NULL, NULL, NULL, true, false);
ppro->KillChatTimer( ppro->OnlineNotifTimer );
ppro->KillChatTimer( ppro->OnlineNotifTimer3 );
@@ -737,14 +737,14 @@ struct DoInputRequestParam str( mir_tstrdup( _str ))
{}
- CIrcProto* ppro;
+ CIrcProto *ppro;
TCHAR* str;
};
static void __stdcall DoInputRequestAliasApcStub( void* _par )
{
DoInputRequestParam* param = ( DoInputRequestParam* )_par;
- CIrcProto* ppro = param->ppro;
+ CIrcProto *ppro = param->ppro;
TCHAR* str = param->str;
TCHAR* infotext = NULL;
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 510375eee8..9c1aef10e6 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -372,7 +372,7 @@ struct CIrcProto : public PROTO<CIrcProto> DWORD m_bConnectThreadRunning;
HGENMENU hMenuRoot, hMenuQuick, hMenuServer, hMenuJoin, hMenuNick, hMenuList;
- HANDLE hNetlib, hNetlibDCC;
+ HANDLE hNetlibDCC;
bool bTempDisableCheck, bTempForceCheck, bEcho;
bool nickflag;
@@ -474,7 +474,6 @@ struct CIrcProto : public PROTO<CIrcProto> // services.cpp
void ConnectToServer(void);
void DisconnectFromServer(void);
- void DoNetlibLog( const char* fmt, ... );
void InitMainMenus(void);
UINT_PTR RetryTimer;
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 78f30e729c..abb59fa2e6 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -194,7 +194,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) ncon.cbSize = sizeof(ncon);
ncon.szHost = info.sServer.c_str();
ncon.wPort = info.iPort;
- con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlib, (LPARAM)&ncon);
+ con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon);
if (con == NULL) {
TCHAR szTemp[300];
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("\0035%s \002%s\002 (%S: %u)."),
@@ -373,9 +373,9 @@ void CIrcProto::DoReceive() nb.pfnNewConnectionV2 = DoIdent;
nb.pExtra = this;
nb.wPort = m_info.iIdentServerPort;
- hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlib, (LPARAM)&nb);
+ hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hNetlibUser, (LPARAM)&nb);
if ( !hBindPort || nb.wPort != m_info.iIdentServerPort ) {
- DoNetlibLog("Error: unable to bind local port %u", m_info.iIdentServerPort);
+ debugLogA("Error: unable to bind local port %u", m_info.iIdentServerPort);
KillIdent();
} }
@@ -702,7 +702,7 @@ void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) }
__except( EXCEPTION_EXECUTE_HANDLER ) // dedicated to Sava :)
{
- DoNetlibLog( "IRC handler feels sick: %S", pmsg->sCommand.c_str());
+ debugLogA( "IRC handler feels sick: %S", pmsg->sCommand.c_str());
}
}
else // handler not found. call default handler
@@ -1409,7 +1409,7 @@ int CDccSession::Disconnect() VOID CALLBACK DCCTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
+ CIrcProto *ppro = GetTimerOwner( idEvent );
if ( ppro )
ppro->CheckDCCTimeout();
}
@@ -1434,7 +1434,7 @@ void strdel( char* parBuffer, int len ) void DoIdent(HANDLE hConnection, DWORD, void* extra )
{
- CIrcProto* ppro = ( CIrcProto* )extra;
+ CIrcProto *ppro = ( CIrcProto* )extra;
char szBuf[1024];
int cbTotal = 0;
@@ -1454,7 +1454,7 @@ LBL_Parse: EOLPos[0] = EOLPos[1] = '\0';
rtrim( szBuf );
- ppro->DoNetlibLog("Got Ident request: %s", szBuf);
+ ppro->debugLogA("Got Ident request: %s", szBuf);
unsigned int PeerPortNrRcvd = 0, LocalPortNrRcvd = 0;
int iParamCnt = sscanf( szBuf, "%d , %d", &LocalPortNrRcvd, &PeerPortNrRcvd );
@@ -1481,9 +1481,9 @@ LBL_Parse: }
if ( Netlib_Send(hConnection, (const char*)buf, cbLen, 0) > 0)
- ppro->DoNetlibLog("Sent Ident answer: %s", buf);
+ ppro->debugLogA("Sent Ident answer: %s", buf);
else
- ppro->DoNetlibLog("Sending Ident answer failed.");
+ ppro->debugLogA("Sending Ident answer failed.");
if ( ppro->m_identTimer )
break;
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 0592354d3a..39e92289f3 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -149,7 +149,7 @@ CIrcProto::~CIrcProto() con = NULL;
}
- Netlib_CloseHandle(hNetlib); hNetlib = NULL;
+ Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
Netlib_CloseHandle(hNetlibDCC); hNetlibDCC = NULL;
m_dcc_chats.destroy();
@@ -201,7 +201,7 @@ int CIrcProto::OnModulesLoaded( WPARAM, LPARAM ) nlu.szSettingsModule = m_szModuleName;
mir_sntprintf( name, SIZEOF(name), TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = name;
- hNetlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
nlu.flags = NUF_OUTGOING|NUF_INCOMING|NUF_HTTPCONNS|NUF_TCHAR;
char szTemp2[256];
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index 88e3fe181b..88f151671b 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -75,12 +75,12 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO static CIrcProto* ircProtoInit( const char* pszProtoName, const TCHAR* tszUserName )
{
- CIrcProto* ppro = new CIrcProto( pszProtoName, tszUserName );
+ CIrcProto *ppro = new CIrcProto( pszProtoName, tszUserName );
g_Instances.insert( ppro );
return ppro;
}
-static int ircProtoUninit( CIrcProto* ppro )
+static int ircProtoUninit( CIrcProto *ppro )
{
g_Instances.remove(( CIrcProto* )ppro);
delete ppro;
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index b59a589a7b..4631eda7ff 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -105,25 +105,25 @@ static CIrcProto* IrcGetInstanceByHContact(HANDLE hContact) static INT_PTR IrcMenuChanSettings(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuChanSettings(wParam, lParam) : 0;
}
static INT_PTR IrcMenuWhois(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuWhois(wParam, lParam) : 0;
}
static INT_PTR IrcMenuDisconnect(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuDisconnect(wParam, lParam) : 0;
}
static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuIgnore(wParam, lParam) : 0;
}
@@ -1197,8 +1197,8 @@ INT_PTR __cdecl CIrcProto::GetMyAwayMsg(WPARAM wParam,LPARAM lParam) VOID CALLBACK RetryTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( ppro->m_iRetryCount <= StrToInt( ppro->m_retryCount) && ppro->m_retry ) {
@@ -1222,15 +1222,3 @@ VOID CALLBACK RetryTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) }
else ppro->KillChatTimer( ppro->RetryTimer );
}
-
-// logs text into NetLib (stolen from Jabber ;))
-void CIrcProto::DoNetlibLog( const char* fmt, ... )
-{
- va_list vararg;
- va_start( vararg, fmt );
- char* str = ( char* )alloca( 32000 );
- mir_vsnprintf( str, 32000, fmt, vararg );
- va_end( vararg );
-
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)str);
-}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 76e89c81f0..f477221510 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -554,7 +554,7 @@ struct TimerPair {}
UINT_PTR idEvent;
- CIrcProto* ppro;
+ CIrcProto *ppro;
};
static int CompareTimers( const TimerPair* p1, const TimerPair* p2 )
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index e3ac6f23c3..b693d06d9e 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -31,7 +31,7 @@ struct UserDetailsDlgProcParam hContact( _info )
{}
- CIrcProto* ppro;
+ CIrcProto *ppro;
HANDLE hContact;
};
|