From d3cb19278d60ac6f7963379254546cdca36a90e2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 14 Jan 2017 01:22:55 +0300 Subject: separate handle types for HNETLIBCONN & HNETLIBBIND --- protocols/IRCG/src/irclib.cpp | 15 +++++---------- protocols/IRCG/src/irclib.h | 10 +++++----- protocols/IRCG/src/stdafx.h | 6 +++--- protocols/IRCG/src/tools.cpp | 2 +- 4 files changed, 14 insertions(+), 19 deletions(-) (limited to 'protocols/IRCG/src') diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index cf6a7914d7..e621777293 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -358,7 +358,6 @@ void CIrcProto::DoReceive() if (m_info.bIdentServer && m_info.iIdentServerPort != NULL) { NETLIBBIND nb = {}; - nb.cbSize = sizeof(NETLIBBIND); nb.pfnNewConnectionV2 = DoIdent; nb.pExtra = this; nb.wPort = m_info.iIdentServerPort; @@ -875,10 +874,8 @@ int CDccSession::SetupConnection() // create a listening socket for outgoing chat/send requests. The remote computer connects to this computer. Used for both chat and filetransfer. if (di->bSender && !di->bReverse) { NETLIBBIND nb = {}; - nb.cbSize = sizeof(NETLIBBIND); nb.pfnNewConnectionV2 = DoIncomingDcc; // this is the (helper) function to be called once an incoming connection is made. The 'real' function that is called is IncomingConnection() - nb.pExtra = (void *)this; - nb.wPort = 0; + nb.pExtra = this; hBindPort = Netlib_BindPort(m_proto->hNetlibDCC, &nb); if (hBindPort == NULL) { @@ -954,10 +951,8 @@ int CDccSession::SetupConnection() // hack for passive filetransfers if (di->iType == DCC_SEND && !di->bSender && di->bReverse) { NETLIBBIND nb = {}; - nb.cbSize = sizeof(NETLIBBIND); nb.pfnNewConnectionV2 = DoIncomingDcc; // this is the (helper) function to be called once an incoming connection is made. The 'real' function that is called is IncomingConnection() - nb.pExtra = (void *)this; - nb.wPort = 0; + nb.pExtra = this; hBindPort = Netlib_BindPort(m_proto->hNetlibDCC, &nb); if (hBindPort == NULL) { @@ -1015,7 +1010,7 @@ int CDccSession::SetupConnection() } // called by netlib for incoming connections on a listening socket (chat/filetransfer) -int CDccSession::IncomingConnection(HANDLE hConnection, DWORD dwIP) +int CDccSession::IncomingConnection(HNETLIBCONN hConnection, DWORD dwIP) { con = hConnection; if (con == NULL) { @@ -1380,7 +1375,7 @@ VOID CALLBACK DCCTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) } // helper function for incoming dcc connections. -void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void * p1) +void DoIncomingDcc(HNETLIBCONN hConnection, DWORD dwRemoteIP, void * p1) { CDccSession *dcc = (CDccSession*)p1; dcc->IncomingConnection(hConnection, dwRemoteIP); @@ -1388,7 +1383,7 @@ void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void * p1) // ident server -void DoIdent(HANDLE hConnection, DWORD, void* extra) +void DoIdent(HNETLIBCONN hConnection, DWORD, void* extra) { CIrcProto *ppro = (CIrcProto*)extra; diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index 4c0395e3f6..e75d5205a9 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning (disable: 4786) -void DoIdent(HANDLE hConnection, DWORD dwRemoteIP, void* extra); -void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void* extra); +void DoIdent(HNETLIBCONN hConnection, DWORD dwRemoteIP, void* extra); +void DoIncomingDcc(HNETLIBCONN hConnection, DWORD dwRemoteIP, void* extra); unsigned long ConvertIPToInteger(char * IP); char* ConvertIntegerToIP(unsigned long int_ip_addr); @@ -123,8 +123,8 @@ class CDccSession { protected: CIrcProto* m_proto; - HANDLE con; // connection handle - HANDLE hBindPort; // handle for listening port + HNETLIBCONN con; // connection handle + HNETLIBBIND hBindPort; // handle for listening port static int nDcc; // number of dcc objects unsigned __int64 dwTotal; // total bytes sent/received @@ -164,7 +164,7 @@ public: int Connect(); void SetupPassive( DWORD adr, DWORD port ); int SendStuff(const wchar_t* fmt); - int IncomingConnection(HANDLE hConnection, DWORD dwIP); + int IncomingConnection(HNETLIBCONN hConnection, DWORD dwIP); int Disconnect(); }; diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h index ca32a61167..9662f643ce 100644 --- a/protocols/IRCG/src/stdafx.h +++ b/protocols/IRCG/src/stdafx.h @@ -447,7 +447,7 @@ struct CIrcProto : public PROTO void AddToJTemp(wchar_t op, CMStringW& sCommand); bool AddWindowItemData(CMStringW window, const wchar_t *pszLimit, const wchar_t *pszMode, const wchar_t *pszPassword, const wchar_t *pszTopic); INT_PTR DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *pszNick, const wchar_t *pszText, const wchar_t *pszStatus, const wchar_t *pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp = 1); - void FindLocalIP(HANDLE con); + void FindLocalIP(HNETLIBCONN con); bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis); bool IsChannel(const char* sName); bool IsChannel(const wchar_t* sName); @@ -502,8 +502,8 @@ struct CIrcProto : public PROTO protected: int codepage; - HANDLE con; - HANDLE hBindPort; + HNETLIBCONN con; + HNETLIBBIND hBindPort; void DoReceive(); LIST m_dcc_chats; LIST m_dcc_xfers; diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 34b0148b96..3efe9a248e 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -589,7 +589,7 @@ bool CIrcProto::AddWindowItemData(CMStringW window, const wchar_t* pszLimit, con return false; } -void CIrcProto::FindLocalIP(HANDLE hConn) // inspiration from jabber +void CIrcProto::FindLocalIP(HNETLIBCONN hConn) // inspiration from jabber { // Determine local IP int socket = Netlib_GetSocket(hConn); -- cgit v1.2.3