Index: miranda32.dsp
===================================================================
--- miranda32.dsp	(revision 4046)
+++ miranda32.dsp	(working copy)
@@ -55,8 +55,12 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 wsock32.lib comctl32.lib winmm.lib version.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../bin/release/miranda32.exe" /fixed /ALIGN:4096 /ignore:4108
+# ADD LINK32 wsock32.lib comctl32.lib winmm.lib version.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../bin/upload/06/A/miranda32.exe" /fixed /ALIGN:4096 /ignore:4108
 # SUBTRACT LINK32 /pdb:none /incremental:yes
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Cmds=cd ../bin/upload/	upx --best --force 06/A/miranda32.exe	md5 -t -s -o06/A/miranda32.exe.md5 06/A/miranda32.exe
+# End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "miranda32 - Win32 Debug"
 
@@ -110,10 +114,14 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 wsock32.lib comctl32.lib winmm.lib version.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /map /machine:I386 /out:"../bin/release/miranda32.exe" /fixed /ALIGN:4096 /ignore:4108
+# ADD BASE LINK32 wsock32.lib comctl32.lib winmm.lib version.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /map /machine:I386 /fixed /ALIGN:4096 /ignore:4108
 # SUBTRACT BASE LINK32 /pdb:none /debug
-# ADD LINK32 wsock32.lib comctl32.lib winmm.lib version.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../bin/Release Unicode/miranda32.exe" /fixed /ALIGN:4096 /ignore:4108
+# ADD LINK32 wsock32.lib comctl32.lib winmm.lib version.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../bin/upload/06/W/miranda32.exe" /fixed /ALIGN:4096 /ignore:4108
 # SUBTRACT LINK32 /pdb:none /incremental:yes
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Cmds=cd ../bin/upload/	upx --best --force 06/W/miranda32.exe	md5 -t -s -o06/W/miranda32.exe.md5 06/W/miranda32.exe
+# End Special Build Tool
 
 !ELSEIF  "$(CFG)" == "miranda32 - Win32 Debug Unicode"
 
@@ -389,14 +397,6 @@
 
 # End Source File
 # End Group
-# Begin Group "autoaway"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\modules\autoaway\autoaway.c
-# End Source File
-# End Group
 # Begin Group "button"
 
 # PROP Default_Filter ""
@@ -474,22 +474,6 @@
 SOURCE=.\modules\help\help.c
 # End Source File
 # End Group
-# Begin Group "history"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\modules\history\history.c
-# End Source File
-# End Group
-# Begin Group "idle"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\modules\idle\idle.c
-# End Source File
-# End Group
 # Begin Group "ignore"
 
 # PROP Default_Filter ""
@@ -834,7 +818,65 @@
 SOURCE=.\modules\clist\keyboard.c
 # End Source File
 # End Group
+# Begin Group "saa"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\extra\saa\aa_utils.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\autoaway.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\dlgproc.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\globals.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\idle.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\idleMenu.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\idleMessages.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\reconnect.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\extra\saa\saamain.c
+# ADD CPP /I "core"
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
 # End Group
+# End Group
 # Begin Group "Resources"
 
 # PROP Default_Filter ""
@@ -997,6 +1039,8 @@
 # Begin Source File
 
 SOURCE=.\resource.rc
+# ADD BASE RSC /l 0x402
+# ADD RSC /l 0x402 /i "../extra/saa"
 # End Source File
 # Begin Source File
 
Index: core/modules.c
===================================================================
--- core/modules.c	(revision 4046)
+++ core/modules.c	(working copy)
@@ -90,7 +90,7 @@
 int LoadSkinModule(void);		// ui: skin
 int LoadHelpModule(void);		// ui: help stuff
 int LoadUserInfoModule(void);	// ui: user info
-int LoadHistoryModule(void);	// ui: history viewer
+//int LoadHistoryModule(void);	// ui: history viewer
 int LoadAwayMsgModule(void);	// ui: setting away messages
 int LoadVisibilityModule(void);	// ui: visibility control
 int LoadCLUIModule(void);		// ui: CList UI
@@ -133,7 +133,7 @@
 	if(!disableDefaultModule[DEFMOD_SRAUTH]) if(LoadSendRecvAuthModule()) return 1;
 	if(!disableDefaultModule[DEFMOD_SRFILE]) if(LoadSendRecvFileModule()) return 1;
 	if(!disableDefaultModule[DEFMOD_UIHELP]) if(LoadHelpModule()) return 1;
-	if(!disableDefaultModule[DEFMOD_UIHISTORY]) if(LoadHistoryModule()) return 1;
+//	if(!disableDefaultModule[DEFMOD_UIHISTORY]) if(LoadHistoryModule()) return 1;
 	if(!disableDefaultModule[DEFMOD_RNDIDLE]) if(LoadIdleModule()) return 1;
 	if(!disableDefaultModule[DEFMOD_RNDAUTOAWAY]) if(LoadAutoAwayModule()) return 1;
 	if(!disableDefaultModule[DEFMOD_RNDUSERONLINE]) if(LoadUserOnlineModule()) return 1;
Index: core/commonheaders.h
===================================================================
--- core/commonheaders.h	(revision 4046)
+++ core/commonheaders.h	(working copy)
@@ -27,7 +27,6 @@
 #  define _UNICODE
 #endif
 
-#include <tchar.h>
 #include <malloc.h>
 
 #define _ALPHA_BASE_ 1	// defined for CVS builds
@@ -84,3 +83,20 @@
 #include <m_idle.h>
 #include <m_ignore.h>
 #include <m_utils.h>
+
+#ifdef __GNUC__
+	#include <pbt.h>
+	#define __try
+	#define __except(x) if (0) /* don't execute handler */
+	#define __finally
+	#define _try __try
+	#define _except __except
+	#define _finally __finally 
+
+	typedef struct tagTVKEYDOWN{
+		NMHDR hdr;
+		WORD wVKey;
+	   UINT flags;
+	} NMTVKEYDOWN, *LPNMTVKEYDOWN;
+
+#endif
Index: core/miranda.c
===================================================================
--- core/miranda.c	(revision 4046)
+++ core/miranda.c	(working copy)
@@ -474,10 +474,16 @@
 	pVerInfo=mir_alloc(verInfoSize);
 	GetFileVersionInfoA(filename,0,verInfoSize,pVerInfo);
 	VerQueryValueA(pVerInfo,"\\StringFileInfo\\000004b0\\ProductVersion",(void*)&productVersion,&blockSize);
+	lstrcpynA((char*)lParam,productVersion,wParam);
+	unused = strlen((char*)lParam);
+	if (VerQueryValueA(pVerInfo,"\\StringFileInfo\\000004b0\\PrivateBuild",(void*)&productVersion,&blockSize))
+		if (strlen(productVersion))
+			unused += mir_snprintf(( char* )lParam+unused, wParam-unused, " Priv(%s)", productVersion );
+	if (VerQueryValueA(pVerInfo,"\\StringFileInfo\\000004b0\\SpecialBuild",(void*)&productVersion,&blockSize))
+		if (strlen(productVersion))
+			unused += mir_snprintf(( char* )lParam+unused, wParam-unused, " Spec(%s)", productVersion );
 	#if defined( _UNICODE )
-		mir_snprintf(( char* )lParam, wParam, "%s Unicode", productVersion );
-	#else
-		lstrcpynA((char*)lParam,productVersion,wParam);
+		lstrcpynA(( char* )lParam+unused, " Unicode", wParam-unused);
 	#endif
 	mir_free(pVerInfo);
 	return 0;
Index: modules/database/dbtime.c
===================================================================
--- modules/database/dbtime.c	(revision 4046)
+++ modules/database/dbtime.c	(working copy)
@@ -185,7 +185,7 @@
 	int destCharsLeft, dateTimeStrLen;
 
 	//this huge number is the difference between 1970 and 1601 in seconds
-	liFiletime.QuadPart = (11644473600i64+(__int64)(DWORD)TimestampToLocal(wParam,0))*10000000;
+	liFiletime.QuadPart = ((__int64)11644473600+(__int64)(DWORD)TimestampToLocal(wParam,0))*10000000;
 	filetime.dwHighDateTime = liFiletime.HighPart;
 	filetime.dwLowDateTime = liFiletime.LowPart;
 	FileTimeToSystemTime(&filetime,&st);
Index: modules/skin/sounds.c
===================================================================
--- modules/skin/sounds.c	(revision 4046)
+++ modules/skin/sounds.c	(working copy)
@@ -334,22 +334,12 @@
 			case TVN_KEYDOWN:
 				{
 					NMTVKEYDOWN* ptkd = (NMTVKEYDOWN*)lParam;
-					TVHITTESTINFO hti;
+					LPNMHDR pnmhdr = (LPNMHDR)lParam;
 
 					if (ptkd) {
-						if (ptkd->wVKey == 0x0020) {
-							hti.pt.x=(short)LOWORD(GetMessagePos());
-							hti.pt.y=(short)HIWORD(GetMessagePos());
-							ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt);
-							if(TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti)) {
-								if (hti.flags&TVHT_ONITEM) {
-									if (TreeView_GetParent(hwndTree, hti.hItem)!=TreeView_GetRoot(hwndTree)) {
-										// the stupid checkbox gets enabled here.
-									}
-									else {
-										SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-									}
-								}
+						if (ptkd->wVKey == VK_SPACE) {
+							if (TreeView_GetSelection(pnmhdr->hwndFrom)) {
+								PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
 							}
 						}
 					}
@@ -364,8 +354,7 @@
 					if(TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom,&hti)) {
 						if (hti.flags&TVHT_ONITEM) {
 							if(hti.flags&TVHT_ONITEMSTATEICON) {
-								if (TreeView_GetParent(hwndTree, hti.hItem)!=TreeView_GetRoot(hwndTree))
-									SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+								SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
 							}
 						}
 					}
Index: modules/netlib/netlibhttpproxy.c
===================================================================
--- modules/netlib/netlibhttpproxy.c	(revision 4046)
+++ modules/netlib/netlibhttpproxy.c	(working copy)
@@ -22,6 +22,7 @@
 */
 #include "commonheaders.h"
 #include "netlib.h"
+#define FILENAME "netlibhttpproxy.c"
 
 #define HTTPGETTIMEOUT   55000  //in ms. http GETs through most proxies will give up after a while so the request needs to be re-sent
 
@@ -34,12 +35,12 @@
 
 	nlc->s=socket(AF_INET,SOCK_STREAM,0);
 	if(nlc->s==INVALID_SOCKET) {
-		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"socket",WSAGetLastError());
+		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"socket",WSAGetLastError());
 		return 0;
 	}
 
 	if(connect(nlc->s,(SOCKADDR *)&nlc->sinProxy,sizeof(nlc->sinProxy))==SOCKET_ERROR) {
-		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"connect",WSAGetLastError());
+		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"connect",WSAGetLastError());
 		return 0;
 	}
 
@@ -51,8 +52,8 @@
 	 *          receiving
 	 */
 	nlhrSend.requestType=(nlc->nlhpi.szHttpGetUrl == NULL) ? REQUEST_POST : REQUEST_GET;
-	nlhrSend.flags=NLHRF_GENERATEHOST|NLHRF_DUMPPROXY|NLHRF_SMARTAUTHHEADER;
-	if (nlc->nlhpi.flags & NLHPIF_HTTP11) nlhrSend.flags |= NLHRF_HTTP11;
+	nlhrSend.flags=NLHRF_GENERATEHOST|NLHRF_DUMPPROXY|NLHRF_SMARTAUTHHEADER;
+	if (nlc->nlhpi.flags & NLHPIF_HTTP11) nlhrSend.flags |= NLHRF_HTTP11;
 
 	/*
 	 * Gena01 - fixing a possible crash, can't use GET Sequence if there is no GET URL
@@ -81,7 +82,7 @@
 
 	if (nlc->nlhpi.szHttpGetUrl != NULL) {
 
-		Netlib_Logf(nlc->nlu,"%s %d: Sending data.[ICQ GET] ",__FILE__,__LINE__);
+		Netlib_Logf(nlc->nlu,"%s %d: Sending data.[ICQ GET] ",FILENAME,__LINE__);
 		if(NetlibHttpSendRequest((WPARAM)&nlcSend,(LPARAM)&nlhrSend)==SOCKET_ERROR) {
 			nlc->usingHttpGateway=1;
 			return 0;
@@ -106,9 +107,9 @@
 
 	if(NetlibHttpSendRequest((WPARAM)&nlcSend,(LPARAM)&nlhrSend)==SOCKET_ERROR) {
 		struct NetlibHTTPProxyPacketQueue *p = nlc->pHttpProxyPacketQueue;
-		
-		mir_free(nlhrSend.pData);
 
+		mir_free(nlhrSend.pData);
+
 		nlc->usingHttpGateway=1;
 
 		/*
@@ -127,7 +128,7 @@
 
 		return 0;
 	}
-	mir_free(nlhrSend.pData);
+	mir_free(nlhrSend.pData);
 	nlc->dwLastGetSentTime=GetTickCount();
 	return 1;
 }
@@ -148,7 +149,7 @@
 	nlcSend.hInstSecurityDll=nlc->hInstSecurityDll;
 	nlcSend.s=socket(AF_INET,SOCK_STREAM,0);
 	if(nlcSend.s==INVALID_SOCKET) {
-		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"socket",WSAGetLastError());
+		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"socket",WSAGetLastError());
 		return SOCKET_ERROR;
 	}
 	nlcSend.hOkToCloseEvent=CreateEvent(NULL,TRUE,TRUE,NULL);
@@ -157,7 +158,7 @@
 	NetlibInitializeNestedCS(&nlcSend.ncsSend);
 
 	if(connect(nlcSend.s,(SOCKADDR *)&nlc->sinProxy,sizeof(nlc->sinProxy))==SOCKET_ERROR) {
-		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"connect",WSAGetLastError());
+		Netlib_Logf(nlc->nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"connect",WSAGetLastError());
 		NetlibDeleteNestedCS(&nlcSend.ncsRecv);
 		NetlibDeleteNestedCS(&nlcSend.ncsSend);
 		CloseHandle(nlcSend.hOkToCloseEvent);
@@ -303,7 +304,7 @@
 			}
 */
 			if ( nlc->pHttpProxyPacketQueue == 0 && nlc->nlu->user.pfnHttpGatewayWrapSend != NULL )
-				nlc->nlu->user.pfnHttpGatewayWrapSend((HANDLE)nlc,"",0,MSG_NOHTTPGATEWAYWRAP,NetlibSend);
+				nlc->nlu->user.pfnHttpGatewayWrapSend((HANDLE)nlc,"",0,MSG_NOHTTPGATEWAYWRAP,NetlibSend);
 
 			if(!HttpGatewaySendGet(nlc)) {
 				return SOCKET_ERROR;
@@ -348,10 +349,10 @@
 		if(nlhrReply==NULL) return SOCKET_ERROR;
         // ignore 1xx result codes
         if (nlhrReply->resultCode < 200)
-		{
-			NetlibHttpFreeRequestStruct(0,(LPARAM)nlhrReply);
+		{
+			NetlibHttpFreeRequestStruct(0,(LPARAM)nlhrReply);
 			continue;
-		}
+		}
 		// 0.3.1+
 		// Attempt to retry NETLIBHTTP_RETRYCOUNT times if the result code is >300
         if (nlhrReply->resultCode >= 300)
@@ -364,7 +365,7 @@
 				nlc->s = INVALID_SOCKET;
 				Sleep(NETLIBHTTP_RETRYTIMEOUT); // wait 5 seconds
 				// retry the connection
-				Netlib_Logf(nlc->nlu,"%s %d: ResultCode?? Doing GET.",__FILE__,__LINE__);
+				Netlib_Logf(nlc->nlu,"%s %d: ResultCode?? Doing GET.",FILENAME,__LINE__);
 				if(HttpGatewaySendGet(nlc))
 					continue;
 				SetLastError(ERROR_GEN_FAILURE);
@@ -374,12 +375,12 @@
 		retryCount = 0;
 		contentLength=-1;
 		for(i=0;i<nlhrReply->headersCount;i++)
-		{
+		{
 			if(!lstrcmpiA(nlhrReply->headers[i].szName,"Content-Length")) {
 				contentLength=atoi(nlhrReply->headers[i].szValue);
 				break;
 			}
-		}
+		}
 
 		/*
 		if(contentLength<0) {
@@ -388,10 +389,10 @@
 			return SOCKET_ERROR;
 		}*/
 		if(contentLength==0 && nlc->nlu->user.szHttpGatewayHello != NULL)
-		{
-			NetlibHttpFreeRequestStruct(0,(LPARAM)nlhrReply);
+		{
+			NetlibHttpFreeRequestStruct(0,(LPARAM)nlhrReply);
 			continue;
-		}
+		}
 
 
 		if (contentLength < 0) {
@@ -451,7 +452,7 @@
 		 *
 		 */
 		if (nlc->nlhpi.szHttpGetUrl != NULL)  {
-			Netlib_Logf(nlc->nlu,"%s %d: Doing GET, Again????",__FILE__,__LINE__);
+			Netlib_Logf(nlc->nlu,"%s %d: Doing GET, Again????",FILENAME,__LINE__);
 
 		if(!HttpGatewaySendGet(nlc)) {
 			mir_free(dataBuffer);
@@ -494,7 +495,7 @@
 	else nlc->dataBufferLen=contentLength;
 	nlc->dataBuffer=dataBuffer;
 
-	Netlib_Logf(nlc->nlu,"%s %d: NetlibHTTPGatewayRecv EXIT!",__FILE__,__LINE__);
+	Netlib_Logf(nlc->nlu,"%s %d: NetlibHTTPGatewayRecv EXIT!",FILENAME,__LINE__);
 	return len;
 }
 
@@ -514,9 +515,9 @@
 	nlhrSend.cbSize=sizeof(nlhrSend);
 	nlhrSend.nlc=nlc;
 	nlhrSend.requestType=REQUEST_GET;
-	nlhrSend.flags=NLHRF_GENERATEHOST|NLHRF_DUMPPROXY|NLHRF_SMARTAUTHHEADER;
-	if (nlc->nlhpi.flags & NLHPIF_HTTP11) nlhrSend.flags |= NLHRF_HTTP11;
-
+	nlhrSend.flags=NLHRF_GENERATEHOST|NLHRF_DUMPPROXY|NLHRF_SMARTAUTHHEADER;
+	if (nlc->nlhpi.flags & NLHPIF_HTTP11) nlhrSend.flags |= NLHRF_HTTP11;
+
 	nlhrSend.szUrl=nlu->user.szHttpGatewayHello;
 	nlhrSend.headers=httpHeaders;
     nlhrSend.headersCount=3;
Index: modules/netlib/netliblog.c
===================================================================
--- modules/netlib/netliblog.c	(revision 4046)
+++ modules/netlib/netliblog.c	(working copy)
@@ -34,6 +34,7 @@
 #define TIMEFORMAT_MICROSECONDS 3
 struct {
 	HWND   hwndOpts;
+	int    toConsole;
 	int    toOutputDebugString;
 	int    toFile;
 	TCHAR* szFile;
@@ -53,6 +54,33 @@
 	_T( "Times in microseconds" )
 };
 
+static int IsConsoleVisible(void)
+{
+	char szTitle[MAX_PATH];
+	return GetConsoleTitleA(szTitle,sizeof(szTitle));
+}
+
+static void ShowConsole(void)
+{
+	HWND hwndConsole;
+	MSG msg;
+	
+	if(IsConsoleVisible()) {
+		logOptions.toConsole = 1;
+		return;
+	}
+	AllocConsole();
+	SetConsoleTitleA("676d4af7-970d-4808-b7f6-cb182ff60297");
+	while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
+	hwndConsole=FindWindowA(NULL,"676d4af7-970d-4808-b7f6-cb182ff60297");
+	SetConsoleTitleA("Miranda Netlib Log");
+	if(hwndConsole) DeleteMenu(GetSystemMenu(hwndConsole,FALSE),SC_CLOSE,MF_BYCOMMAND);
+	logOptions.toConsole = 1;
+}
+
 static BOOL CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam)
 {
 	switch(message) {
@@ -74,6 +102,7 @@
 		CheckDlgButton(hwndDlg,IDC_TOFILE,logOptions.toFile?BST_CHECKED:BST_UNCHECKED);
 		SetDlgItemText(hwndDlg,IDC_FILENAME,logOptions.szFile);
 		CheckDlgButton(hwndDlg,IDC_SHOWTHISDLGATSTART,DBGetContactSettingByte(NULL,"Netlib","ShowLogOptsAtStart",0)?BST_CHECKED:BST_UNCHECKED);
+		CheckDlgButton(hwndDlg,IDC_DISABLECONSOLEMENUITEM,DBGetContactSettingByte(NULL,"Netlib","DisableMenuItem",1)?BST_CHECKED:BST_UNCHECKED);
 		{	DBVARIANT dbv;
 			if(!DBGetContactSetting(NULL,"Netlib","RunAtStart",&dbv)) {
 				SetDlgItemTextA(hwndDlg,IDC_RUNATSTART,dbv.pszVal);
@@ -104,6 +133,21 @@
 		case IDC_SHOWNAMES:
 			logOptions.showUser=IsDlgButtonChecked(hwndDlg,LOWORD(wParam));
 			break;
+		case IDC_SHOWCONSOLE:
+			NetLibShowHideConsole(0, 0);
+			break;
+		case IDC_CLEARCONSOLE:
+		{	COORD topLeft={0,0};
+			DWORD charsWritten;
+			CONSOLE_SCREEN_BUFFER_INFO csbi;
+			GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),&csbi);
+			FillConsoleOutputCharacter(GetStdHandle(STD_OUTPUT_HANDLE),' ',csbi.dwSize.X*csbi.dwSize.Y,topLeft,&charsWritten);
+			SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),topLeft);
+			break;
+		}
+		case IDC_DISABLECONSOLEMENUITEM:
+			DBWriteContactSettingByte(NULL,"Netlib","DisableMenuItem",(BYTE)IsDlgButtonChecked(hwndDlg,LOWORD(wParam)));
+			break;
 		case IDC_TOOUTPUTDEBUGSTRING:
 			logOptions.toOutputDebugString=IsDlgButtonChecked(hwndDlg,LOWORD(wParam));
 			break;
@@ -198,6 +242,7 @@
 			DBWriteContactSettingByte(NULL,"Netlib","AutoDetectText",(BYTE)logOptions.autoDetectText);
 			DBWriteContactSettingByte(NULL,"Netlib","TimeFormat",(BYTE)logOptions.timeFormat);
 			DBWriteContactSettingByte(NULL,"Netlib","ShowUser",(BYTE)logOptions.showUser);
+			DBWriteContactSettingByte(NULL,"Netlib","ToConsole",(BYTE)logOptions.toConsole);
 			DBWriteContactSettingByte(NULL,"Netlib","ToOutputDebugString",(BYTE)logOptions.toOutputDebugString);
 			DBWriteContactSettingByte(NULL,"Netlib","ToFile",(BYTE)logOptions.toFile);
 			DBWriteContactSettingTString(NULL,"Netlib","File", logOptions.szFile ? logOptions.szFile: _T(""));
@@ -218,6 +263,22 @@
 	return FALSE;
 }
 
+int NetLibShowHideConsole(WPARAM wParam, LPARAM lParam)
+{
+	if(IsConsoleVisible()) {
+//		SetDlgItemText(hwndDlg,IDC_SHOWCONSOLE,Translate("Show console"));
+		FreeConsole();
+		logOptions.toConsole = 0;
+		DBWriteContactSettingByte(NULL,"Netlib","ShowConsoleAtStart",0);
+		return 0;		
+	} else {
+//		SetDlgItemText(hwndDlg,IDC_SHOWCONSOLE,Translate("Hide console"));
+		DBWriteContactSettingByte(NULL,"Netlib","ShowConsoleAtStart",1);
+		ShowConsole();
+		return 1;
+	}
+}
+
 void NetlibLogShowOptions(void)
 {
 	if(logOptions.hwndOpts==NULL)
@@ -281,6 +342,10 @@
 		sprintf(szLine,"[%s%s] %s\n",szTime,logOptions.showUser?nlu->user.szSettingsModule:"",pszMsg);
 	else
 		sprintf(szLine,"%s\n",pszMsg);
+	if(logOptions.toConsole) {
+		DWORD charsWritten;
+ 		WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE),szLine,lstrlenA(szLine),&charsWritten,NULL);
+	}
 	if(logOptions.toOutputDebugString) OutputDebugStringA(szLine);
 	if(logOptions.toFile && logOptions.szFile[0]) {
 		FILE *fp;
@@ -315,7 +380,7 @@
 		return;
 
 	// Check user's log settings
-	if (!(logOptions.toOutputDebugString ||
+	if (!(logOptions.toConsole || logOptions.toOutputDebugString ||
 		(logOptions.toFile && logOptions.szFile[0])))
 		return;
 	if ((sent && !logOptions.dumpSent) ||
@@ -408,6 +473,7 @@
 	logOptions.autoDetectText=DBGetContactSettingByte(NULL,"Netlib","AutoDetectText",1);
 	logOptions.timeFormat=DBGetContactSettingByte(NULL,"Netlib","TimeFormat",TIMEFORMAT_HHMMSS);
 	logOptions.showUser=DBGetContactSettingByte(NULL,"Netlib","ShowUser",1);
+	logOptions.toConsole=DBGetContactSettingByte(NULL,"Netlib","ToConsole",0);
 	logOptions.toOutputDebugString=DBGetContactSettingByte(NULL,"Netlib","ToOutputDebugString",0);
 	logOptions.toFile=DBGetContactSettingByte(NULL,"Netlib","ToFile",0);
 
@@ -420,6 +486,8 @@
 		fp = _tfopen(logOptions.szFile, _T("wt"));
 		if(fp) fclose(fp);
 	}
+	if(DBGetContactSettingByte(NULL,"Netlib","ShowConsoleAtStart",0))
+		ShowConsole();
 	if(DBGetContactSettingByte(NULL,"Netlib","ShowLogOptsAtStart",0))
 		NetlibLogShowOptions();
 	if(!DBGetContactSetting(NULL,"Netlib","RunAtStart",&dbv)) {
Index: modules/netlib/netlibupnp.c
===================================================================
--- modules/netlib/netlibupnp.c	(revision 4046)
+++ modules/netlib/netlibupnp.c	(working copy)
@@ -24,7 +24,10 @@
 
 #include "commonheaders.h"
 #include "netlib.h"
-
+#ifdef __GNUC__
+	#define IP_MULTICAST_IF	2
+	#define IP_TTL              7           /* set/get IP Time To Live          */
+#endif
 static char search_request_msg[] = 
 	"M-SEARCH * HTTP/1.1\r\n"
 	"MX: 2\r\n"
Index: modules/netlib/netlib.h
===================================================================
--- modules/netlib/netlib.h	(revision 4046)
+++ modules/netlib/netlib.h	(working copy)
@@ -121,6 +121,7 @@
 void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int flags);
 void NetlibLogInit(void);
 void NetlibLogShutdown(void);
+ int NetLibShowHideConsole(WPARAM wParam, LPARAM lParam);
 
 //netlibopenconn.c
 DWORD DnsLookup(struct NetlibUser *nlu,const char *szHost);
@@ -145,8 +146,8 @@
 BOOL NetlibUPnPAddPortMapping(WORD intport, char *proto, 
 							  WORD *extport, DWORD *extip, BOOL search);
 void NetlibUPnPDeletePortMapping(WORD extport, char* proto);
-void NetlibUPnPInit(void);
-void NetlibUPnPDestroy(void);
+void NetlibUPnPInit(void);
+void NetlibUPnPDestroy(void);
 
 static __inline int NLSend(struct NetlibConnection *nlc,const char *buf,int len,int flags) {
 	NETLIBBUFFER nlb={(char*)buf,len,flags};
Index: modules/netlib/netlibbind.c
===================================================================
--- modules/netlib/netlibbind.c	(revision 4046)
+++ modules/netlib/netlibbind.c	(working copy)
@@ -22,6 +22,7 @@
 */
 #include "commonheaders.h"
 #include "netlib.h"
+#define FILENAME "netlibbind.c"
 
 //mask must be 8192 bytes, returns number of bits set
 #define PortInMask(mask,p)  ((mask)[((p)&0xFFFF)>>3]&(1<<((p)&7)))
@@ -127,7 +128,7 @@
 	nlbp->s=socket(AF_INET,SOCK_STREAM,0);
 	nlbp->pExtra= (nlb->cbSize == sizeof(NETLIBBIND)) ? nlb->pExtra : NULL;
 	if(nlbp->s==INVALID_SOCKET) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"socket",WSAGetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"socket",WSAGetLastError());
 		mir_free(nlbp);
 		return (int)(HANDLE)NULL;
 	}
@@ -177,20 +178,20 @@
 		/* if ->wPort==0 then they'll get any free port, otherwise they'll
 		be asking for whatever was in nlb->wPort*/
 		if (nlb->wPort!=0) {			
-			Netlib_Logf(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);
+			Netlib_Logf(nlu,"%s %d: trying to bind port %d, this 'feature' can be abused, please be sure you want to allow it.",FILENAME,__LINE__,nlb->wPort);
 			sin.sin_port=htons(nlb->wPort);
 		} 
 		if(bind(nlbp->s,(SOCKADDR *)&sin,sizeof(sin))==0) foundPort=1;
 	}
 	if(!foundPort) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"bind",WSAGetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"bind",WSAGetLastError());
 		closesocket(nlbp->s);
 		mir_free(nlbp);
 		return (int)(HANDLE)NULL;
 	}
 
 	if(listen(nlbp->s,5)) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"listen",WSAGetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"listen",WSAGetLastError());
 		closesocket(nlbp->s);
 		mir_free(nlbp);
 		return (int)(HANDLE)NULL;
@@ -202,7 +203,7 @@
 		ZeroMemory(&sin,sizeof(sin));
 		len=sizeof(sin);
 		if(getsockname(nlbp->s,(SOCKADDR *)&sin,&len)) {
-			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"getsockname",WSAGetLastError());
+			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"getsockname",WSAGetLastError());
 			closesocket(nlbp->s);
 			mir_free(nlbp);
 			return (int)(HANDLE)NULL;
Index: modules/netlib/netlib.c
===================================================================
--- modules/netlib/netlib.c	(revision 4046)
+++ modules/netlib/netlib.c	(working copy)
@@ -233,28 +233,28 @@
 			DWORD waitResult;
 
 			WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
-			if (nlc->usingHttpGateway)
-			{
-				struct NetlibHTTPProxyPacketQueue *p = nlc->pHttpProxyPacketQueue;
-				while (p != NULL) {
-					struct NetlibHTTPProxyPacketQueue *t = p;
-
-					p = p->next;
-
-					mir_free(t->dataBuffer);
-					mir_free(t);
-				}
-			}
-			else
-			{
-				if(nlc->handleType!=NLH_CONNECTION || nlc->s==INVALID_SOCKET) {
-					ReleaseMutex(hConnectionHeaderMutex);
-					SetLastError(ERROR_INVALID_PARAMETER);	  //already been closed
-					return 0;
-				}
-				closesocket(nlc->s);
-				nlc->s=INVALID_SOCKET;
+			if (nlc->usingHttpGateway)
+			{
+				struct NetlibHTTPProxyPacketQueue *p = nlc->pHttpProxyPacketQueue;
+				while (p != NULL) {
+					struct NetlibHTTPProxyPacketQueue *t = p;
+
+					p = p->next;
+
+					mir_free(t->dataBuffer);
+					mir_free(t);
+				}
 			}
+			else
+			{
+				if(nlc->handleType!=NLH_CONNECTION || nlc->s==INVALID_SOCKET) {
+					ReleaseMutex(hConnectionHeaderMutex);
+					SetLastError(ERROR_INVALID_PARAMETER);	  //already been closed
+					return 0;
+				}
+				closesocket(nlc->s);
+				nlc->s=INVALID_SOCKET;
+			}
 			ReleaseMutex(hConnectionHeaderMutex);
 
 			waitHandles[0]=hConnectionHeaderMutex;
@@ -448,7 +448,7 @@
 {
 	int i;
 	
-	NetlibUPnPDestroy();
+	NetlibUPnPDestroy();
 	NetlibLogShutdown();
 	for(i=netlibUserCount;i>0;i--)
 		NetlibCloseHandle((WPARAM)netlibUser[i-1],0);
@@ -469,6 +469,8 @@
 {
 	WSADATA wsadata;
 
+	SetConsoleCtrlHandler(NULL,TRUE); /* kill evil ctrl+c */
+
 	//HookEvent(ME_SYSTEM_SHUTDOWN,NetlibShutdown); // hooked later to be called last after plugins
 	HookEvent(ME_SYSTEM_MODULESLOADED, NetlibModulesLoaded);
 	HookEvent(ME_OPT_INITIALISE,NetlibOptInitialise);
@@ -500,7 +502,19 @@
 	CreateServiceFunction(MS_NETLIB_CREATEPACKETRECVER,NetlibPacketRecverCreate);
 	CreateServiceFunction(MS_NETLIB_GETMOREPACKETS,NetlibPacketRecverGetMore);
 	CreateServiceFunction(MS_NETLIB_SETPOLLINGTIMEOUT,NetlibHttpSetPollingTimeout);	
-
-	NetlibUPnPInit();
+	CreateServiceFunction("Netlib/ShowHideConsole",NetLibShowHideConsole);
+	if (! DBGetContactSettingByte(NULL,"Netlib","DisableMenuItem",0)){
+		CLISTMENUITEM mi;
+
+		ZeroMemory(&mi,sizeof(mi));
+		mi.cbSize=sizeof(mi);
+		mi.flags=0;
+		mi.hIcon=LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_MIRANDA));
+		mi.position=1900000000;
+		mi.pszName=Translate("&Console");
+		mi.pszService="Netlib/ShowHideConsole";
+		CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
+	}
+	NetlibUPnPInit();
 	return 0;
-}
+}
Index: modules/netlib/netlibopenconn.c
===================================================================
--- modules/netlib/netlibopenconn.c	(revision 4046)
+++ modules/netlib/netlibopenconn.c	(working copy)
@@ -22,6 +22,7 @@
 */
 #include "commonheaders.h"
 #include "netlib.h"
+#define FILENAME "netlibopenconn.c"
 
 extern CRITICAL_SECTION csNetlibUser;
 extern DWORD g_LastConnectionTick; // protected by csNetlibUser
@@ -36,7 +37,7 @@
 	if(ip!=INADDR_NONE) return ip;
 	host=gethostbyname(szHost);
 	if(host) return *(u_long *)host->h_addr_list[0];
-	Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"gethostbyname",WSAGetLastError());
+	Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"gethostbyname",WSAGetLastError());
 	return 0;
 }
 
@@ -107,14 +108,14 @@
 		len=9+nUserLen;
 	}
 	if(NLSend(nlc,pInit,len,MSG_DUMPPROXY)==SOCKET_ERROR) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLSend",GetLastError());
 		mir_free(pInit);
 		return 0;
 	}
 	mir_free(pInit);
 
 	if(!WaitUntilReadable(nlc->s,30000)) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"WaitUntilReadable",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"WaitUntilReadable",GetLastError());
 		return 0;
 	}
 
@@ -129,7 +130,7 @@
 				default: SetLastError(ERROR_INVALID_DATA); break;
 			}
 		}
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLRecv",GetLastError());
 		return 0;
 	}
 	//connected
@@ -145,12 +146,12 @@
 	buf[1]=1;  //one auth method
 	buf[2]=nlu->settings.useProxyAuth?2:0;
 	if(NLSend(nlc,buf,3,MSG_DUMPPROXY)==SOCKET_ERROR) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLSend",GetLastError());
 		return 0;
 	}
 
 	if(!WaitUntilReadable(nlc->s,10000)) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"WaitUntilReadable",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"WaitUntilReadable",GetLastError());
 		return 0;
 	}
 
@@ -160,7 +161,7 @@
 			if(len<2) SetLastError(ERROR_BAD_FORMAT);
 			else SetLastError(ERROR_INVALID_ID_AUTHORITY);
 		}
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLRecv",GetLastError());
 		return 0;
 	}
 
@@ -177,14 +178,14 @@
 		pAuthBuf[2+nUserLen]=nPassLen;
 		memcpy(pAuthBuf+3+nUserLen,nlu->settings.szProxyAuthPassword,nPassLen);
 		if(NLSend(nlc,pAuthBuf,3+nUserLen+nPassLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
-			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLSend",GetLastError());
 			mir_free(pAuthBuf);
 			return 0;
 		}
 		mir_free(pAuthBuf);
 
 		if(!WaitUntilReadable(nlc->s,10000)) {
-			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"WaitUntilReadable",GetLastError());
+			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"WaitUntilReadable",GetLastError());
 			return 0;
 		}
 
@@ -194,7 +195,7 @@
 				if(len<2) SetLastError(ERROR_BAD_FORMAT);
 				else SetLastError(ERROR_ACCESS_DENIED);
 			}
-			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError());
+			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLRecv",GetLastError());
 			return 0;
 		}
 	}
@@ -228,7 +229,7 @@
 		}
 		*(PWORD)(pInit+4+nHostLen)=htons(nloc->wPort);
 		if(NLSend(nlc,pInit,6+nHostLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
-			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
+			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLSend",GetLastError());
 			mir_free(pInit);
 			return 0;
 		}
@@ -236,7 +237,7 @@
 	}
 
 	if(!WaitUntilReadable(nlc->s,30000)) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"WaitUntilReadable",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"WaitUntilReadable",GetLastError());
 		return 0;
 	}
 
@@ -256,7 +257,7 @@
 				default: SetLastError(ERROR_INVALID_DATA); break;
 			}
 		}
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"NLRecv",GetLastError());
 		return 0;
 	}
 	//connected
@@ -273,7 +274,7 @@
 
 	nlhrSend.cbSize=sizeof(nlhrSend);
 	nlhrSend.requestType=REQUEST_CONNECT;
-	nlhrSend.flags=NLHRF_DUMPPROXY|NLHRF_SMARTAUTHHEADER|NLHRF_HTTP11;
+	nlhrSend.flags=NLHRF_DUMPPROXY|NLHRF_SMARTAUTHHEADER|NLHRF_HTTP11;
 	if(nlu->settings.dnsThroughProxy) {
 		mir_snprintf(szUrl,SIZEOF(szUrl),"%s:%u",nloc->szHost,nloc->wPort);
 		if(inet_addr(nloc->szHost)==INADDR_NONE) {
@@ -298,7 +299,7 @@
 	if(nlhrReply==NULL) return 0;
 	if(nlhrReply->resultCode<200 || nlhrReply->resultCode>=300) {
 		NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
-		Netlib_Logf(nlu,"%s %d: %s request failed (%u %s)",__FILE__,__LINE__,nlu->settings.proxyType==PROXYTYPE_HTTP?"HTTP":"HTTPS",nlhrReply->resultCode,nlhrReply->szResultDescr);
+		Netlib_Logf(nlu,"%s %d: %s request failed (%u %s)",FILENAME,__LINE__,nlu->settings.proxyType==PROXYTYPE_HTTP?"HTTP":"HTTPS",nlhrReply->resultCode,nlhrReply->szResultDescr);
 		NetlibHttpFreeRequestStruct(0,(LPARAM)nlhrReply);
 		return 0;
 	}
@@ -434,7 +435,7 @@
 	nlc->nlu=nlu;
 	nlc->s=socket(AF_INET,SOCK_STREAM,0);
 	if(nlc->s==INVALID_SOCKET) {
-		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"socket",WSAGetLastError());
+		Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"socket",WSAGetLastError());
 		mir_free(nlc);
 		return (int)(HANDLE)NULL;
 	}
@@ -492,7 +493,7 @@
 	if(nlc->sinProxy.sin_addr.S_un.S_addr==0
 	   || my_connect(nlc->s,(SOCKADDR *)&nlc->sinProxy,sizeof(nlc->sinProxy), nloc)==SOCKET_ERROR) {
 		if(nlc->sinProxy.sin_addr.S_un.S_addr)
-			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"connect",WSAGetLastError());
+			Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"connect",WSAGetLastError());
 		FreePartiallyInitedConnection(nlc);		
 		return (int)(HANDLE)NULL;
 	}
@@ -546,7 +547,7 @@
 						if(nlc->sinProxy.sin_addr.S_un.S_addr==0
 						   || my_connect(nlc->s,(SOCKADDR *)&nlc->sinProxy,sizeof(nlc->sinProxy), nloc)==SOCKET_ERROR) {
 							if(nlc->sinProxy.sin_addr.S_un.S_addr)
-								Netlib_Logf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"connect",WSAGetLastError());
+								Netlib_Logf(nlu,"%s %d: %s() failed (%u)",FILENAME,__LINE__,"connect",WSAGetLastError());
 							FreePartiallyInitedConnection(nlc);
 							return (int)(HANDLE)NULL;
 						}
Index: version.rc
===================================================================
--- version.rc	(revision 4046)
+++ version.rc	(working copy)
@@ -32,7 +32,7 @@
             VALUE "PrivateBuild", "\0"                                        
             VALUE "ProductName", "Miranda IM\0"                               
             VALUE "ProductVersion", "0.6 alpha build #14\0"                 
-            VALUE "SpecialBuild", "\0"                                        
+            VALUE "SpecialBuild", "YB\0"                                        
         END                                                                   
     END                                                                       
     BLOCK "VarFileInfo"                                                       
Index: resource.rc
===================================================================
--- resource.rc	(revision 4046)
+++ resource.rc	(working copy)
@@ -125,7 +125,7 @@
     EDITTEXT        IDC_BUILDTIME,4,91,146,12,ES_AUTOHSCROLL | ES_READONLY | 
                     NOT WS_BORDER
     PUSHBUTTON      "Credits >",IDC_CONTRIBLINK,5,112,55,14
-    LTEXT           "Version",IDC_VERSION,5,25,150,15
+    LTEXT           "Version",IDC_VERSION,5,25,200,15
     EDITTEXT        IDC_CREDITSFILE,4,44,202,56,ES_CENTER | ES_MULTILINE | 
                     ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | NOT 
                     WS_BORDER | WS_VSCROLL
@@ -543,7 +543,7 @@
     PUSHBUTTON      "&Leave",IDC_LEAVE,131,36,50,14
 END
 
-IDD_NETLIBLOGOPTS DIALOGEX 0, 0, 261, 201
+IDD_NETLIBLOGOPTS DIALOGEX 0, 0, 261, 206
 STYLE DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | 
     WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_CONTROLPARENT
@@ -567,6 +567,11 @@
     CONTROL         "Calling modules' names",IDC_SHOWNAMES,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,13,66,234,10
     GROUPBOX        "Log to",IDC_STATIC,5,87,250,43
+    PUSHBUTTON      "Show/Hide console",IDC_SHOWCONSOLE,70,186,70,14
+    PUSHBUTTON      "Clear console",IDC_CLEARCONSOLE,144,186,56,14
+    CONTROL         "Disable Console menu item (Restart required)", 
+                    IDC_DISABLECONSOLEMENUITEM,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,5,145,250,10 
     CONTROL         "OutputDebugString()",IDC_TOOUTPUTDEBUGSTRING,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,13,100,122,10
     CONTROL         "File",IDC_TOFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
@@ -577,26 +582,14 @@
                     IDC_SHOWTHISDLGATSTART,"Button",BS_AUTOCHECKBOX | 
                     WS_TABSTOP,5,135,250,10
     LTEXT           "Run programme when Miranda IM starts (eg tail -f, dbgview, etc):",
-                    IDC_STATIC,5,147,250,8
-    EDITTEXT        IDC_RUNATSTART,13,158,170,12,ES_AUTOHSCROLL
-    PUSHBUTTON      "...",IDC_RUNATSTARTBROWSE,186,158,15,12
-    PUSHBUTTON      "Run now",IDC_RUNNOW,205,158,42,12
-    PUSHBUTTON      "Save as default",IDC_SAVE,5,182,77,14
-    DEFPUSHBUTTON   "Close",IDOK,205,182,50,14
+                    IDC_STATIC,5,156,250,8
+    EDITTEXT        IDC_RUNATSTART,13,168,170,12,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_RUNATSTARTBROWSE,186,168,15,12
+    PUSHBUTTON      "Run now",IDC_RUNNOW,205,168,42,12
+    PUSHBUTTON      "Save as default",IDC_SAVE,5,186,61,14
+    DEFPUSHBUTTON   "Close",IDOK,204,186,50,14
 END
 
-IDD_HISTORY_FIND DIALOGEX 0, 0, 230, 46
-STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Find"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-    EDITTEXT        IDC_FINDWHAT,48,11,115,12,ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "&Find Next",IDOK,173,7,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,173,24,50,14
-    LTEXT           "Find What:",IDC_STATIC,7,13,39,9
-END
-
 IDD_FILESEND DIALOGEX 0, 0, 256, 177
 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | 
     WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | 
@@ -805,22 +798,6 @@
                     ES_READONLY | WS_VSCROLL
 END
 
-IDD_HISTORY DIALOGEX 0, 0, 296, 166
-STYLE DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | 
-    WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
-EXSTYLE WS_EX_CONTROLPARENT
-CAPTION "Message History"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-    DEFPUSHBUTTON   "Close",IDOK,239,144,50,14
-    EDITTEXT        IDC_EDIT,7,83,282,52,ES_MULTILINE | ES_AUTOVSCROLL | 
-                    ES_READONLY | WS_VSCROLL
-    LISTBOX         IDC_LIST,7,7,282,72,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | 
-                    WS_TABSTOP
-    PUSHBUTTON      "&Find...",IDC_FIND,7,144,50,14
-    PUSHBUTTON      "Delete",IDC_DELETEHISTORY,66,144,50,14
-END
-
 IDD_OPT_SOUND DIALOGEX 0, 0, 285, 240
 STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
 EXSTYLE WS_EX_CONTROLPARENT
@@ -1068,43 +1045,6 @@
                     IDC_STATIC,93,27,167,11,WS_DISABLED
 END
 
-IDD_OPT_IDLE DIALOGEX 0, 0, 312, 172
-STYLE DS_FIXEDSYS | WS_CHILD | WS_BORDER
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
-    CONTROL         "Become idle if the following is left unattended:",
-                    IDC_IDLESHORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,
-                    18,259,9
-    CONTROL         "Windows",IDC_IDLEONWINDOWS,"Button",BS_AUTORADIOBUTTON,
-                    45,31,104,9
-    CONTROL         "Miranda",IDC_IDLEONMIRANDA,"Button",BS_AUTORADIOBUTTON,
-                    45,43,103,9
-    EDITTEXT        IDC_IDLE1STTIME,59,59,27,14,ES_AUTOHSCROLL | ES_NUMBER
-    CONTROL         "Spin2",IDC_IDLESPIN,"msctls_updown32",UDS_WRAP | 
-                    UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | 
-                    UDS_NOTHOUSANDS | UDS_HOTTRACK,71,55,12,23
-    CONTROL         "Become idle if the screen saver is active",
-                    IDC_SCREENSAVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,
-                    83,268,9
-    CONTROL         "Become idle if the computer is locked (2000/XP+ only)",
-                    IDC_LOCKED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,99,
-                    249,9
-    CONTROL         "Do not let protocols report any idle information",
-                    IDC_IDLEPRIVATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,
-                    115,251,9
-    LTEXT           "minute(s)",IDC_STATIC,91,61,76,9
-    RTEXT           "for",IDC_STATIC,12,59,41,9
-    COMBOBOX        IDC_AASTATUS,128,130,64,50,CBS_DROPDOWNLIST | WS_VSCROLL | 
-                    WS_TABSTOP
-    CONTROL         "Change my status mode to:",IDC_AASHORTIDLE,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,25,131,101,11
-    CONTROL         "Do not set status back to online when returning from idle",
-                    IDC_IDLESTATUSLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    35,148,246,10
-    GROUPBOX        "Idle Options",IDC_STATIC,3,3,304,165
-END
-
 IDD_PROFILE_SELECTION DIALOGEX 0, 0, 386, 142
 STYLE DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
 EXSTYLE WS_EX_CONTROLPARENT
@@ -1398,15 +1338,6 @@
         BOTTOMMARGIN, 196
     END
 
-    IDD_HISTORY_FIND, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 223
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 39
-        HORZGUIDE, 17
-    END
-
     IDD_FILESEND, DIALOG
     BEGIN
         LEFTMARGIN, 5
@@ -1461,14 +1392,6 @@
         BOTTOMMARGIN, 135
     END
 
-    IDD_HISTORY, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 289
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 158
-    END
-
     IDD_OPT_SOUND, DIALOG
     BEGIN
         LEFTMARGIN, 4
@@ -1761,6 +1684,7 @@
 //
 #include "version.rc"
 
+#include "saa-res.rc"
 
 /////////////////////////////////////////////////////////////////////////////
 #endif    // not APSTUDIO_INVOKED
Index: resource.h
===================================================================
--- resource.h	(revision 4046)
+++ resource.h	(working copy)
@@ -1,3 +1,6 @@
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0501
+#endif
 //{{NO_DEPENDENCIES}}
 // Microsoft Developer Studio generated include file.
 // Used by resource.rc
@@ -15,7 +18,6 @@
 #define IDD_URLRECV                     120
 #define IDD_AUTHREQ                     121
 #define IDD_DETAILS                     125
-#define IDD_HISTORY                     127
 #define IDI_AWAY                        128
 #define IDI_FREE4CHAT                   129
 #define IDI_INVISIBLE                   130
@@ -36,7 +38,6 @@
 #define IDI_DELETE                      175
 #define IDR_CONTEXT                     180
 #define IDC_DROP                        183
-#define IDD_HISTORY_FIND                192
 #define IDI_SENDEMAIL                   193
 #define IDD_FILERECV                    194
 #define IDD_PROFILEMANAGER              197
@@ -271,6 +272,9 @@
 #define IDC_PORTSRANGE                  1450
 #define IDC_STATIC53                    1451
 #define IDC_PORTSRANGEO                 1452
+#define IDC_SHOWCONSOLE                 1454
+#define IDC_CLEARCONSOLE                1457
+#define IDC_DISABLECONSOLEMENUITEM      1472
 #define IDC_STATIC54                    1453
 #define IDC_TOOUTPUTDEBUGSTRING         1455
 #define IDC_TOFILE                      1456
