summary refs log blame commit diff stats
path: root/xchat-wdk.patch
blob: d04ef181fdd2712d014f07a80b9c21ba843b34fb (plain) (tree)
1
2
3
4
5
6
7
8
                                                                                              

                                                                 
                   



                       


                    

                     
                     


















                                                                                                   
                                                                                   
                                                                                                                                                     
                                                                                                

                                                                                                                              
                                                                                                                            

                                 
                                                                                                      

                                                                         
                   
 










                                     
                 



                                                                 
                                                            


                      
                      


























                                                                                                           
                     







                                                                  
                                                                                                      

                                                                         








                                                                








                                                                                                                                                                                                         
                                                                                              

                                                                 












                                                   
                                                                                                  

                                                                         







                    


                  
                    
                      
 



                             

                            

                               


                     


                                     
                                             













                                                                                                 


                       








                                                                               


                                  
                             


                                   
                                                                                                

                                                                 







                       
                                                                                          

                                                                 







                    
                   



                                                                                        
                                                                                                                


                                                         
                                                                                        

                                                                 
















                                                                                            
                                                                                              

                                                                 







                       
                                                                                                

                                                                 







                       
                                                                                          

                                                                 










                                   
                                                                                                

                                                                 







                    
                                                                                                

                                                                 







                                                                                                 
                                                                                              

                                                                 







                       
                                                                                                  

                                                                         







                      
                                                                                                          

                                                                         









                                                                                              

                                                                 








                                      








                                                                                                            
                                                                                                    

                                                                         







                                                                     
                                                                                              

                                                                 







                    

                     
             






                                                                     
         




                                                                                        

  
                                                                                                  

                                                                         







                        
                                                                                        

                                                                 
                   


                                                                             
                                                                                                  


                                                                         





                                                                                
                                                                                          

                                                                 













                        






                                


                                                 

                     

                       




































                                                                          
 

                                    


                                                                                    
                                      


                   
                                                                                          

                                                                 

                                                                             

    


                                                                                                
                                       






                             
                 







                         










                                                   










                            
                     



































                                                                                                      
                                                                                            

                                                                 







                       








                          
                   

                                                             
                                                                



                                                                    
                                                                                            

                                                                 






                            




                              
       


                 
                 







                                                                       







                                                              
                                                                                            

                                                                 
                 






                                
                     



                                                                                                           
             
                                                                                           
                                                                                           
       
                                                              

                                                     

                                                         
                                                               
                                                              

                                                                                                            
                                               



                                                  
                                                                 






                                                                 
                                                                                                                   





                                                                        
                                                         

                                                                
                                               
                                       
               











                                                                      
                                                                                                
                                                                 
                                                                 
                 






                    
                                                                                                  

                                                                         







                    


























                                                                                                    
                                                                                                  
                                                                         
                                                                 







                       




































                                                                                                           
                                                                                              

                                                                 
                 






                    
                 







                                  
                 






                                








                                                           
                                                                                              

                                                                 

                                                                     


                                                                   



                                 
                                                                                            
                                                                 
                                                                 







                       



























                                                                                                    
                                                                                                

                                                                 







                       
                                                                                            

                                                                 







                       
                                                                                                

                                                                 








































































































                                                                                               
                                                                                          

                                                                 
                 






                     
                                                                                                

                                                                 
                 






                       
                                                                                                        

                                                                         
               



                                             

                                    

                              
                               












                                                                                                








                                                                    









































































                                                                                                                             








                                                                                   








                                                                           
                                                                                                    

                                                                         








                                      
                                                                                              
                                                                 
                                                                 
                 






                    













                                                                                                        
                                                                 





























































                                                                                                             








                                                                                      








                                                                                                                  
                                                                                            
                                                                 
                                                                 








                                     






                                                       
                   






                                          
                     







                                    
                     






                                                                               

















                                                                        
                     



                                                                

                                                                                        


                                  
                                                                                                                  

                                                                                 




















                                                                         






































                                                                                                   
                                                                                            

                                                                 







                              
                                                                                                  

                                                                         










































































                                                                                         
diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/perl/perl.c xchat-wdk/plugins/perl/perl.c
--- xchat-wdk.orig/plugins/perl/perl.c	2010-08-26 02:18:04 +0000
+++ xchat-wdk/plugins/perl/perl.c	2010-09-22 15:30:07 +0000
@@ -22,12 +22,15 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <dirent.h>
 #ifdef ENABLE_NLS
 #include <locale.h>
 #endif
 #ifdef WIN32
 #include <windows.h>
+#define  _INC_DIRENT
+#include "../../src/common/dirent.h"
+#else
+#include <dirent.h>
 #endif
 
 #undef PACKAGE
@@ -1339,7 +1342,11 @@
 			if (GetLastError () == ERROR_BAD_EXE_FORMAT)
 				/* http://forum.xchat.org/viewtopic.php?t=3277 */
 				thread_mbox ("Cannot use this " PERL_DLL "\n\n"
+#ifdef _WIN64
+								 "64-bit ActivePerl is required.");
+#else
 								 "32-bit ActivePerl is required.");
+#endif
 			else {
 				/* a lot of people install this old version */
 				lib = LoadLibraryA ("perl56.dll");
@@ -1354,7 +1361,7 @@
 					thread_mbox ("Cannot open " PERL_DLL "\n\n"
 									 "You must have ActivePerl " PERL_REQUIRED_VERSION " installed in order to\n"
 									 "run perl scripts.\n\n"
-									 "http://www.activestate.com/ActivePerl/\n\n"
+									 "http://www.activestate.com/activeperl/downloads\n\n"
 									 "Make sure perl's bin directory is in your PATH.");
 				}
 			}
diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/python/python.c xchat-wdk/plugins/python/python.c
--- xchat-wdk.orig/plugins/python/python.c	2010-05-16 04:31:54 +0000
+++ xchat-wdk/plugins/python/python.c	2010-09-22 15:30:07 +0000
@@ -53,10 +53,10 @@
 
 #include <glib.h>
 #include <string.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <sys/types.h>
-#include <dirent.h>
+#include "../../src/common/dirent.h"
+#include "../../config.h"
 
 #include "xchat-plugin.h"
 #include "Python.h"
@@ -68,7 +68,7 @@
 
 #ifdef WIN32
 #undef WITH_THREAD /* Thread support locks up xchat on Win32. */
-#define VERSION "0.8/2.4"	/* Linked to python24.dll */
+#define VERSION "0.8/2.6"	/* Linked to python26.dll */
 #else
 #define VERSION "0.8"
 #endif
@@ -1161,6 +1161,27 @@
 	PyObject_SetAttrString(m, "__version__", o);
 
 	if (filename) {
+#ifdef WIN32
+		/*	more info: 
+		 *	http://bytes.com/topic/python/answers/840542-pyrun_simplefile-crashes#post3364174
+		 *	http://effbot.org/pyfaq/pyrun-simplefile-crashes-on-windows-but-not-on-unix-why.htm
+		 */
+		PyObject* PyFileObject = PyFile_FromString(filename, "r");
+		if (PyFileObject == NULL) {
+			xchat_printf(ph, "Can't open file %s: %s\n",
+				     filename, strerror(errno));
+			goto error;
+		}
+
+		if (PyRun_SimpleFile(PyFile_AsFile(PyFileObject), filename) != 0) {
+			xchat_printf(ph, "Error loading module %s\n",
+				     filename);
+			goto error;
+		}
+
+		plugin->filename = filename;
+		filename = NULL;
+#else
 		FILE *fp;
 
 		plugin->filename = filename;
@@ -1184,7 +1205,7 @@
 			goto error;
 		}
 		fclose(fp);
-
+#endif
 		m = PyDict_GetItemString(PyImport_GetModuleDict(),
 					 "__main__");
 		if (m == NULL) {
diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/tcl/tclplugin.c xchat-wdk/plugins/tcl/tclplugin.c
--- xchat-wdk.orig/plugins/tcl/tclplugin.c	2010-03-21 00:49:42 +0000
+++ xchat-wdk/plugins/tcl/tclplugin.c	2010-09-22 15:30:07 +0000
@@ -32,8 +32,6 @@
 #include <windows.h>
 #define bzero(mem, sz) memset((mem), 0, (sz))
 #define bcopy(src, dest, count) memmove((dest), (src), (count))
-#else
-#include <unistd.h>
 #endif
 
 #include "xchat-plugin.h"
@@ -2221,7 +2219,7 @@
 #ifdef WIN32
     lib = LoadLibraryA(TCL_DLL);
     if (!lib) {
-        xchat_print(ph, "You must have ActiveTCL installed in order to run Tcl scripts.\n" "http://aspn.activestate.com/ASPN/Tcl/\n" "Make sure Tcl's bin directory is in your PATH.\n\n");
+        xchat_print(ph, "You must have ActiveTCL 8.5 installed in order to run Tcl scripts.\n" "http://www.activestate.com/activetcl/downloads\n" "Make sure Tcl's bin directory is in your PATH.\n\n");
         return 0;
     }
     FreeLibrary(lib);
diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xdcc/xdcc.c xchat-wdk/plugins/xdcc/xdcc.c
--- xchat-wdk.orig/plugins/xdcc/xdcc.c	2002-12-26 03:35:09 +0000
+++ xchat-wdk/plugins/xdcc/xdcc.c	2010-09-22 15:30:07 +0000
@@ -2,11 +2,11 @@
 
 #include <glib.h>
 #include <string.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 
 #include "xchat-plugin.h"
+#include "../../src/common/xchat.h"
 
 static xchat_plugin *ph;	/* plugin handle */
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/cfgfiles.c xchat-wdk/src/common/cfgfiles.c
--- xchat-wdk.orig/src/common/cfgfiles.c	2010-08-07 07:14:45 +0000
+++ xchat-wdk/src/common/cfgfiles.c	2010-09-22 15:30:07 +0000
@@ -17,7 +17,6 @@
  */
 
 #include <fcntl.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -30,10 +29,9 @@
 #include "fe.h"
 #include "text.h"
 #include "xchatc.h"
+#include "portable.h"
 
-#ifdef WIN32
-#define XCHAT_DIR "X-Chat 2"
-#else
+#ifndef WIN32
 #define XCHAT_DIR ".xchat2"
 #endif
 #define DEF_FONT "Monospace 9"
@@ -308,12 +306,19 @@
 {
 	if (!xdir_fs)
 	{
-		char out[256];
+		if (portable_mode ())
+		{
+			xdir_fs = "./config";
+		}
+		else
+		{
+			char out[256];
 
-		if (!get_reg_str ("Software\\Microsoft\\Windows\\CurrentVersion\\"
-				"Explorer\\Shell Folders", "AppData", out, sizeof (out)))
-			return "./config";
-		xdir_fs = g_strdup_printf ("%s\\" XCHAT_DIR, out);
+			if (!get_reg_str ("Software\\Microsoft\\Windows\\CurrentVersion\\"
+					"Explorer\\Shell Folders", "AppData", out, sizeof (out)))
+				return "./config";
+			xdir_fs = g_strdup_printf ("%s\\" "X-Chat 2", out);
+		}
 	}
 	return xdir_fs;
 }
@@ -461,6 +466,7 @@
 
 #ifdef WIN32
 	{"identd", P_OFFINT (identd), TYPE_BOOL},
+	{"text_emoticons", P_OFFINT (emoticons), TYPE_BOOL},
 #endif
 	{"input_balloon_chans", P_OFFINT (input_balloon_chans), TYPE_BOOL},
 	{"input_balloon_hilight", P_OFFINT (input_balloon_hilight), TYPE_BOOL},
@@ -648,6 +654,7 @@
 	prefs.dialog_height = 256;
 	prefs.gui_join_dialog = 1;
 	prefs.gui_quit_dialog = 1;
+	prefs.slist_skip = 1;
 	prefs.dcctimeout = 180;
 	prefs.dccstalltimeout = 60;
 	prefs.notify_timeout = 15;
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/chanopt.c xchat-wdk/src/common/chanopt.c
--- xchat-wdk.orig/src/common/chanopt.c	2008-06-15 04:40:29 +0000
+++ xchat-wdk/src/common/chanopt.c	2010-09-22 15:30:07 +0000
@@ -3,7 +3,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/ctcp.c xchat-wdk/src/common/ctcp.c
--- xchat-wdk.orig/src/common/ctcp.c	2010-05-30 02:28:04 +0000
+++ xchat-wdk/src/common/ctcp.c	2010-09-22 15:30:07 +0000
@@ -18,7 +18,6 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <stdlib.h>
 
 #include "xchat.h"
@@ -134,7 +133,7 @@
 
 	if (!strcasecmp (msg, "VERSION") && !prefs.hidever)
 	{
-		snprintf (outbuf, sizeof (outbuf), "VERSION xchat "PACKAGE_VERSION" %s",
+		snprintf (outbuf, sizeof (outbuf), "VERSION xchat-wdk "PACKAGE_VERSION" ("PACKAGE_TARNAME") %s",
 					 get_cpu_str ());
 		serv->p_nctcp (serv, nick, outbuf);
 	}
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/dcc.c xchat-wdk/src/common/dcc.c
--- xchat-wdk.orig/src/common/dcc.c	2010-05-30 02:28:04 +0000
+++ xchat-wdk/src/common/dcc.c	2010-09-22 15:30:07 +0000
@@ -31,7 +31,6 @@
 #include <time.h>
 #include <errno.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <fcntl.h>
 
 #define WANTSOCKET
@@ -1984,7 +1983,7 @@
 
 	/* now handle case-insensitive Filesystems: HFS+, FAT */
 #ifdef WIN32
-#warning no win32 implementation - behaviour may be unreliable
+/* warning no win32 implementation - behaviour may be unreliable */
 #else
 	/* this fstat() shouldn't really fail */
 	if ((dcc->fp == -1 ? stat (dcc->destfile_fs, &st_a) : fstat (dcc->fp, &st_a)) == -1)
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/ignore.c xchat-wdk/src/common/ignore.c
--- xchat-wdk.orig/src/common/ignore.c	2006-04-15 07:00:39 +0000
+++ xchat-wdk/src/common/ignore.c	2010-09-22 15:30:07 +0000
@@ -19,7 +19,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/inbound.c xchat-wdk/src/common/inbound.c
--- xchat-wdk.orig/src/common/inbound.c	2010-05-30 02:28:04 +0000
+++ xchat-wdk/src/common/inbound.c	2010-09-22 15:30:07 +0000
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/types.h>
-#include <unistd.h>
 #include <time.h>
 
 #define WANTARPA
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/inet.h xchat-wdk/src/common/inet.h
--- xchat-wdk.orig/src/common/inet.h	2005-09-03 10:57:48 +0000
+++ xchat-wdk/src/common/inet.h	2010-09-22 15:30:07 +0000
@@ -24,9 +24,8 @@
 #ifdef USE_IPV6
 #include <winsock2.h>
 #include <ws2tcpip.h>
-#include <tpipv6.h>
 #else
-#include <winsock.h>
+#include <winsock2.h>
 #endif
 
 #define set_blocking(sok)	{ \
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/msproxy.c xchat-wdk/src/common/msproxy.c
--- xchat-wdk.orig/src/common/msproxy.c	2006-04-16 15:32:17 +0000
+++ xchat-wdk/src/common/msproxy.c	2010-09-22 15:30:07 +0000
@@ -26,7 +26,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <fcntl.h>
 
 #define WANTSOCKET
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/network.c xchat-wdk/src/common/network.c
--- xchat-wdk.orig/src/common/network.c	2006-04-16 08:11:26 +0000
+++ xchat-wdk/src/common/network.c	2010-09-22 15:30:07 +0000
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <glib.h>
 
 #include "../../config.h"				  /* grab USE_IPV6 and LOOKUPD defines */
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/notify.c xchat-wdk/src/common/notify.c
--- xchat-wdk.orig/src/common/notify.c	2008-06-08 07:58:58 +0000
+++ xchat-wdk/src/common/notify.c	2010-09-22 15:30:07 +0000
@@ -22,7 +22,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <time.h>
 
 #include "xchat.h"
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/outbound.c xchat-wdk/src/common/outbound.c
--- xchat-wdk.orig/src/common/outbound.c	2010-05-30 02:28:04 +0000
+++ xchat-wdk/src/common/outbound.c	2010-09-22 15:30:07 +0000
@@ -32,7 +32,6 @@
 #include <sys/wait.h>
 #endif
 
-#include <unistd.h>
 #include <time.h>
 #include <signal.h>
 #include <sys/stat.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/plugin-timer.c xchat-wdk/src/common/plugin-timer.c
--- xchat-wdk.orig/src/common/plugin-timer.c	2005-02-02 10:03:51 +0000
+++ xchat-wdk/src/common/plugin-timer.c	2010-09-22 15:30:07 +0000
@@ -1,7 +1,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
-#include "xchat-plugin.h"
+#include <xchat-plugin.h>
 
 #ifdef WIN32
 #define strcasecmp stricmp
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/plugin.c xchat-wdk/src/common/plugin.c
--- xchat-wdk.orig/src/common/plugin.c	2010-08-14 01:46:21 +0000
+++ xchat-wdk/src/common/plugin.c	2010-09-22 15:30:07 +0000
@@ -34,7 +34,7 @@
 #include "text.h"
 #define PLUGIN_C
 typedef struct session xchat_context;
-#include "xchat-plugin.h"
+#include <xchat-plugin.h>
 #include "plugin.h"
 
 
@@ -1212,7 +1212,7 @@
 	static const char * const dcc_fields[] =
 	{
 		"iaddress32","icps",		"sdestfile","sfile",		"snick",	"iport",
-		"ipos", "iposhigh", "iresume", "iresumehigh" "isize", "isizehigh", "istatus", "itype", NULL
+		"ipos", "iposhigh", "iresume", "iresumehigh", "isize", "isizehigh", "istatus", "itype", NULL
 	};
 	static const char * const channels_fields[] =
 	{
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/proto-irc.c xchat-wdk/src/common/proto-irc.c
--- xchat-wdk.orig/src/common/proto-irc.c	2010-05-30 02:28:04 +0000
+++ xchat-wdk/src/common/proto-irc.c	2010-09-22 15:30:07 +0000
@@ -18,7 +18,6 @@
 
 /* IRC RFC1459(+commonly used extensions) protocol implementation */
 
-#include <unistd.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/server.c xchat-wdk/src/common/server.c
--- xchat-wdk.orig/src/common/server.c	2010-05-30 02:28:04 +0000
+++ xchat-wdk/src/common/server.c	2010-09-22 15:30:07 +0000
@@ -26,7 +26,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
 
@@ -1390,7 +1389,7 @@
 {
 #ifdef WIN32
 	/* make sure waitline() uses recv() or it'll fail on win32 */
-	len = waitline (sok, buf, len, FALSE);
+	len = waitline (sok, buf, len, TRUE);
 #else
 	len = waitline (sok, buf, len, TRUE);
 #endif
@@ -1738,7 +1737,7 @@
 	}
 #endif
 	serv->childpid = pid;
-	serv->iotag = fe_input_add (serv->childread, FIA_READ, server_read_child,
+	serv->iotag = fe_input_add (serv->childread, FIA_READ|FIA_FD, server_read_child,
 										 serv);
 }
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/servlist.c xchat-wdk/src/common/servlist.c
--- xchat-wdk.orig/src/common/servlist.c	2010-05-16 07:43:49 +0000
+++ xchat-wdk/src/common/servlist.c	2010-09-22 15:30:07 +0000
@@ -21,7 +21,6 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 
 #include "xchat.h"
 #include <glib/ghash.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/ssl.c xchat-wdk/src/common/ssl.c
--- xchat-wdk.orig/src/common/ssl.c	2007-03-28 08:35:06 +0000
+++ xchat-wdk/src/common/ssl.c	2010-09-22 15:30:07 +0000
@@ -17,12 +17,12 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#include "inet.h"				  /* make it first to avoid macro redefinitions */
 #include <openssl/ssl.h>		  /* SSL_() */
 #include <openssl/err.h>		  /* ERR_() */
 #include <time.h>					  /* asctime() */
 #include <string.h>				  /* strncpy() */
 #include "ssl.h"					  /* struct cert_info */
-#include "inet.h"
 #include "../../config.h"		  /* HAVE_SNPRINTF */
 
 #ifndef HAVE_SNPRINTF
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/text.c xchat-wdk/src/common/text.c
--- xchat-wdk.orig/src/common/text.c	2010-05-30 02:28:04 +0000
+++ xchat-wdk/src/common/text.c	2010-09-22 15:30:07 +0000
@@ -19,13 +19,11 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #include <ctype.h>
 #include <time.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
 
 #include "xchat.h"
 #include <glib/ghash.h>
@@ -271,9 +269,6 @@
 	char *text;
 	time_t stamp;
 	int lines;
-	char *map, *end_map;
-	struct stat statbuf;
-	const char *begin, *eol;
 
 	if (sess->text_scrollback == SET_DEFAULT)
 	{
@@ -293,32 +288,9 @@
 	if (fh == -1)
 		return;
 
-	if (fstat (fh, &statbuf) < 0)
-		return;
-
-	map = mmap (NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fh, 0);
-	if (map == MAP_FAILED)
-		return;
-
-	end_map = map + statbuf.st_size;
-	
 	lines = 0;
-	begin = map;
-	while (begin < end_map)
+	while (waitline (fh, buf, sizeof buf, FALSE) != -1)
 	{
-		int n_bytes;
-
-		eol = memchr (begin, '\n', end_map - begin);
-
-		if (!eol)
-			eol = end_map;
-
-		n_bytes = MIN (eol - begin, sizeof (buf) - 1);
-		
-		strncpy (buf, begin, n_bytes);
-
-		buf[n_bytes] = 0;
-		
 		if (buf[0] == 'T')
 		{
 			if (sizeof (time_t) == 4)
@@ -334,8 +306,6 @@
 			}
 			lines++;
 		}
-
-		begin = eol + 1;
 	}
 
 	sess->scrollwritten = lines;
@@ -349,7 +319,6 @@
 		/*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/
 	}
 
-	munmap (map, statbuf.st_size);
 	close (fh);
 }
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/util.c xchat-wdk/src/common/util.c
--- xchat-wdk.orig/src/common/util.c	2008-02-07 01:50:37 +0000
+++ xchat-wdk/src/common/util.c	2010-09-22 15:30:07 +0000
@@ -16,11 +16,13 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#define WANTSOCKET
+#include "inet.h"				/* make it first to avoid macro redefinitions */
+
 #define __APPLE_API_STRICT_CONFORMANCE
 
 #define _FILE_OFFSET_BITS 64
 #include <stdio.h>
-#include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
@@ -35,7 +37,7 @@
 #include <sys/utsname.h>
 #endif
 #include <fcntl.h>
-#include <dirent.h>
+#include "dirent.h"
 #include <errno.h>
 #include "xchat.h"
 #include "xchatc.h"
@@ -44,9 +46,6 @@
 #include "util.h"
 #include "../../config.h"
 
-#define WANTSOCKET
-#include "inet.h"
-
 #if defined (USING_FREEBSD) || defined (__APPLE__)
 #include <sys/sysctl.h>
 #endif
@@ -54,9 +53,11 @@
 #include <socks.h>
 #endif
 
+#ifndef ENABLE_NLS
 #ifndef HAVE_SNPRINTF
 #define snprintf g_snprintf
 #endif
+#endif
 
 #ifdef USE_DEBUG
 
@@ -631,22 +632,32 @@
 	OSVERSIONINFO osvi;
 	SYSTEM_INFO si;
 	double mhz;
+	int cpu_arch;
 
 	osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
 	GetVersionEx (&osvi);
 	GetSystemInfo (&si);
 
+	if (si.wProcessorArchitecture == 9)
+	{
+		cpu_arch = 64;
+	}
+	else
+	{
+		cpu_arch = 86;
+	}
+
 	mhz = get_mhz ();
 	if (mhz)
 	{
 		double cpuspeed = ( mhz > 1000 ) ? mhz / 1000 : mhz;
 		const char *cpuspeedstr = ( mhz > 1000 ) ? "GHz" : "MHz";
-		sprintf (verbuf, "Windows %ld.%ld [i%d86/%.2f%s]",
-					osvi.dwMajorVersion, osvi.dwMinorVersion, si.wProcessorLevel, 
+		sprintf (verbuf, "Windows %ld.%ld [x%d/%.2f%s]",
+					osvi.dwMajorVersion, osvi.dwMinorVersion, cpu_arch, 
 					cpuspeed, cpuspeedstr);
 	} else
-		sprintf (verbuf, "Windows %ld.%ld [i%d86]",
-			osvi.dwMajorVersion, osvi.dwMinorVersion, si.wProcessorLevel);
+		sprintf (verbuf, "Windows %ld.%ld [x%d]",
+			osvi.dwMajorVersion, osvi.dwMinorVersion, cpu_arch);
 
 	return verbuf;
 }
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/xchat.c xchat-wdk/src/common/xchat.c
--- xchat-wdk.orig/src/common/xchat.c	2008-06-08 07:58:58 +0000
+++ xchat-wdk/src/common/xchat.c	2010-09-22 15:30:07 +0000
@@ -22,7 +22,6 @@
 #include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 
 #define WANTSOCKET
 #include "inet.h"
@@ -38,7 +37,7 @@
 #include "cfgfiles.h"
 #include "chanopt.h"
 #include "ignore.h"
-#include "xchat-plugin.h"
+#include <xchat-plugin.h>
 #include "plugin.h"
 #include "plugin-timer.h"
 #include "notify.h"
@@ -583,6 +582,7 @@
 	"NAME DMSG\n"			"CMD msg =%2 &3\n\n"\
 	"NAME EXIT\n"			"CMD quit\n\n"\
 	"NAME GREP\n"			"CMD lastlog -r &2\n\n"\
+	"NAME IGNALL\n"			"CMD ignore %2!*@* ALL\n\n"\
 	"NAME J\n"				"CMD join &2\n\n"\
 	"NAME KILL\n"			"CMD quote KILL %2 :&3\n\n"\
 	"NAME LEAVE\n"			"CMD part &2\n\n"\
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/xchat.h xchat-wdk/src/common/xchat.h
--- xchat-wdk.orig/src/common/xchat.h	2010-08-07 07:14:45 +0000
+++ xchat-wdk/src/common/xchat.h	2010-09-22 15:30:07 +0000
@@ -12,12 +12,14 @@
 
 #include "history.h"
 
+#ifndef ENABLE_NLS
 #ifndef HAVE_SNPRINTF
 #define snprintf g_snprintf
 #endif
 
 #ifndef HAVE_VSNPRINTF
-#define vsnprintf g_vsnprintf
+#define vsnprintf _vsnprintf
+#endif
 #endif
 
 #ifdef USE_DEBUG
@@ -58,7 +60,7 @@
 
 #ifdef WIN32						/* for win32 */
 #define OFLAGS O_BINARY
-#define sleep(t) _sleep(t*1000)
+#define sleep(t) Sleep(t*1000)
 #include <direct.h>
 #define	F_OK	0
 #define	X_OK	1
@@ -297,6 +299,7 @@
 	unsigned int confmode;
 	unsigned int utf8_locale;
 	unsigned int identd;
+	unsigned int emoticons;
 
 	unsigned int ctcp_number_limit;	/*flood */
 	unsigned int ctcp_time_limit;	/*seconds of floods */
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/about.c xchat-wdk/src/fe-gtk/about.c
--- xchat-wdk.orig/src/fe-gtk/about.c	2010-05-16 07:43:49 +0000
+++ xchat-wdk/src/fe-gtk/about.c	2010-09-22 15:30:07 +0000
@@ -39,6 +39,7 @@
 
 #include "../common/xchat.h"
 #include "../common/util.h"
+#include "../common/portable.h"
 #include "palette.h"
 #include "pixmaps.h"
 #include "gtkutil.h"
@@ -114,35 +115,38 @@
 	g_get_charset (&locale);
 	(snprintf) (buf, sizeof (buf),
 				"<span size=\"x-large\"><b>"DISPLAY_NAME" "PACKAGE_VERSION"</b></span>\n\n"
-				"%s\n\n"
 #ifdef WIN32
-				/* leave this message to avoid time wasting bug reports! */
-				"This version is unofficial and comes with no support.\n\n"
-#endif
+				"<b>XChat Base</b>: 2.8.8\n\n"
 				"%s\n"
 				"<b>Charset</b>: %s "
-#ifdef WIN32 
 				"<b>GTK+</b>: %i.%i.%i\n"
+				"<b>Compiled</b>: "__DATE__"\n"
+				"<b>Portable Mode</b>: %s\n\n"
+				"<small>This version is unofficial and comes with no support.\n"
+				"\302\251 1998-2010 Peter \305\275elezn\303\275 &lt;zed@xchat.org></small>",
+				get_cpu_str (),
+				locale,
+				gtk_major_version,
+				gtk_minor_version,
+				gtk_micro_version,
+				(portable_mode () ? "Yes" : "No")
 #else
+				"%s\n\n"
+				"%s\n"
+				"<b>Charset</b>: %s "
 				"<b>Renderer</b>: %s\n"
-#endif
 				"<b>Compiled</b>: "__DATE__"\n\n"
 				"<small>\302\251 1998-2010 Peter \305\275elezn\303\275 &lt;zed@xchat.org></small>",
-					_("A multiplatform IRC Client"),
-					get_cpu_str(),
-					locale,
-#ifdef WIN32
-					gtk_major_version,
-					gtk_minor_version,
-					gtk_micro_version
-#else
+				_("A multiplatform IRC Client"),
+				get_cpu_str (),
+				locale,
 #ifdef USE_XFT
-					"Xft"
+				"Xft"
 #else
-					"Pango"
+				"Pango"
 #endif
 #endif
-					);
+				);
 	gtk_label_set_markup (GTK_LABEL (label), buf);
 	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/banlist.c xchat-wdk/src/fe-gtk/banlist.c
--- xchat-wdk.orig/src/fe-gtk/banlist.c	2010-05-16 03:20:22 +0000
+++ xchat-wdk/src/fe-gtk/banlist.c	2010-09-22 15:30:07 +0000
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <time.h>
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/chanlist.c xchat-wdk/src/fe-gtk/chanlist.c
--- xchat-wdk.orig/src/fe-gtk/chanlist.c	2008-02-24 03:46:02 +0000
+++ xchat-wdk/src/fe-gtk/chanlist.c	2010-09-22 18:13:19 +0000
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <time.h>
 
@@ -671,6 +670,17 @@
 #endif
 }
 
+static gboolean
+chanlist_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	return FALSE;
+}
+
 static void
 chanlist_closegui (GtkWidget *wid, server *serv)
 {
@@ -928,6 +938,8 @@
 
 	g_signal_connect (G_OBJECT (serv->gui->chanlist_window), "destroy",
 							G_CALLBACK (chanlist_destroy_widget), serv);
+	g_signal_connect (G_OBJECT (serv->gui->chanlist_window), "key_press_event",
+							G_CALLBACK (chanlist_key_cb), serv);
 
 	/* reset the counters. */
 	chanlist_reset_counters (serv);
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/editlist.c xchat-wdk/src/fe-gtk/editlist.c
--- xchat-wdk.orig/src/fe-gtk/editlist.c	2006-03-13 08:33:45 +0000
+++ xchat-wdk/src/fe-gtk/editlist.c	2010-09-22 18:36:22 +0000
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -30,6 +29,7 @@
 #include <gtk/gtkclist.h>
 #include <gtk/gtkhbox.h>
 #include <gtk/gtkvseparator.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "../common/xchat.h"
 #include "../common/cfgfiles.h"
@@ -294,6 +294,17 @@
 	editlist_gui_window = 0;
 }
 
+static gboolean
+editlist_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	return FALSE;
+}
+
 void
 editlist_gui_open (char *title1, char *title2, GSList * list, char *title, char *wmclass,
 						 char *file, char *help)
@@ -404,6 +415,10 @@
 	gtk_widget_show (hbox);
 
 	editlist_gui_load (editlist_gui_list);
+	
+	g_signal_connect (G_OBJECT (editlist_gui_window), "key_press_event",
+							G_CALLBACK (editlist_key_cb), editlist_gui_window);
+
 
 	gtk_widget_show (editlist_gui_window);
 }
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/fe-gtk.c xchat-wdk/src/fe-gtk/fe-gtk.c
--- xchat-wdk.orig/src/fe-gtk/fe-gtk.c	2010-08-14 01:46:21 +0000
+++ xchat-wdk/src/fe-gtk/fe-gtk.c	2010-09-22 15:30:07 +0000
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 
 #include "fe-gtk.h"
 
@@ -32,6 +31,8 @@
 #include <gtk/gtkmessagedialog.h>
 #include <gtk/gtkversion.h>
 
+#include <gdk/gdkwin32.h>
+
 #include "../common/xchat.h"
 #include "../common/fe.h"
 #include "../common/util.h"
@@ -39,6 +40,7 @@
 #include "../common/cfgfiles.h"
 #include "../common/xchatc.h"
 #include "../common/plugin.h"
+#include "../common/server.h"
 #include "gtkutil.h"
 #include "maingui.h"
 #include "pixmaps.h"
@@ -330,7 +332,7 @@
 {
 	session *sess;
 
-	if (getenv ("XCHAT_WARNING_IGNORE"))
+	/* if (getenv ("XCHAT_WARNING_IGNORE")) */
 		return;
 
 	sess = find_dialog (serv_list->data, "(warnings)");
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/fe-gtk.h xchat-wdk/src/fe-gtk/fe-gtk.h
--- xchat-wdk.orig/src/fe-gtk/fe-gtk.h	2010-05-30 06:31:29 +0000
+++ xchat-wdk/src/fe-gtk/fe-gtk.h	2010-09-22 15:30:07 +0000
@@ -4,7 +4,7 @@
 /* If you're compiling this for Windows, your release is un-official
  * and not condoned. Please don't use the XChat name. Make up your
  * own name! */
-#define DISPLAY_NAME "XChat-Unofficial"
+#define DISPLAY_NAME "XChat-WDK"
 #else
 #define DISPLAY_NAME "XChat"
 #endif
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/fkeys.c xchat-wdk/src/fe-gtk/fkeys.c
--- xchat-wdk.orig/src/fe-gtk/fkeys.c	2008-02-24 05:09:34 +0000
+++ xchat-wdk/src/fe-gtk/fkeys.c	2010-09-22 18:43:54 +0000
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
 #include <ctype.h>
@@ -695,6 +694,17 @@
 	}
 }
 
+static gboolean
+key_dialog_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	return FALSE;
+}
+
 void
 key_dialog_show ()
 {
@@ -830,6 +840,9 @@
 
 	gtk_widget_show (hbox2);
 	key_dialog_text = wid;
+	
+	g_signal_connect (G_OBJECT (key_dialog), "key_press_event",
+							G_CALLBACK (key_dialog_key_cb), key_dialog);
 
 	gtk_widget_show_all (key_dialog);
 }
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/gtkutil.c xchat-wdk/src/fe-gtk/gtkutil.c
--- xchat-wdk.orig/src/fe-gtk/gtkutil.c	2009-07-18 12:38:10 +0000
+++ xchat-wdk/src/fe-gtk/gtkutil.c	2010-09-22 15:30:07 +0000
@@ -22,7 +22,6 @@
 #include <stdarg.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include "fe-gtk.h"
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/joind.c xchat-wdk/src/fe-gtk/joind.c
--- xchat-wdk.orig/src/fe-gtk/joind.c	2006-12-26 04:56:55 +0000
+++ xchat-wdk/src/fe-gtk/joind.c	2010-09-22 15:30:07 +0000
@@ -9,7 +9,6 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <string.h>
 #include <stdio.h>
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/maingui.c xchat-wdk/src/fe-gtk/maingui.c
--- xchat-wdk.orig/src/fe-gtk/maingui.c	2010-05-16 03:20:22 +0000
+++ xchat-wdk/src/fe-gtk/maingui.c	2010-09-22 15:30:07 +0000
@@ -214,60 +214,10 @@
 	away_list = mg_attr_list_create (&colors[COL_AWAY], FALSE);
 }
 
-#ifdef WIN32
-#define WINVER 0x0501	/* needed for vc6? */
-#include <windows.h>
-#include <gdk/gdkwin32.h>
-
-/* Flash the taskbar button on Windows when there's a highlight event. */
-
-static void
-flash_window (GtkWidget *win)
-{
-	FLASHWINFO fi;
-	static HMODULE user = NULL;
-	static BOOL (*flash) (PFLASHWINFO) = NULL;
-
-	if (!user)
-	{
-		user = GetModuleHandleA ("USER32");
-		if (!user)
-			return;	/* this should never fail */
-	}
-
-	if (!flash)
-	{
-		flash = (void *)GetProcAddress (user, "FlashWindowEx");
-		if (!flash)
-			return;	/* this fails on NT4.0 and Win95 */
-	}
-
-	fi.cbSize = sizeof (fi);
-	fi.hwnd = GDK_WINDOW_HWND (win->window);
-	fi.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
-	fi.uCount = 0;
-	fi.dwTimeout = 500;
-	flash (&fi);
-	/*FlashWindowEx (&fi);*/
-}
-#else
-
-#ifdef USE_XLIB
-#include <gdk/gdkx.h>
-
 static void
 set_window_urgency (GtkWidget *win, gboolean set)
 {
-	XWMHints *hints;
-
-	hints = XGetWMHints(GDK_WINDOW_XDISPLAY(win->window), GDK_WINDOW_XWINDOW(win->window));
-	if (set)
-		hints->flags |= XUrgencyHint;
-	else
-		hints->flags &= ~XUrgencyHint;
-	XSetWMHints(GDK_WINDOW_XDISPLAY(win->window),
-	            GDK_WINDOW_XWINDOW(win->window), hints);
-	XFree(hints);
+	gtk_window_set_urgency_hint (GTK_WINDOW (win), set);
 }
 
 static void
@@ -281,18 +231,14 @@
 {
 	set_window_urgency (win, FALSE);
 }
-#endif
-#endif
 
 /* flash the taskbar button */
 
 void
 fe_flash_window (session *sess)
 {
-#if defined(WIN32) || defined(USE_XLIB)
 	if (fe_gui_info (sess, 0) != 1)	/* only do it if not focused */
 		flash_window (sess->gui->window);
-#endif
 }
 
 /* set a tab plain, red, light-red, or blue */
@@ -2957,11 +2903,7 @@
 		gtk_xtext_check_marker_visibility (GTK_XTEXT (current_sess->gui->xtext));
 		plugin_emit_dummy_print (current_sess, "Focus Window");
 	}
-#ifndef WIN32
-#ifdef USE_XLIB
 	unflash_window (GTK_WIDGET (win));
-#endif
-#endif
 	return FALSE;
 }
 
@@ -2972,11 +2914,7 @@
 	if (!sess->server->server_session)
 		sess->server->server_session = sess;
 	gtk_xtext_check_marker_visibility(GTK_XTEXT (current_sess->gui->xtext));
-#ifndef WIN32
-#ifdef USE_XLIB
 	unflash_window (GTK_WIDGET (win));
-#endif
-#endif
 	plugin_emit_dummy_print (sess, "Focus Window");
 	return FALSE;
 }
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/menu.c xchat-wdk/src/fe-gtk/menu.c
--- xchat-wdk.orig/src/fe-gtk/menu.c	2010-05-16 04:24:24 +0000
+++ xchat-wdk/src/fe-gtk/menu.c	2010-09-22 15:30:07 +0000
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <string.h>
-#include <unistd.h>
 
 #ifdef WIN32
 #include <windows.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/palette.c xchat-wdk/src/fe-gtk/palette.c
--- xchat-wdk.orig/src/fe-gtk/palette.c	2010-05-16 03:20:22 +0000
+++ xchat-wdk/src/fe-gtk/palette.c	2010-09-22 15:30:07 +0000
@@ -18,7 +18,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/src/fe-gtk/plugin-tray.c
--- xchat-wdk.orig/src/fe-gtk/plugin-tray.c	2010-08-14 01:46:21 +0000
+++ xchat-wdk/src/fe-gtk/plugin-tray.c	2010-09-22 15:30:07 +0000
@@ -1,8 +1,7 @@
 /* Copyright (C) 2006-2007 Peter Zelezny. */
 
 #include <string.h>
-#include <unistd.h>
-#include "../common/xchat-plugin.h"
+#include <xchat-plugin.h>
 #include "../common/xchat.h"
 #include "../common/xchatc.h"
 #include "../common/inbound.h"
@@ -298,10 +297,10 @@
 		nets = tray_count_networks ();
 		chans = tray_count_channels ();
 		if (nets)
-			tray_set_tipf (_("XChat: Connected to %u networks and %u channels"),
+			tray_set_tipf (_("XChat-WDK: Connected to %u networks and %u channels"),
 								nets, chans);
 		else
-			tray_set_tipf ("XChat: %s", _("Not connected."));
+			tray_set_tipf ("XChat-WDK: %s", _("Not connected."));
 	}
 
 	if (custom_icon1)
@@ -451,7 +450,7 @@
 	/* ph may have an invalid context now */
 	xchat_set_context (ph, xchat_find_context (ph, NULL, NULL));
 
-	win = (GtkWindow *)xchat_get_info (ph, "win_ptr");
+	win = xchat_get_info (ph, "gtkwin_ptr");
 
 	tray_stop_flash ();
 	tray_reset_counts ();
@@ -651,15 +650,15 @@
 		/* FIXME: hides any previous private messages */
 		tray_hilight_count++;
 		if (tray_hilight_count == 1)
-			tray_set_tipf (_("XChat: Highlighted message from: %s (%s)"),
+			tray_set_tipf (_("XChat-WDK: Highlighted message from: %s (%s)"),
 								word[1], xchat_get_info (ph, "channel"));
 		else
-			tray_set_tipf (_("XChat: %u highlighted messages, latest from: %s (%s)"),
+			tray_set_tipf (_("XChat-WDK: %u highlighted messages, latest from: %s (%s)"),
 								tray_hilight_count, word[1], xchat_get_info (ph, "channel"));
 	}
 
 	if (prefs.input_balloon_hilight)
-		tray_set_balloonf (word[2], _("XChat: Highlighted message from: %s (%s)"),
+		tray_set_balloonf (word[2], _("XChat-WDK: Highlighted message from: %s (%s)"),
 								 word[1], xchat_get_info (ph, "channel"));
 
 	return XCHAT_EAT_NONE;
@@ -677,14 +676,14 @@
 
 		tray_pub_count++;
 		if (tray_pub_count == 1)
-			tray_set_tipf (_("XChat: New public message from: %s (%s)"),
+			tray_set_tipf (_("XChat-WDK: New public message from: %s (%s)"),
 								word[1], xchat_get_info (ph, "channel"));
 		else
-			tray_set_tipf (_("XChat: %u new public messages."), tray_pub_count);
+			tray_set_tipf (_("XChat-WDK: %u new public messages."), tray_pub_count);
 	}
 
 	if (prefs.input_balloon_chans)
-		tray_set_balloonf (word[2], _("XChat: New public message from: %s (%s)"),
+		tray_set_balloonf (word[2], _("XChat-WDK: New public message from: %s (%s)"),
 								 word[1], xchat_get_info (ph, "channel"));
 
 	return XCHAT_EAT_NONE;
@@ -706,14 +705,14 @@
 
 	tray_priv_count++;
 	if (tray_priv_count == 1)
-		tray_set_tipf (_("XChat: Private message from: %s (%s)"),
+		tray_set_tipf (_("XChat-WDK: Private message from: %s (%s)"),
 							from, network);
 	else
-		tray_set_tipf (_("XChat: %u private messages, latest from: %s (%s)"),
+		tray_set_tipf (_("XChat-WDK: %u private messages, latest from: %s (%s)"),
 							tray_priv_count, from, network);
 
 	if (prefs.input_balloon_priv)
-		tray_set_balloonf (text, _("XChat: Private message from: %s (%s)"),
+		tray_set_balloonf (text, _("XChat-WDK: Private message from: %s (%s)"),
 								 from, network);
 }
 
@@ -759,15 +758,15 @@
 
 		tray_file_count++;
 		if (tray_file_count == 1)
-			tray_set_tipf (_("XChat: File offer from: %s (%s)"),
+			tray_set_tipf (_("XChat-WDK: File offer from: %s (%s)"),
 								word[1], network);
 		else
-			tray_set_tipf (_("XChat: %u file offers, latest from: %s (%s)"),
+			tray_set_tipf (_("XChat-WDK: %u file offers, latest from: %s (%s)"),
 								tray_file_count, word[1], network);
 	}
 
 	if (prefs.input_balloon_priv)
-		tray_set_balloonf ("", _("XChat: File offer from: %s (%s)"),
+		tray_set_balloonf ("", _("XChat-WDK: File offer from: %s (%s)"),
 								word[1], network);
 
 	return XCHAT_EAT_NONE;
@@ -803,7 +802,7 @@
 	}
 	else
 	{
-		if (prefs.gui_tray)
+		if (prefs.gui_tray && !((_access( "plugins/xtray.dll", 0 )) != -1))
 			tray_init ();
 	}
 }
@@ -835,7 +834,7 @@
 
 	xchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
 
-	if (prefs.gui_tray)
+	if (prefs.gui_tray && !((_access( "plugins/xtray.dll", 0 )) != -1))
 		tray_init ();
 
 	return 1;       /* return 1 for success */
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugingui.c xchat-wdk/src/fe-gtk/plugingui.c
--- xchat-wdk.orig/src/fe-gtk/plugingui.c	2010-05-16 03:20:22 +0000
+++ xchat-wdk/src/fe-gtk/plugingui.c	2010-09-22 15:30:07 +0000
@@ -35,7 +35,7 @@
 #include "../common/xchat.h"
 #define PLUGIN_C
 typedef struct session xchat_context;
-#include "../common/xchat-plugin.h"
+#include <xchat-plugin.h>
 #include "../common/plugin.h"
 #include "../common/util.h"
 #include "../common/outbound.h"
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/rawlog.c xchat-wdk/src/fe-gtk/rawlog.c
--- xchat-wdk.orig/src/fe-gtk/rawlog.c	2010-05-16 03:20:22 +0000
+++ xchat-wdk/src/fe-gtk/rawlog.c	2010-09-22 15:30:07 +0000
@@ -19,7 +19,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <stdlib.h>
 
 #include "fe-gtk.h"
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/search.c xchat-wdk/src/fe-gtk/search.c
--- xchat-wdk.orig/src/fe-gtk/search.c	2010-05-16 03:20:22 +0000
+++ xchat-wdk/src/fe-gtk/search.c	2010-09-22 18:22:22 +0000
@@ -153,7 +153,7 @@
 								_("_Find"));
 	g_object_set_data (G_OBJECT (wid), "e", entry);
 
-	g_signal_connect (G_OBJECT (win), "key-press-event", G_CALLBACK (search_key_cb), win);
+	g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (search_key_cb), win);
 
 	gtk_widget_show (win);
 }
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/servlistgui.c xchat-wdk/src/fe-gtk/servlistgui.c
--- xchat-wdk.orig/src/fe-gtk/servlistgui.c	2010-08-07 07:14:45 +0000
+++ xchat-wdk/src/fe-gtk/servlistgui.c	2010-09-25 00:29:23 +0000
@@ -486,6 +486,41 @@
 	return FALSE;
 }
 
+static gboolean 
+servlist_netwin_keypress_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	serverlist_win = NULL;
+	selected_net = NULL;
+	return FALSE;
+}
+
+static gboolean 
+servlist_servwin_keypress_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	return FALSE;
+}
+
+static gboolean 
+servlist_autojoinedit_keypress_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	return FALSE;
+}
+
 static void
 servlist_edit_cb (GtkWidget *but, gpointer none)
 {
@@ -501,6 +536,9 @@
 						 	G_CALLBACK (servlist_editwin_delete_cb), 0);
 	g_signal_connect (G_OBJECT (edit_tree), "key_press_event",
 							G_CALLBACK (servlist_serv_keypress_cb), 0);
+	g_signal_connect (G_OBJECT (edit_win), "key_press_event",
+							G_CALLBACK (servlist_servwin_keypress_cb), edit_win);
+	
 	gtk_widget_show (edit_win);
 }
 
@@ -961,6 +999,9 @@
 	}
 
 	fav_add_net = net;
+	
+	g_signal_connect (G_OBJECT (win), "key_press_event",
+							G_CALLBACK (servlist_autojoinedit_keypress_cb), win);
 
 	gtk_widget_show (win);
 }
@@ -1782,7 +1823,7 @@
 	gtk_container_add (GTK_CONTAINER (hbox), checkbutton_fav);
 	g_signal_connect (G_OBJECT (checkbutton_fav), "toggled",
 							G_CALLBACK (fav_servlist), 0);
-	gtk_widget_show (checkbutton_fav);
+	/* gtk_widget_show (checkbutton_fav); don't show this until it's completed */
 
 	vbuttonbox2 = gtk_vbutton_box_new ();
 	gtk_box_set_spacing (GTK_BOX (vbuttonbox2), 3);
@@ -1875,6 +1916,8 @@
 							"changed", G_CALLBACK (servlist_network_row_cb), NULL);
 	g_signal_connect (G_OBJECT (networks_tree), "key_press_event",
 							G_CALLBACK (servlist_net_keypress_cb), networks_tree);
+	g_signal_connect (G_OBJECT (serverlist_win), "key_press_event", 
+							G_CALLBACK (servlist_netwin_keypress_cb), serverlist_win);
 
 	gtk_widget_show (serverlist_win);
 }
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/setup.c xchat-wdk/src/fe-gtk/setup.c
--- xchat-wdk.orig/src/fe-gtk/setup.c	2008-02-08 09:04:45 +0000
+++ xchat-wdk/src/fe-gtk/setup.c	2010-09-22 18:34:13 +0000
@@ -47,6 +47,7 @@
 #include <gtk/gtktreeselection.h>
 #include <gtk/gtkcellrenderertext.h>
 #include <gtk/gtkhscale.h>
+#include <gdk/gdkkeysyms.h>
 #ifdef WIN32
 #include "../common/fe.h"
 #endif
@@ -363,7 +364,6 @@
 	{ST_END, 0, 0, 0, 0, 0}
 };
 
-#if 0
 static const setting advanced_settings[] =
 {
 	{ST_HEADER,	N_("Advanced Settings"),0,0,0},
@@ -378,7 +378,6 @@
 
 	{ST_END, 0, 0, 0, 0, 0}
 };
-#endif
 
 static const setting logging_settings[] =
 {
@@ -1708,7 +1707,7 @@
 		N_("General"),
 		N_("Logging"),
 		N_("Sound"),
-/*		N_("Advanced"),*/
+		N_("Advanced"),
 		NULL,
 	N_("Network"),
 		N_("Network setup"),
@@ -1733,6 +1732,7 @@
 	setup_add_page (cata[9], book, setup_create_page (general_settings));
 	setup_add_page (cata[10], book, setup_create_page (logging_settings));
 	setup_add_page (cata[11], book, setup_create_sound_page ());
+	setup_add_page (cata[12], book, setup_create_page (advanced_settings));
 	setup_add_page (cata[14], book, setup_create_page (network_settings));
 	setup_add_page (cata[15], book, setup_create_page (filexfer_settings));
 
@@ -2050,6 +2050,17 @@
 	palette_save ();
 }
 
+static gboolean
+setup_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	return FALSE;
+}
+
 static GtkWidget *
 setup_window_open (void)
 {
@@ -2095,6 +2106,9 @@
 
 	wid = gtk_hseparator_new ();
 	gtk_box_pack_end (GTK_BOX (vbox), wid, FALSE, FALSE, 0);
+	
+	g_signal_connect (G_OBJECT (win), "key_press_event",
+							G_CALLBACK (setup_key_cb), win);
 
 	gtk_widget_show_all (win);
 
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/sexy-spell-entry.c xchat-wdk/src/fe-gtk/sexy-spell-entry.c
--- xchat-wdk.orig/src/fe-gtk/sexy-spell-entry.c	2006-07-17 05:51:02 +0000
+++ xchat-wdk/src/fe-gtk/sexy-spell-entry.c	2010-09-22 15:30:07 +0000
@@ -31,6 +31,20 @@
 /*#include "gtkspell-iso-codes.h"
 #include "sexy-marshal.h"*/
 
+/* workaround for ssize_t in VS 
+   from krb/include/win-mac.h */
+#ifndef SSIZE_T_DEFINED
+#ifdef ssize_t
+#undef ssize_t
+#endif
+#ifdef _WIN64
+typedef __int64          ssize_t;
+#else
+typedef _W64 int         ssize_t;
+#endif
+#define SSIZE_T_DEFINED
+#endif
+
 /*
  * Bunch of poop to make enchant into a runtime dependency rather than a
  * compile-time dependency.  This makes it so I don't have to hear the
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/textgui.c xchat-wdk/src/fe-gtk/textgui.c
--- xchat-wdk.orig/src/fe-gtk/textgui.c	2007-05-23 08:55:58 +0000
+++ xchat-wdk/src/fe-gtk/textgui.c	2010-09-22 18:50:21 +0000
@@ -35,6 +35,7 @@
 #include <gtk/gtkvbox.h>
 #include <gtk/gtkvpaned.h>
 #include <gtk/gtkvscrollbar.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "../common/xchat.h"
 #include "../common/xchatc.h"
@@ -355,6 +356,17 @@
 	}
 }
 
+static gboolean
+pevent_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+	{
+		gtk_widget_destroy (window);
+	}
+
+	return FALSE;
+}
+
 void
 pevent_dialog_show ()
 {
@@ -451,6 +463,9 @@
 	gtk_widget_show (wid);
 
 	gtk_widget_show (hbox);
+	
+	g_signal_connect (G_OBJECT (pevent_dialog), "key_press_event",
+							G_CALLBACK (pevent_key_cb), pevent_dialog);
 
 	gtk_widget_show (pevent_dialog);
 }
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/xtext.c xchat-wdk/src/fe-gtk/xtext.c
--- xchat-wdk.orig/src/fe-gtk/xtext.c	2008-08-29 11:24:17 +0000
+++ xchat-wdk/src/fe-gtk/xtext.c	2010-09-22 15:30:07 +0000
@@ -42,7 +42,6 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <time.h>
-#include <unistd.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtksignal.h>
 #include <gtk/gtkselection.h>
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-text/fe-text.c xchat-wdk/src/fe-text/fe-text.c
--- xchat-wdk.orig/src/fe-text/fe-text.c	2008-08-29 11:24:17 +0000
+++ xchat-wdk/src/fe-text/fe-text.c	2010-09-22 15:30:07 +0000
@@ -22,9 +22,13 @@
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif
+#ifdef WIN32
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#else
 #include <sys/time.h>
+#endif
 #include <sys/types.h>
-#include <unistd.h>
 #include <ctype.h>
 #include "../common/xchat.h"
 #include "../common/xchatc.h"
@@ -339,7 +343,11 @@
 	te->callback = callback;
 	te->userdata = userdata;
 
-	gettimeofday (&now, NULL);
+#ifdef WIN32
+		g_get_current_time (&now);
+#else
+		gettimeofday (&now, NULL);
+#endif
 	te->next_call = now.tv_sec * 1000 + (now.tv_usec / 1000) + te->interval;
 
 	tmr_list = g_slist_prepend (tmr_list, te);
@@ -417,7 +425,12 @@
 void
 fe_main (void)
 {
-	struct timeval timeout, now;
+	struct timeval timeout;
+#ifdef WIN32
+	GTimeVal now;
+#else
+	struct timeval now;
+#endif
 	socketevent *se;
 	timerevent *te;
 	fd_set rd, wd, ex;
@@ -428,7 +441,7 @@
 		new_ircwindow (NULL, NULL, SESS_SERVER, 0);
 
 #ifdef ENABLE_NLS
-	bindtextdomain (GETTEXT_PACKAGE, PREFIX"/share/locale");
+	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 #endif
@@ -464,7 +477,11 @@
 				shortest = te->next_call;
 			list = list->next;
 		}
+#ifdef WIN32
+		g_get_current_time (&now);
+#else
 		gettimeofday (&now, NULL);
+#endif
 		delay = shortest - ((now.tv_sec * 1000) + (now.tv_usec / 1000));
 		timeout.tv_sec = delay / 1000;
 		timeout.tv_usec = (delay % 1000) * 1000;
@@ -514,7 +531,11 @@
 		}
 
 		/* now check our list of timeout events, some might need to be called! */
+#ifdef WIN32
+		g_get_current_time (&now);
+#else
 		gettimeofday (&now, NULL);
+#endif
 		list = tmr_list;
 		while (list)
 		{