summaryrefslogtreecommitdiff
path: root/src/modules/netlib
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
commite58823d961a630eb62e60d2ccb443761ba5f1704 (patch)
tree62d071be480d57af2a53f154a1468abe0b9449ff /src/modules/netlib
parent721aea0764451e985d575236205808bbef298244 (diff)
- all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs.
- massive cleanup of the menu-related code git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib')
-rw-r--r--src/modules/netlib/netlib.cpp158
-rw-r--r--src/modules/netlib/netlib.h78
-rw-r--r--src/modules/netlib/netlibautoproxy.cpp20
-rw-r--r--src/modules/netlib/netlibbind.cpp20
-rw-r--r--src/modules/netlib/netlibhttp.cpp30
-rw-r--r--src/modules/netlib/netlibhttpproxy.cpp16
-rw-r--r--src/modules/netlib/netliblog.cpp150
-rw-r--r--src/modules/netlib/netlibopenconn.cpp100
-rw-r--r--src/modules/netlib/netlibopts.cpp268
-rw-r--r--src/modules/netlib/netlibpktrecver.cpp16
-rw-r--r--src/modules/netlib/netlibsecurity.cpp32
-rw-r--r--src/modules/netlib/netlibsock.cpp14
-rw-r--r--src/modules/netlib/netlibssl.cpp100
-rw-r--r--src/modules/netlib/netlibupnp.cpp32
14 files changed, 517 insertions, 517 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp
index 80e005ad7a..cb46c6d14d 100644
--- a/src/modules/netlib/netlib.cpp
+++ b/src/modules/netlib/netlib.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -55,7 +55,7 @@ void NetlibInitializeNestedCS(struct NetlibNestedCriticalSection *nlncs)
{
nlncs->dwOwningThreadId= 0;
nlncs->lockCount=0;
- nlncs->hMutex=CreateMutex(NULL,FALSE,NULL);
+ nlncs->hMutex=CreateMutex(NULL, FALSE, NULL);
}
void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs)
@@ -63,12 +63,12 @@ void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs)
CloseHandle(nlncs->hMutex);
}
-int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which)
+int NetlibEnterNestedCS(struct NetlibConnection *nlc, int which)
{
struct NetlibNestedCriticalSection *nlncs;
DWORD dwCurrentThreadId=GetCurrentThreadId();
- WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
+ WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
if (nlc == NULL || nlc->handleType != NLH_CONNECTION) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER);
@@ -83,7 +83,7 @@ int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which)
InterlockedIncrement(&nlc->dontCloseNow);
ResetEvent(nlc->hOkToCloseEvent);
ReleaseMutex(hConnectionHeaderMutex);
- WaitForSingleObject(nlncs->hMutex,INFINITE);
+ WaitForSingleObject(nlncs->hMutex, INFINITE);
nlncs->dwOwningThreadId=dwCurrentThreadId;
nlncs->lockCount=1;
if (InterlockedDecrement(&nlc->dontCloseNow) == 0)
@@ -99,22 +99,22 @@ void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs)
}
}
-static INT_PTR GetNetlibUserSettingInt(const char *szUserModule,const char *szSetting,int defValue)
+static INT_PTR GetNetlibUserSettingInt(const char *szUserModule, const char *szSetting, int defValue)
{
DBVARIANT dbv;
- if (DBGetContactSetting(NULL,szUserModule,szSetting,&dbv)
- && DBGetContactSetting(NULL,"Netlib",szSetting,&dbv))
+ if (DBGetContactSetting(NULL, szUserModule, szSetting, &dbv)
+ && DBGetContactSetting(NULL, "Netlib", szSetting, &dbv))
return defValue;
if (dbv.type == DBVT_BYTE) return dbv.bVal;
if (dbv.type == DBVT_WORD) return dbv.wVal;
return dbv.dVal;
}
-static char *GetNetlibUserSettingString(const char *szUserModule,const char *szSetting,int decode)
+static char *GetNetlibUserSettingString(const char *szUserModule, const char *szSetting, int decode)
{
DBVARIANT dbv;
- if (DBGetContactSettingString(NULL,szUserModule,szSetting,&dbv)
- && DBGetContactSettingString(NULL,"Netlib",szSetting,&dbv)) {
+ if (DBGetContactSettingString(NULL, szUserModule, szSetting, &dbv)
+ && DBGetContactSettingString(NULL, "Netlib", szSetting, &dbv)) {
return NULL;
}
else {
@@ -127,7 +127,7 @@ static char *GetNetlibUserSettingString(const char *szUserModule,const char *szS
}
}
-static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam)
+static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam)
{
NETLIBUSER *nlu=(NETLIBUSER*)lParam;
struct NetlibUser *thisUser;
@@ -170,28 +170,28 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam)
thisUser->user.szHttpGatewayHello=NULL;
thisUser->settings.cbSize=sizeof(NETLIBUSERSETTINGS);
- thisUser->settings.useProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLUseProxy",0);
- thisUser->settings.proxyType=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLProxyType",PROXYTYPE_SOCKS5);
+ thisUser->settings.useProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLUseProxy", 0);
+ thisUser->settings.proxyType=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyType", PROXYTYPE_SOCKS5);
if (thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType == PROXYTYPE_HTTPS)
thisUser->settings.proxyType=PROXYTYPE_HTTP;
if (!(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) {
thisUser->settings.useProxy=0;
thisUser->settings.proxyType=PROXYTYPE_SOCKS5;
}
- thisUser->settings.szProxyServer=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLProxyServer",0);
- thisUser->settings.wProxyPort=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLProxyPort",1080);
- thisUser->settings.useProxyAuth=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLUseProxyAuth",0);
- thisUser->settings.szProxyAuthUser=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLProxyAuthUser",0);
- thisUser->settings.szProxyAuthPassword=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLProxyAuthPassword",1);
- thisUser->settings.dnsThroughProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLDnsThroughProxy",1);
- thisUser->settings.specifyIncomingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLSpecifyIncomingPorts",0);
- thisUser->settings.szIncomingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLIncomingPorts",0);
- thisUser->settings.specifyOutgoingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLSpecifyOutgoingPorts",0);
- thisUser->settings.szOutgoingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule,"NLOutgoingPorts",0);
- thisUser->settings.enableUPnP=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLEnableUPnP",1); //default to on
- thisUser->settings.validateSSL=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLValidateSSL",0);
-
- thisUser->toLog=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLlog",1);
+ thisUser->settings.szProxyServer=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyServer", 0);
+ thisUser->settings.wProxyPort=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyPort", 1080);
+ thisUser->settings.useProxyAuth=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLUseProxyAuth", 0);
+ thisUser->settings.szProxyAuthUser=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthUser", 0);
+ thisUser->settings.szProxyAuthPassword=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLProxyAuthPassword", 1);
+ thisUser->settings.dnsThroughProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLDnsThroughProxy", 1);
+ thisUser->settings.specifyIncomingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLSpecifyIncomingPorts", 0);
+ thisUser->settings.szIncomingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLIncomingPorts", 0);
+ thisUser->settings.specifyOutgoingPorts=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLSpecifyOutgoingPorts", 0);
+ thisUser->settings.szOutgoingPorts=GetNetlibUserSettingString(thisUser->user.szSettingsModule, "NLOutgoingPorts", 0);
+ thisUser->settings.enableUPnP=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLEnableUPnP", 1); //default to on
+ thisUser->settings.validateSSL=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLValidateSSL", 0);
+
+ thisUser->toLog=GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLlog", 1);
EnterCriticalSection(&csNetlibUser);
netlibUser.insert(thisUser);
@@ -199,7 +199,7 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam)
return (INT_PTR)thisUser;
}
-static INT_PTR NetlibGetUserSettings(WPARAM wParam,LPARAM lParam)
+static INT_PTR NetlibGetUserSettings(WPARAM wParam, LPARAM lParam)
{
NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam;
struct NetlibUser *nlu=(struct NetlibUser*)wParam;
@@ -212,7 +212,7 @@ static INT_PTR NetlibGetUserSettings(WPARAM wParam,LPARAM lParam)
return 1;
}
-static INT_PTR NetlibSetUserSettings(WPARAM wParam,LPARAM lParam)
+static INT_PTR NetlibSetUserSettings(WPARAM wParam, LPARAM lParam)
{
NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam;
struct NetlibUser *nlu=(struct NetlibUser*)wParam;
@@ -221,7 +221,7 @@ static INT_PTR NetlibSetUserSettings(WPARAM wParam,LPARAM lParam)
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- NetlibSaveUserSettingsStruct(nlu->user.szSettingsModule,nlus);
+ NetlibSaveUserSettingsStruct(nlu->user.szSettingsModule, nlus);
return 1;
}
@@ -267,7 +267,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
HANDLE waitHandles[4];
DWORD waitResult;
- WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
+ WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
if (nlc->usingHttpGateway)
{
HttpGatewayRemovePacket(nlc, -1);
@@ -286,7 +286,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
waitHandles[1]=nlc->hOkToCloseEvent;
waitHandles[2]=nlc->ncsRecv.hMutex;
waitHandles[3]=nlc->ncsSend.hMutex;
- waitResult=WaitForMultipleObjects( SIZEOF(waitHandles),waitHandles,TRUE,INFINITE);
+ waitResult=WaitForMultipleObjects( SIZEOF(waitHandles), waitHandles, TRUE, INFINITE);
if (waitResult<WAIT_OBJECT_0 || waitResult >= WAIT_OBJECT_0 + SIZEOF(waitHandles)) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER); //already been closed
@@ -304,7 +304,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
CloseHandle(nlc->hOkToCloseEvent);
DeleteCriticalSection(&nlc->csHttpSequenceNums);
ReleaseMutex(hConnectionHeaderMutex);
- NetlibLogf(nlc->nlu,"(%p:%u) Connection closed",nlc,nlc->s);
+ NetlibLogf(nlc->nlu, "(%p:%u) Connection closed", nlc, nlc->s);
break;
}
case NLH_BOUNDPORT:
@@ -332,7 +332,7 @@ static INT_PTR NetlibGetSocket(WPARAM wParam, LPARAM)
}
else
{
- WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
+ WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
switch (GetNetlibHandleType(wParam))
{
case NLH_CONNECTION:
@@ -384,7 +384,7 @@ INT_PTR NetlibShutdown(WPARAM wParam, LPARAM)
{
if (wParam)
{
- WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
+ WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
switch(GetNetlibHandleType(wParam)) {
case NLH_CONNECTION:
{
@@ -409,29 +409,29 @@ INT_PTR NetlibShutdown(WPARAM wParam, LPARAM)
}
static const char szHexDigits[]="0123456789ABCDEF";
-INT_PTR NetlibHttpUrlEncode(WPARAM,LPARAM lParam)
+INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam)
{
- unsigned char *szOutput,*szInput=(unsigned char*)lParam;
- unsigned char *pszIn,*pszOut;
+ unsigned char *szOutput, *szInput=(unsigned char*)lParam;
+ unsigned char *pszIn, *pszOut;
int outputLen;
if (szInput == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return (INT_PTR)(char*)NULL;
}
- for (outputLen=0,pszIn=szInput;*pszIn;pszIn++) {
+ for (outputLen=0, pszIn=szInput;*pszIn;pszIn++) {
if ( (48 <= *pszIn && *pszIn <= 57) ||//0-9
(65 <= *pszIn && *pszIn <= 90) ||//ABC...XYZ
(97 <= *pszIn && *pszIn <= 122) ||//abc...xyz
*pszIn == '-' || *pszIn == '_' || *pszIn == '.' || *pszIn == ' ') outputLen++;
else outputLen+=3;
}
- szOutput=(unsigned char*)HeapAlloc(GetProcessHeap(),0,outputLen+1);
+ szOutput=(unsigned char*)HeapAlloc(GetProcessHeap(), 0, outputLen+1);
if (szOutput == NULL) {
SetLastError(ERROR_OUTOFMEMORY);
return (INT_PTR)(unsigned char*)NULL;
}
- for (pszOut=szOutput,pszIn=szInput;*pszIn;pszIn++) {
+ for (pszOut=szOutput, pszIn=szInput;*pszIn;pszIn++) {
if ( (48 <= *pszIn && *pszIn <= 57) ||
(65 <= *pszIn && *pszIn <= 90) ||
(97 <= *pszIn && *pszIn <= 122) ||
@@ -464,7 +464,7 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam)
return 0;
}
nlb64->cchEncoded=Netlib_GetBase64EncodedBufferSize(nlb64->cbDecoded);
- for (iIn=0,pbIn=nlb64->pbDecoded,pszOut=nlb64->pszEncoded;iIn<nlb64->cbDecoded;iIn+=3,pbIn+=3,pszOut+=4) {
+ for (iIn=0, pbIn=nlb64->pbDecoded, pszOut=nlb64->pszEncoded;iIn<nlb64->cbDecoded;iIn+=3, pbIn+=3, pszOut+=4) {
pszOut[0]=base64chars[pbIn[0]>>2];
if (nlb64->cbDecoded-iIn == 1) {
pszOut[1]=base64chars[(pbIn[0]&3)<<4];
@@ -503,7 +503,7 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam)
NETLIBBASE64 *nlb64=(NETLIBBASE64*)lParam;
char *pszIn;
PBYTE pbOut;
- BYTE b1,b2,b3,b4;
+ BYTE b1, b2, b3, b4;
int iIn;
if (nlb64 == NULL || nlb64->pszEncoded == NULL || nlb64->pbDecoded == NULL) {
@@ -519,7 +519,7 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam)
return 0;
}
nlb64->cbDecoded=Netlib_GetBase64DecodedBufferSize(nlb64->cchEncoded);
- for (iIn=0,pszIn=nlb64->pszEncoded,pbOut=nlb64->pbDecoded;iIn<nlb64->cchEncoded;iIn+=4,pszIn+=4,pbOut+=3) {
+ for (iIn=0, pszIn=nlb64->pszEncoded, pbOut=nlb64->pbDecoded;iIn<nlb64->cchEncoded;iIn+=4, pszIn+=4, pbOut+=3) {
b1=Base64CharToInt(pszIn[0]);
b2=Base64CharToInt(pszIn[1]);
b3=Base64CharToInt(pszIn[2]);
@@ -571,12 +571,12 @@ int LoadNetlibModule(void)
bModuleInitialized = TRUE;
- WSAStartup(MAKEWORD(2,2), &wsadata);
+ WSAStartup(MAKEWORD(2, 2), &wsadata);
- HookEvent(ME_OPT_INITIALISE,NetlibOptInitialise);
+ HookEvent(ME_OPT_INITIALISE, NetlibOptInitialise);
InitializeCriticalSection(&csNetlibUser);
- hConnectionHeaderMutex=CreateMutex(NULL,FALSE,NULL);
+ hConnectionHeaderMutex=CreateMutex(NULL, FALSE, NULL);
NetlibLogInit();
connectionTimeout = 0;
@@ -629,38 +629,38 @@ int LoadNetlibModule(void)
}
}
- hConnectionOpenMutex = connectionTimeout ? CreateMutex(NULL,FALSE,NULL) : NULL;
+ hConnectionOpenMutex = connectionTimeout ? CreateMutex(NULL, FALSE, NULL) : NULL;
g_LastConnectionTick = GetTickCount();
- CreateServiceFunction(MS_NETLIB_REGISTERUSER,NetlibRegisterUser);
- CreateServiceFunction(MS_NETLIB_GETUSERSETTINGS,NetlibGetUserSettings);
- CreateServiceFunction(MS_NETLIB_SETUSERSETTINGS,NetlibSetUserSettings);
- CreateServiceFunction(MS_NETLIB_CLOSEHANDLE,NetlibCloseHandle);
- CreateServiceFunction(MS_NETLIB_BINDPORT,NetlibBindPort);
- CreateServiceFunction(MS_NETLIB_OPENCONNECTION,NetlibOpenConnection);
- CreateServiceFunction(MS_NETLIB_SETHTTPPROXYINFO,NetlibHttpGatewaySetInfo);
- CreateServiceFunction(MS_NETLIB_SETSTICKYHEADERS,NetlibHttpSetSticky);
- CreateServiceFunction(MS_NETLIB_GETSOCKET,NetlibGetSocket);
- CreateServiceFunction(MS_NETLIB_URLENCODE,NetlibHttpUrlEncode);
- CreateServiceFunction(MS_NETLIB_BASE64ENCODE,NetlibBase64Encode);
- CreateServiceFunction(MS_NETLIB_BASE64DECODE,NetlibBase64Decode);
- CreateServiceFunction(MS_NETLIB_SENDHTTPREQUEST,NetlibHttpSendRequest);
- CreateServiceFunction(MS_NETLIB_RECVHTTPHEADERS,NetlibHttpRecvHeaders);
- CreateServiceFunction(MS_NETLIB_FREEHTTPREQUESTSTRUCT,NetlibHttpFreeRequestStruct);
- CreateServiceFunction(MS_NETLIB_HTTPTRANSACTION,NetlibHttpTransaction);
- CreateServiceFunction(MS_NETLIB_SEND,NetlibSend);
- CreateServiceFunction(MS_NETLIB_RECV,NetlibRecv);
- CreateServiceFunction(MS_NETLIB_SELECT,NetlibSelect);
- CreateServiceFunction(MS_NETLIB_SELECTEX,NetlibSelectEx);
- CreateServiceFunction(MS_NETLIB_SHUTDOWN,NetlibShutdown);
- CreateServiceFunction(MS_NETLIB_CREATEPACKETRECVER,NetlibPacketRecverCreate);
- CreateServiceFunction(MS_NETLIB_GETMOREPACKETS,NetlibPacketRecverGetMore);
- CreateServiceFunction(MS_NETLIB_SETPOLLINGTIMEOUT,NetlibHttpSetPollingTimeout);
- CreateServiceFunction(MS_NETLIB_STARTSSL,NetlibStartSsl);
- CreateServiceFunction(MS_NETLIB_STARINGTOADDRESS,NetlibStringToAddressSrv);
- CreateServiceFunction(MS_NETLIB_ADDRESSTOSTRING,NetlibAddressToStringSrv);
- CreateServiceFunction(MS_NETLIB_GETCONNECTIONINFO,NetlibGetConnectionInfoSrv);
- CreateServiceFunction(MS_NETLIB_GETMYIP,NetlibGetMyIp);
+ CreateServiceFunction(MS_NETLIB_REGISTERUSER, NetlibRegisterUser);
+ CreateServiceFunction(MS_NETLIB_GETUSERSETTINGS, NetlibGetUserSettings);
+ CreateServiceFunction(MS_NETLIB_SETUSERSETTINGS, NetlibSetUserSettings);
+ CreateServiceFunction(MS_NETLIB_CLOSEHANDLE, NetlibCloseHandle);
+ CreateServiceFunction(MS_NETLIB_BINDPORT, NetlibBindPort);
+ CreateServiceFunction(MS_NETLIB_OPENCONNECTION, NetlibOpenConnection);
+ CreateServiceFunction(MS_NETLIB_SETHTTPPROXYINFO, NetlibHttpGatewaySetInfo);
+ CreateServiceFunction(MS_NETLIB_SETSTICKYHEADERS, NetlibHttpSetSticky);
+ CreateServiceFunction(MS_NETLIB_GETSOCKET, NetlibGetSocket);
+ CreateServiceFunction(MS_NETLIB_URLENCODE, NetlibHttpUrlEncode);
+ CreateServiceFunction(MS_NETLIB_BASE64ENCODE, NetlibBase64Encode);
+ CreateServiceFunction(MS_NETLIB_BASE64DECODE, NetlibBase64Decode);
+ CreateServiceFunction(MS_NETLIB_SENDHTTPREQUEST, NetlibHttpSendRequest);
+ CreateServiceFunction(MS_NETLIB_RECVHTTPHEADERS, NetlibHttpRecvHeaders);
+ CreateServiceFunction(MS_NETLIB_FREEHTTPREQUESTSTRUCT, NetlibHttpFreeRequestStruct);
+ CreateServiceFunction(MS_NETLIB_HTTPTRANSACTION, NetlibHttpTransaction);
+ CreateServiceFunction(MS_NETLIB_SEND, NetlibSend);
+ CreateServiceFunction(MS_NETLIB_RECV, NetlibRecv);
+ CreateServiceFunction(MS_NETLIB_SELECT, NetlibSelect);
+ CreateServiceFunction(MS_NETLIB_SELECTEX, NetlibSelectEx);
+ CreateServiceFunction(MS_NETLIB_SHUTDOWN, NetlibShutdown);
+ CreateServiceFunction(MS_NETLIB_CREATEPACKETRECVER, NetlibPacketRecverCreate);
+ CreateServiceFunction(MS_NETLIB_GETMOREPACKETS, NetlibPacketRecverGetMore);
+ CreateServiceFunction(MS_NETLIB_SETPOLLINGTIMEOUT, NetlibHttpSetPollingTimeout);
+ CreateServiceFunction(MS_NETLIB_STARTSSL, NetlibStartSsl);
+ CreateServiceFunction(MS_NETLIB_STARINGTOADDRESS, NetlibStringToAddressSrv);
+ CreateServiceFunction(MS_NETLIB_ADDRESSTOSTRING, NetlibAddressToStringSrv);
+ CreateServiceFunction(MS_NETLIB_GETCONNECTIONINFO, NetlibGetConnectionInfoSrv);
+ CreateServiceFunction(MS_NETLIB_GETMYIP, NetlibGetMyIp);
hRecvEvent = CreateHookableEvent(ME_NETLIB_FASTRECV);
hSendEvent = CreateHookableEvent(ME_NETLIB_FASTSEND);
diff --git a/src/modules/netlib/netlib.h b/src/modules/netlib/netlib.h
index 8939e7fafc..88a1db2284 100644
--- a/src/modules/netlib/netlib.h
+++ b/src/modules/netlib/netlib.h
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -74,7 +74,7 @@ struct NetlibConnection
CRITICAL_SECTION csHttpSequenceNums;
HANDLE hOkToCloseEvent;
LONG dontCloseNow;
- struct NetlibNestedCriticalSection ncsSend,ncsRecv;
+ struct NetlibNestedCriticalSection ncsSend, ncsRecv;
HSSL hSsl;
struct NetlibHTTPProxyPacketQueue * pHttpProxyPacketQueue;
char *szNewUrl;
@@ -107,16 +107,16 @@ struct NetlibPacketRecver {
//netlib.c
void NetlibFreeUserSettingsStruct(NETLIBUSERSETTINGS *settings);
void NetlibDoClose(NetlibConnection *nlc, bool noShutdown = false);
-INT_PTR NetlibCloseHandle(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM lParam);
void NetlibInitializeNestedCS(struct NetlibNestedCriticalSection *nlncs);
void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs);
#define NLNCS_SEND 0
#define NLNCS_RECV 1
-int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which);
+int NetlibEnterNestedCS(struct NetlibConnection *nlc, int which);
void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs);
-INT_PTR NetlibBase64Encode(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibBase64Decode(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibHttpUrlEncode(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibBase64Encode(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibBase64Decode(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibHttpUrlEncode(WPARAM wParam, LPARAM lParam);
extern CRITICAL_SECTION csNetlibUser;
extern LIST<NetlibUser> netlibUser;
@@ -129,62 +129,62 @@ bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps);
//netlibbind.c
int NetlibFreeBoundPort(struct NetlibBoundPort *nlbp);
-INT_PTR NetlibBindPort(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam);
bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn);
//netlibhttp.c
-INT_PTR NetlibHttpSendRequest(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibHttpFreeRequestStruct(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibHttpTransaction(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibHttpFreeRequestStruct(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam);
void NetlibHttpSetLastErrorUsingHttpResult(int result);
NETLIBHTTPREQUEST* NetlibHttpRecv(NetlibConnection* nlc, DWORD hflags, DWORD dflags, bool isConnect = false);
void NetlibConnFromUrl(const char* szUrl, bool secur, NETLIBOPENCONNECTION &nloc);
//netlibhttpproxy.c
-int NetlibInitHttpConnection(struct NetlibConnection *nlc,struct NetlibUser *nlu,NETLIBOPENCONNECTION *nloc);
-int NetlibHttpGatewayRecv(struct NetlibConnection *nlc,char *buf,int len,int flags);
-int NetlibHttpGatewayPost(struct NetlibConnection *nlc,const char *buf,int len,int flags);
+int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc);
+int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int flags);
+int NetlibHttpGatewayPost(struct NetlibConnection *nlc, const char *buf, int len, int flags);
void HttpGatewayRemovePacket(NetlibConnection *nlc, int pck);
-INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibHttpSetPollingTimeout(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibHttpSetPollingTimeout(WPARAM wParam, LPARAM lParam);
INT_PTR NetlibHttpSetSticky(WPARAM wParam, LPARAM lParam);
//netliblog.c
void NetlibLogShowOptions(void);
-void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int flags);
+void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags);
void NetlibLogf(NetlibUser* nlu, const char *fmt, ...);
void NetlibLogInit(void);
void NetlibLogShutdown(void);
//netlibopenconn.c
-DWORD DnsLookup(struct NetlibUser *nlu,const char *szHost);
-int WaitUntilReadable(SOCKET s,DWORD dwTimeout, bool check = false);
-int WaitUntilWritable(SOCKET s,DWORD dwTimeout);
+DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost);
+int WaitUntilReadable(SOCKET s, DWORD dwTimeout, bool check = false);
+int WaitUntilWritable(SOCKET s, DWORD dwTimeout);
bool NetlibDoConnect(NetlibConnection *nlc);
bool NetlibReconnect(NetlibConnection *nlc);
-INT_PTR NetlibOpenConnection(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam);
INT_PTR NetlibStartSsl(WPARAM wParam, LPARAM lParam);
//netlibopts.c
-int NetlibOptInitialise(WPARAM wParam,LPARAM lParam);
-void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTINGS *settings);
+int NetlibOptInitialise(WPARAM wParam, LPARAM lParam);
+void NetlibSaveUserSettingsStruct(const char *szSettingsModule, NETLIBUSERSETTINGS *settings);
//netlibpktrecver.c
-INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibPacketRecverCreate(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam);
//netlibsock.c
#define NL_SELECT_READ 0x0001
#define NL_SELECT_WRITE 0x0002
#define NL_SELECT_ALL (NL_SELECT_READ+NL_SELECT_WRITE)
-INT_PTR NetlibSend(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibRecv(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibSelect(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibSelectEx(WPARAM wParam,LPARAM lParam);
-INT_PTR NetlibShutdown(WPARAM wParam,LPARAM lParam);
+INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibSelect(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibSelectEx(WPARAM wParam, LPARAM lParam);
+INT_PTR NetlibShutdown(WPARAM wParam, LPARAM lParam);
bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr);
char* NetlibAddressToString(SOCKADDR_INET_M* addr);
@@ -192,7 +192,7 @@ void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo);
NETLIBIPLIST* GetMyIp(unsigned flags);
//netlibupnp.c
-bool NetlibUPnPAddPortMapping(WORD intport, char *proto,
+bool NetlibUPnPAddPortMapping(WORD intport, char *proto,
WORD *extport, DWORD *extip, bool search);
void NetlibUPnPDeletePortMapping(WORD extport, char* proto);
void NetlibUPnPCleanup(void*);
@@ -211,11 +211,11 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge
bool http, unsigned& complete);
-static __inline INT_PTR NLSend(struct NetlibConnection *nlc,const char *buf,int len,int flags) {
- NETLIBBUFFER nlb={(char*)buf,len,flags};
- return NetlibSend((WPARAM)nlc,(LPARAM)&nlb);
+static __inline INT_PTR NLSend(struct NetlibConnection *nlc, const char *buf, int len, int flags) {
+ NETLIBBUFFER nlb={(char*)buf, len, flags};
+ return NetlibSend((WPARAM)nlc, (LPARAM)&nlb);
}
-static __inline INT_PTR NLRecv(struct NetlibConnection *nlc,char *buf,int len,int flags) {
- NETLIBBUFFER nlb={buf,len,flags};
- return NetlibRecv((WPARAM)nlc,(LPARAM)&nlb);
+static __inline INT_PTR NLRecv(struct NetlibConnection *nlc, char *buf, int len, int flags) {
+ NETLIBBUFFER nlb={buf, len, flags};
+ return NetlibRecv((WPARAM)nlc, (LPARAM)&nlb);
}
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp
index 21f841ff3c..a3164216cd 100644
--- a/src/modules/netlib/netlibautoproxy.cpp
+++ b/src/modules/netlib/netlibautoproxy.cpp
@@ -1,7 +1,7 @@
/*
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2010-2011 Miranda ICQ/IM project,
+Copyright 2010-2011 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -10,7 +10,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////
// ResolveHostName (a helper function)
/////////////////////////////////////////////////////////////////////
-DWORD __stdcall ResolveHostName(LPSTR lpszHostName,
+DWORD __stdcall ResolveHostName(LPSTR lpszHostName,
LPSTR lpszIPAddress, LPDWORD lpdwIPAddressSize)
{
if (*lpdwIPAddressSize < 17 || lpszIPAddress == NULL)
@@ -99,13 +99,13 @@ BOOL __stdcall IsInNet(LPSTR lpszIPAddress, LPSTR lpszDest, LPSTR lpszMask)
static const AutoProxyHelperVtbl OurVtbl =
{
- IsResolvable,
- GetIPAddress,
- ResolveHostName,
- IsInNet,
- NULL,
- NULL,
- NULL,
+ IsResolvable,
+ GetIPAddress,
+ ResolveHostName,
+ IsInNet,
+ NULL,
+ NULL,
+ NULL,
NULL
};
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp
index 5e8d76d464..7e5724994d 100644
--- a/src/modules/netlib/netlibbind.cpp
+++ b/src/modules/netlib/netlibbind.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -55,7 +55,7 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn)
for (psz=szPorts;*psz;)
{
- while (*psz == ' ' || *psz == ',') psz++;
+ while (*psz == ' ' || *psz == ', ') psz++;
portMin = strtol(psz, &pszEnd, 0);
if (pszEnd == psz) break;
while (*pszEnd == ' ') pszEnd++;
@@ -122,7 +122,7 @@ int NetlibFreeBoundPort(struct NetlibBoundPort *nlbp)
{
closesocket(nlbp->s);
closesocket(nlbp->s6);
- WaitForSingleObject(nlbp->hThread,INFINITE);
+ WaitForSingleObject(nlbp->hThread, INFINITE);
CloseHandle(nlbp->hThread);
NetlibLogf(nlbp->nlu, "(%u) Port %u closed for incoming connections", nlbp->s, nlbp->wPort);
mir_free(nlbp);
@@ -213,7 +213,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
nlbp->pExtra = (nlb->cbSize != NETLIBBIND_SIZEOF_V1) ? nlb->pExtra : NULL;
if (nlbp->s == INVALID_SOCKET && nlbp->s6 == INVALID_SOCKET)
{
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"socket",WSAGetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "socket", WSAGetLastError());
mir_free(nlbp);
return 0;
}
@@ -238,7 +238,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
be asking for whatever was in nlb->wPort*/
if (nlb->wPort != 0)
{
- NetlibLogf(nlu,"%s %d: trying to bind port %d, this 'feature' can be abused, please be sure you want to allow it.",__FILE__,__LINE__,nlb->wPort);
+ NetlibLogf(nlu, "%s %d: trying to bind port %d, this 'feature' can be abused, please be sure you want to allow it.", __FILE__, __LINE__, nlb->wPort);
sin.sin_port = htons(nlb->wPort);
sin6.sin6_port = htons(nlb->wPort);
}
@@ -256,7 +256,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
}
if (!foundPort)
{
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"bind",WSAGetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "bind", WSAGetLastError());
closesocket(nlbp->s);
closesocket(nlbp->s6);
mir_free(nlbp);
@@ -265,7 +265,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
if (nlbp->s != INVALID_SOCKET && listen(nlbp->s, 5))
{
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"listen",WSAGetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "listen", WSAGetLastError());
closesocket(nlbp->s);
closesocket(nlbp->s6);
mir_free(nlbp);
@@ -274,7 +274,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
if (nlbp->s6 != INVALID_SOCKET && listen(nlbp->s6, 5))
{
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"listen",WSAGetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "listen", WSAGetLastError());
closesocket(nlbp->s);
closesocket(nlbp->s6);
mir_free(nlbp);
@@ -293,7 +293,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
nlb->wPort = ntohs(sin.Ipv6.sin6_port);
else
{
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"getsockname",WSAGetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "getsockname", WSAGetLastError());
closesocket(nlbp->s);
closesocket(nlbp->s6);
mir_free(nlbp);
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp
index fb027366bc..6c6c58a481 100644
--- a/src/modules/netlib/netlibhttp.cpp
+++ b/src/modules/netlib/netlibhttp.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -398,14 +398,14 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
return 1;
}
-static int SendHttpRequestAndData(struct NetlibConnection *nlc,struct ResizableCharBuffer *httpRequest,NETLIBHTTPREQUEST *nlhr,int sendContentLengthHeader)
+static int SendHttpRequestAndData(struct NetlibConnection *nlc, struct ResizableCharBuffer *httpRequest, NETLIBHTTPREQUEST *nlhr, int sendContentLengthHeader)
{
bool sendData = (nlhr->requestType == REQUEST_POST || nlhr->requestType == REQUEST_PUT);
if (sendContentLengthHeader && sendData)
- AppendToCharBuffer(httpRequest,"Content-Length: %d\r\n\r\n", nlhr->dataLength);
+ AppendToCharBuffer(httpRequest, "Content-Length: %d\r\n\r\n", nlhr->dataLength);
else
- AppendToCharBuffer(httpRequest,"\r\n");
+ AppendToCharBuffer(httpRequest, "\r\n");
DWORD hflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
(nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND | NLHRF_NODUMPHEADERS) ?
@@ -420,7 +420,7 @@ static int SendHttpRequestAndData(struct NetlibConnection *nlc,struct ResizableC
MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
(nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
- int sendResult = NLSend(nlc,nlhr->pData,nlhr->dataLength, sflags);
+ int sendResult = NLSend(nlc, nlhr->pData, nlhr->dataLength, sflags);
bytesSent = sendResult != SOCKET_ERROR ? bytesSent + sendResult : SOCKET_ERROR;
}
@@ -611,7 +611,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
DWORD dwTimeOutTime = hdrTimeout < 0 ? -1 : GetTickCount() + hdrTimeout;
if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &resultCode, NULL, NULL))
{
- NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)",__FILE__,__LINE__,"HttpPeekFirstResponseLine",GetLastError(), count);
+ NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", GetLastError(), count);
DWORD err = GetLastError();
if (err == ERROR_TIMEOUT || err == ERROR_BAD_FORMAT || err == ERROR_BUFFER_OVERFLOW ||
lastFirstLineFail || nlc->termRequested || nlhr->requestType == REQUEST_CONNECT)
@@ -839,7 +839,7 @@ INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam)
return 1;
}
-INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam)
+INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam)
{
struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
NETLIBHTTPREQUEST *nlhr;
@@ -850,7 +850,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam)
int headersCount = 0, bufferSize = 8192;
bool headersCompleted = false;
- if (!NetlibEnterNestedCS(nlc,NLNCS_RECV))
+ if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
return 0;
dwRequestTimeoutTime = GetTickCount() + HTTPRECVDATATIMEOUT;
@@ -859,7 +859,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam)
nlhr->nlc = nlc; // Needed to id connection in the protocol HTTP gateway wrapper functions
nlhr->requestType = REQUEST_RESPONSE;
- if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK,
+ if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK,
&nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength))
{
NetlibLeaveNestedCS(&nlc->ncsRecv);
@@ -992,13 +992,13 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam)
}
if (!doneUserAgentHeader)
{
- char *pspace,szMirandaVer[64];
+ char *pspace, szMirandaVer[64];
nlhrSend.headers[nlhrSend.headersCount].szName = "User-Agent";
nlhrSend.headers[nlhrSend.headersCount].szValue = szUserAgent;
++nlhrSend.headersCount;
- CallService(MS_SYSTEM_GETVERSIONTEXT,SIZEOF(szMirandaVer),(LPARAM)szMirandaVer);
- pspace=strchr(szMirandaVer,' ');
+ CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(szMirandaVer), (LPARAM)szMirandaVer);
+ pspace=strchr(szMirandaVer, ' ');
if (pspace)
{
*pspace++ = '\0';
@@ -1220,14 +1220,14 @@ next:
for (;;)
{
recvResult = RecvWithTimeoutTime(nlc, GetTickCount() + HTTPRECVDATATIMEOUT,
- nlhrReply->pData + nlhrReply->dataLength,
+ nlhrReply->pData + nlhrReply->dataLength,
dataBufferAlloced - nlhrReply->dataLength - 1,
dflags | (cenctype ? MSG_NODUMP : 0));
if (recvResult == 0) break;
if (recvResult == SOCKET_ERROR)
{
- NetlibHttpFreeRequestStruct(0,(LPARAM)nlhrReply);
+ NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
return NULL;
}
nlhrReply->dataLength += recvResult;
diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp
index a760aee43d..6b48894d34 100644
--- a/src/modules/netlib/netlibhttpproxy.cpp
+++ b/src/modules/netlib/netlibhttpproxy.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -25,10 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef enum
{
- reqHelloGet,
- reqOldGet,
- reqOldPost,
- reqNewPost,
+ reqHelloGet,
+ reqOldGet,
+ reqOldPost,
+ reqNewPost,
}
RequestType;
@@ -151,7 +151,7 @@ static bool NetlibHttpGatewaySend(struct NetlibConnection *nlc, RequestType reqT
// nlhrSend.headers[3].szName = "Accept-Encoding";
// nlhrSend.headers[3].szValue = "deflate, gzip";
- return NetlibHttpSendRequest((WPARAM)nlc,(LPARAM)&nlhrSend) != SOCKET_ERROR;
+ return NetlibHttpSendRequest((WPARAM)nlc, (LPARAM)&nlhrSend) != SOCKET_ERROR;
}
static bool NetlibHttpGatewayStdPost(NetlibConnection *nlc, int& numPackets)
@@ -476,7 +476,7 @@ int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nl
return 1;
}
-INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam,LPARAM lParam)
+INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam)
{
NETLIBHTTPPROXYINFO *nlhpi=(NETLIBHTTPPROXYINFO*)lParam;
struct NetlibConnection *nlc=(struct NetlibConnection*)wParam;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index 92496eaa5c..586d160baf 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -42,8 +42,8 @@ struct {
TCHAR* szUserFile;
int timeFormat;
int showUser;
- int dumpSent,dumpRecv,dumpProxy,dumpSsl;
- int textDumps,autoDetectText;
+ int dumpSent, dumpRecv, dumpProxy, dumpSsl;
+ int textDumps, autoDetectText;
CRITICAL_SECTION cs;
int save;
} logOptions = {0};
@@ -53,44 +53,44 @@ typedef struct {
const char* pszMsg;
} LOGMSG;
-static __int64 mirandaStartTime,perfCounterFreq;
+static __int64 mirandaStartTime, perfCounterFreq;
static int bIsActive = TRUE;
static HANDLE hLogEvent = NULL;
static const TCHAR* szTimeFormats[] =
{
- _T( "No times" ),
- _T( "Standard hh:mm:ss times" ),
- _T( "Times in milliseconds" ),
+ _T( "No times" ),
+ _T( "Standard hh:mm:ss times" ),
+ _T( "Times in milliseconds" ),
_T( "Times in microseconds" )
};
-static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
case WM_INITDIALOG:
logOptions.hwndOpts=hwndDlg;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg,IDC_DUMPRECV,logOptions.dumpRecv?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg,IDC_DUMPSENT,logOptions.dumpSent?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg,IDC_DUMPPROXY,logOptions.dumpProxy?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg,IDC_DUMPSSL,logOptions.dumpSsl?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg,IDC_TEXTDUMPS,logOptions.textDumps?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg,IDC_AUTODETECTTEXT,logOptions.autoDetectText?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPRECV, logOptions.dumpRecv?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPSENT, logOptions.dumpSent?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPPROXY, logOptions.dumpProxy?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DUMPSSL, logOptions.dumpSsl?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TEXTDUMPS, logOptions.textDumps?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTODETECTTEXT, logOptions.autoDetectText?BST_CHECKED:BST_UNCHECKED);
{ int i;
for ( i=0; i < SIZEOF(szTimeFormats); i++ )
- SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_ADDSTRING,0,(LPARAM)TranslateTS( szTimeFormats[i] ));
+ SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_ADDSTRING, 0, (LPARAM)TranslateTS( szTimeFormats[i] ));
}
- SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_SETCURSEL,logOptions.timeFormat,0);
- CheckDlgButton(hwndDlg,IDC_SHOWNAMES,logOptions.showUser?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg,IDC_TOOUTPUTDEBUGSTRING,logOptions.toOutputDebugString?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg,IDC_TOFILE,logOptions.toFile?BST_CHECKED:BST_UNCHECKED);
- SetDlgItemText(hwndDlg,IDC_FILENAME,logOptions.szUserFile);
- SetDlgItemText(hwndDlg,IDC_PATH,logOptions.szFile);
- CheckDlgButton(hwndDlg,IDC_SHOWTHISDLGATSTART,DBGetContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart",0)?BST_CHECKED:BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_SETCURSEL, logOptions.timeFormat, 0);
+ CheckDlgButton(hwndDlg, IDC_SHOWNAMES, logOptions.showUser?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TOOUTPUTDEBUGSTRING, logOptions.toOutputDebugString?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TOFILE, logOptions.toFile?BST_CHECKED:BST_UNCHECKED);
+ SetDlgItemText(hwndDlg, IDC_FILENAME, logOptions.szUserFile);
+ SetDlgItemText(hwndDlg, IDC_PATH, logOptions.szFile);
+ CheckDlgButton(hwndDlg, IDC_SHOWTHISDLGATSTART, DBGetContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart", 0)?BST_CHECKED:BST_UNCHECKED);
{ DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, "Netlib", "RunAtStart",&dbv)) {
- SetDlgItemTextA(hwndDlg,IDC_RUNATSTART,dbv.pszVal);
+ if (!DBGetContactSettingString(NULL, "Netlib", "RunAtStart", &dbv)) {
+ SetDlgItemTextA(hwndDlg, IDC_RUNATSTART, dbv.pszVal);
DBFreeVariant(&dbv);
}
}
@@ -98,7 +98,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
{
TVINSERTSTRUCT tvis = {0};
int i;
- HWND hwndFilter = GetDlgItem(hwndDlg,IDC_FILTER);
+ HWND hwndFilter = GetDlgItem(hwndDlg, IDC_FILTER);
SetWindowLongPtr(hwndFilter, GWL_STYLE, GetWindowLongPtr(hwndFilter, GWL_STYLE) | (TVS_NOHSCROLL | TVS_CHECKBOXES));
@@ -139,7 +139,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
case IDC_FILENAME:
if (HIWORD(wParam) != EN_CHANGE) break;
if ((HWND)lParam == GetFocus())
- CheckDlgButton(hwndDlg,IDC_TOFILE,BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_TOFILE, BST_CHECKED);
{
TCHAR path[MAX_PATH];
@@ -155,9 +155,9 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
case IDC_RUNATSTARTBROWSE:
{ TCHAR str[MAX_PATH+2];
OPENFILENAME ofn={0};
- TCHAR filter[512],*pfilter;
+ TCHAR filter[512], *pfilter;
- GetWindowText(GetWindow((HWND)lParam,GW_HWNDPREV),str,SIZEOF(str));
+ GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, SIZEOF(str));
ofn.lStructSize=OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner=hwndDlg;
ofn.Flags=OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
@@ -167,10 +167,10 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
ofn.Flags|=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST;
ofn.lpstrTitle=TranslateT("Select program to be run");
}
- _tcscpy(filter,TranslateT("All Files"));
- _tcscat(filter,_T(" (*)"));
+ _tcscpy(filter, TranslateT("All Files"));
+ _tcscat(filter, _T(" (*)"));
pfilter=filter+lstrlen(filter)+1;
- _tcscpy(pfilter,_T("*"));
+ _tcscpy(pfilter, _T("*"));
pfilter=pfilter+lstrlen(pfilter)+1;
*pfilter='\0';
ofn.lpstrFilter=filter;
@@ -182,21 +182,21 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
} else {
if (!GetOpenFileName(&ofn)) return 1;
}
- if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str,' ') != NULL) {
- MoveMemory(str+1,str,SIZEOF(str)-2);
+ if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) {
+ MoveMemory(str+1, str, SIZEOF(str)-2);
str[0]='"';
- lstrcat(str,_T("\""));
+ lstrcat(str, _T("\""));
}
- SetWindowText(GetWindow((HWND)lParam,GW_HWNDPREV),str);
+ SetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str);
break;
}
case IDC_RUNNOW:
{ TCHAR str[MAX_PATH+1];
STARTUPINFO si={0};
PROCESS_INFORMATION pi;
- GetDlgItemText(hwndDlg,IDC_RUNATSTART,str,MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
si.cb=sizeof(si);
- if (str[0]) CreateProcess(NULL,str,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
+ if (str[0]) CreateProcess(NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}
break;
case IDC_SAVE:
@@ -207,29 +207,29 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
TCHAR str[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
- DBWriteContactSettingTString(NULL, "Netlib", "RunAtStart",str);
- DBWriteContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWTHISDLGATSTART));
+ DBWriteContactSettingTString(NULL, "Netlib", "RunAtStart", str);
+ DBWriteContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
EnterCriticalSection(&logOptions.cs);
mir_free(logOptions.szUserFile);
- GetWindowText(GetDlgItem(hwndDlg,IDC_FILENAME), str, MAX_PATH );
+ GetWindowText(GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH );
logOptions.szUserFile = mir_tstrdup(str);
mir_free(logOptions.szFile);
- GetWindowText(GetDlgItem(hwndDlg,IDC_PATH), str, MAX_PATH );
+ GetWindowText(GetDlgItem(hwndDlg, IDC_PATH), str, MAX_PATH );
logOptions.szFile = mir_tstrdup(str);
- logOptions.dumpRecv=IsDlgButtonChecked(hwndDlg,IDC_DUMPRECV);
- logOptions.dumpSent=IsDlgButtonChecked(hwndDlg,IDC_DUMPSENT);
- logOptions.dumpProxy=IsDlgButtonChecked(hwndDlg,IDC_DUMPPROXY);
- logOptions.dumpSsl=IsDlgButtonChecked(hwndDlg,IDC_DUMPSSL);
- logOptions.textDumps=IsDlgButtonChecked(hwndDlg,IDC_TEXTDUMPS);
- logOptions.autoDetectText=IsDlgButtonChecked(hwndDlg,IDC_AUTODETECTTEXT);
- logOptions.timeFormat=SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_GETCURSEL,0,0);
- logOptions.showUser=IsDlgButtonChecked(hwndDlg,IDC_SHOWNAMES);
- logOptions.toOutputDebugString=IsDlgButtonChecked(hwndDlg,IDC_TOOUTPUTDEBUGSTRING);
- logOptions.toFile=IsDlgButtonChecked(hwndDlg,IDC_TOFILE);
+ logOptions.dumpRecv=IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV);
+ logOptions.dumpSent=IsDlgButtonChecked(hwndDlg, IDC_DUMPSENT);
+ logOptions.dumpProxy=IsDlgButtonChecked(hwndDlg, IDC_DUMPPROXY);
+ logOptions.dumpSsl=IsDlgButtonChecked(hwndDlg, IDC_DUMPSSL);
+ logOptions.textDumps=IsDlgButtonChecked(hwndDlg, IDC_TEXTDUMPS);
+ logOptions.autoDetectText=IsDlgButtonChecked(hwndDlg, IDC_AUTODETECTTEXT);
+ logOptions.timeFormat=SendDlgItemMessage(hwndDlg, IDC_TIMEFORMAT, CB_GETCURSEL, 0, 0);
+ logOptions.showUser=IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES);
+ logOptions.toOutputDebugString=IsDlgButtonChecked(hwndDlg, IDC_TOOUTPUTDEBUGSTRING);
+ logOptions.toFile=IsDlgButtonChecked(hwndDlg, IDC_TOFILE);
LeaveCriticalSection(&logOptions.cs);
}
@@ -243,36 +243,36 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
while (tvi.hItem)
{
- TreeView_GetItem(hwndFilter,&tvi);
+ TreeView_GetItem(hwndFilter, &tvi);
checked = ((tvi.state&TVIS_STATEIMAGEMASK)>>12 == 2);
if (tvi.lParam == -1) {
logOptions.toLog = checked;
if ( logOptions.save )
- DBWriteContactSettingDword(NULL, "Netlib", "NLlog",checked);
+ DBWriteContactSettingDword(NULL, "Netlib", "NLlog", checked);
}
else
if (tvi.lParam < netlibUser.getCount()) {
netlibUser[tvi.lParam]->toLog = checked;
if ( logOptions.save )
- DBWriteContactSettingDword(NULL,netlibUser[tvi.lParam]->user.szSettingsModule,"NLlog",checked);
+ DBWriteContactSettingDword(NULL, netlibUser[tvi.lParam]->user.szSettingsModule, "NLlog", checked);
}
- tvi.hItem=TreeView_GetNextSibling(hwndFilter,tvi.hItem);
+ tvi.hItem=TreeView_GetNextSibling(hwndFilter, tvi.hItem);
}
}
if ( logOptions.save ) {
- DBWriteContactSettingByte(NULL, "Netlib", "DumpRecv",(BYTE)logOptions.dumpRecv);
- DBWriteContactSettingByte(NULL, "Netlib", "DumpSent",(BYTE)logOptions.dumpSent);
- DBWriteContactSettingByte(NULL, "Netlib", "DumpProxy",(BYTE)logOptions.dumpProxy);
- DBWriteContactSettingByte(NULL, "Netlib", "DumpSsl",(BYTE)logOptions.dumpSsl);
- DBWriteContactSettingByte(NULL, "Netlib", "TextDumps",(BYTE)logOptions.textDumps);
- DBWriteContactSettingByte(NULL, "Netlib", "AutoDetectText",(BYTE)logOptions.autoDetectText);
- DBWriteContactSettingByte(NULL, "Netlib", "TimeFormat",(BYTE)logOptions.timeFormat);
- DBWriteContactSettingByte(NULL, "Netlib", "ShowUser",(BYTE)logOptions.showUser);
- DBWriteContactSettingByte(NULL, "Netlib", "ToOutputDebugString",(BYTE)logOptions.toOutputDebugString);
- DBWriteContactSettingByte(NULL, "Netlib", "ToFile",(BYTE)logOptions.toFile);
+ DBWriteContactSettingByte(NULL, "Netlib", "DumpRecv", (BYTE)logOptions.dumpRecv);
+ DBWriteContactSettingByte(NULL, "Netlib", "DumpSent", (BYTE)logOptions.dumpSent);
+ DBWriteContactSettingByte(NULL, "Netlib", "DumpProxy", (BYTE)logOptions.dumpProxy);
+ DBWriteContactSettingByte(NULL, "Netlib", "DumpSsl", (BYTE)logOptions.dumpSsl);
+ DBWriteContactSettingByte(NULL, "Netlib", "TextDumps", (BYTE)logOptions.textDumps);
+ DBWriteContactSettingByte(NULL, "Netlib", "AutoDetectText", (BYTE)logOptions.autoDetectText);
+ DBWriteContactSettingByte(NULL, "Netlib", "TimeFormat", (BYTE)logOptions.timeFormat);
+ DBWriteContactSettingByte(NULL, "Netlib", "ShowUser", (BYTE)logOptions.showUser);
+ DBWriteContactSettingByte(NULL, "Netlib", "ToOutputDebugString", (BYTE)logOptions.toOutputDebugString);
+ DBWriteContactSettingByte(NULL, "Netlib", "ToFile", (BYTE)logOptions.toFile);
DBWriteContactSettingTString(NULL, "Netlib", "File", logOptions.szFile ? logOptions.szUserFile: _T(""));
logOptions.save = 0;
}
@@ -299,7 +299,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
void NetlibLogShowOptions(void)
{
if (logOptions.hwndOpts == NULL)
- logOptions.hwndOpts=CreateDialog(hMirandaInst,MAKEINTRESOURCE(IDD_NETLIBLOGOPTS),NULL,LogOptionsDlgProc);
+ logOptions.hwndOpts=CreateDialog(hMirandaInst, MAKEINTRESOURCE(IDD_NETLIBLOGOPTS), NULL, LogOptionsDlgProc);
SetForegroundWindow(logOptions.hwndOpts);
}
@@ -354,7 +354,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
case TIMEFORMAT_MICROSECONDS:
QueryPerformanceCounter(&liTimeNow);
liTimeNow.QuadPart -= mirandaStartTime;
- mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%06I64u", liTimeNow.QuadPart / perfCounterFreq,
+ mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%06I64u", liTimeNow.QuadPart / perfCounterFreq,
1000000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq);
break;
@@ -364,7 +364,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
}
if (logOptions.timeFormat || logOptions.showUser)
mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%s%s] ", szTime,
- (logOptions.showUser && logOptions.timeFormat) ? " " : "",
+ (logOptions.showUser && logOptions.timeFormat) ? " " : "",
logOptions.showUser ? nlu->user.szSettingsModule : "");
else
szHead[0]=0;
@@ -391,7 +391,7 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
if (fp)
{
size_t len = strlen(pszMsg);
- fprintf(fp,"%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n");
+ fprintf(fp, "%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n");
fclose(fp);
}
LeaveCriticalSection(&logOptions.cs);
@@ -429,7 +429,7 @@ void NetlibLogf(NetlibUser* nlu, const char *fmt, ...)
va_list va;
char szText[1024];
- va_start(va,fmt);
+ va_start(va, fmt);
mir_vsnprintf(szText, sizeof(szText), fmt, va);
va_end(va);
@@ -437,7 +437,7 @@ void NetlibLogf(NetlibUser* nlu, const char *fmt, ...)
}
-void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int flags)
+void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags)
{
int isText=1;
char szTitleLine[128];
@@ -526,8 +526,8 @@ void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int
if (colsInLine == 16) {
PBYTE p = buf + line;
pszBuf += wsprintfA(
- pszBuf, "%08X: %02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X ",
- line, p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15] );
+ pszBuf, "%08X: %02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X-%02X %02X %02X %02X ",
+ line, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] );
}
else {
pszBuf += wsprintfA(pszBuf, "%08X: ", line);
@@ -555,7 +555,7 @@ void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int
*pszBuf = '\0';
}
- NetlibLog((WPARAM)nlu,(LPARAM)szBuf);
+ NetlibLog((WPARAM)nlu, (LPARAM)szBuf);
if (!useStack) mir_free(szBuf);
}
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp
index 0be23f2da1..5cc1e7635e 100644
--- a/src/modules/netlib/netlibopenconn.cpp
+++ b/src/modules/netlib/netlibopenconn.cpp
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -32,7 +32,7 @@ static int iUPnPCleanup = 0;
#define RECV_DEFAULT_TIMEOUT 60000
//returns in network byte order
-DWORD DnsLookup(struct NetlibUser *nlu,const char *szHost)
+DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost)
{
HOSTENT* host;
DWORD ip = inet_addr(szHost);
@@ -45,7 +45,7 @@ DWORD DnsLookup(struct NetlibUser *nlu,const char *szHost)
if ( host )
return *(u_long*)host->h_addr_list[0];
- NetlibLogf(nlu,"%s %d: %s() for host %s failed (%u)",__FILE__,__LINE__,"gethostbyname", szHost, WSAGetLastError());
+ NetlibLogf(nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "gethostbyname", szHost, WSAGetLastError());
}
__except(EXCEPTION_EXECUTE_HANDLER) {}
@@ -70,7 +70,7 @@ int WaitUntilReadable(SOCKET s, DWORD dwTimeout, bool check)
return result;
}
-int WaitUntilWritable(SOCKET s,DWORD dwTimeout)
+int WaitUntilWritable(SOCKET s, DWORD dwTimeout)
{
fd_set writefd;
TIMEVAL tv;
@@ -138,14 +138,14 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
if (NLSend(nlc, pInit, (int)len, MSG_DUMPPROXY) == SOCKET_ERROR)
{
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError());
return 0;
}
char reply[8];
if (!RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT))
{
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -157,35 +157,35 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
case 93: SetLastError(ERROR_INVALID_ACCESS); break;
default: SetLastError(ERROR_INVALID_DATA); break;
}
- NetlibLogf(nlu,"%s %d: Proxy connection failed (%x %u)",__FILE__,__LINE__, (BYTE)reply[1], GetLastError());
+ NetlibLogf(nlu, "%s %d: Proxy connection failed (%x %u)", __FILE__, __LINE__, (BYTE)reply[1], GetLastError());
return 0;
}
-static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct NetlibUser *nlu,NETLIBOPENCONNECTION *nloc)
+static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{ //rfc1928
BYTE buf[258];
buf[0]=5; //yep, socks5
buf[1]=1; //one auth method
buf[2]=nlu->settings.useProxyAuth?2:0;
- if (NLSend(nlc,(char*)buf,3,MSG_DUMPPROXY) == SOCKET_ERROR) {
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+ if (NLSend(nlc, (char*)buf, 3, MSG_DUMPPROXY) == SOCKET_ERROR) {
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError());
return 0;
}
//confirmation of auth method
- if (!RecvUntilTimeout(nlc,(char*)buf,2,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) {
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
+ if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
if ((buf[1] != 0 && buf[1] != 2)) {
SetLastError(ERROR_INVALID_ID_AUTHORITY);
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLRecv", GetLastError());
return 0;
}
if (buf[1] == 2) { //rfc1929
- int nUserLen,nPassLen;
+ int nUserLen, nPassLen;
PBYTE pAuthBuf;
nUserLen=lstrlenA(nlu->settings.szProxyAuthUser);
@@ -193,23 +193,23 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
pAuthBuf=(PBYTE)mir_alloc(3+nUserLen+nPassLen);
pAuthBuf[0]=1; //auth version
pAuthBuf[1]=nUserLen;
- memcpy(pAuthBuf+2,nlu->settings.szProxyAuthUser,nUserLen);
+ memcpy(pAuthBuf+2, nlu->settings.szProxyAuthUser, nUserLen);
pAuthBuf[2+nUserLen]=nPassLen;
- memcpy(pAuthBuf+3+nUserLen,nlu->settings.szProxyAuthPassword,nPassLen);
- if (NLSend(nlc,(char*)pAuthBuf,3+nUserLen+nPassLen,MSG_DUMPPROXY) == SOCKET_ERROR) {
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+ memcpy(pAuthBuf+3+nUserLen, nlu->settings.szProxyAuthPassword, nPassLen);
+ if (NLSend(nlc, (char*)pAuthBuf, 3+nUserLen+nPassLen, MSG_DUMPPROXY) == SOCKET_ERROR) {
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError());
mir_free(pAuthBuf);
return 0;
}
mir_free(pAuthBuf);
- if (!RecvUntilTimeout(nlc,(char*)buf,2,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) {
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
+ if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
if (buf[1]) {
SetLastError(ERROR_ACCESS_DENIED);
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
}
@@ -228,7 +228,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
}
else
{
- hostIP = DnsLookup(nlu,nloc->szHost);
+ hostIP = DnsLookup(nlu, nloc->szHost);
if (hostIP == 0)
return 0;
nHostLen = 4;
@@ -240,23 +240,23 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
if (hostIP == INADDR_NONE) { //DNS lookup through proxy
pInit[3]=3;
pInit[4]=nHostLen-1;
- memcpy(pInit+5,nloc->szHost,nHostLen-1);
+ memcpy(pInit+5, nloc->szHost, nHostLen-1);
}
else {
pInit[3]=1;
*(PDWORD)(pInit+4)=hostIP;
}
*(PWORD)(pInit+4+nHostLen)=htons(nloc->wPort);
- if (NLSend(nlc,(char*)pInit,6+nHostLen,MSG_DUMPPROXY) == SOCKET_ERROR) {
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+ if (NLSend(nlc, (char*)pInit, 6+nHostLen, MSG_DUMPPROXY) == SOCKET_ERROR) {
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError());
mir_free(pInit);
return 0;
}
mir_free(pInit);
}
- if (!RecvUntilTimeout(nlc,(char*)buf,5,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) {
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
+ if (!RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -279,7 +279,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
default: SetLastError(ERROR_INVALID_DATA); break;
}
}
- NetlibLogf(nlu,"%s %d: Proxy conection failed. %s.",__FILE__,__LINE__, err);
+ NetlibLogf(nlu, "%s %d: Proxy conection failed. %s.", __FILE__, __LINE__, err);
return 0;
}
{
@@ -295,11 +295,11 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
nRecvSize = 17;
break;
default:
- NetlibLogf(nlu,"%s %d: %s() unknown address type (%u)",__FILE__,__LINE__,"NetlibInitSocks5Connection",(int)buf[3]);
+ NetlibLogf(nlu, "%s %d: %s() unknown address type (%u)", __FILE__, __LINE__, "NetlibInitSocks5Connection", (int)buf[3]);
return 0;
}
- if (!RecvUntilTimeout(nlc,(char*)buf,nRecvSize,MSG_DUMPPROXY,RECV_DEFAULT_TIMEOUT)) {
- NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
+ if (!RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
}
@@ -348,7 +348,7 @@ static bool NetlibInitHttpsConnection(struct NetlibConnection *nlc, struct Netli
}
NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
- NetlibLogf(nlu,"%s %d: %s request failed (%u %s)",__FILE__,__LINE__,nlu->settings.proxyType == PROXYTYPE_HTTP?"HTTP":"HTTPS",nlhrReply->resultCode,nlhrReply->szResultDescr);
+ NetlibLogf(nlu, "%s %d: %s request failed (%u %s)", __FILE__, __LINE__, nlu->settings.proxyType == PROXYTYPE_HTTP?"HTTP":"HTTPS", nlhrReply->resultCode, nlhrReply->szResultDescr);
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
return 0;
}
@@ -407,9 +407,9 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
if (!nlc->szProxyServer) return false;
if (nloc)
- NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort);
else
- NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort);
sin.sin_port = htons(nlc->wProxyPort);
he = gethostbyname(nlc->szProxyServer);
@@ -417,7 +417,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
else
{
if (!nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false;
- NetlibLogf(nlc->nlu,"(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
sin.sin_port = htons(nloc->wPort);
he = gethostbyname(nloc->szHost);
@@ -428,7 +428,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
sin.sin_addr.s_addr = *(u_long*)*har;
char* szIp = NetlibAddressToString((SOCKADDR_INET_M*)&sin);
- NetlibLogf(nlc->nlu,"(%p) Connecting to ip %s ....", nlc, szIp);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, szIp);
mir_free(szIp);
retry:
@@ -441,7 +441,7 @@ retry:
if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0])
{
if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum))
- NetlibLogf(nlc->nlu,"Netlib connect: Not enough ports for outgoing connections specified");
+ NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified");
}
// try a connect
@@ -576,27 +576,27 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
if (!nlc->szProxyServer) return false;
if (nloc)
- NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort);
else
- NetlibLogf(nlc->nlu,"(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort);
_itoa(nlc->wProxyPort, szPort, 10);
if (MyGetaddrinfo(nlc->szProxyServer, szPort, &hints, &air))
{
- NetlibLogf(nlc->nlu,"%s %d: %s() for host %s failed (%u)",__FILE__,__LINE__,"getaddrinfo", nlc->szProxyServer, WSAGetLastError());
+ NetlibLogf(nlc->nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "getaddrinfo", nlc->szProxyServer, WSAGetLastError());
return false;
}
}
else
{
if (!nloc || !nloc->szHost) return false;
- NetlibLogf(nlc->nlu,"(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
_itoa(nlc->nloc.wPort, szPort, 10);
if (MyGetaddrinfo(nlc->nloc.szHost, szPort, &hints, &air))
{
- NetlibLogf(nlc->nlu,"%s %d: %s() for host %s failed (%u)",__FILE__,__LINE__,"getaddrinfo", nlc->nloc.szHost, WSAGetLastError());
+ NetlibLogf(nlc->nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "getaddrinfo", nlc->nloc.szHost, WSAGetLastError());
return false;
}
}
@@ -604,7 +604,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
for (ai = air; ai && !Miranda_Terminated(); ai = ai->ai_next)
{
char* szIp = NetlibAddressToString((SOCKADDR_INET_M*)ai->ai_addr);
- NetlibLogf(nlc->nlu,"(%p) Connecting to ip %s ....", nlc, szIp);
+ NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, szIp);
mir_free(szIp);
retry:
nlc->s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
@@ -618,7 +618,7 @@ retry:
SOCKET s = ai->ai_family == AF_INET ? nlc->s : INVALID_SOCKET;
SOCKET s6 = ai->ai_family == AF_INET6 ? nlc->s : INVALID_SOCKET;
if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum))
- NetlibLogf(nlc->nlu,"Netlib connect: Not enough ports for outgoing connections specified");
+ NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified");
}
// try a connect
@@ -721,7 +721,7 @@ static int NetlibHttpFallbackToDirect(struct NetlibConnection *nlc, struct Netli
{
NetlibDoClose(nlc, true);
- NetlibLogf(nlu,"Fallback to direct connection");
+ NetlibLogf(nlu, "Fallback to direct connection");
nlc->proxyAuthNeeded = false;
nlc->proxyType = 0;
@@ -854,7 +854,7 @@ retry:
nlc->usingDirectHttpGateway = true;
}
- NetlibLogf(nlu,"(%d) Connected to %s:%d", nlc->s, nloc->szHost, nloc->wPort);
+ NetlibLogf(nlu, "(%d) Connected to %s:%d", nlc->s, nloc->szHost, nloc->wPort);
if (NLOCF_SSL & nloc->flags)
{
@@ -904,13 +904,13 @@ bool NetlibReconnect(NetlibConnection *nlc)
return true;
}
-INT_PTR NetlibOpenConnection(WPARAM wParam,LPARAM lParam)
+INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam)
{
NETLIBOPENCONNECTION *nloc = (NETLIBOPENCONNECTION*)lParam;
struct NetlibUser *nlu = (struct NetlibUser*)wParam;
struct NetlibConnection *nlc;
- NetlibLogf(nlu,"Connection request to %s:%d (Flags %x)....", nloc->szHost, nloc->wPort, nloc->flags);
+ NetlibLogf(nlu, "Connection request to %s:%d (Flags %x)....", nloc->szHost, nloc->wPort, nloc->flags);
if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_OUTGOING) || nloc == NULL ||
(nloc->cbSize != NETLIBOPENCONNECTION_V1_SIZE && nloc->cbSize != sizeof(NETLIBOPENCONNECTION)) ||
@@ -929,7 +929,7 @@ INT_PTR NetlibOpenConnection(WPARAM wParam,LPARAM lParam)
nlc->dnsThroughProxy = nlu->settings.dnsThroughProxy != 0;
InitializeCriticalSection(&nlc->csHttpSequenceNums);
- nlc->hOkToCloseEvent = CreateEvent(NULL,TRUE,TRUE,NULL);
+ nlc->hOkToCloseEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
nlc->dontCloseNow = 0;
NetlibInitializeNestedCS(&nlc->ncsSend);
NetlibInitializeNestedCS(&nlc->ncsRecv);
@@ -966,7 +966,7 @@ INT_PTR NetlibStartSsl(WPARAM wParam, LPARAM lParam)
nlc->hSsl = si.connect(nlc->s, szHost, nlc->nlu->settings.validateSSL);
if (nlc->hSsl == NULL)
- NetlibLogf(nlc->nlu,"(%d %s) Failure to negotiate SSL connection", nlc->s, szHost);
+ NetlibLogf(nlc->nlu, "(%d %s) Failure to negotiate SSL connection", nlc->s, szHost);
else
NetlibLogf(nlc->nlu, "(%d %s) SSL negotiation successful", nlc->s, szHost);
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp
index 48d4f4c291..7649ab4ab1 100644
--- a/src/modules/netlib/netlibopts.cpp
+++ b/src/modules/netlib/netlibopts.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -34,64 +34,64 @@ static LIST <NetlibTempSettings> tempSettings(5);
static const UINT outgoingConnectionsControls[] =
{
- IDC_STATIC12,
- IDC_USEPROXY,
- IDC_STATIC21,IDC_PROXYTYPE,
- IDC_STATIC22,IDC_PROXYHOST,IDC_STATIC23,IDC_PROXYPORT,IDC_STOFTENPORT,
- IDC_PROXYAUTH,
- IDC_STATIC31,IDC_PROXYUSER,IDC_STATIC32,IDC_PROXYPASS,
- IDC_PROXYDNS,
- IDC_SPECIFYPORTSO,
- IDC_PORTSRANGEO,
- IDC_STATIC54,
+ IDC_STATIC12,
+ IDC_USEPROXY,
+ IDC_STATIC21, IDC_PROXYTYPE,
+ IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT,
+ IDC_PROXYAUTH,
+ IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS,
+ IDC_PROXYDNS,
+ IDC_SPECIFYPORTSO,
+ IDC_PORTSRANGEO,
+ IDC_STATIC54,
IDC_VALIDATESSL};
static const UINT useProxyControls[]={
- IDC_STATIC21,IDC_PROXYTYPE,
- IDC_STATIC22,IDC_PROXYHOST,IDC_STATIC23,IDC_PROXYPORT,IDC_STOFTENPORT,
- IDC_PROXYAUTH,
- IDC_STATIC31,IDC_PROXYUSER,IDC_STATIC32,IDC_PROXYPASS,
+ IDC_STATIC21, IDC_PROXYTYPE,
+ IDC_STATIC22, IDC_PROXYHOST, IDC_STATIC23, IDC_PROXYPORT, IDC_STOFTENPORT,
+ IDC_PROXYAUTH,
+ IDC_STATIC31, IDC_PROXYUSER, IDC_STATIC32, IDC_PROXYPASS,
IDC_PROXYDNS};
static const UINT specifyOPortsControls[]={
- IDC_PORTSRANGEO,
+ IDC_PORTSRANGEO,
IDC_STATIC54
};
static const UINT incomingConnectionsControls[]={
- IDC_STATIC43,
- IDC_SPECIFYPORTS,
- IDC_PORTSRANGE,
- IDC_STATIC52,
+ IDC_STATIC43,
+ IDC_SPECIFYPORTS,
+ IDC_PORTSRANGE,
+ IDC_STATIC52,
IDC_ENABLEUPNP};
static const UINT specifyPortsControls[]={
- IDC_PORTSRANGE,
+ IDC_PORTSRANGE,
IDC_STATIC52};
-static const TCHAR* szProxyTypes[]={_T("<mixed>"),_T("SOCKS4"),_T("SOCKS5"),_T("HTTP"),_T("HTTPS"),_T("Internet Explorer")};
-static const WORD oftenProxyPorts[]={1080,1080,1080,8080,8080,8080};
+static const TCHAR* szProxyTypes[]={_T("<mixed>"), _T("SOCKS4"), _T("SOCKS5"), _T("HTTP"), _T("HTTPS"), _T("Internet Explorer")};
+static const WORD oftenProxyPorts[]={1080, 1080, 1080, 8080, 8080, 8080};
#define M_REFRESHALL (WM_USER+100)
#define M_REFRESHENABLING (WM_USER+101)
-static void ShowMultipleControls(HWND hwndDlg,const UINT *controls,int cControls,int state)
+static void ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state)
{
int i;
- for (i=0;i<cControls;i++) ShowWindow(GetDlgItem(hwndDlg,controls[i]),state);
+ for (i=0;i<cControls;i++) ShowWindow(GetDlgItem(hwndDlg, controls[i]), state);
}
-static void EnableMultipleControls(HWND hwndDlg,const UINT *controls,int cControls,int state)
+static void EnableMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state)
{
int i;
- for (i=0;i<cControls;i++) EnableWindow(GetDlgItem(hwndDlg,controls[i]),state);
+ for (i=0;i<cControls;i++) EnableWindow(GetDlgItem(hwndDlg, controls[i]), state);
}
-static void AddProxyTypeItem(HWND hwndDlg,int type,int selectType)
+static void AddProxyTypeItem(HWND hwndDlg, int type, int selectType)
{
int i;
- i = SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_ADDSTRING,0,(LPARAM)(type == 0?TranslateTS(szProxyTypes[type]):szProxyTypes[type]));
+ i = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_ADDSTRING, 0, (LPARAM)(type == 0?TranslateTS(szProxyTypes[type]):szProxyTypes[type]));
SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_SETITEMDATA, i, type);
if (type == selectType) SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_SETCURSEL, i, 0);
}
-static void CopySettingsStruct(NETLIBUSERSETTINGS *dest,NETLIBUSERSETTINGS *source)
+static void CopySettingsStruct(NETLIBUSERSETTINGS *dest, NETLIBUSERSETTINGS *source)
{
*dest=*source;
if (dest->szIncomingPorts) dest->szIncomingPorts=mir_strdup(dest->szIncomingPorts);
@@ -101,26 +101,26 @@ static void CopySettingsStruct(NETLIBUSERSETTINGS *dest,NETLIBUSERSETTINGS *sour
if (dest->szProxyServer) dest->szProxyServer=mir_strdup(dest->szProxyServer);
}
-static void CombineSettingsStrings(char **dest,char **source)
+static void CombineSettingsStrings(char **dest, char **source)
{
- if (*dest != NULL && (*source == NULL || lstrcmpiA(*dest,*source))) {mir_free(*dest); *dest=NULL;}
+ if (*dest != NULL && (*source == NULL || lstrcmpiA(*dest, *source))) {mir_free(*dest); *dest=NULL;}
}
-static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NETLIBUSERSETTINGS *source,DWORD sourceFlags)
+static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest, DWORD *destFlags, NETLIBUSERSETTINGS *source, DWORD sourceFlags)
{
if (sourceFlags&NUF_OUTGOING) {
if (*destFlags&NUF_OUTGOING) {
if (dest->validateSSL != source->validateSSL) dest->validateSSL=2;
if (dest->useProxy != source->useProxy) dest->useProxy=2;
if (dest->proxyType != source->proxyType) dest->proxyType=0;
- CombineSettingsStrings(&dest->szProxyServer,&source->szProxyServer);
+ CombineSettingsStrings(&dest->szProxyServer, &source->szProxyServer);
if (dest->wProxyPort != source->wProxyPort) dest->wProxyPort=0;
if (dest->useProxyAuth != source->useProxyAuth) dest->useProxyAuth=2;
- CombineSettingsStrings(&dest->szProxyAuthUser,&source->szProxyAuthUser);
- CombineSettingsStrings(&dest->szProxyAuthPassword,&source->szProxyAuthPassword);
+ CombineSettingsStrings(&dest->szProxyAuthUser, &source->szProxyAuthUser);
+ CombineSettingsStrings(&dest->szProxyAuthPassword, &source->szProxyAuthPassword);
if (dest->dnsThroughProxy != source->dnsThroughProxy) dest->dnsThroughProxy=2;
if (dest->specifyOutgoingPorts != source->specifyOutgoingPorts) dest->specifyOutgoingPorts=2;
- CombineSettingsStrings(&dest->szOutgoingPorts,&source->szOutgoingPorts);
+ CombineSettingsStrings(&dest->szOutgoingPorts, &source->szOutgoingPorts);
}
else {
dest->validateSSL=source->validateSSL;
@@ -144,7 +144,7 @@ static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NET
if (*destFlags&NUF_INCOMING) {
if (dest->enableUPnP != source->enableUPnP) dest->enableUPnP=2;
if (dest->specifyIncomingPorts != source->specifyIncomingPorts) dest->specifyIncomingPorts=2;
- CombineSettingsStrings(&dest->szIncomingPorts,&source->szIncomingPorts);
+ CombineSettingsStrings(&dest->szIncomingPorts, &source->szIncomingPorts);
}
else {
dest->enableUPnP=source->enableUPnP;
@@ -158,12 +158,12 @@ static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NET
else *destFlags|=sourceFlags;
}
-static void ChangeSettingIntByCheckbox(HWND hwndDlg,UINT ctrlId,int iUser,int memberOffset)
+static void ChangeSettingIntByCheckbox(HWND hwndDlg, UINT ctrlId, int iUser, int memberOffset)
{
- int newValue,i;
+ int newValue, i;
- newValue=IsDlgButtonChecked(hwndDlg,ctrlId) != BST_CHECKED;
- CheckDlgButton(hwndDlg,ctrlId,newValue?BST_CHECKED:BST_UNCHECKED);
+ newValue=IsDlgButtonChecked(hwndDlg, ctrlId) != BST_CHECKED;
+ CheckDlgButton(hwndDlg, ctrlId, newValue?BST_CHECKED:BST_UNCHECKED);
if (iUser == -1)
{
for (i=0; i<tempSettings.getCount(); i++)
@@ -171,17 +171,17 @@ static void ChangeSettingIntByCheckbox(HWND hwndDlg,UINT ctrlId,int iUser,int me
*(int*)(((PBYTE)&tempSettings[i]->settings) + memberOffset) = newValue;
}
else *(int*)(((PBYTE)&tempSettings[iUser]->settings) + memberOffset)=newValue;
- SendMessage(hwndDlg,M_REFRESHENABLING,0,0);
+ SendMessage(hwndDlg, M_REFRESHENABLING, 0, 0);
}
-static void ChangeSettingStringByEdit(HWND hwndDlg,UINT ctrlId,int iUser,int memberOffset)
+static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int memberOffset)
{
- int i,newValueLen;
- char *szNewValue,**ppszNew;
+ int i, newValueLen;
+ char *szNewValue, **ppszNew;
- newValueLen=GetWindowTextLength(GetDlgItem(hwndDlg,ctrlId));
+ newValueLen=GetWindowTextLength(GetDlgItem(hwndDlg, ctrlId));
szNewValue=(char*)mir_alloc(newValueLen+1);
- GetDlgItemTextA(hwndDlg,ctrlId,szNewValue,newValueLen+1);
+ GetDlgItemTextA(hwndDlg, ctrlId, szNewValue, newValueLen+1);
if (iUser == -1)
{
for (i=0; i<tempSettings.getCount(); ++i)
@@ -200,32 +200,32 @@ static void ChangeSettingStringByEdit(HWND hwndDlg,UINT ctrlId,int iUser,int mem
}
}
-static void WriteSettingsStructToDb(const char *szSettingsModule,NETLIBUSERSETTINGS *settings,DWORD flags)
+static void WriteSettingsStructToDb(const char *szSettingsModule, NETLIBUSERSETTINGS *settings, DWORD flags)
{
if (flags&NUF_OUTGOING) {
char szEncodedPassword[512];
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLValidateSSL",(BYTE)settings->validateSSL);
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLUseProxy",(BYTE)settings->useProxy);
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLProxyType",(BYTE)settings->proxyType);
- DBWriteContactSettingString(NULL,szSettingsModule,"NLProxyServer",settings->szProxyServer?settings->szProxyServer:"");
- DBWriteContactSettingWord(NULL,szSettingsModule,"NLProxyPort",(WORD)settings->wProxyPort);
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLUseProxyAuth",(BYTE)settings->useProxyAuth);
- DBWriteContactSettingString(NULL,szSettingsModule,"NLProxyAuthUser",settings->szProxyAuthUser?settings->szProxyAuthUser:"");
- lstrcpynA(szEncodedPassword,settings->szProxyAuthPassword?settings->szProxyAuthPassword:"",SIZEOF(szEncodedPassword));
- CallService(MS_DB_CRYPT_ENCODESTRING,SIZEOF(szEncodedPassword),(LPARAM)szEncodedPassword);
- DBWriteContactSettingString(NULL,szSettingsModule,"NLProxyAuthPassword",szEncodedPassword);
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLDnsThroughProxy",(BYTE)settings->dnsThroughProxy);
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLSpecifyOutgoingPorts",(BYTE)settings->specifyOutgoingPorts);
- DBWriteContactSettingString(NULL,szSettingsModule,"NLOutgoingPorts",settings->szOutgoingPorts?settings->szOutgoingPorts:"");
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLValidateSSL", (BYTE)settings->validateSSL);
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLUseProxy", (BYTE)settings->useProxy);
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLProxyType", (BYTE)settings->proxyType);
+ DBWriteContactSettingString(NULL, szSettingsModule, "NLProxyServer", settings->szProxyServer?settings->szProxyServer:"");
+ DBWriteContactSettingWord(NULL, szSettingsModule, "NLProxyPort", (WORD)settings->wProxyPort);
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLUseProxyAuth", (BYTE)settings->useProxyAuth);
+ DBWriteContactSettingString(NULL, szSettingsModule, "NLProxyAuthUser", settings->szProxyAuthUser?settings->szProxyAuthUser:"");
+ lstrcpynA(szEncodedPassword, settings->szProxyAuthPassword?settings->szProxyAuthPassword:"", SIZEOF(szEncodedPassword));
+ CallService(MS_DB_CRYPT_ENCODESTRING, SIZEOF(szEncodedPassword), (LPARAM)szEncodedPassword);
+ DBWriteContactSettingString(NULL, szSettingsModule, "NLProxyAuthPassword", szEncodedPassword);
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLDnsThroughProxy", (BYTE)settings->dnsThroughProxy);
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLSpecifyOutgoingPorts", (BYTE)settings->specifyOutgoingPorts);
+ DBWriteContactSettingString(NULL, szSettingsModule, "NLOutgoingPorts", settings->szOutgoingPorts?settings->szOutgoingPorts:"");
}
if (flags&NUF_INCOMING) {
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLEnableUPnP",(BYTE)settings->enableUPnP);
- DBWriteContactSettingByte(NULL,szSettingsModule,"NLSpecifyIncomingPorts",(BYTE)settings->specifyIncomingPorts);
- DBWriteContactSettingString(NULL,szSettingsModule,"NLIncomingPorts",settings->szIncomingPorts?settings->szIncomingPorts:"");
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLEnableUPnP", (BYTE)settings->enableUPnP);
+ DBWriteContactSettingByte(NULL, szSettingsModule, "NLSpecifyIncomingPorts", (BYTE)settings->specifyIncomingPorts);
+ DBWriteContactSettingString(NULL, szSettingsModule, "NLIncomingPorts", settings->szIncomingPorts?settings->szIncomingPorts:"");
}
}
-void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTINGS *settings)
+void NetlibSaveUserSettingsStruct(const char *szSettingsModule, NETLIBUSERSETTINGS *settings)
{
int i;
NETLIBUSERSETTINGS combinedSettings={0};
@@ -259,7 +259,7 @@ void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTING
if (combinedSettings.dnsThroughProxy == 2) combinedSettings.dnsThroughProxy=1;
if (combinedSettings.enableUPnP == 2) combinedSettings.enableUPnP=1;
if (combinedSettings.specifyIncomingPorts == 2) combinedSettings.specifyIncomingPorts=0;
- WriteSettingsStructToDb("Netlib",&combinedSettings,flags);
+ WriteSettingsStructToDb("Netlib", &combinedSettings, flags);
NetlibFreeUserSettingsStruct(&combinedSettings);
LeaveCriticalSection(&csNetlibUser);
}
@@ -269,12 +269,12 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
switch (msg)
{
case WM_INITDIALOG:
- { int iUser,iItem;
+ { int iUser, iItem;
TranslateDialogDefault(hwndDlg);
- iItem=SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_ADDSTRING,0,(LPARAM)TranslateT("<All connections>"));
- SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_SETITEMDATA,iItem,(LPARAM)-1);
- SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_SETCURSEL,iItem,0);
+ iItem=SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_ADDSTRING, 0, (LPARAM)TranslateT("<All connections>"));
+ SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_SETITEMDATA, iItem, (LPARAM)-1);
+ SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_SETCURSEL, iItem, 0);
EnterCriticalSection(&csNetlibUser);
for (iUser = 0; iUser < netlibUser.getCount(); ++iUser)
@@ -288,15 +288,15 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if (netlibUser[iUser]->user.flags & NUF_NOOPTIONS) continue;
iItem = SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_ADDSTRING, 0,
(LPARAM)netlibUser[iUser]->user.ptszDescriptiveName);
- SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS,CB_SETITEMDATA, iItem, iUser);
+ SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_SETITEMDATA, iItem, iUser);
}
LeaveCriticalSection(&csNetlibUser);
- SendMessage(hwndDlg,M_REFRESHALL,0,0);
+ SendMessage(hwndDlg, M_REFRESHALL, 0, 0);
return TRUE;
}
case M_REFRESHALL:
- { int iUser=SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETCURSEL,0,0),0);
+ { int iUser=SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETCURSEL, 0, 0), 0);
NETLIBUSERSETTINGS settings = {0};
DWORD flags;
@@ -316,46 +316,46 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
CopySettingsStruct(&settings, &tempSettings[iUser]->settings);
flags = tempSettings[iUser]->flags;
}
- ShowMultipleControls(hwndDlg,outgoingConnectionsControls,SIZEOF(outgoingConnectionsControls),flags&NUF_OUTGOING?SW_SHOW:SW_HIDE);
- CheckDlgButton(hwndDlg,IDC_USEPROXY,settings.useProxy);
- SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_RESETCONTENT,0,0);
- if (settings.proxyType == 0) AddProxyTypeItem(hwndDlg,0,settings.proxyType);
+ ShowMultipleControls(hwndDlg, outgoingConnectionsControls, SIZEOF(outgoingConnectionsControls), flags&NUF_OUTGOING?SW_SHOW:SW_HIDE);
+ CheckDlgButton(hwndDlg, IDC_USEPROXY, settings.useProxy);
+ SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_RESETCONTENT, 0, 0);
+ if (settings.proxyType == 0) AddProxyTypeItem(hwndDlg, 0, settings.proxyType);
AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS4, settings.proxyType);
AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS5, settings.proxyType);
- if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg,PROXYTYPE_HTTP,settings.proxyType);
- if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg,PROXYTYPE_HTTPS,settings.proxyType);
+ if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTP, settings.proxyType);
+ if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType);
if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY) || !(flags & NUF_NOHTTPSOPTION))
- AddProxyTypeItem(hwndDlg,PROXYTYPE_IE,settings.proxyType);
- SetDlgItemTextA(hwndDlg,IDC_PROXYHOST,settings.szProxyServer?settings.szProxyServer:"");
- if (settings.wProxyPort) SetDlgItemInt(hwndDlg,IDC_PROXYPORT,settings.wProxyPort,FALSE);
- else SetDlgItemTextA(hwndDlg,IDC_PROXYPORT,"");
- CheckDlgButton(hwndDlg,IDC_PROXYAUTH,settings.useProxyAuth);
- SetDlgItemTextA(hwndDlg,IDC_PROXYUSER,settings.szProxyAuthUser?settings.szProxyAuthUser:"");
- SetDlgItemTextA(hwndDlg,IDC_PROXYPASS,settings.szProxyAuthPassword?settings.szProxyAuthPassword:"");
- CheckDlgButton(hwndDlg,IDC_PROXYDNS,settings.dnsThroughProxy);
- CheckDlgButton(hwndDlg,IDC_VALIDATESSL,settings.validateSSL);
+ AddProxyTypeItem(hwndDlg, PROXYTYPE_IE, settings.proxyType);
+ SetDlgItemTextA(hwndDlg, IDC_PROXYHOST, settings.szProxyServer?settings.szProxyServer:"");
+ if (settings.wProxyPort) SetDlgItemInt(hwndDlg, IDC_PROXYPORT, settings.wProxyPort, FALSE);
+ else SetDlgItemTextA(hwndDlg, IDC_PROXYPORT, "");
+ CheckDlgButton(hwndDlg, IDC_PROXYAUTH, settings.useProxyAuth);
+ SetDlgItemTextA(hwndDlg, IDC_PROXYUSER, settings.szProxyAuthUser?settings.szProxyAuthUser:"");
+ SetDlgItemTextA(hwndDlg, IDC_PROXYPASS, settings.szProxyAuthPassword?settings.szProxyAuthPassword:"");
+ CheckDlgButton(hwndDlg, IDC_PROXYDNS, settings.dnsThroughProxy);
+ CheckDlgButton(hwndDlg, IDC_VALIDATESSL, settings.validateSSL);
- ShowMultipleControls(hwndDlg,incomingConnectionsControls,SIZEOF(incomingConnectionsControls),flags&NUF_INCOMING?SW_SHOW:SW_HIDE);
- CheckDlgButton(hwndDlg,IDC_SPECIFYPORTS,settings.specifyIncomingPorts);
- SetDlgItemTextA(hwndDlg,IDC_PORTSRANGE,settings.szIncomingPorts?settings.szIncomingPorts:"");
+ ShowMultipleControls(hwndDlg, incomingConnectionsControls, SIZEOF(incomingConnectionsControls), flags&NUF_INCOMING?SW_SHOW:SW_HIDE);
+ CheckDlgButton(hwndDlg, IDC_SPECIFYPORTS, settings.specifyIncomingPorts);
+ SetDlgItemTextA(hwndDlg, IDC_PORTSRANGE, settings.szIncomingPorts?settings.szIncomingPorts:"");
- CheckDlgButton(hwndDlg,IDC_SPECIFYPORTSO,settings.specifyOutgoingPorts);
- SetDlgItemTextA(hwndDlg,IDC_PORTSRANGEO,settings.szOutgoingPorts?settings.szOutgoingPorts:"");
+ CheckDlgButton(hwndDlg, IDC_SPECIFYPORTSO, settings.specifyOutgoingPorts);
+ SetDlgItemTextA(hwndDlg, IDC_PORTSRANGEO, settings.szOutgoingPorts?settings.szOutgoingPorts:"");
- CheckDlgButton(hwndDlg,IDC_ENABLEUPNP,settings.enableUPnP);
+ CheckDlgButton(hwndDlg, IDC_ENABLEUPNP, settings.enableUPnP);
NetlibFreeUserSettingsStruct(&settings);
- SendMessage(hwndDlg,M_REFRESHENABLING,0,0);
+ SendMessage(hwndDlg, M_REFRESHENABLING, 0, 0);
break;
}
case M_REFRESHENABLING:
{ int selectedProxyType;
TCHAR str[80];
- selectedProxyType=SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETCURSEL,0,0),0);
- mir_sntprintf(str, SIZEOF(str), TranslateT("(often %d)"),oftenProxyPorts[selectedProxyType]);
- SetDlgItemText(hwndDlg,IDC_STOFTENPORT,str);
- if (IsDlgButtonChecked(hwndDlg,IDC_USEPROXY) != BST_UNCHECKED)
+ selectedProxyType=SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0);
+ mir_sntprintf(str, SIZEOF(str), TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
+ SetDlgItemText(hwndDlg, IDC_STOFTENPORT, str);
+ if (IsDlgButtonChecked(hwndDlg, IDC_USEPROXY) != BST_UNCHECKED)
{
int enableAuth = 0, enableUser = 0, enablePass = 0, enableServer = 1;
EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), TRUE);
@@ -386,29 +386,29 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
if (selectedProxyType == PROXYTYPE_IE) enableServer=0;
enableAuth=1;
- if (IsDlgButtonChecked(hwndDlg,IDC_PROXYAUTH) != BST_UNCHECKED)
+ if (IsDlgButtonChecked(hwndDlg, IDC_PROXYAUTH) != BST_UNCHECKED)
enableUser = enablePass = 1;
}
}
- EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYAUTH), enableAuth);
- EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC31), enableUser);
- EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYUSER), enableUser);
- EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC32), enablePass);
- EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYPASS), enablePass);
- EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYHOST), enableServer);
- EnableWindow(GetDlgItem(hwndDlg,IDC_PROXYPORT), enableServer);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYAUTH), enableAuth);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC31), enableUser);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYUSER), enableUser);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC32), enablePass);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYPASS), enablePass);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYHOST), enableServer);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROXYPORT), enableServer);
}
- else EnableMultipleControls(hwndDlg,useProxyControls,SIZEOF(useProxyControls),FALSE);
- EnableMultipleControls(hwndDlg,specifyPortsControls,SIZEOF(specifyPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTS) != BST_UNCHECKED);
- EnableMultipleControls(hwndDlg,specifyOPortsControls,SIZEOF(specifyOPortsControls),IsDlgButtonChecked(hwndDlg,IDC_SPECIFYPORTSO) != BST_UNCHECKED);
+ else EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), FALSE);
+ EnableMultipleControls(hwndDlg, specifyPortsControls, SIZEOF(specifyPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTS) != BST_UNCHECKED);
+ EnableMultipleControls(hwndDlg, specifyOPortsControls, SIZEOF(specifyOPortsControls), IsDlgButtonChecked(hwndDlg, IDC_SPECIFYPORTSO) != BST_UNCHECKED);
break;
}
case WM_COMMAND:
- { int iUser=SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_NETLIBUSERS,CB_GETCURSEL,0,0),0);
+ { int iUser=SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_GETCURSEL, 0, 0), 0);
switch(LOWORD(wParam))
{
case IDC_NETLIBUSERS:
- if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(hwndDlg,M_REFRESHALL,0,0);
+ if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(hwndDlg, M_REFRESHALL, 0, 0);
return 0;
case IDC_LOGOPTIONS:
@@ -417,8 +417,8 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_PROXYTYPE:
if (HIWORD(wParam) != CBN_SELCHANGE) return 0;
- { int newValue,i;
- newValue = SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROXYTYPE,CB_GETCURSEL,0,0),0);
+ { int newValue, i;
+ newValue = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0);
if (iUser == -1)
{
if (newValue == 0) return 0;
@@ -436,39 +436,39 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
else
{
tempSettings[iUser]->settings.proxyType = newValue;
- SendMessage(hwndDlg,M_REFRESHENABLING,0,0);
+ SendMessage(hwndDlg, M_REFRESHENABLING, 0, 0);
}
}
break;
case IDC_USEPROXY:
- ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,useProxy));
+ ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, useProxy));
break;
case IDC_PROXYAUTH:
- ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,useProxyAuth));
+ ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, useProxyAuth));
break;
case IDC_PROXYDNS:
- ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,dnsThroughProxy));
+ ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, dnsThroughProxy));
break;
case IDC_SPECIFYPORTS:
- ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,specifyIncomingPorts));
+ ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, specifyIncomingPorts));
break;
case IDC_SPECIFYPORTSO:
- ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,specifyOutgoingPorts));
+ ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, specifyOutgoingPorts));
break;
case IDC_ENABLEUPNP:
- ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,enableUPnP));
+ ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, enableUPnP));
break;
case IDC_VALIDATESSL:
- ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,validateSSL));
+ ChangeSettingIntByCheckbox(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, validateSSL));
break;
case IDC_PROXYHOST:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
- ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyServer));
+ ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szProxyServer));
break;
case IDC_PROXYPORT:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
- { int newValue,i;
- newValue=GetDlgItemInt(hwndDlg,LOWORD(wParam),NULL,FALSE);
+ { int newValue, i;
+ newValue=GetDlgItemInt(hwndDlg, LOWORD(wParam), NULL, FALSE);
if (iUser == -1)
{
for (i = 0; i < tempSettings.getCount(); ++i)
@@ -480,23 +480,23 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case IDC_PROXYUSER:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
- ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthUser));
+ ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szProxyAuthUser));
break;
case IDC_PROXYPASS:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
- ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthPassword));
+ ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szProxyAuthPassword));
break;
case IDC_PORTSRANGE:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
- ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szIncomingPorts));
+ ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szIncomingPorts));
break;
case IDC_PORTSRANGEO:
if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0;
- ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szOutgoingPorts));
+ ChangeSettingStringByEdit(hwndDlg, LOWORD(wParam), iUser, offsetof(NETLIBUSERSETTINGS, szOutgoingPorts));
break;
}
- ShowWindow(GetDlgItem(hwndDlg,IDC_RECONNECTREQD),SW_SHOW);
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RECONNECTREQD), SW_SHOW);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
case WM_NOTIFY:
@@ -531,7 +531,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
}
static UINT expertOnlyControls[]={IDC_LOGOPTIONS};
-int NetlibOptInitialise(WPARAM wParam,LPARAM)
+int NetlibOptInitialise(WPARAM wParam, LPARAM)
{
int optionsCount = 0;
EnterCriticalSection(&csNetlibUser);
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp
index 401e545792..56f9b8ffae 100644
--- a/src/modules/netlib/netlibpktrecver.cpp
+++ b/src/modules/netlib/netlibpktrecver.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "..\..\core\commonheaders.h"
#include "netlib.h"
-INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam)
+INT_PTR NetlibPacketRecverCreate(WPARAM wParam, LPARAM lParam)
{
struct NetlibConnection *nlc=(struct NetlibConnection*)wParam;
struct NetlibPacketRecver *nlpr;
@@ -47,7 +47,7 @@ INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam)
return (INT_PTR)nlpr;
}
-INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam)
+INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam)
{
struct NetlibPacketRecver *nlpr=(struct NetlibPacketRecver*)wParam;
NETLIBPACKETRECVER *nlprParam=(NETLIBPACKETRECVER*)lParam;
@@ -65,20 +65,20 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam)
if (nlprParam->bytesUsed == 0) {
if (nlpr->packetRecver.bytesAvailable == nlpr->packetRecver.bufferSize) {
nlpr->packetRecver.bytesAvailable=0;
- NetlibLogf(nlpr->nlc->nlu,"Packet recver: packet overflowed buffer, ditching");
+ NetlibLogf(nlpr->nlc->nlu, "Packet recver: packet overflowed buffer, ditching");
}
}
else {
- MoveMemory(nlpr->packetRecver.buffer,nlpr->packetRecver.buffer+nlprParam->bytesUsed,nlpr->packetRecver.bytesAvailable-nlprParam->bytesUsed);
+ MoveMemory(nlpr->packetRecver.buffer, nlpr->packetRecver.buffer+nlprParam->bytesUsed, nlpr->packetRecver.bytesAvailable-nlprParam->bytesUsed);
nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed;
}
if (nlprParam->dwTimeout != INFINITE) {
- if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s,nlprParam->dwTimeout) <= 0) {
+ if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) {
*nlprParam=nlpr->packetRecver;
return SOCKET_ERROR;
}
}
- recvResult=NLRecv(nlpr->nlc, (char*)nlpr->packetRecver.buffer+nlpr->packetRecver.bytesAvailable,nlpr->packetRecver.bufferSize-nlpr->packetRecver.bytesAvailable,0);
+ recvResult=NLRecv(nlpr->nlc, (char*)nlpr->packetRecver.buffer+nlpr->packetRecver.bytesAvailable, nlpr->packetRecver.bufferSize-nlpr->packetRecver.bytesAvailable, 0);
if (recvResult>0) nlpr->packetRecver.bytesAvailable+=recvResult;
*nlprParam=nlpr->packetRecver;
return recvResult;
diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp
index a8da8af514..c97ee97c30 100644
--- a/src/modules/netlib/netlibsecurity.cpp
+++ b/src/modules/netlib/netlibsecurity.cpp
@@ -1,7 +1,7 @@
/*
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -10,7 +10,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -67,7 +67,7 @@ static HANDLE hSecMutex;
static void ReportSecError(SECURITY_STATUS scRet, int line)
{
char szMsgBuf[256];
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, SIZEOF(szMsgBuf), NULL);
char *p = strchr(szMsgBuf, 13); if (p) *p = 0;
@@ -197,8 +197,8 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
SecBuffer inBuffers[2] =
{
- { sizeof(inDataBuffer), SECBUFFER_DATA, inDataBuffer },
- { chlsz, SECBUFFER_STREAM, szChallenge },
+ { sizeof(inDataBuffer), SECBUFFER_DATA, inDataBuffer },
+ { chlsz, SECBUFFER_STREAM, szChallenge },
};
SecBufferDesc inBuffersDesc = { SECBUFFER_VERSION, 2, inBuffers };
@@ -229,8 +229,8 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
SecBuffer outBuffers[3] =
{
- { sizes.cbSecurityTrailer, SECBUFFER_TOKEN, tokenBuffer },
- { sizeof(outDataBuffer), SECBUFFER_DATA, outDataBuffer },
+ { sizes.cbSecurityTrailer, SECBUFFER_TOKEN, tokenBuffer },
+ { sizeof(outDataBuffer), SECBUFFER_DATA, outDataBuffer },
{ sizes.cbBlockSize, SECBUFFER_PADDING, paddingBuffer }
};
SecBufferDesc outBuffersDesc = { SECBUFFER_VERSION, 3, outBuffers };
@@ -259,7 +259,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
nlb64.pbDecoded = response;
nlb64.cchEncoded = Netlib_GetBase64EncodedBufferSize(nlb64.cbDecoded);
nlb64.pszEncoded = (char*)alloca(nlb64.cchEncoded);
- if (!NetlibBase64Encode(0,(LPARAM)&nlb64)) return NULL;
+ if (!NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL;
return mir_strdup(nlb64.pszEncoded);
}
@@ -268,8 +268,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
bool http, unsigned& complete)
{
SECURITY_STATUS sc;
- SecBufferDesc outputBufferDescriptor,inputBufferDescriptor;
- SecBuffer outputSecurityToken,inputSecurityToken;
+ SecBufferDesc outputBufferDescriptor, inputBufferDescriptor;
+ SecBuffer outputSecurityToken, inputSecurityToken;
TimeStamp tokenExpiration;
ULONG contextAttributes;
NETLIBBASE64 nlb64 = { 0 };
@@ -422,10 +422,10 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
outputSecurityToken.cbBuffer = hNtlm->cbMaxToken;
outputSecurityToken.pvBuffer = alloca(outputSecurityToken.cbBuffer);
- sc = g_pSSPI->InitializeSecurityContext(&hNtlm->hClientCredential,
- hasChallenge ? &hNtlm->hClientContext : NULL,
- hNtlm->szPrincipal, isGSSAPI ? ISC_REQ_MUTUAL_AUTH | ISC_REQ_STREAM : 0, 0, SECURITY_NATIVE_DREP,
- hasChallenge ? &inputBufferDescriptor : NULL, 0, &hNtlm->hClientContext,
+ sc = g_pSSPI->InitializeSecurityContext(&hNtlm->hClientCredential,
+ hasChallenge ? &hNtlm->hClientContext : NULL,
+ hNtlm->szPrincipal, isGSSAPI ? ISC_REQ_MUTUAL_AUTH | ISC_REQ_STREAM : 0, 0, SECURITY_NATIVE_DREP,
+ hasChallenge ? &inputBufferDescriptor : NULL, 0, &hNtlm->hClientContext,
&outputBufferDescriptor, &contextAttributes, &tokenExpiration);
complete = (sc != SEC_I_COMPLETE_AND_CONTINUE && sc != SEC_I_CONTINUE_NEEDED);
@@ -454,7 +454,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
size_t authLen = strlen(szLogin) + strlen(szPassw) + 5;
char *szAuth = (char*)alloca(authLen);
- nlb64.cbDecoded = mir_snprintf(szAuth, authLen,"%s:%s", szLogin, szPassw);
+ nlb64.cbDecoded = mir_snprintf(szAuth, authLen, "%s:%s", szLogin, szPassw);
nlb64.pbDecoded=(PBYTE)szAuth;
complete = true;
@@ -464,7 +464,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
nlb64.cchEncoded = Netlib_GetBase64EncodedBufferSize(nlb64.cbDecoded);
nlb64.pszEncoded = (char*)alloca(nlb64.cchEncoded);
- if (!NetlibBase64Encode(0,(LPARAM)&nlb64)) return NULL;
+ if (!NetlibBase64Encode(0, (LPARAM)&nlb64)) return NULL;
char* result;
if (http)
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp
index 251d95e0fd..c2f5094aac 100644
--- a/src/modules/netlib/netlibsock.cpp
+++ b/src/modules/netlib/netlibsock.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -117,14 +117,14 @@ static int ConnectionListToSocketList(HANDLE *hConns, fd_set *fd, int& pending)
SetLastError(ERROR_INVALID_DATA);
return 0;
}
- FD_SET(nlcCheck->s,fd);
+ FD_SET(nlcCheck->s, fd);
if (si.pending(nlcCheck->hSsl))
pending++;
}
return 1;
}
-INT_PTR NetlibSelect(WPARAM,LPARAM lParam)
+INT_PTR NetlibSelect(WPARAM, LPARAM lParam)
{
NETLIBSELECT *nls = (NETLIBSELECT*)lParam;
if (nls == NULL || nls->cbSize != sizeof(NETLIBSELECT))
@@ -197,19 +197,19 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam)
if (conn->usingHttpGateway && conn->nlhpi.szHttpGetUrl == NULL && conn->dataBuffer == NULL)
nls->hReadStatus[j] = (conn->pHttpProxyPacketQueue != NULL);
else
- nls->hReadStatus[j] = FD_ISSET(conn->s,&readfd);
+ nls->hReadStatus[j] = FD_ISSET(conn->s, &readfd);
}
for (j = 0; j < FD_SETSIZE; j++)
{
conn = (NetlibConnection*)nls->hWriteConns[j];
if (conn == NULL || conn == INVALID_HANDLE_VALUE) break;
- nls->hWriteStatus[j] = FD_ISSET(conn->s,&writefd);
+ nls->hWriteStatus[j] = FD_ISSET(conn->s, &writefd);
}
for (j = 0; j < FD_SETSIZE; j++)
{
conn = (NetlibConnection*)nls->hExceptConns[j];
if (conn == NULL || conn == INVALID_HANDLE_VALUE) break;
- nls->hExceptStatus[j] = FD_ISSET(conn->s,&exceptfd);
+ nls->hExceptStatus[j] = FD_ISSET(conn->s, &exceptfd);
}
ReleaseMutex(hConnectionHeaderMutex);
return rc;
diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp
index d533bc1236..76c663d5ba 100644
--- a/src/modules/netlib/netlibssl.cpp
+++ b/src/modules/netlib/netlibssl.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -54,8 +54,8 @@ static pfnCertVerifyCertificateChainPolicy fnCertVerifyCertificateChainPolicy;
typedef enum
{
- sockOpen,
- sockClosed,
+ sockOpen,
+ sockClosed,
sockError
} SocketState;
@@ -96,7 +96,7 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool showPopup = fal
break;
default:
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, scRet, LANG_USER_DEFAULT, szMsgBuf, SIZEOF(szMsgBuf), NULL);
}
@@ -133,7 +133,7 @@ static bool AcquireCredentials(void)
&SchannelCred, // Package specific data
NULL, // Pointer to GetKey() func
NULL, // Value to pass to GetKey()
- &hCreds, // (out) Cred Handle
+ &hCreds, // (out) Cred Handle
&tsExpiry); // (out) Lifetime (optional)
ReportSslError(scRet, __LINE__);
@@ -207,8 +207,8 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF
static LPSTR rgszUsages[] =
{
- szOID_PKIX_KP_SERVER_AUTH,
- szOID_SERVER_GATED_CRYPTO,
+ szOID_PKIX_KP_SERVER_AUTH,
+ szOID_SERVER_GATED_CRYPTO,
szOID_SGC_NETSCAPE
};
@@ -222,7 +222,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF
PWSTR pwszServerName = mir_a2u(pszServerName);
- scRet = g_pSSPI->QueryContextAttributesA(&ssl->hContext,
+ scRet = g_pSSPI->QueryContextAttributesA(&ssl->hContext,
SECPKG_ATTR_REMOTE_CERT_CONTEXT, &pServerCert);
if (scRet != SEC_E_OK)
goto cleanup;
@@ -255,7 +255,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF
PolicyStatus.cbSize = sizeof(PolicyStatus);
- if (!fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext,
+ if (!fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext,
&PolicyPara, &PolicyStatus))
{
scRet = GetLastError();
@@ -386,17 +386,17 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)
OutBuffer.ulVersion = SECBUFFER_VERSION;
scRet = g_pSSPI->InitializeSecurityContextA(
- &hCreds,
- &ssl->hContext,
- NULL,
- dwSSPIFlags,
- 0,
- SECURITY_NATIVE_DREP,
- &InBuffer,
- 0,
- NULL,
- &OutBuffer,
- &dwSSPIOutFlags,
+ &hCreds,
+ &ssl->hContext,
+ NULL,
+ dwSSPIFlags,
+ 0,
+ SECURITY_NATIVE_DREP,
+ &InBuffer,
+ 0,
+ NULL,
+ &OutBuffer,
+ &dwSSPIOutFlags,
&tsExpiry);
// If success (or if the error was one of the special extended ones),
@@ -431,8 +431,8 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)
// Store remaining data for further use
if (InBuffers[1].BufferType == SECBUFFER_EXTRA)
{
- memmove(ssl->pbIoBuffer,
- ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer),
+ memmove(ssl->pbIoBuffer,
+ ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer),
InBuffers[1].cbBuffer);
ssl->cbIoBuffer = InBuffers[1].cbBuffer;
}
@@ -460,8 +460,8 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)
// Copy any leftover data from the buffer, and go around again.
if (InBuffers[1].BufferType == SECBUFFER_EXTRA)
{
- memmove(ssl->pbIoBuffer,
- ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer),
+ memmove(ssl->pbIoBuffer,
+ ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer),
InBuffers[1].cbBuffer);
ssl->cbIoBuffer = InBuffers[1].cbBuffer;
@@ -518,17 +518,17 @@ static bool ClientConnect(SslHandle *ssl, const char *host)
OutBuffer.ulVersion = SECBUFFER_VERSION;
scRet = g_pSSPI->InitializeSecurityContextA(
- &hCreds,
- NULL,
- (SEC_CHAR*)host,
- dwSSPIFlags,
- 0,
- SECURITY_NATIVE_DREP,
- NULL,
- 0,
- &ssl->hContext,
- &OutBuffer,
- &dwSSPIOutFlags,
+ &hCreds,
+ NULL,
+ (SEC_CHAR*)host,
+ dwSSPIFlags,
+ 0,
+ SECURITY_NATIVE_DREP,
+ NULL,
+ 0,
+ &ssl->hContext,
+ &OutBuffer,
+ &dwSSPIOutFlags,
&tsExpiry);
if (scRet != SEC_I_CONTINUE_NEEDED)
@@ -631,17 +631,17 @@ void NetlibSslShutdown(SslHandle *ssl)
OutBuffer.ulVersion = SECBUFFER_VERSION;
scRet = g_pSSPI->InitializeSecurityContextA(
- &hCreds,
- &ssl->hContext,
- NULL,
- dwSSPIFlags,
- 0,
- SECURITY_NATIVE_DREP,
- NULL,
- 0,
- &ssl->hContext,
- &OutBuffer,
- &dwSSPIOutFlags,
+ &hCreds,
+ &ssl->hContext,
+ NULL,
+ dwSSPIFlags,
+ 0,
+ SECURITY_NATIVE_DREP,
+ NULL,
+ 0,
+ &ssl->hContext,
+ &OutBuffer,
+ &dwSSPIOutFlags,
&tsExpiry);
if (FAILED(scRet)) return;
@@ -953,10 +953,10 @@ static INT_PTR GetSslApi(WPARAM, LPARAM lParam)
if (si->cbSize != sizeof(SSL_API))
return FALSE;
- si->connect = (HSSL (__cdecl *)(SOCKET,const char *,int))NetlibSslConnect;
+ si->connect = (HSSL (__cdecl *)(SOCKET, const char *, int))NetlibSslConnect;
si->pending = (BOOL (__cdecl *)(HSSL))NetlibSslPending;
- si->read = (int (__cdecl *)(HSSL,char *,int,int))NetlibSslRead;
- si->write = (int (__cdecl *)(HSSL,const char *,int))NetlibSslWrite;
+ si->read = (int (__cdecl *)(HSSL, char *, int, int))NetlibSslRead;
+ si->write = (int (__cdecl *)(HSSL, const char *, int))NetlibSslWrite;
si->shutdown = (void (__cdecl *)(HSSL))NetlibSslShutdown;
si->sfree = (void (__cdecl *)(HSSL))NetlibSslFree;
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp
index 655bb781eb..12e0345c27 100644
--- a/src/modules/netlib/netlibupnp.cpp
+++ b/src/modules/netlib/netlibupnp.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2012 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -115,12 +115,12 @@ static char szCtlUrl[256], szDev[256];
typedef enum
{
- DeviceGetReq,
- ControlAction,
+ DeviceGetReq,
+ ControlAction,
ControlQuery
} ReqType;
-static bool txtParseParam(char* szData, char* presearch,
+static bool txtParseParam(char* szData, char* presearch,
char* start, char* finish, char* param, size_t size)
{
char *cp, *cp1;
@@ -156,14 +156,14 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath)
char *ppath, *phost, *pport;
int sz;
- phost = strstr(szUrl,"://");
+ phost = strstr(szUrl, "://");
if (phost == NULL) phost = szUrl;
else phost += 3;
- ppath = strchr(phost,'/');
+ ppath = strchr(phost, '/');
if (ppath == NULL) ppath = phost + strlen(phost);
- pport = strchr(phost,':');
+ pport = strchr(phost, ':');
if (pport == NULL) pport = ppath;
if (szHost != NULL)
@@ -272,11 +272,11 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction
char szData1[1024];
szReq = mir_strdup(szResult);
- sz = mir_snprintf (szData1, sizeof(szData1),
+ sz = mir_snprintf (szData1, sizeof(szData1),
soap_action, szActionName, szDev, szReq, szActionName);
- sz = mir_snprintf (szData, 4096,
- szPostHdr, szPath, szHost, sPort,
+ sz = mir_snprintf (szData, 4096,
+ szPostHdr, szPath, szHost, sPort,
sz, szDev, szActionName, szData1);
}
break;
@@ -285,11 +285,11 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction
{
char szData1[1024];
- sz = mir_snprintf (szData1, sizeof(szData1),
+ sz = mir_snprintf (szData1, sizeof(szData1),
soap_query, szActionName);
- sz = mir_snprintf (szData, 4096,
- szPostHdr, szPath, szHost, sPort,
+ sz = mir_snprintf (szData, 4096,
+ szPostHdr, szPath, szHost, sPort,
sz, "urn:schemas-upnp-org:control-1-0", "QueryStateVariable", szData1);
}
break;
@@ -742,7 +742,7 @@ bool NetlibUPnPAddPortMapping(WORD intport, char *proto, WORD *extport, DWORD *e
do
{
++*extport;
- mir_snprintf(szData, 4096, add_port_mapping,
+ mir_snprintf(szData, 4096, add_port_mapping,
*extport, proto, intport, inet_ntoa(locIP.sin_addr));
res = httpTransact(szCtlUrl, szData, 4096, "AddPortMapping", ControlAction);
txtParseParam(szData, NULL, "<errorCode>", "</errorCode>", szExtIP, sizeof(szExtIP));
@@ -795,7 +795,7 @@ void NetlibUPnPDeletePortMapping(WORD extport, char* proto)
void NetlibUPnPCleanup(void*)
{
- if (DBGetContactSettingByte(NULL,"Netlib","NLEnableUPnP",1) == 0)
+ if (DBGetContactSettingByte(NULL, "Netlib", "NLEnableUPnP", 1) == 0)
// upnp is disabled globally, no need for a cleanup
return;