summary refs log tree commit diff stats
path: root/xchat-wdk.patch
blob: a13e8f5d2d03a1b8142d661aac32883efff46d39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
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-10 11:15:00 +0200
+++ xchat-wdk/plugins/perl/perl.c	2010-08-10 16:29:30 +0200
@@ -16,13 +16,14 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
+#define  _INC_DIRENT
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <dirent.h>
+#include "../../src/common/dirent.h"
 #ifdef ENABLE_NLS
 #include <locale.h>
 #endif
@@ -1337,14 +1338,14 @@
 					FreeLibrary (lib);
 					lib = NULL;
 					thread_mbox ("Cannot open " PERL_DLL "\n\n"
-									 "You must have ActivePerl 5.8 installed in order to\n"
+									 "You must have ActivePerl 5.10 installed in order to\n"
 									 "run perl scripts.\n\n"
-									 "I have found Perl 5.6, but that is too old.");
+									 "I have found a Perl version, but that is too old.");
 				} else {
 					thread_mbox ("Cannot open " PERL_DLL "\n\n"
-									 "You must have ActivePerl 5.8 installed in order to\n"
+									 "You must have ActivePerl 5.10 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 06:31:54 +0200
+++ xchat-wdk/plugins/python/python.c	2010-08-11 06:28:13 +0200
@@ -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 01:49:42 +0100
+++ xchat-wdk/plugins/tcl/tclplugin.c	2010-08-10 16:29:30 +0200
@@ -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 04:35:09 +0100
+++ xchat-wdk/plugins/xdcc/xdcc.c	2010-08-11 22:49:06 +0200
@@ -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 09:14:45 +0200
+++ xchat-wdk/src/common/cfgfiles.c	2010-08-11 02:10:02 +0200
@@ -17,7 +17,6 @@
  */
 
 #include <fcntl.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -32,7 +31,11 @@
 #include "xchatc.h"
 
 #ifdef WIN32
+#ifdef PORTABLE_BUILD
+#define XCHAT_DIR "config"
+#else
 #define XCHAT_DIR "X-Chat 2"
+#endif
 #else
 #define XCHAT_DIR ".xchat2"
 #endif
@@ -308,12 +311,16 @@
 {
 	if (!xdir_fs)
 	{
+#ifdef PORTABLE_BUILD
+		xdir_fs = XCHAT_DIR;
+#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);
+#endif
 	}
 	return xdir_fs;
 }
@@ -677,7 +684,10 @@
 	prefs.mainwindow_save = 1;
 	prefs.bantype = 2;
 	prefs.input_balloon_time = 20;
+	/* taskbar alerts crash xchat-wdk only on x86 */
+#ifdef _WIN64
 	prefs.input_flash_priv = prefs.input_flash_hilight = 1;
+#endif
 	prefs.input_tray_priv = prefs.input_tray_hilight = 1;
 	prefs.autodccsend = 2;	/* browse mode */
 #ifdef WIN32
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 06:40:29 +0200
+++ xchat-wdk/src/common/chanopt.c	2010-08-10 16:29:30 +0200
@@ -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 04:28:04 +0200
+++ xchat-wdk/src/common/ctcp.c	2010-08-10 16:29:30 +0200
@@ -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" %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 04:28:04 +0200
+++ xchat-wdk/src/common/dcc.c	2010-08-10 16:29:30 +0200
@@ -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 09:00:39 +0200
+++ xchat-wdk/src/common/ignore.c	2010-08-10 16:29:30 +0200
@@ -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 04:28:04 +0200
+++ xchat-wdk/src/common/inbound.c	2010-08-10 16:29:30 +0200
@@ -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 12:57:48 +0200
+++ xchat-wdk/src/common/inet.h	2010-08-12 01:00:09 +0200
@@ -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 17:32:17 +0200
+++ xchat-wdk/src/common/msproxy.c	2010-08-10 16:29:30 +0200
@@ -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 10:11:26 +0200
+++ xchat-wdk/src/common/network.c	2010-08-10 16:29:30 +0200
@@ -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 09:58:58 +0200
+++ xchat-wdk/src/common/notify.c	2010-08-10 16:29:30 +0200
@@ -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 04:28:04 +0200
+++ xchat-wdk/src/common/outbound.c	2010-08-10 16:29:30 +0200
@@ -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/proto-irc.c xchat-wdk/src/common/proto-irc.c
--- xchat-wdk.orig/src/common/proto-irc.c	2010-05-30 04:28:04 +0200
+++ xchat-wdk/src/common/proto-irc.c	2010-08-10 16:29:30 +0200
@@ -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 04:28:04 +0200
+++ xchat-wdk/src/common/server.c	2010-08-11 02:09:36 +0200
@@ -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 09:43:49 +0200
+++ xchat-wdk/src/common/servlist.c	2010-08-10 16:29:30 +0200
@@ -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 10:35:06 +0200
+++ xchat-wdk/src/common/ssl.c	2010-08-12 00:55:22 +0200
@@ -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 04:28:04 +0200
+++ xchat-wdk/src/common/text.c	2010-08-10 16:29:30 +0200
@@ -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>
@@ -274,6 +272,8 @@
 	char *map, *end_map;
 	struct stat statbuf;
 	const char *begin, *eol;
+	
+	HANDLE hFile, hMapFile;
 
 	if (sess->text_scrollback == SET_DEFAULT)
 	{
@@ -296,9 +296,32 @@
 	if (fstat (fh, &statbuf) < 0)
 		return;
 
-	map = mmap (NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fh, 0);
-	if (map == MAP_FAILED)
+	/* from http://osdir.com/ml/guile-devel-gnu/2009-04/msg00008.html */
+
+	hFile = (HANDLE)_get_osfhandle(fh);
+	if (hFile == INVALID_HANDLE_VALUE)
+	{
+		return;
+	}
+
+	/* Create mapping object */
+	hMapFile = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+	if (hMapFile == INVALID_HANDLE_VALUE)
+	{
 		return;
+	}
+
+	/* Select which portions of the file we need (entire file) */
+	map = (char *)MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
+
+	if (map == NULL)
+	{
+		CloseHandle(hMapFile);
+		return;
+	}
+	/*map = mmap (NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fh, 0);
+	if (map == MAP_FAILED)
+		return;*/
 
 	end_map = map + statbuf.st_size;
 	
@@ -349,7 +372,9 @@
 		/*EMIT_SIGNAL (XP_TE_GENMSG, sess, "*", buf, NULL, NULL, NULL, 0);*/
 	}
 
-	munmap (map, statbuf.st_size);
+	/* munmap (map, statbuf.st_size); */
+	CloseHandle(hMapFile);
+	CloseHandle(hFile);
 	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 02:50:37 +0100
+++ xchat-wdk/src/common/util.c	2010-08-12 01:05:46 +0200
@@ -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 09:58:58 +0200
+++ xchat-wdk/src/common/xchat.c	2010-08-10 16:29:30 +0200
@@ -22,7 +22,6 @@
 #include <time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 
 #define WANTSOCKET
 #include "inet.h"
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 09:14:45 +0200
+++ xchat-wdk/src/common/xchat.h	2010-08-10 16:29:30 +0200
@@ -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
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 09:43:49 +0200
+++ xchat-wdk/src/fe-gtk/about.c	2010-08-10 16:29:30 +0200
@@ -113,11 +113,15 @@
 	gtk_container_add (GTK_CONTAINER (vbox), label);
 	g_get_charset (&locale);
 	(snprintf) (buf, sizeof (buf),
+#ifdef PORTABLE_BUILD
+				"<span size=\"x-large\"><b>"DISPLAY_NAME" "PACKAGE_VERSION"</b></span>\n<span size=\"x-large\"><b>Portable Version</b></span>\n\n"
+#else
 				"<span size=\"x-large\"><b>"DISPLAY_NAME" "PACKAGE_VERSION"</b></span>\n\n"
+#endif
 				"%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"
+				"This version is unofficial and\ncomes with no support.\n\n"
 #endif
 				"%s\n"
 				"<b>Charset</b>: %s "
@@ -127,6 +131,7 @@
 				"<b>Renderer</b>: %s\n"
 #endif
 				"<b>Compiled</b>: "__DATE__"\n\n"
+				"<b>XChat Base</b>: 2.8.8\n\n"
 				"<small>\302\251 1998-2010 Peter \305\275elezn\303\275 &lt;zed@xchat.org></small>",
 					_("A multiplatform IRC Client"),
 					get_cpu_str(),
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 05:20:22 +0200
+++ xchat-wdk/src/fe-gtk/banlist.c	2010-08-10 16:29:30 +0200
@@ -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 04:46:02 +0100
+++ xchat-wdk/src/fe-gtk/chanlist.c	2010-08-10 16:29:30 +0200
@@ -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/editlist.c xchat-wdk/src/fe-gtk/editlist.c
--- xchat-wdk.orig/src/fe-gtk/editlist.c	2006-03-13 09:33:45 +0100
+++ xchat-wdk/src/fe-gtk/editlist.c	2010-08-10 16:29:30 +0200
@@ -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>
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-05-16 05:20:22 +0200
+++ xchat-wdk/src/fe-gtk/fe-gtk.c	2010-08-10 16:29:30 +0200
@@ -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"
@@ -844,11 +846,11 @@
 	switch (info_type)
 	{
 	case 0:	/* native window pointer (for plugins) */
-#ifdef WIN32
+/*#ifdef WIN32
 		return GDK_WINDOW_HWND (sess->gui->window->window);
-#else
+#else*/
 		return sess->gui->window;
-#endif
+/*#endif*/
 	}
 	return NULL;
 }
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 08:31:29 +0200
+++ xchat-wdk/src/fe-gtk/fe-gtk.h	2010-08-10 16:29:30 +0200
@@ -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 06:09:34 +0100
+++ xchat-wdk/src/fe-gtk/fkeys.c	2010-08-10 16:29:30 +0200
@@ -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>
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 14:38:10 +0200
+++ xchat-wdk/src/fe-gtk/gtkutil.c	2010-08-10 16:29:30 +0200
@@ -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 05:56:55 +0100
+++ xchat-wdk/src/fe-gtk/joind.c	2010-08-10 16:29:30 +0200
@@ -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/menu.c xchat-wdk/src/fe-gtk/menu.c
--- xchat-wdk.orig/src/fe-gtk/menu.c	2010-05-16 06:24:24 +0200
+++ xchat-wdk/src/fe-gtk/menu.c	2010-08-10 16:29:30 +0200
@@ -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 05:20:22 +0200
+++ xchat-wdk/src/fe-gtk/palette.c	2010-08-10 16:29:30 +0200
@@ -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-05-16 03:40:42 +0200
+++ xchat-wdk/src/fe-gtk/plugin-tray.c	2010-08-10 16:29:30 +0200
@@ -1,7 +1,6 @@
 /* Copyright (C) 2006-2007 Peter Zelezny. */
 
 #include <string.h>
-#include <unistd.h>
 #include "../common/xchat-plugin.h"
 #include "../common/xchat.h"
 #include "../common/xchatc.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)
@@ -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;
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 05:20:22 +0200
+++ xchat-wdk/src/fe-gtk/rawlog.c	2010-08-10 16:29:30 +0200
@@ -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/setup.c xchat-wdk/src/fe-gtk/setup.c
--- xchat-wdk.orig/src/fe-gtk/setup.c	2008-02-08 10:04:45 +0100
+++ xchat-wdk/src/fe-gtk/setup.c	2010-08-10 16:29:30 +0200
@@ -333,7 +333,11 @@
 	{ST_3OGGLE, N_("Show tray balloons on:"), 0, 0, (void *)balloonlist, 0},
 #endif
 	{ST_3OGGLE, N_("Blink tray icon on:"), 0, 0, (void *)trayblinklist, 0},
+
+	/* taskbar alerts crash xchat-wdk only on x86 */
+#ifdef _WIN64
 	{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
+#endif
 	{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
 
 	{ST_TOGGLE,	N_("Enable system tray icon"), P_OFFINTNL(gui_tray), 0, 0, 0},
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 07:51:02 +0200
+++ xchat-wdk/src/fe-gtk/sexy-spell-entry.c	2010-08-10 16:29:30 +0200
@@ -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/xtext.c xchat-wdk/src/fe-gtk/xtext.c
--- xchat-wdk.orig/src/fe-gtk/xtext.c	2008-08-29 13:24:17 +0200
+++ xchat-wdk/src/fe-gtk/xtext.c	2010-08-10 16:29:30 +0200
@@ -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>