summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorberkeviktor@aol.com <berkeviktor@aol.com>2011-01-14 06:43:56 +0100
committerberkeviktor@aol.com <berkeviktor@aol.com>2011-01-14 06:43:56 +0100
commite26a1c5f7a6bceb032e8a5f2bb77c34ad569a1a4 (patch)
treee64edd14717dfeebc7995ce3f552fcbe09cd0d1b
parent1effb26d5f316c79ae7815355f46d42b48264079 (diff)
split dirent.h and more xtray support
-rw-r--r--build/build-small.bat2
-rw-r--r--plugins/lua/makefile.mak4
-rw-r--r--plugins/python/makefile.mak3
-rw-r--r--src/common/dirent.c199
-rw-r--r--src/common/dirent.h210
-rw-r--r--src/common/makefile.mak9
-rw-r--r--src/common/wdkutil.c (renamed from src/common/portable.c)13
-rw-r--r--src/common/wdkutil.h (renamed from src/common/portable.h)1
-rw-r--r--xchat-wdk.patch130
9 files changed, 335 insertions, 236 deletions
diff --git a/build/build-small.bat b/build/build-small.bat
index 4076302f..55d8f3ed 100644
--- a/build/build-small.bat
+++ b/build/build-small.bat
@@ -61,7 +61,7 @@ copy ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins
 copy ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins
 copy ..\plugins\upd\xcupd.dll %XCHAT_DEST%\plugins
 ::copy ..\plugins\xdcc\xcxdcc.dll %XCHAT_DEST%\plugins
-::copy ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins
+copy ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins
 copy ..\plugins\winamp\xcwinamp.dll %XCHAT_DEST%\plugins
 copy %DEPS_ROOT%\bin\lua51.dll %XCHAT_DEST%
 pause
diff --git a/plugins/lua/makefile.mak b/plugins/lua/makefile.mak
index 81399ac6..fbc94072 100644
--- a/plugins/lua/makefile.mak
+++ b/plugins/lua/makefile.mak
@@ -1,7 +1,9 @@
 include "..\..\src\makeinc.mak"

 

+DIRENTLIB = ..\..\src\common\dirent.lib

+

 all: lua.obj lua.def

-	link $(LDFLAGS) $(LIBS) /dll /out:xclua.dll $(LUALIB).lib /def:lua.def lua.obj 

+	link $(LDFLAGS) $(LIBS) /dll /out:xclua.dll $(LUALIB).lib $(DIRENTLIB) /def:lua.def lua.obj 

 

 lua.def:

 	echo EXPORTS > lua.def

diff --git a/plugins/python/makefile.mak b/plugins/python/makefile.mak
index 7414f188..8cbba3f5 100644
--- a/plugins/python/makefile.mak
+++ b/plugins/python/makefile.mak
@@ -1,5 +1,6 @@
 include "..\..\src\makeinc.mak"
 
+DIRENTLIB = ..\..\src\common\dirent.lib
 TARGET = $(PYTHONOUTPUT)
 
 all: $(TARGET)
@@ -14,7 +15,7 @@ python.obj: python.c
 	$(CC) $(CFLAGS) /I.. /Dusleep=_sleep /DPATH_MAX=255 python.c $(GLIB) /I$(PYTHONPATH)\include /DPYTHON_DLL=\"$(PYTHONLIB).dll\"
 
 $(TARGET): python.obj python.def
-	$(LINK) /dll /out:$(TARGET) $(LDFLAGS) python.obj /libpath:$(PYTHONPATH)\libs $(PYTHONLIB).lib $(LIBS) /def:python.def
+	$(LINK) /dll /out:$(TARGET) $(LDFLAGS) python.obj /libpath:$(PYTHONPATH)\libs $(PYTHONLIB).lib $(DIRENTLIB) $(LIBS) /def:python.def
 
 clean:
 	del $(TARGET)
diff --git a/src/common/dirent.c b/src/common/dirent.c
new file mode 100644
index 00000000..a84f1b65
--- /dev/null
+++ b/src/common/dirent.c
@@ -0,0 +1,199 @@
+/*****************************************************************************
+ * dirent.h - dirent API for Microsoft Visual Studio
+ *
+ * Copyright (C) 2006 Toni Ronkko
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * ``Software''), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Dec 15, 2009, John Cunningham
+ * Added rewinddir member function
+ *
+ * Jan 18, 2008, Toni Ronkko
+ * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string
+ * between multi-byte and unicode representations.  This makes the
+ * code simpler and also allows the code to be compiled under MingW.  Thanks
+ * to Azriel Fasten for the suggestion.
+ *
+ * Mar 4, 2007, Toni Ronkko
+ * Bug fix: due to the strncpy_s() function this file only compiled in
+ * Visual Studio 2005.  Using the new string functions only when the
+ * compiler version allows.
+ *
+ * Nov  2, 2006, Toni Ronkko
+ * Major update: removed support for Watcom C, MS-DOS and Turbo C to
+ * simplify the file, updated the code to compile cleanly on Visual
+ * Studio 2005 with both unicode and multi-byte character strings,
+ * removed rewinddir() as it had a bug.
+ *
+ * Aug 20, 2006, Toni Ronkko
+ * Removed all remarks about MSVC 1.0, which is antiqued now.  Simplified
+ * comments by removing SGML tags.
+ *
+ * May 14 2002, Toni Ronkko
+ * Embedded the function definitions directly to the header so that no
+ * source modules need to be included in the Visual Studio project.  Removed
+ * all the dependencies to other projects so that this very header can be
+ * used independently.
+ *
+ * May 28 1998, Toni Ronkko
+ * First version.
+ *****************************************************************************/
+
+#include "dirent.h"
+
+/* Use the new safe string functions introduced in Visual Studio 2005 */
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE)
+#else
+# define STRNCPY(dest,src,size) strncpy((dest),(src),(size))
+#endif
+
+
+/*****************************************************************************
+ * Open directory stream DIRNAME for read and return a pointer to the
+ * internal working area that is used to retrieve individual directory
+ * entries.
+ */
+DIR *opendir(const char *dirname)
+{
+   DIR *dirp;
+   assert (dirname != NULL);
+   assert (strlen (dirname) < MAX_PATH);
+
+   /* construct new DIR structure */
+   dirp = (DIR*) malloc (sizeof (struct DIR));
+   if (dirp != NULL) {
+      char *p;
+
+      /* take directory name... */
+      STRNCPY (dirp->patt, dirname, sizeof(dirp->patt));
+      dirp->patt[MAX_PATH] = '\0';
+
+      /* ... and append search pattern to it */
+      p = strchr (dirp->patt, '\0');
+      if (dirp->patt < p  &&  *(p-1) != '\\'  &&  *(p-1) != ':') {
+         *p++ = '\\';
+      }
+      *p++ = '*';
+      *p = '\0';
+
+      /* open stream and retrieve first file */
+      dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
+      if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+         /* invalid search pattern? */
+         free (dirp);
+         return NULL;
+      }
+
+      /* there is an un-processed directory entry in memory now */
+      dirp->cached = 1;
+   }
+
+   return dirp;
+}
+
+
+/*****************************************************************************
+ * Read a directory entry, and return a pointer to a dirent structure
+ * containing the name of the entry in d_name field.  Individual directory
+ * entries returned by this very function include regular files,
+ * sub-directories, pseudo-directories "." and "..", but also volume labels,
+ * hidden files and system files may be returned.
+ */
+struct dirent *readdir(DIR *dirp)
+{
+   assert (dirp != NULL);
+
+   if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+      /* directory stream was opened/rewound incorrectly or ended normally */
+      return NULL;
+   }
+
+   /* get next directory entry */
+   if (dirp->cached != 0) {
+      /* a valid directory entry already in memory */
+      dirp->cached = 0;
+   } else {
+      /* read next directory entry from disk */
+      if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) {
+         /* the very last file has been processed or an error occured */
+         FindClose (dirp->search_handle);
+         dirp->search_handle = INVALID_HANDLE_VALUE;
+         return NULL;
+      }
+   }
+
+   /* copy as a multibyte character string */
+   STRNCPY ( dirp->current.d_name,
+             dirp->current.data.cFileName,
+             sizeof(dirp->current.d_name) );
+   dirp->current.d_name[MAX_PATH] = '\0';
+
+   return &dirp->current;
+}
+
+
+/*****************************************************************************
+ * Close directory stream opened by opendir() function.  Close of the
+ * directory stream invalidates the DIR structure as well as any previously
+ * read directory entry.
+ */
+int closedir(DIR *dirp)
+{
+   assert (dirp != NULL);
+
+   /* release search handle */
+   if (dirp->search_handle != INVALID_HANDLE_VALUE) {
+      FindClose (dirp->search_handle);
+      dirp->search_handle = INVALID_HANDLE_VALUE;
+   }
+
+   /* release directory handle */
+   free (dirp);
+   return 0;
+}
+
+
+/*****************************************************************************
+ * Resets the position of the directory stream to which dirp refers to the
+ * beginning of the directory. It also causes the directory stream to refer
+ * to the current state of the corresponding directory, as a call to opendir()
+ * would have done. If dirp does not refer to a directory stream, the effect
+ * is undefined.
+ */
+void rewinddir(DIR* dirp)
+{
+   /* release search handle */
+   if (dirp->search_handle != INVALID_HANDLE_VALUE) {
+      FindClose (dirp->search_handle);
+      dirp->search_handle = INVALID_HANDLE_VALUE;
+   }
+
+   /* open new search handle and retrieve first file */
+   dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
+   if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+      /* invalid search pattern? */
+      free (dirp);
+      return;
+   }
+
+   /* there is an un-processed directory entry in memory now */
+   dirp->cached = 1;
+}
diff --git a/src/common/dirent.h b/src/common/dirent.h
index 64251740..cbb753e6 100644
--- a/src/common/dirent.h
+++ b/src/common/dirent.h
@@ -1,60 +1,3 @@
-/*****************************************************************************
- * dirent.h - dirent API for Microsoft Visual Studio
- *
- * Copyright (C) 2006 Toni Ronkko
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * ``Software''), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Dec 15, 2009, John Cunningham
- * Added rewinddir member function
- *
- * Jan 18, 2008, Toni Ronkko
- * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string
- * between multi-byte and unicode representations.  This makes the
- * code simpler and also allows the code to be compiled under MingW.  Thanks
- * to Azriel Fasten for the suggestion.
- *
- * Mar 4, 2007, Toni Ronkko
- * Bug fix: due to the strncpy_s() function this file only compiled in
- * Visual Studio 2005.  Using the new string functions only when the
- * compiler version allows.
- *
- * Nov  2, 2006, Toni Ronkko
- * Major update: removed support for Watcom C, MS-DOS and Turbo C to
- * simplify the file, updated the code to compile cleanly on Visual
- * Studio 2005 with both unicode and multi-byte character strings,
- * removed rewinddir() as it had a bug.
- *
- * Aug 20, 2006, Toni Ronkko
- * Removed all remarks about MSVC 1.0, which is antiqued now.  Simplified
- * comments by removing SGML tags.
- *
- * May 14 2002, Toni Ronkko
- * Embedded the function definitions directly to the header so that no
- * source modules need to be included in the Visual Studio project.  Removed
- * all the dependencies to other projects so that this very header can be
- * used independently.
- *
- * May 28 1998, Toni Ronkko
- * First version.
- *****************************************************************************/
 #ifndef DIRENT_H
 #define DIRENT_H
 
@@ -62,14 +5,12 @@
 #include <string.h>
 #include <assert.h>
 
-
 typedef struct dirent
 {
    char d_name[MAX_PATH + 1]; /* current dir entry (multi-byte char string) */
    WIN32_FIND_DATAA data;     /* file attributes */
 }  dirent;
 
-
 typedef struct DIR
 {
    dirent current;            /* Current directory entry */
@@ -78,153 +19,10 @@ typedef struct DIR
    char   patt[MAX_PATH + 3]; /* search pattern (3 = pattern + "\\*\0") */
 } DIR;
 
-
 /* Forward declarations */
-static DIR *opendir (const char *dirname);
-static struct dirent *readdir (DIR *dirp);
-static int closedir (DIR *dirp);
-static void rewinddir(DIR* dirp);
-
-
-/* Use the new safe string functions introduced in Visual Studio 2005 */
-#if defined(_MSC_VER) && _MSC_VER >= 1400
-# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE)
-#else
-# define STRNCPY(dest,src,size) strncpy((dest),(src),(size))
-#endif
-
-
-/*****************************************************************************
- * Open directory stream DIRNAME for read and return a pointer to the
- * internal working area that is used to retrieve individual directory
- * entries.
- */
-static DIR *opendir(const char *dirname)
-{
-   DIR *dirp;
-   assert (dirname != NULL);
-   assert (strlen (dirname) < MAX_PATH);
-
-   /* construct new DIR structure */
-   dirp = (DIR*) malloc (sizeof (struct DIR));
-   if (dirp != NULL) {
-      char *p;
-
-      /* take directory name... */
-      STRNCPY (dirp->patt, dirname, sizeof(dirp->patt));
-      dirp->patt[MAX_PATH] = '\0';
-
-      /* ... and append search pattern to it */
-      p = strchr (dirp->patt, '\0');
-      if (dirp->patt < p  &&  *(p-1) != '\\'  &&  *(p-1) != ':') {
-         *p++ = '\\';
-      }
-      *p++ = '*';
-      *p = '\0';
-
-      /* open stream and retrieve first file */
-      dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
-      if (dirp->search_handle == INVALID_HANDLE_VALUE) {
-         /* invalid search pattern? */
-         free (dirp);
-         return NULL;
-      }
-
-      /* there is an un-processed directory entry in memory now */
-      dirp->cached = 1;
-   }
-
-   return dirp;
-}
-
-
-/*****************************************************************************
- * Read a directory entry, and return a pointer to a dirent structure
- * containing the name of the entry in d_name field.  Individual directory
- * entries returned by this very function include regular files,
- * sub-directories, pseudo-directories "." and "..", but also volume labels,
- * hidden files and system files may be returned.
- */
-static struct dirent *readdir(DIR *dirp)
-{
-   assert (dirp != NULL);
-
-   if (dirp->search_handle == INVALID_HANDLE_VALUE) {
-      /* directory stream was opened/rewound incorrectly or ended normally */
-      return NULL;
-   }
-
-   /* get next directory entry */
-   if (dirp->cached != 0) {
-      /* a valid directory entry already in memory */
-      dirp->cached = 0;
-   } else {
-      /* read next directory entry from disk */
-      if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) {
-         /* the very last file has been processed or an error occured */
-         FindClose (dirp->search_handle);
-         dirp->search_handle = INVALID_HANDLE_VALUE;
-         return NULL;
-      }
-   }
-
-   /* copy as a multibyte character string */
-   STRNCPY ( dirp->current.d_name,
-             dirp->current.data.cFileName,
-             sizeof(dirp->current.d_name) );
-   dirp->current.d_name[MAX_PATH] = '\0';
-
-   return &dirp->current;
-}
-
-
-/*****************************************************************************
- * Close directory stream opened by opendir() function.  Close of the
- * directory stream invalidates the DIR structure as well as any previously
- * read directory entry.
- */
-static int closedir(DIR *dirp)
-{
-   assert (dirp != NULL);
-
-   /* release search handle */
-   if (dirp->search_handle != INVALID_HANDLE_VALUE) {
-      FindClose (dirp->search_handle);
-      dirp->search_handle = INVALID_HANDLE_VALUE;
-   }
-
-   /* release directory handle */
-   free (dirp);
-   return 0;
-}
-
-
-/*****************************************************************************
- * Resets the position of the directory stream to which dirp refers to the
- * beginning of the directory. It also causes the directory stream to refer
- * to the current state of the corresponding directory, as a call to opendir()
- * would have done. If dirp does not refer to a directory stream, the effect
- * is undefined.
- */
-static void rewinddir(DIR* dirp)
-{
-   /* release search handle */
-   if (dirp->search_handle != INVALID_HANDLE_VALUE) {
-      FindClose (dirp->search_handle);
-      dirp->search_handle = INVALID_HANDLE_VALUE;
-   }
-
-   /* open new search handle and retrieve first file */
-   dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data);
-   if (dirp->search_handle == INVALID_HANDLE_VALUE) {
-      /* invalid search pattern? */
-      free (dirp);
-      return;
-   }
-
-   /* there is an un-processed directory entry in memory now */
-   dirp->cached = 1;
-}
-
+DIR *opendir (const char *dirname);
+struct dirent *readdir (DIR *dirp);
+int closedir (DIR *dirp);
+void rewinddir(DIR* dirp);
 
 #endif /*DIRENT_H*/
diff --git a/src/common/makefile.mak b/src/common/makefile.mak
index 3ef6bad1..424316c0 100644
--- a/src/common/makefile.mak
+++ b/src/common/makefile.mak
@@ -5,6 +5,7 @@ cfgfiles.obj \
 chanopt.obj \
 ctcp.obj \
 dcc.obj \
+dirent.obj \
 history.obj \
 ignore.obj \
 inbound.obj \
@@ -14,7 +15,6 @@ notify.obj \
 outbound.obj \
 plugin.obj \
 plugin-timer.obj \
-portable.obj \
 proto-irc.obj \
 server.obj \
 servlist.obj \
@@ -25,16 +25,21 @@ tree.obj \
 url.obj \
 userlist.obj \
 util.obj \
+wdkutil.obj \
 xchat.obj
 
-all: $(COMMON_OBJECTS) xchatcommon.lib
+all: $(COMMON_OBJECTS) xchatcommon.lib dirent.lib
 
 xchatcommon.lib: $(COMMON_OBJECTS)
 	lib /nologo /out:xchatcommon.lib $(COMMON_OBJECTS)
 
+dirent.lib: dirent.obj
+	lib /nologo /out:dirent.lib dirent.obj
+
 .c.obj::
 	$(CC) $(CFLAGS) $(GLIB) $<
 
 clean:
 	@del *.obj
 	@del xchatcommon.lib
+	@del dirent.lib
diff --git a/src/common/portable.c b/src/common/wdkutil.c
index 05a6c281..5bf4f0c0 100644
--- a/src/common/portable.c
+++ b/src/common/wdkutil.c
@@ -12,3 +12,16 @@ portable_mode ()
 		return 0;
 	}
 }
+
+int
+xtray_mode ()
+{
+	if ((_access( "plugins/xtray.dll", 0 )) != -1)
+	{
+		return 1;
+	}
+	else
+	{
+		return 0;
+	}
+}
diff --git a/src/common/portable.h b/src/common/wdkutil.h
index bd40b24d..2e4c693a 100644
--- a/src/common/portable.h
+++ b/src/common/wdkutil.h
@@ -1 +1,2 @@
 int portable_mode ();
+int xtray_mode ();
diff --git a/xchat-wdk.patch b/xchat-wdk.patch
index 41f403ba..b15fb97b 100644
--- a/xchat-wdk.patch
+++ b/xchat-wdk.patch
@@ -103,7 +103,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xdcc/xdcc.c xchat-wdk/plugi
  
 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	2011-01-09 22:15:18 +0100
++++ xchat-wdk/src/common/cfgfiles.c	2011-01-14 05:44:35 +0100
 @@ -17,7 +17,6 @@
   */
  
@@ -116,7 +116,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/cfgfiles.c xchat-wdk/src
  #include "fe.h"
  #include "text.h"
  #include "xchatc.h"
-+#include "portable.h"
++#include "wdkutil.h"
  
 -#ifdef WIN32
 -#define XCHAT_DIR "X-Chat 2"
@@ -844,12 +844,12 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/xchat.h xchat-wdk/src/co
  	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 09:43:49 +0200
-+++ xchat-wdk/src/fe-gtk/about.c	2011-01-13 02:40:11 +0100
++++ xchat-wdk/src/fe-gtk/about.c	2011-01-14 05:44:48 +0100
 @@ -39,6 +39,7 @@
  
  #include "../common/xchat.h"
  #include "../common/util.h"
-+#include "../common/portable.h"
++#include "../common/wdkutil.h"
  #include "palette.h"
  #include "pixmaps.h"
  #include "gtkutil.h"
@@ -1491,8 +1491,16 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/joind.c xchat-wdk/src/fe
  
 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-12-28 04:16:34 +0100
-+++ xchat-wdk/src/fe-gtk/maingui.c	2010-12-28 14:57:33 +0100
-@@ -214,60 +214,10 @@
++++ xchat-wdk/src/fe-gtk/maingui.c	2011-01-14 06:24:27 +0100
+@@ -53,6 +53,7 @@
+ #include "../common/plugin.h"
+ #include "../common/modes.h"
+ #include "../common/url.h"
++#include "../common/wdkutil.h"
+ #include "fe-gtk.h"
+ #include "banlist.h"
+ #include "gtkutil.h"
+@@ -214,60 +215,10 @@
  	away_list = mg_attr_list_create (&colors[COL_AWAY], FALSE);
  }
  
@@ -1554,7 +1562,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/maingui.c xchat-wdk/src/
  }
  
  static void
-@@ -281,18 +231,14 @@
+@@ -281,18 +232,14 @@
  {
  	set_window_urgency (win, FALSE);
  }
@@ -1573,7 +1581,16 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/maingui.c xchat-wdk/src/
  }
  
  /* set a tab plain, red, light-red, or blue */
-@@ -2972,11 +2918,7 @@
+@@ -1334,7 +1281,7 @@
+ 	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
+ 										GTK_BUTTONBOX_END);
+ 
+-	if (minimize_button)
++	if (minimize_button && !xtray_mode ())
+ 	{
+ 		button = gtk_button_new_with_mnemonic (_("_Minimize to Tray"));
+ 		gtk_widget_show (button);
+@@ -2972,11 +2919,7 @@
  		gtk_xtext_check_marker_visibility (GTK_XTEXT (current_sess->gui->xtext));
  		plugin_emit_dummy_print (current_sess, "Focus Window");
  	}
@@ -1585,7 +1602,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/maingui.c xchat-wdk/src/
  	return FALSE;
  }
  
-@@ -2987,11 +2929,7 @@
+@@ -2987,11 +2930,7 @@
  	if (!sess->server->server_session)
  		sess->server->server_session = sess;
  	gtk_xtext_check_marker_visibility(GTK_XTEXT (current_sess->gui->xtext));
@@ -1653,8 +1670,8 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/palette.c xchat-wdk/src/
  #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-11-16 09:26:23 +0100
-+++ xchat-wdk/src/fe-gtk/plugin-tray.c	2011-01-11 00:16:30 +0100
-@@ -1,8 +1,7 @@
++++ xchat-wdk/src/fe-gtk/plugin-tray.c	2011-01-14 05:52:36 +0100
+@@ -1,14 +1,14 @@
  /* Copyright (C) 2006-2007 Peter Zelezny. */
  
  #include <string.h>
@@ -1664,7 +1681,14 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  #include "../common/xchat.h"
  #include "../common/xchatc.h"
  #include "../common/inbound.h"
-@@ -297,10 +296,10 @@
+ #include "../common/server.h"
+ #include "../common/fe.h"
+ #include "../common/util.h"
++#include "../common/wdkutil.h"
+ #include "fe-gtk.h"
+ #include "pixmaps.h"
+ #include "maingui.h"
+@@ -297,10 +297,10 @@
  		nets = tray_count_networks ();
  		chans = tray_count_channels ();
  		if (nets)
@@ -1677,7 +1701,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  	}
  
  	if (custom_icon1)
-@@ -450,7 +449,7 @@
+@@ -450,7 +450,7 @@
  	/* ph may have an invalid context now */
  	xchat_set_context (ph, xchat_find_context (ph, NULL, NULL));
  
@@ -1686,7 +1710,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  
  	tray_stop_flash ();
  	tray_reset_counts ();
-@@ -585,11 +584,12 @@
+@@ -585,11 +585,12 @@
  	/*gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));*/
  
  	if (tray_get_window_status () == WS_HIDDEN)
@@ -1701,7 +1725,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  	submenu = mg_submenu (menu, _("_Blink on"));
  	blink_item (&prefs.input_tray_chans, submenu, _("Channel Message"));
  	blink_item (&prefs.input_tray_priv, submenu, _("Private Message"));
-@@ -606,6 +606,7 @@
+@@ -606,6 +607,7 @@
  		gtk_widget_set_sensitive (item, FALSE);
  
  	tray_make_item (menu, NULL, tray_menu_quit_cb, NULL);
@@ -1709,7 +1733,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  	mg_create_icon_item (_("_Quit"), GTK_STOCK_QUIT, menu, tray_menu_quit_cb, NULL);
  
  	menu_add_plugin_items (menu, "\x5$TRAY", NULL);
-@@ -631,8 +632,8 @@
+@@ -631,8 +633,8 @@
  	sticon = gtk_status_icon_new_from_pixbuf (ICON_NORMAL);
  	if (!sticon)
  		return;
@@ -1720,7 +1744,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  	g_signal_connect (G_OBJECT (sticon), "activate",
  							G_CALLBACK (tray_menu_restore_cb), NULL);
  }
-@@ -650,15 +651,15 @@
+@@ -650,15 +652,15 @@
  		/* FIXME: hides any previous private messages */
  		tray_hilight_count++;
  		if (tray_hilight_count == 1)
@@ -1739,7 +1763,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  								 word[1], xchat_get_info (ph, "channel"));
  
  	return XCHAT_EAT_NONE;
-@@ -676,14 +677,14 @@
+@@ -676,14 +678,14 @@
  
  		tray_pub_count++;
  		if (tray_pub_count == 1)
@@ -1757,7 +1781,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  								 word[1], xchat_get_info (ph, "channel"));
  
  	return XCHAT_EAT_NONE;
-@@ -705,14 +706,14 @@
+@@ -705,14 +707,14 @@
  
  	tray_priv_count++;
  	if (tray_priv_count == 1)
@@ -1775,7 +1799,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  								 from, network);
  }
  
-@@ -758,15 +759,15 @@
+@@ -758,15 +760,15 @@
  
  		tray_file_count++;
  		if (tray_file_count == 1)
@@ -1794,6 +1818,24 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/plugin-tray.c xchat-wdk/
  								word[1], network);
  
  	return XCHAT_EAT_NONE;
+@@ -802,7 +804,7 @@
+ 	}
+ 	else
+ 	{
+-		if (prefs.gui_tray)
++		if (prefs.gui_tray && !xtray_mode ())
+ 			tray_init ();
+ 	}
+ }
+@@ -834,7 +836,7 @@
+ 
+ 	xchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
+ 
+-	if (prefs.gui_tray)
++	if (prefs.gui_tray && !xtray_mode ())
+ 		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 05:20:22 +0200
 +++ xchat-wdk/src/fe-gtk/plugingui.c	2010-12-28 14:57:33 +0100
@@ -1854,7 +1896,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/servlistgui.c xchat-wdk/
  	gtk_box_set_spacing (GTK_BOX (vbuttonbox2), 3);
 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	2011-01-10 06:58:17 +0100
++++ xchat-wdk/src/fe-gtk/setup.c	2011-01-14 06:37:24 +0100
 @@ -109,19 +109,32 @@
  					N_("Give each person on IRC a different color"),0,0},
  	{ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(indent_nicks),
@@ -1892,7 +1934,32 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/setup.c xchat-wdk/src/fe
  	{ST_END, 0, 0, 0, 0, 0}
  };
  
-@@ -363,7 +376,6 @@
+@@ -348,6 +361,24 @@
+ 	{ST_END, 0, 0, 0, 0, 0}
+ };
+ 
++static const setting alert_settings_xtray[] =
++{
++	{ST_HEADER,	N_("Alerts"),0,0,0},
++
++	{ST_ALERTHEAD},
++	{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
++	{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
++
++	{ST_HEADER,	N_("Highlighted Messages"),0,0,0},
++	{ST_LABEL,	N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
++
++	{ST_ENTRY,	N_("Extra words to highlight:"), P_OFFSETNL(irc_extra_hilight), 0, 0, sizeof prefs.irc_extra_hilight},
++	{ST_ENTRY,	N_("Nick names not to highlight:"), P_OFFSETNL(irc_no_hilight), 0, 0, sizeof prefs.irc_no_hilight},
++	{ST_ENTRY,	N_("Nick names to always highlight:"), P_OFFSETNL(irc_nick_hilight), 0, 0, sizeof prefs.irc_nick_hilight},
++	{ST_LABEL,	N_("Separate multiple words with commas.\nWildcards are accepted.")},
++	{ST_END, 0, 0, 0, 0, 0}
++};
++
+ static const setting general_settings[] =
+ {
+ 	{ST_HEADER,	N_("Default Messages"),0,0,0},
+@@ -363,7 +394,6 @@
  	{ST_END, 0, 0, 0, 0, 0}
  };
  
@@ -1900,7 +1967,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/setup.c xchat-wdk/src/fe
  static const setting advanced_settings[] =
  {
  	{ST_HEADER,	N_("Advanced Settings"),0,0,0},
-@@ -378,7 +390,6 @@
+@@ -378,7 +408,6 @@
  
  	{ST_END, 0, 0, 0, 0, 0}
  };
@@ -1908,7 +1975,7 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/setup.c xchat-wdk/src/fe
  
  static const setting logging_settings[] =
  {
-@@ -1708,7 +1719,7 @@
+@@ -1708,7 +1737,7 @@
  		N_("General"),
  		N_("Logging"),
  		N_("Sound"),
@@ -1917,7 +1984,20 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/setup.c xchat-wdk/src/fe
  		NULL,
  	N_("Network"),
  		N_("Network setup"),
-@@ -1733,6 +1744,7 @@
+@@ -1729,10 +1758,19 @@
+ 	setup_add_page (cata[3], book, setup_create_page (userlist_settings));
+ 	setup_add_page (cata[4], book, setup_create_page (tabs_settings));
+ 	setup_add_page (cata[5], book, setup_create_color_page ());
+-	setup_add_page (cata[8], book, setup_create_page (alert_settings));
++
++	if (xtray_mode ())
++	{
++		setup_add_page (cata[8], book, setup_create_page (alert_settings_xtray));
++	} else
++	{
++		setup_add_page (cata[8], book, setup_create_page (alert_settings));
++	}
++
  	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 ());