diff --git a/build/build-x64.bat b/build/build-x64.bat new file mode 100644 index 00000000..07ae4be3 --- /dev/null +++ b/build/build-x64.bat @@ -0,0 +1,33 @@ +@echo off +set INCLUDE=c:\WinDDK\7600.16385.1\inc\api;c:\WinDDK\7600.16385.1\inc\crt;c:\WinDDK\7600.16385.1\inc\api\crt\stl70;c:\mozilla-build\build\xchat-dev64\include;c:\mozilla-build\build\openssl-0.9.8j-wdk-x64\include +set LIB=c:\WinDDK\7600.16385.1\lib\wnet\amd64;c:\WinDDK\7600.16385.1\lib\Crt\amd64;c:\mozilla-build\build\openssl-0.9.8j-wdk-x64\lib +set OPATH=%PATH% +set PATH=c:\WinDDK\7600.16385.1\bin\x86\amd64;c:\WinDDK\7600.16385.1\bin\x86;c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;c:\mozilla-build\build\xchat-dev64\bin;c:\mozilla-build\perl-5.10-x64\bin +cd ..\src +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\plugins\dns +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\ewc +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\perl +nmake -f makefile.mak clean +nmake -f makefile.mak +::cd ..\python +::nmake -f makefile.mak clean +::nmake -f makefile.mak +::cd ..\tcl +::nmake -f makefile.mak clean +::nmake -f makefile.mak +cd ..\xtray +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\..\build +set PATH=%PATH%;c:\mozilla-build\build\xchat-dev32\bin +call compile-po-files.bat +cd ..\build +set PATH=%OPATH% +call release-x64.bat +pause diff --git a/build/build-x86.bat b/build/build-x86.bat new file mode 100644 index 00000000..a7a9a916 --- /dev/null +++ b/build/build-x86.bat @@ -0,0 +1,32 @@ +@echo off +set INCLUDE=c:\WinDDK\7600.16385.1\inc\api;c:\WinDDK\7600.16385.1\inc\crt;c:\WinDDK\7600.16385.1\inc\api\crt\stl70;c:\mozilla-build\build\xchat-dev32\include;c:\mozilla-build\build\openssl-0.9.8j-wdk-x86\include +set LIB=c:\WinDDK\7600.16385.1\lib\wxp\i386;c:\WinDDK\7600.16385.1\lib\Crt\i386;c:\mozilla-build\build\openssl-0.9.8j-wdk-x86\lib +set OPATH=%PATH% +set PATH=c:\WinDDK\7600.16385.1\bin\x86\x86;c:\WinDDK\7600.16385.1\bin\x86;c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;c:\mozilla-build\build\xchat-dev32\bin;c:\mozilla-build\mingw\bin;c:\mozilla-build\perl-5.10-x86\bin +cd ..\src +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\plugins\dns +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\ewc +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\perl +nmake -f makefile.mak clean +nmake -f makefile.mak +::cd ..\python +::nmake -f makefile.mak clean +::nmake -f makefile.mak +cd ..\tcl +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\xtray +nmake -f makefile.mak clean +nmake -f makefile.mak +cd ..\..\build +call compile-po-files.bat +cd ..\build +set PATH=%OPATH% +call release-x86.bat +pause diff --git a/build/compile-po-files.bat b/build/compile-po-files.bat new file mode 100644 index 00000000..79a3b4b1 --- /dev/null +++ b/build/compile-po-files.bat @@ -0,0 +1,87 @@ +@echo off + +echo.Compiling translations . . . +cd ..\po +rmdir /Q /S locale +mkdir locale + +mkdir locale\be\LC_MESSAGES +msgfmt -cvo locale\be\LC_MESSAGES\xchat.mo be.po + +mkdir locale\ca\LC_MESSAGES +msgfmt -cvo locale\ca\LC_MESSAGES\xchat.mo ca.po + +mkdir locale\cs\LC_MESSAGES +msgfmt -cvo locale\cs\LC_MESSAGES\xchat.mo cs.po + +mkdir locale\de\LC_MESSAGES +msgfmt -cvo locale\de\LC_MESSAGES\xchat.mo de.po + +mkdir locale\el\LC_MESSAGES +msgfmt -cvo locale\el\LC_MESSAGES\xchat.mo el.po + +mkdir locale\es\LC_MESSAGES +msgfmt -cvo locale\es\LC_MESSAGES\xchat.mo es.po + +mkdir locale\fi\LC_MESSAGES +msgfmt -cvo locale\fi\LC_MESSAGES\xchat.mo fi.po + +mkdir locale\fr\LC_MESSAGES +msgfmt -cvo locale\fr\LC_MESSAGES\xchat.mo fr.po + +mkdir locale\gl\LC_MESSAGES +msgfmt -cvo locale\gl\LC_MESSAGES\xchat.mo gl.po + +mkdir locale\hu\LC_MESSAGES +msgfmt -cvo locale\hu\LC_MESSAGES\xchat.mo hu.po + +mkdir locale\it\LC_MESSAGES +msgfmt -cvo locale\it\LC_MESSAGES\xchat.mo it.po + +mkdir locale\ja\LC_MESSAGES +msgfmt -cvo locale\ja\LC_MESSAGES\xchat.mo ja.po + +mkdir locale\ko\LC_MESSAGES +msgfmt -cvo locale\ko\LC_MESSAGES\xchat.mo ko.po + +mkdir locale\lt\LC_MESSAGES +msgfmt -cvo locale\lt\LC_MESSAGES\xchat.mo lt.po + +mkdir locale\mk\LC_MESSAGES +msgfmt -cvo locale\mk\LC_MESSAGES\xchat.mo mk.po + +mkdir locale\nl\LC_MESSAGES +msgfmt -cvo locale\nl\LC_MESSAGES\xchat.mo nl.po + +mkdir locale\pa\LC_MESSAGES +msgfmt -cvo locale\pa\LC_MESSAGES\xchat.mo pa.po + +mkdir locale\pt\LC_MESSAGES +msgfmt -cvo locale\pt\LC_MESSAGES\xchat.mo pt.po + +mkdir locale\ru\LC_MESSAGES +msgfmt -cvo locale\ru\LC_MESSAGES\xchat.mo ru.po + +mkdir locale\sq\LC_MESSAGES +msgfmt -cvo locale\sq\LC_MESSAGES\xchat.mo sq.po + +mkdir locale\sr\LC_MESSAGES +msgfmt -cvo locale\sr\LC_MESSAGES\xchat.mo sr.po + +mkdir locale\sv\LC_MESSAGES +msgfmt -cvo locale\sv\LC_MESSAGES\xchat.mo sv.po + +mkdir locale\th\LC_MESSAGES +msgfmt -cvo locale\th\LC_MESSAGES\xchat.mo th.po + +mkdir locale\uk\LC_MESSAGES +msgfmt -cvo locale\uk\LC_MESSAGES\xchat.mo uk.po + +mkdir locale\vi\LC_MESSAGES +msgfmt -cvo locale\vi\LC_MESSAGES\xchat.mo vi.po + +mkdir locale\zh_CN\LC_MESSAGES +msgfmt -cvo locale\zh_CN\LC_MESSAGES\xchat.mo zh_CN.po + +mkdir locale\zh_TW\LC_MESSAGES +msgfmt -cvo locale\zh_TW\LC_MESSAGES\xchat.mo zh_TW.po diff --git a/build/etc/gtk-2.0/gtkrc b/build/etc/gtk-2.0/gtkrc new file mode 100644 index 00000000..6b3ffa45 --- /dev/null +++ b/build/etc/gtk-2.0/gtkrc @@ -0,0 +1,68 @@ +gtk-font-name = "sans 8" + +gtk-icon-sizes = "gtk-menu=13,13:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32" +gtk-toolbar-icon-size = small-toolbar + +# disable images in buttons. i've only seen ugly delphi apps use this feature. +gtk-button-images = 0 + +# enable/disable images in menus. most "stock" microsoft apps don't use these, except sparingly. +# the office apps use them heavily, though. +gtk-menu-images = 1 + +# use the win32 button ordering instead of the GNOME HIG one, where applicable +gtk-alternative-button-order = 1 + +# use the win32 sort indicators direction, as in Explorer +gtk-alternative-sort-arrows = 1 + +# Windows users don't expect the PC Speaker beeping at them when they backspace in an empty textview and stuff like that +gtk-error-bell = 0 + +style "msw-default" +{ + GtkWidget::interior-focus = 1 + GtkOptionMenu::indicator-size = { 9, 5 } + GtkOptionMenu::indicator-spacing = { 7, 5, 2, 2 } + GtkSpinButton::shadow-type = in + + # Owen and I disagree that these should be themable + #GtkUIManager::add-tearoffs = 0 + #GtkComboBox::add-tearoffs = 0 + + GtkComboBox::appears-as-list = 1 + GtkComboBox::focus-on-click = 0 + + GOComboBox::add_tearoffs = 0 + + GtkTreeView::allow-rules = 0 + GtkTreeView::expander-size = 12 + + GtkExpander::expander-size = 12 + + GtkScrolledWindow::scrollbar_spacing = 1 + + GtkSeparatorMenuItem::horizontal-padding = 2 + + engine "wimp" + { + } +} +class "*" style "msw-default" + +binding "ms-windows-tree-view" +{ + bind "Right" { "expand-collapse-cursor-row" (1,1,0) } + bind "Left" { "expand-collapse-cursor-row" (1,0,0) } +} + +class "GtkTreeView" binding "ms-windows-tree-view" + +style "msw-combobox-thickness" = "msw-default" +{ + xthickness = 0 + ythickness = 0 +} + +widget_class "*TreeView*ComboBox*" style "msw-combobox-thickness" +widget_class "*ComboBox*GtkFrame*" style "msw-combobox-thickness" diff --git a/build/release-x64.bat b/build/release-x64.bat new file mode 100644 index 00000000..5f672afa --- /dev/null +++ b/build/release-x64.bat @@ -0,0 +1,39 @@ +@echo off +set GTK_BIN=c:\mozilla-build\build\xchat-dev64\bin +set SSL_BIN=c:\mozilla-build\build\openssl-0.9.8j-wdk-x64\bin +set XCHAT_DEST=c:\mozilla-build\build\xchat-wdk-x64 +rmdir /Q /S %XCHAT_DEST% +mkdir %XCHAT_DEST% +xcopy ..\src\fe-gtk\xchat.exe %XCHAT_DEST% +xcopy %GTK_BIN%\libgtk-win32-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgdk_pixbuf-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgio-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libglib-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgmodule-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgobject-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpng14-14.dll %XCHAT_DEST% +xcopy %GTK_BIN%\zlib1.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgdk-win32-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libcairo-2.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libfontconfig-1.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libexpat-1.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libfreetype-6.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpango-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpangocairo-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpangoft2-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpangowin32-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libatk-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libintl-8.dll %XCHAT_DEST% +xcopy /S /I %GTK_BIN%\..\lib\gtk-2.0 %XCHAT_DEST%\lib\gtk-2.0 +rmdir /Q /S %XCHAT_DEST%\lib\gtk-2.0\include +xcopy /S /I etc %XCHAT_DEST%\etc +xcopy ..\COPYING %XCHAT_DEST% +::xcopy %SSL_BIN%\libeay32.dll %XCHAT_DEST% +::xcopy %SSL_BIN%\ssleay32.dll %XCHAT_DEST% +xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\ +::xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\ +::xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\po\locale %XCHAT_DEST%\locale diff --git a/build/release-x86.bat b/build/release-x86.bat new file mode 100644 index 00000000..7fd70e31 --- /dev/null +++ b/build/release-x86.bat @@ -0,0 +1,39 @@ +@echo off +set GTK_BIN=c:\mozilla-build\build\xchat-dev32\bin +set SSL_BIN=c:\mozilla-build\build\openssl-0.9.8j-wdk-x86\bin +set XCHAT_DEST=c:\mozilla-build\build\xchat-wdk-x86 +rmdir /Q /S %XCHAT_DEST% +mkdir %XCHAT_DEST% +xcopy ..\src\fe-gtk\xchat.exe %XCHAT_DEST% +xcopy %GTK_BIN%\libgtk-win32-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgdk_pixbuf-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgio-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libglib-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgmodule-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgobject-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpng14-14.dll %XCHAT_DEST% +xcopy %GTK_BIN%\zlib1.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libgdk-win32-2.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libcairo-2.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libfontconfig-1.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libexpat-1.dll %XCHAT_DEST% +xcopy %GTK_BIN%\freetype6.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpango-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpangocairo-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpangoft2-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libpangowin32-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\libatk-1.0-0.dll %XCHAT_DEST% +xcopy %GTK_BIN%\intl.dll %XCHAT_DEST% +xcopy /S /I %GTK_BIN%\..\lib\gtk-2.0 %XCHAT_DEST%\lib\gtk-2.0 +rmdir /Q /S %XCHAT_DEST%\lib\gtk-2.0\include +xcopy /S /I etc %XCHAT_DEST%\etc +xcopy ..\COPYING %XCHAT_DEST% +::xcopy %SSL_BIN%\libeay32.dll %XCHAT_DEST% +::xcopy %SSL_BIN%\ssleay32.dll %XCHAT_DEST% +xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\ +::xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\ +xcopy /S /I ..\po\locale %XCHAT_DEST%\locale diff --git a/build/test-x64.bat b/build/test-x64.bat new file mode 100644 index 00000000..95f46d37 --- /dev/null +++ b/build/test-x64.bat @@ -0,0 +1,3 @@ +@echo off +set PATH=c:\mozilla-build\build\xchat-dev64\bin;c:\mozilla-build\perl-5.10-x64\bin;c:\mozilla-build\python-2.6-x64 +..\src\fe-gtk\xchat.exe diff --git a/build/test-x86.bat b/build/test-x86.bat new file mode 100644 index 00000000..d45ce8ff --- /dev/null +++ b/build/test-x86.bat @@ -0,0 +1,3 @@ +@echo off +set PATH=c:\mozilla-build\build\xchat-dev32\bin;c:\mozilla-build\perl-5.10-x86\bin;c:\mozilla-build\python-2.6-x86 +..\src\fe-gtk\xchat.exe diff --git a/config.h b/config.h new file mode 100644 index 00000000..8344e39d --- /dev/null +++ b/config.h @@ -0,0 +1,14 @@ +#define LOCALEDIR "./locale" +#define ENABLE_NLS +#define USE_GMODULE +#define USE_PLUGIN +#define PACKAGE_NAME "xchat" +#define PACKAGE_VERSION "r1409-6" +#define XCHATLIBDIR "." +#define XCHATSHAREDIR "." +#define OLD_PERL +#ifndef USE_IPV6 +#define socklen_t int +#endif +#define GETTEXT_PACKAGE "xchat" +#define PACKAGE_TARNAME "xchat-2.8.6" diff --git a/plugins/dns/makefile.mak b/plugins/dns/makefile.mak new file mode 100644 index 00000000..f1dd4c73 --- /dev/null +++ b/plugins/dns/makefile.mak @@ -0,0 +1,19 @@ +include "..\..\src\makeinc.mak" + +xcdns.dll: plugin-dns.obj dns.def + link $(LDFLAGS) /dll /out:xcdns.dll /def:dns.def plugin-dns.obj ws2_32.lib + dir xcdns.dll + +dns.def: + echo EXPORTS > dns.def + echo xchat_plugin_init >> dns.def + echo xchat_plugin_deinit >> dns.def + +plugin-dns.obj: plugin-dns.c makefile.mak thread.c + cl $(CFLAGS) /I.. -Dsnprintf=_snprintf plugin-dns.c + +clean: + del *.obj + del *.dll + del *.exp + del *.lib diff --git a/plugins/dns/plugin-dns.c b/plugins/dns/plugin-dns.c new file mode 100644 index 00000000..fdefd490 --- /dev/null +++ b/plugins/dns/plugin-dns.c @@ -0,0 +1,335 @@ +/* XChat Win32 DNS Plugin + * Copyright (C) 2003-2004 Peter Zelezny. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +/* + * Requires MS Visual Studio and IPV6 headers to compile (run nmake). + * Compiling with gcc (mingw) will fail due to missing gai_strerror. + */ + +#define DNS_VERSION "2.4" + +#include +#include +#include +#include + +#define IPV6 + +#ifdef _WIN32 +#ifdef IPV6 +#include +#include +#else +#include +#endif +#else +#include +#include +#endif + +#include "xchat-plugin.h" +#include "thread.c" + +#define HELP "Usage: DNS \n" +#define HEAD "\0034[DNS]\017\t" + +#define PIPE_READ 0 +#define PIPE_WRITE 1 +#define MAX_HOSTNAME 128 + +static xchat_plugin *ph; +static thread *active_thread = NULL; + + +static int +waitline (void *source, char *buf, int bufsize) +{ + int i = 0; + int len; + + while(1) + { + len = 1; + /* we can't read() here, due to glib's giowin32 */ + if(ph->xchat_read_fd(ph, source, buf + i, &len) != 0) + return -1; + if(buf[i] == '\n' || bufsize == i + 1) + { + buf[i] = 0; + return i; + } + i++; + } +} + +static void * +thread_function (void *ud) +{ +#ifdef IPV6 + struct addrinfo *ent; + struct addrinfo *cur; + struct addrinfo hints; +#else + struct hostent *ent; +#endif + thread *th = ud; + int fd = th->pipe_fd[PIPE_WRITE]; + int ret; + char ipstring[MAX_HOSTNAME]; + char reverse[MAX_HOSTNAME]; +// int i; + + active_thread = th; + +#ifdef IPV6 + memset (&hints, 0, sizeof (hints)); + hints.ai_family = PF_UNSPEC; /* support ipv6 and ipv4 */ + hints.ai_flags = AI_CANONNAME; +// hints.ai_socktype = SOCK_STREAM; + + ret = getaddrinfo (th->userdata, NULL, &hints, &ent); + if (ret != 0) + { + sprintf (ipstring, "1%d\n", ret); /* failed */ + write (fd, ipstring, strlen (ipstring)); +// Sleep (3000); + active_thread = NULL; + return 0; + } + +// i = 0; + cur = ent; + while (cur) + { + /* find the numeric IP number */ + ipstring[0] = 0; + getnameinfo (cur->ai_addr, cur->ai_addrlen, + ipstring, sizeof (ipstring), NULL, 0, NI_NUMERICHOST); + + if (cur->ai_canonname) + { + /* force reverse lookup if canonname & ipstring are the same */ + if (/*i == 0 &&*/ strcmp (cur->ai_canonname, ipstring) == 0) + goto lamecode; + } + + if (cur->ai_canonname) + { + write (fd, "0", 1); + write (fd, ipstring, strlen (ipstring)); + write (fd, "\n", 1); + write (fd, cur->ai_canonname, strlen (cur->ai_canonname)); + } else + { +lamecode: + // ret = 1; + // if (i == 0) + { + /* reverse lookup */ + reverse[0] = 0; + ret = getnameinfo (cur->ai_addr, cur->ai_addrlen, + reverse, sizeof (reverse), NULL, 0, NI_NAMEREQD); + } + + write (fd, "0", 1); + write (fd, ipstring, strlen (ipstring)); + + write (fd, "\n", 1); + if (ret == 0) + write (fd, reverse, strlen (reverse)); + } + write (fd, "\n", 1); + +// i++; + cur = cur->ai_next; + } + + /* tell the parent we're done */ + write (fd, "2\n", 2); + freeaddrinfo (ent); + +#else + ent = gethostbyname (th->userdata); + if (ent) + { + write (fd, "0", 1); + write (fd, ent->h_name, strlen (ent->h_name)); + write (fd, "\n", 1); + write (fd, ent->h_name, strlen (ent->h_name)); + write (fd, "\n", 1); + write (fd, "2\n", 2); + } else + { + write (fd, "10\n", 1); + } +#endif + +// Sleep (3000); + active_thread = NULL; /* race condition, better than nothing */ + + return 0; +} + +static int +dns_close_pipe (int fd) +{ + close (fd); + return 0; +} + +/* read messages comming from the child (through the pipe) */ + +static int +dns_read_cb (int fd, int flags, thread *th, void *source) +{ + char buf[512]; + char buf2[512]; + + while (waitline (source, buf, sizeof (buf))) + { + switch (buf[0]) + { + case '0': /* got data to show */ + waitline (source, buf2, sizeof (buf2)); + if (buf2[0] == 0) + xchat_printf(ph, HEAD"\002Numerical\002: %s\n", buf + 1); + else + xchat_printf(ph, HEAD"\002Canonical\002: %s \002Numerical\002: %s\n", buf2, buf + 1); + return 1; + + case '1': /* failed */ + xchat_printf(ph, HEAD"Lookup failed. %s\n", gai_strerrorA (atoi (buf + 1))); + + case '2': /* done */ + // close (th->pipe_fd[PIPE_WRITE]); + // close (th->pipe_fd[PIPE_READ]); + xchat_hook_timer(ph, 3000, dns_close_pipe, (void *)th->pipe_fd[PIPE_WRITE]); + xchat_hook_timer(ph, 4000, dns_close_pipe, (void *)th->pipe_fd[PIPE_READ]); + free (th->userdata); /* hostname strdup'ed */ + free (th); + return 0; + } + } + + return 1; +} + +/* find hostname from nickname (search the userlist, current chan only) */ + +static char * +find_nick_host (char *nick) +{ + xchat_list *list; + char *at; + const char *host; + + list = xchat_list_get (ph, "users"); + if (!list) + return NULL; + + while (xchat_list_next (ph, list)) + { + if (stricmp (nick, xchat_list_str (ph, list, "nick")) == 0) + { + host = xchat_list_str (ph, list, "host"); + if (host) + { + at = strrchr (host, '@'); + if (at) + return at + 1; + } + break; + } + } + + return NULL; +} + +static int +dns_cmd_cb (char *word[], char *word_eol[], void *ud) +{ + thread *th; + char *nickhost; + + if (!word[2][0]) + { + xchat_print (ph, HELP); + return XCHAT_EAT_ALL; + } + + th = thread_new (); + if (th) + { + nickhost = find_nick_host (word[2]); + if (nickhost) + { + xchat_printf (ph, HEAD"Looking up %s (%s)...\n", nickhost, word[2]); + th->userdata = strdup (nickhost); + } else + { + xchat_printf (ph, HEAD"Looking up %s...\n", word[2]); + th->userdata = strdup (word[2]); + } + + if (thread_start (th, thread_function, th)) + { + xchat_hook_fd(ph, th->pipe_fd[PIPE_READ], + XCHAT_FD_READ | XCHAT_FD_EXCEPTION | XCHAT_FD_NOTSOCKET, + (void *)dns_read_cb, th); + + } + } + + return XCHAT_EAT_ALL; +} + +int +xchat_plugin_deinit (xchat_plugin *plugin_handle) +{ + while (active_thread) /* children will set this var to NULL soon... */ + { + Sleep (1000); + } + return 1; +} + +int +#ifdef STATIC +exec_plugin_init +#else +xchat_plugin_init +#endif + (xchat_plugin *plugin_handle, char **plugin_name, + char **plugin_desc, char **plugin_version, char *arg) +{ + /* we need to save this for use with any xchat_* functions */ + ph = plugin_handle; + + /*if((void *)ph->xchat_read_fd == ph->dummy7) + { + xchat_print(ph, HEAD"This version of xchat is too old.\n"); + return 0; + }*/ + + *plugin_name = "DNS"; + *plugin_desc = "Threaded IPv4/6 DNS Command"; + *plugin_version = DNS_VERSION; + + xchat_hook_command(ph, "DNS", XCHAT_PRI_LOW, dns_cmd_cb, HELP, 0); + + return 1; /* return 1 for success */ +} diff --git a/plugins/dns/thread.c b/plugins/dns/thread.c new file mode 100644 index 00000000..aa153137 --- /dev/null +++ b/plugins/dns/thread.c @@ -0,0 +1,111 @@ +#include + +#define USE_PTHREAD + +#ifdef WIN32 + +#include +#define pthread_t DWORD +#define pipe(a) _pipe(a,4096,_O_BINARY) + +#else +#ifdef USE_PTHREAD + +#include + +#else + +#include +#include +#include +#define pthread_t int + +#endif +#endif + + +typedef struct +{ + pthread_t threadid; + int pipe_fd[2]; + void *userdata; +} thread; + +thread * +thread_new (void) +{ + thread *th; + + th = calloc (1, sizeof (*th)); + if (!th) + return NULL; + + if (pipe (th->pipe_fd) == -1) + { + free (th); + return NULL; + } + +#ifdef __EMX__ /* os/2 */ + setmode (pipe_fd[0], O_BINARY); + setmode (pipe_fd[1], O_BINARY); +#endif + + return th; +} + +int +thread_start (thread *th, void *(*start_routine)(void *), void *arg) +{ + pthread_t id; + +#ifdef WIN32 + CloseHandle (CreateThread (NULL, 0, + (LPTHREAD_START_ROUTINE)start_routine, + arg, 0, (DWORD *)&id)); +#else +#ifdef USE_PTHREAD + if (pthread_create (&id, NULL, start_routine, arg) != 0) + return 0; +#else + switch (id = fork ()) + { + case -1: + return 0; + case 0: + /* this is the child */ + setuid (getuid ()); + start_routine (arg); + _exit (0); + } +#endif +#endif + + th->threadid = id; + + return 1; +} + +/*void +thread_kill (thread *th) +{ +#ifdef WIN32 + PostThreadMessage (th->threadid, WM_QUIT, 0, 0); +#else +#ifdef USE_PTHREAD + pthread_cancel (th->threadid); + pthread_join (th->threadid, (void *)&th); +#else + kill (th->threadid, SIGKILL); + waitpid (th->threadid, NULL, 0); +#endif +#endif +} + +void +thread_free (thread *th) +{ + close (th->pipe_fd[0]); + close (th->pipe_fd[1]); + free (th); +}*/ diff --git a/plugins/ewc/COPYING b/plugins/ewc/COPYING new file mode 100644 index 00000000..4362b491 --- /dev/null +++ b/plugins/ewc/COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/plugins/ewc/ewc.c b/plugins/ewc/ewc.c new file mode 100644 index 00000000..ff9d776a --- /dev/null +++ b/plugins/ewc/ewc.c @@ -0,0 +1,231 @@ +/* +EasyWinampControl - A Winamp "What's playing" plugin for Xchat +Copyright (C) Yann HAMON & contributors + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "xchat-plugin.h" +#include + +static xchat_plugin *ph; /* plugin handle */ +static int enable = 1; + +// For example, circularstrstr("winamp", "pwi", 3) would return 5 (the index of p) +int circularstrstr(char* a, char* b, int nb) +{ + int equal = 1; + int length; + int pos=-1; + int i, j; + + length = strlen(a); + + for (i=0; ititle && *p != '-') p--; + *p = '\0'; + } +} + + +// Controlling winamp +static int wcmd_cb(char *word[], char *word_eol[], void *userdata) +{ + // Everything's here : http://winamp.com/nsdn/winamp2x/dev/sdk/api.php + // The previous url seems dead, see http://forums.winamp.com/showthread.php?threadid=180297 + HWND hwndWinamp = NULL; + + if ((hwndWinamp = FindWindow("Winamp v1.x",NULL)) == NULL) { + xchat_print(ph, "Winamp's window not found - Is winamp really running?\n"); + } + else { + if (strcmp(word[1], "") == 0) + xchat_print(ph, "Usage: wcmd [command]\n"); + else if (strcmp(word[2], "next") == 0) { + xchat_print(ph, "Loading next song...\n"); + SendMessage (hwndWinamp, WM_COMMAND, 40048, 0); + } + else if (strcmp(word[2], "prev") == 0) { + xchat_print(ph, "Loading previous song...\n"); + SendMessage (hwndWinamp, WM_COMMAND, 40044, 0); + } + else if (strcmp(word[2], "play") == 0) { + xchat_print(ph, "Playin'...\n"); + SendMessage (hwndWinamp, WM_COMMAND, 40045, 0); + } + else if (strcmp(word[2], "stop") == 0) { + xchat_print(ph, "Winamp stopped!...\n"); + SendMessage (hwndWinamp, WM_COMMAND, 40047, 0); + } + else if (strcmp(word[2], "pause") == 0) { + SendMessage (hwndWinamp, WM_COMMAND, 40046, 0); + } + } + + return XCHAT_EAT_ALL; +} + + +// Display current song +static int wp_cb(char *word[], char *word_eol[], void *userdata) +{ + HWND hwndWinamp = NULL; + int bitrate, length, elapsed, minutes, seconds, eminutes, eseconds, samplerate, nbchannels; + char elapsedtime[7]; + char totaltime[7]; + char this_title[1024]; + + if ((hwndWinamp = FindWindow("Winamp v1.x",NULL)) == NULL) + xchat_print(ph, "Winamp's window not found - Is winamp really running?\n"); + else { + //Winamp's running + // Seems buggy when winamp2's agent is running, and winamp not (or winamp3) -> crashes xchat. + SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)125); + + if ((samplerate = SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)126)) == 0) { + xchat_print(ph, "Could not get current song's samplerate... !?\n"); + return XCHAT_EAT_ALL; + } + if ((bitrate = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)126)) == 0) { + xchat_print(ph, "Could not get current song's bitrate... !?\n"); + return XCHAT_EAT_ALL; + } + if ((nbchannels = SendMessage(hwndWinamp, WM_USER, (WPARAM)2, (LPARAM)126)) == 0) { + xchat_print(ph, "Could not get the number of channels... !?\n"); + return XCHAT_EAT_ALL; + } + if ((length = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)105)) == 0) { + // Could be buggy when streaming audio or video, returned length is unexpected; + // How to detect is Winamp is streaming, and display ??:?? in that case? + xchat_print(ph, "Could not get current song's length... !?\n"); + return XCHAT_EAT_ALL; + } + else { + minutes = length/60; + seconds = length%60; + + if (seconds>9) + wsprintf(totaltime, "%d:%d", minutes, seconds); + else + wsprintf(totaltime, "%d:0%d", minutes, seconds); + } + if ((elapsed = SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)105)) == 0) { + xchat_print(ph, "Could not get current song's elapsed time... !?\n"); + return XCHAT_EAT_ALL; + } + else { + eminutes = (elapsed/1000)/60; /* kinda stupid sounding, but e is for elapsed */ + eseconds = (elapsed/1000)%60; + + if (eseconds>9) + wsprintf(elapsedtime, "%d:%d", eminutes, eseconds); + else + wsprintf(elapsedtime, "%d:0%d", eminutes, eseconds); + } + + if ((bitrate = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)126)) == 0) { + xchat_print(ph, "Could not get current song's bitrate... !?\n"); + return XCHAT_EAT_ALL; + } + + GetCurrentSongsName(hwndWinamp, this_title, 1024); + + xchat_commandf(ph, "dispcurrsong %d %d %d %s %s %s", samplerate, bitrate, nbchannels, elapsedtime, totaltime, this_title); + } + + return XCHAT_EAT_ALL; /* eat this command so xchat and other plugins can't process it */ +} + + + +int xchat_plugin_init(xchat_plugin *plugin_handle, + char **plugin_name, + char **plugin_desc, + char **plugin_version, + char *arg) +{ + /* we need to save this for use with any xchat_* functions */ + ph = plugin_handle; + + *plugin_name = "EasyWinampControl"; + *plugin_desc = "Some commands to remotely control winamp"; + *plugin_version = "1.2"; + + xchat_hook_command(ph, "wp", XCHAT_PRI_NORM, wp_cb, + "Usage: wp", 0); + + xchat_hook_command(ph, "wcmd", XCHAT_PRI_NORM, wcmd_cb, + "Usage: wcmd [play|pause|stop|prev|next]", 0); + + xchat_print(ph, "EasyWinampControl 1.2 plugin loaded successfully!\n"); + + return 1; /* return 1 for success */ +} + +int xchat_plugin_deinit(void) +{ + xchat_print(ph, "EasyWinampControl 1.2 plugin unloaded successfully!\n"); + return 1; +} diff --git a/plugins/ewc/makefile.mak b/plugins/ewc/makefile.mak new file mode 100644 index 00000000..a81c060e --- /dev/null +++ b/plugins/ewc/makefile.mak @@ -0,0 +1,19 @@ +include "..\..\src\makeinc.mak" + +xcewc.dll: ewc.obj ewc.def + link $(LDFLAGS) $(LIBS) /dll /out:xcewc.dll /def:ewc.def ewc.obj + dir xcewc.dll + +ewc.def: + echo EXPORTS > ewc.def + echo xchat_plugin_init >> ewc.def + echo xchat_plugin_deinit >> ewc.def + +ewc.obj: ewc.c makefile.mak + cl $(CFLAGS) /I.. ewc.c + +clean: + del *.obj + del *.dll + del *.exp + del *.lib diff --git a/plugins/perl/makefile.mak b/plugins/perl/makefile.mak new file mode 100644 index 00000000..d3a5c967 --- /dev/null +++ b/plugins/perl/makefile.mak @@ -0,0 +1,29 @@ +include "..\..\src\makeinc.mak" + +TARGET = $(PERLOUTPUT) + +all: $(TARGET) + +perl.def: + echo EXPORTS > perl.def + echo xchat_plugin_init >> perl.def + echo xchat_plugin_deinit >> perl.def + echo xchat_plugin_get_info >> perl.def + +perl.obj: perl.c + $(CC) $(CFLAGS) perl.c $(GLIB) -I.. -I$(PERLPATH) -DPERL_DLL=\"$(PERLLIB).dll\" + +perl.c: xchat.pm.h + +xchat.pm.h: Xchat.pm IRC.pm + perl.exe generate_header + +$(TARGET): perl.obj perl.def + $(LINK) /DLL /out:$(TARGET) perl.obj $(LDFLAGS) $(PERLLIB).lib /LIBPATH:$(PERLPATH) /DELAYLOAD:$(PERLLIB).dll DELAYIMP.LIB user32.lib shell32.lib advapi32.lib /def:perl.def + +clean: + del $(TARGET) + del *.obj + del perl.def + del *.lib + del *.exp diff --git a/plugins/python/makefile.mak b/plugins/python/makefile.mak new file mode 100644 index 00000000..dd321e89 --- /dev/null +++ b/plugins/python/makefile.mak @@ -0,0 +1,24 @@ +include "..\..\src\makeinc.mak" + +TARGET = $(PYTHONOUTPUT) + +all: $(TARGET) + +python.def: + echo EXPORTS > python.def + echo xchat_plugin_init >> python.def + echo xchat_plugin_deinit >> python.def + echo xchat_plugin_get_info >> python.def + +python.obj: python.c + $(CC) $(CFLAGS) /Dusleep=_sleep /DPATH_MAX=255 python.c $(GLIB) /I.. /I$(PYTHONPATH)\INCLUDE /DPYTHON_DLL=\"$(PYTHONLIB).dll\" + +$(TARGET): python.obj python.def + $(LINK) /DLL /out:$(TARGET) $(LDFLAGS) python.obj $(PYTHONLIB).lib /LIBPATH:$(PYTHONPATH)\LIBS $(PYTHONLIB).lib $(LIBS) /def:python.def + +clean: + del $(TARGET) + del *.obj + del python.def + del *.lib + del *.exp diff --git a/plugins/tcl/makefile.mak b/plugins/tcl/makefile.mak new file mode 100644 index 00000000..5f43ebb7 --- /dev/null +++ b/plugins/tcl/makefile.mak @@ -0,0 +1,22 @@ +include "..\..\src\makeinc.mak" + +TARGET = $(TCLOUTPUT) + +all: $(TARGET) + +tcl.def: + echo EXPORTS > tcl.def + echo xchat_plugin_init >> tcl.def + echo xchat_plugin_deinit >> tcl.def + echo xchat_plugin_get_info >> tcl.def + +tclplugin.obj: tclplugin.c + $(CC) $(CFLAGS) tclplugin.c /I$(TCLPATH)\INCLUDE /I../../include /I.. /DTCL_DLL=\"$(TCLLIB).dll\" + +$(TARGET): tclplugin.obj tcl.def + $(LINK) /DLL /out:$(TARGET) $(LDFLAGS) tclplugin.obj /LIBPATH:$(TCLPATH)\LIB $(TCLLIB).lib /DELAYLOAD:$(TCLLIB).dll DELAYIMP.LIB /def:tcl.def + +clean: + del $(TARGET) + del *.obj + del tcl.def diff --git a/plugins/xtray/callbacks.cpp b/plugins/xtray/callbacks.cpp new file mode 100644 index 00000000..f6533281 --- /dev/null +++ b/plugins/xtray/callbacks.cpp @@ -0,0 +1,729 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define _WIN32_IE 0x0601 + +#include +#include +#include +#include +#include "utility.h" +#include "plugin.h" +#include "xtray.h" +#include "xchat.h" +#include "callbacks.h" +#include "resource.h" +#include "sdTray.h" +#include "sdAlerts.h" + +HWND g_hPrefTabEvents; +HWND g_hPrefTabSettings; +HWND g_hPrefTabAlerts; +HWND g_hPrefTabAbout; +bool g_bCanQuit; +int g_iIsActive = 1; + + +BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) +{ + TCHAR szTitle[10]; + GetWindowText(hWnd, szTitle, 9); + + if(_tcsstr(szTitle, _T("X-Chat ["))) + { + g_hXchatWnd = hWnd; + return false; + } + + return true; +} + +/***********************************************************************************************/ +/******* our xchat event call back, get the name and info for each event and save it ***********/ +/******* for our alerts later ***********/ +/***********************************************************************************************/ +int event_cb(char *word[], void *userdata) +{ + int iEvent = (int)userdata; + + if(iEvent > 10) + return XCHAT_EAT_NONE; + + /***************************************************************************************/ + /***** if the window is minimized or if we're allowed to show alerts when its not **/ + /***** and if the option to show the specified alert is true and if we're even **/ + /***** allowed to show alerts at all then we show them (a bit confusing but it works) **/ + /***************************************************************************************/ + if(((g_iIsActive == 0) || !(g_dwPrefs & (1< 0) + { + xchat_set_context(ph, xchat_find_server(msg-1)); + + if(!xchat_get_info(ph, "away")) + { + xchat_away(g_szAway); + } + else + { + xchat_back(); + } + } + } + break; + } + + return 1; +} + +int CALLBACK PrefProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch(msg) + { + case WM_INITDIALOG: + { + TCITEM tci1; + TCITEM tci2; + TCITEM tci3; + TCITEM tci4; + + tci1.mask = TCIF_TEXT; + tci1.pszText = _T("Settings"); + tci1.cchTextMax = strlen("Settings"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 0, (LPARAM)&tci1); + + tci2.mask = TCIF_TEXT; + tci2.pszText = _T("Alerts"); + tci2.cchTextMax = strlen("Alerts"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 1, (LPARAM)&tci2); + + tci3.mask = TCIF_TEXT; + tci3.pszText = _T("Events"); + tci3.cchTextMax = strlen("Events"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 2, (LPARAM)&tci3); + + tci4.mask = TCIF_TEXT; + tci4.pszText = _T("About"); + tci4.cchTextMax = strlen("About"); + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 3, (LPARAM)&tci4); + + + /***********************************************************************************/ + /***********************************************************************************/ + /***********************************************************************************/ + + g_hPrefTabSettings = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_SETTINGS), + hWnd, + (DLGPROC)SettingsProc); + SetDialog(g_hPrefTabSettings, IDD_SETTINGS); + + g_hPrefTabAlerts = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_ALERTS), + hWnd, + (DLGPROC)AlertsProc); + SetDialog(g_hPrefTabAlerts, IDD_ALERTS); + + g_hPrefTabEvents = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_EVENTS), + hWnd, + (DLGPROC)EventsProc); + SetDialog(g_hPrefTabEvents, IDD_EVENTS); + + g_hPrefTabAbout = CreateDialog((HINSTANCE)g_hInstance, + MAKEINTRESOURCE(IDD_ABOUT), + hWnd, + (DLGPROC)AboutProc); + } + break; + case WM_SHOWWINDOW: + { + if(wparam) + { + SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_SETCURSEL, 0, 0); + ShowWindow(g_hPrefTabSettings, SW_SHOW); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + } + break; + case WM_NOTIFY: + { + NMHDR *pData = (NMHDR *)lparam; + + switch(pData->code) + { + case TCN_SELCHANGE: + { + switch(SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_GETCURSEL, 0, 0)) + { + case 0: + { + ShowWindow(g_hPrefTabSettings, SW_SHOW); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + break; + case 1: + { + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_SHOW); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + break; + case 2: + { + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_SHOW); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + } + break; + case 3: + { + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_SHOW); + } + break; + } + } + break; + } + } + break; + case WM_CLOSE: + { + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + ShowWindow(hWnd, SW_HIDE); + return TRUE; + } + break; + case WM_COMMAND: + { + switch(wparam) + { + case IDC_PREF_OK: + { + CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); + CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); + CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); + + SavePrefs(0); + + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + ShowWindow(hWnd, SW_HIDE); + return TRUE; + } + break; + case IDC_PREF_CANCEL: + { + ShowWindow(g_hPrefTabEvents, SW_HIDE); + ShowWindow(g_hPrefTabSettings, SW_HIDE); + ShowWindow(g_hPrefTabAlerts, SW_HIDE); + ShowWindow(g_hPrefTabAbout, SW_HIDE); + ShowWindow(hWnd, SW_HIDE); + return TRUE; + } + break; + case IDC_PREF_APPLY: + { + CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); + CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); + CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); + + SavePrefs(0); + return FALSE; + } + break; + } + } + break; + case WM_DESTROY: + { + SendMessage(g_hPrefTabEvents, WM_CLOSE, 0, 0); + SendMessage(g_hPrefTabSettings, WM_CLOSE, 0, 0); + SendMessage(g_hPrefTabAbout, WM_CLOSE, 0, 0); + SendMessage(g_hPrefTabAlerts, WM_CLOSE, 0, 0); + } + break; + } + + return FALSE; +} + +/****************************************************/ +/****************************************************/ +/****************************************************/ +LRESULT CALLBACK AlertsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch(msg) + { + case WM_CLOSE: + { + DestroyWindow(hWnd); + return TRUE; + break; + } + break; + case WM_COMMAND: + { + switch(LOWORD(wparam)) + { + case PREF_AMAE: + { + SetToggle(hWnd, PREF_OSBWM, PREF_AMAE, TRUE); + SetToggle(hWnd, PREF_UWIOB, PREF_AMAE, TRUE); + SetToggle(hWnd, PREF_KAOI, PREF_AMAE, TRUE); + + if(IsDlgButtonChecked(hWnd, PREF_AMAE)) + { + SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); + SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); + SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); + SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); + } + else + { + SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_AMAE, TRUE); + SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_AMAE, TRUE); + SetToggle(hWnd, IDC_ALERT_TIME, PREF_AMAE, TRUE); + SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_AMAE, TRUE); + } + } + break; + case PREF_UWIOB: + { + SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); + SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); + } + break; + case PREF_KAOI: + { + SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); + SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); + } + break; + } + break; + } + } + + return FALSE; +} + +/****************************************************/ +/****************************************************/ +/****************************************************/ +LRESULT CALLBACK AboutProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + + return FALSE; +} + +/*****************************************************/ +/** Process the events for our event dialog **********/ +/*****************************************************/ +LRESULT CALLBACK EventsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + + return FALSE; +} + +/*****************************************************/ +/** Process the events for our settings dialog this **/ +/** is alot more complicated because options are **/ +/** enabled/disabled based on the state of others **/ +/*****************************************************/ +LRESULT CALLBACK SettingsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + + return FALSE; +} + +/*****************************************************/ +/** this is the hotkey message processing function **/ +/** this window is always open and ready to be told **/ +/** if someone has hit the hotkey, if they did, we **/ +/** need to close out all of the tray alerts, for **/ +/** this I wrote sdCloseAlerts, more info there **/ +/*****************************************************/ +LRESULT CALLBACK HotKeyProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if(msg == WM_CLOSE) + { + DestroyWindow(hWnd); + return true; + } + else if(msg == WM_HOTKEY) + { + sdCloseAlerts(); + } + + return FALSE; +} + diff --git a/plugins/xtray/callbacks.h b/plugins/xtray/callbacks.h new file mode 100644 index 00000000..99cbae74 --- /dev/null +++ b/plugins/xtray/callbacks.h @@ -0,0 +1,37 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_CALLBACKS_H +#define _H_CALLBACKS_H + +int event_cb (char *word[], void *userdata); +int command_cb (char *word[], char *word_eol[], void *userdata); + +LRESULT CALLBACK WindowProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +BOOL CALLBACK EnumWindowsProc (HWND hWnd, LPARAM lParam); +LRESULT CALLBACK sdTrayProc (HWND hwnd, int msg); + +LRESULT CALLBACK AlertProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK HotKeyProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK EventsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK AboutProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK AlertsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +int CALLBACK PrefProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); + +#endif \ No newline at end of file diff --git a/plugins/xtray/makefile.mak b/plugins/xtray/makefile.mak new file mode 100644 index 00000000..f5fdb44e --- /dev/null +++ b/plugins/xtray/makefile.mak @@ -0,0 +1,37 @@ +include "..\..\src\makeinc.mak" + +TARGET = xtray.dll + +TRAY_OBJECTS = \ +callbacks.obj \ +sdAlerts.obj \ +sdTray.obj \ +utility.obj \ +xchat.obj \ +xtray.obj + +CPPFLAGS = $(CPPFLAGS) /D_STL70_ /D_STATIC_CPPLIB /EHsc + +all: $(TRAY_OBJECTS) $(TARGET) + +xtray.def: + echo EXPORTS > xtray.def + echo xchat_plugin_init >> xtray.def + echo xchat_plugin_deinit >> xtray.def + +.cpp.obj: + $(CC) $(CPPFLAGS) /c $< + +res: + rc resource.rc + +$(TARGET): $(TRAY_OBJECTS) xtray.def res + $(LINK) /DLL /out:$(TARGET) $(LDFLAGS) $(TRAY_OBJECTS) ntstc_msvcrt.lib $(LIBS) /def:xtray.def resource.res + +clean: + del $(TARGET) + del *.obj + del xtray.def + del resource.res + del *.lib + del *.exp diff --git a/plugins/xtray/plugin.h b/plugins/xtray/plugin.h new file mode 100644 index 00000000..50b0de21 --- /dev/null +++ b/plugins/xtray/plugin.h @@ -0,0 +1,335 @@ +/* You can distribute this header with your plugins for easy compilation */ +#ifndef XCHAT_PLUGIN_H +#define XCHAT_PLUGIN_H + +#include + +#define XCHAT_IFACE_MAJOR 1 +#define XCHAT_IFACE_MINOR 9 +#define XCHAT_IFACE_MICRO 11 +#define XCHAT_IFACE_VERSION ((XCHAT_IFACE_MAJOR * 10000) + \ + (XCHAT_IFACE_MINOR * 100) + \ + (XCHAT_IFACE_MICRO)) + +#define XCHAT_PRI_HIGHEST 127 +#define XCHAT_PRI_HIGH 64 +#define XCHAT_PRI_NORM 0 +#define XCHAT_PRI_LOW (-64) +#define XCHAT_PRI_LOWEST (-128) + +#define XCHAT_FD_READ 1 +#define XCHAT_FD_WRITE 2 +#define XCHAT_FD_EXCEPTION 4 +#define XCHAT_FD_NOTSOCKET 8 + +#define XCHAT_EAT_NONE 0 /* pass it on through! */ +#define XCHAT_EAT_XCHAT 1 /* don't let xchat see this event */ +#define XCHAT_EAT_PLUGIN 2 /* don't let other plugins see this event */ +#define XCHAT_EAT_ALL (XCHAT_EAT_XCHAT|XCHAT_EAT_PLUGIN) /* don't let anything see this event */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xchat_plugin xchat_plugin; +typedef struct _xchat_list xchat_list; +typedef struct _xchat_hook xchat_hook; +#ifndef PLUGIN_C +typedef struct _xchat_context xchat_context; +#endif + +#ifndef PLUGIN_C +struct _xchat_plugin +{ + /* these are only used on win32 */ + xchat_hook *(*xchat_hook_command) (xchat_plugin *ph, + const char *name, + int pri, + int (*callback) (char *word[], char *word_eol[], void *user_data), + const char *help_text, + void *userdata); + xchat_hook *(*xchat_hook_server) (xchat_plugin *ph, + const char *name, + int pri, + int (*callback) (char *word[], char *word_eol[], void *user_data), + void *userdata); + xchat_hook *(*xchat_hook_print) (xchat_plugin *ph, + const char *name, + int pri, + int (*callback) (char *word[], void *user_data), + void *userdata); + xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph, + int timeout, + int (*callback) (void *user_data), + void *userdata); + xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph, + int fd, + int flags, + int (*callback) (int fd, int flags, void *user_data), + void *userdata); + void *(*xchat_unhook) (xchat_plugin *ph, + xchat_hook *hook); + void (*xchat_print) (xchat_plugin *ph, + const char *text); + void (*xchat_printf) (xchat_plugin *ph, + const char *format, ...); + void (*xchat_command) (xchat_plugin *ph, + const char *command); + void (*xchat_commandf) (xchat_plugin *ph, + const char *format, ...); + int (*xchat_nickcmp) (xchat_plugin *ph, + const char *s1, + const char *s2); + int (*xchat_set_context) (xchat_plugin *ph, + xchat_context *ctx); + xchat_context *(*xchat_find_context) (xchat_plugin *ph, + const char *servname, + const char *channel); + xchat_context *(*xchat_get_context) (xchat_plugin *ph); + const char *(*xchat_get_info) (xchat_plugin *ph, + const char *id); + int (*xchat_get_prefs) (xchat_plugin *ph, + const char *name, + const char **string, + int *integer); + xchat_list * (*xchat_list_get) (xchat_plugin *ph, + const char *name); + void (*xchat_list_free) (xchat_plugin *ph, + xchat_list *xlist); + const char * const * (*xchat_list_fields) (xchat_plugin *ph, + const char *name); + int (*xchat_list_next) (xchat_plugin *ph, + xchat_list *xlist); + const char * (*xchat_list_str) (xchat_plugin *ph, + xchat_list *xlist, + const char *name); + int (*xchat_list_int) (xchat_plugin *ph, + xchat_list *xlist, + const char *name); + void * (*xchat_plugingui_add) (xchat_plugin *ph, + const char *filename, + const char *name, + const char *desc, + const char *version, + char *reserved); + void (*xchat_plugingui_remove) (xchat_plugin *ph, + void *handle); + int (*xchat_emit_print) (xchat_plugin *ph, + const char *event_name, ...); + int (*xchat_read_fd) (xchat_plugin *ph, + void *src, + char *buf, + int *len); + time_t (*xchat_list_time) (xchat_plugin *ph, + xchat_list *xlist, + const char *name); + char *(*xchat_gettext) (xchat_plugin *ph, + const char *msgid); + void (*xchat_send_modes) (xchat_plugin *ph, + const char **targets, + int ntargets, + int modes_per_line, + char sign, + char mode); + char *(*xchat_strip) (xchat_plugin *ph, + const char *str, + int len, + int flags); + void (*xchat_free) (xchat_plugin *ph, + void *ptr); +}; +#endif + + + +xchat_hook * +xchat_hook_command (xchat_plugin *ph, + const char *name, + int pri, + int (*callback) (char *word[], char *word_eol[], void *user_data), + const char *help_text, + void *userdata); + +xchat_hook * +xchat_hook_server (xchat_plugin *ph, + const char *name, + int pri, + int (*callback) (char *word[], char *word_eol[], void *user_data), + void *userdata); + +xchat_hook * +xchat_hook_print (xchat_plugin *ph, + const char *name, + int pri, + int (*callback) (char *word[], void *user_data), + void *userdata); + +xchat_hook * +xchat_hook_timer (xchat_plugin *ph, + int timeout, + int (*callback) (void *user_data), + void *userdata); + +xchat_hook * +xchat_hook_fd (xchat_plugin *ph, + int fd, + int flags, + int (*callback) (int fd, int flags, void *user_data), + void *userdata); + +void * +xchat_unhook (xchat_plugin *ph, + xchat_hook *hook); + +void +xchat_print (xchat_plugin *ph, + const char *text); + +void +xchat_printf (xchat_plugin *ph, + const char *format, ...); + +void +xchat_command (xchat_plugin *ph, + const char *command); + +void +xchat_commandf (xchat_plugin *ph, + const char *format, ...); + +int +xchat_nickcmp (xchat_plugin *ph, + const char *s1, + const char *s2); + +int +xchat_set_context (xchat_plugin *ph, + xchat_context *ctx); + +xchat_context * +xchat_find_context (xchat_plugin *ph, + const char *servname, + const char *channel); + +xchat_context * +xchat_get_context (xchat_plugin *ph); + +const char * +xchat_get_info (xchat_plugin *ph, + const char *id); + +int +xchat_get_prefs (xchat_plugin *ph, + const char *name, + const char **string, + int *integer); + +xchat_list * +xchat_list_get (xchat_plugin *ph, + const char *name); + +void +xchat_list_free (xchat_plugin *ph, + xchat_list *xlist); + +const char * const * +xchat_list_fields (xchat_plugin *ph, + const char *name); + +int +xchat_list_next (xchat_plugin *ph, + xchat_list *xlist); + +const char * +xchat_list_str (xchat_plugin *ph, + xchat_list *xlist, + const char *name); + +int +xchat_list_int (xchat_plugin *ph, + xchat_list *xlist, + const char *name); + +time_t +xchat_list_time (xchat_plugin *ph, + xchat_list *xlist, + const char *name); + +void * +xchat_plugingui_add (xchat_plugin *ph, + const char *filename, + const char *name, + const char *desc, + const char *version, + char *reserved); + +void +xchat_plugingui_remove (xchat_plugin *ph, + void *handle); + +int +xchat_emit_print (xchat_plugin *ph, + const char *event_name, ...); + +char * +xchat_gettext (xchat_plugin *ph, + const char *msgid); + +void +xchat_send_modes (xchat_plugin *ph, + const char **targets, + int ntargets, + int modes_per_line, + char sign, + char mode); + +char * +xchat_strip (xchat_plugin *ph, + const char *str, + int len, + int flags); + +void +xchat_free (xchat_plugin *ph, + void *ptr); + +#if !defined(PLUGIN_C) && defined(WIN32) +#ifndef XCHAT_PLUGIN_HANDLE +#define XCHAT_PLUGIN_HANDLE (ph) +#endif +#define xchat_hook_command ((XCHAT_PLUGIN_HANDLE)->xchat_hook_command) +#define xchat_hook_server ((XCHAT_PLUGIN_HANDLE)->xchat_hook_server) +#define xchat_hook_print ((XCHAT_PLUGIN_HANDLE)->xchat_hook_print) +#define xchat_hook_timer ((XCHAT_PLUGIN_HANDLE)->xchat_hook_timer) +#define xchat_hook_fd ((XCHAT_PLUGIN_HANDLE)->xchat_hook_fd) +#define xchat_unhook ((XCHAT_PLUGIN_HANDLE)->xchat_unhook) +#define xchat_print ((XCHAT_PLUGIN_HANDLE)->xchat_print) +#define xchat_printf ((XCHAT_PLUGIN_HANDLE)->xchat_printf) +#define xchat_command ((XCHAT_PLUGIN_HANDLE)->xchat_command) +#define xchat_commandf ((XCHAT_PLUGIN_HANDLE)->xchat_commandf) +#define xchat_nickcmp ((XCHAT_PLUGIN_HANDLE)->xchat_nickcmp) +#define xchat_set_context ((XCHAT_PLUGIN_HANDLE)->xchat_set_context) +#define xchat_find_context ((XCHAT_PLUGIN_HANDLE)->xchat_find_context) +#define xchat_get_context ((XCHAT_PLUGIN_HANDLE)->xchat_get_context) +#define xchat_get_info ((XCHAT_PLUGIN_HANDLE)->xchat_get_info) +#define xchat_get_prefs ((XCHAT_PLUGIN_HANDLE)->xchat_get_prefs) +#define xchat_list_get ((XCHAT_PLUGIN_HANDLE)->xchat_list_get) +#define xchat_list_free ((XCHAT_PLUGIN_HANDLE)->xchat_list_free) +#define xchat_list_fields ((XCHAT_PLUGIN_HANDLE)->xchat_list_fields) +#define xchat_list_str ((XCHAT_PLUGIN_HANDLE)->xchat_list_str) +#define xchat_list_int ((XCHAT_PLUGIN_HANDLE)->xchat_list_int) +#define xchat_list_time ((XCHAT_PLUGIN_HANDLE)->xchat_list_time) +#define xchat_list_next ((XCHAT_PLUGIN_HANDLE)->xchat_list_next) +#define xchat_plugingui_add ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_add) +#define xchat_plugingui_remove ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_remove) +#define xchat_emit_print ((XCHAT_PLUGIN_HANDLE)->xchat_emit_print) +#define xchat_gettext ((XCHAT_PLUGIN_HANDLE)->xchat_gettext) +#define xchat_send_modes ((XCHAT_PLUGIN_HANDLE)->xchat_send_modes) +#define xchat_strip ((XCHAT_PLUGIN_HANDLE)->xchat_strip) +#define xchat_free ((XCHAT_PLUGIN_HANDLE)->xchat_free) +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/plugins/xtray/resource.h b/plugins/xtray/resource.h new file mode 100644 index 00000000..b8008c2c --- /dev/null +++ b/plugins/xtray/resource.h @@ -0,0 +1,47 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDD_ALERTS 104 +#define IDD_EVENTS 105 +#define IDD_SETTINGS 106 +#define IDD_ALERT 107 +#define IDD_PREF 108 +#define IDD_ABOUT 109 +#define IDR_TRAY_MENU 110 +#define ICO_XCHAT 111 +#define ICO_BANNED 112 +#define ICO_CHANMSG 113 +#define ICO_DISCONNECTED 114 +#define ICO_HIGHLIGHT 115 +#define ICO_KICKED 116 +#define ICO_PMSG 117 +#define ICO_SNOTICE 118 +#define IDB_SD_LOGO 119 +#define IDC_PREF_OK 1014 +#define IDC_PREF_CANCEL 1015 +#define IDC_PREF_APPLY 1016 +#define IDC_AWAY_MSG 1017 +#define IDC_ALERT_TIME 1018 +#define IDC_TAB_CONTROL 1019 +#define IDC_ALERT_HOTKEY 1020 +#define IDC_ALERT_MSG 1021 +#define IDC_ALERT_HOTKEY_TEXT 1022 +#define IDC_ALERT_TIME_TEXT 1023 +#define ACT_EXIT 40001 +#define ACT_SETTINGS 40002 +#define ACT_AWAY 40003 +#define ACT_BACK 40004 +#define ACT_RESTORE 40005 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 120 +#define _APS_NEXT_COMMAND_VALUE 40006 +#define _APS_NEXT_CONTROL_VALUE 1024 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/xtray/resource.rc b/plugins/xtray/resource.rc new file mode 100644 index 00000000..0622aa2a --- /dev/null +++ b/plugins/xtray/resource.rc @@ -0,0 +1,318 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_EVENTS DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | DS_SETFOREGROUND | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + GROUPBOX "X-Chat Events",IDC_STATIC,5,5,205,77 + CONTROL "Server Notice",9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 145,32,55,10 + CONTROL "Topic Change",3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 145,18,55,10 + CONTROL "Banned",4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,18, + 49,10 + CONTROL "Kicked",5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,32, + 49,10 + CONTROL "Killed",8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46, + 49,10 + CONTROL "Disconnect",10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16, + 60,49,10 + CONTROL "Private Message",7,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,70,18,69,10 + CONTROL "CTCP",6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,32,69, + 10 + CONTROL "Invite",2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,46, + 69,10 + CONTROL "Highlight",1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70, + 60,69,10 +END + +IDD_SETTINGS DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + GROUPBOX "Options",IDC_STATIC,5,5,205,135 + CONTROL "Auto away on minimize",11,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,16,60,100,10 + CONTROL "Minimize X-Chat to the system tray",12,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,18,133,10 + CONTROL "Minimize to the tray instead of closing",17,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,32,174,9 + EDITTEXT IDC_AWAY_MSG,33,86,169,50,ES_AUTOHSCROLL + LTEXT "Away Msg:",IDC_STATIC,27,72,35,8 + CONTROL "Remove X-Chat from the taskbar ( Only show in tray )", + 20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,191,9 +END + +IDD_ALERT DIALOGEX 0, 0, 151, 28 +STYLE DS_LOCALEDIT | DS_SETFONT | DS_NOIDLEMSG | DS_CENTER | WS_CAPTION | + WS_SYSMENU +EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW +CAPTION "Event Name" +FONT 8, "Tahoma", 0, 0, 0x1 +BEGIN + LTEXT "Event Text",IDC_ALERT_MSG,3,0,147,27 +END + +IDD_PREF DIALOGEX 0, 0, 233, 190 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "X-Tray Preferences" +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + DEFPUSHBUTTON "Ok",IDC_PREF_OK,57,173,50,14 + PUSHBUTTON "Cancel",IDC_PREF_CANCEL,115,173,50,14 + PUSHBUTTON "Apply",IDC_PREF_APPLY,175,173,50,14 + CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",0x0,7,7,218,159 +END + +IDD_ABOUT DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + CONTROL 119,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN | + WS_BORDER,3,6,88,81 + CTEXT "X-Tray\r\nBy: Michael Hotaling\r\n www.SinisterDevelopments.com", + IDC_STATIC,95,33,118,30 + LTEXT "Folken\r\nBasket\r\nDonatzsky\r\nDaemon404",IDC_STATIC, + 15,103,64,33 + GROUPBOX "Special Thanks To:",IDC_STATIC,3,91,89,50 + GROUPBOX "Version Information:",IDC_STATIC,101,92,109,49 + LTEXT "1.2.3 PR",IDC_STATIC,170,105,33,8,0,WS_EX_RIGHT + LTEXT "Compiled On: ",IDC_STATIC,110,116,46,8 + LTEXT "11/06/05",IDC_STATIC,174,117,30,8 + LTEXT "Version Number:",IDC_STATIC,110,105,54,8 +END + +IDD_ALERTS DIALOGEX 8, 20, 216, 143 +STYLE DS_SETFONT | WS_CHILD +FONT 8, "Tahoma", 0, 0, 0x0 +BEGIN + GROUPBOX "Alerts",IDC_STATIC,5,5,205,117 + CONTROL "Only show alerts while minimized",14,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,27,46,117,10 + CONTROL "Use tray alerts to notify me about events",13,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,32,152,10 + CONTROL "Use window instead of balloons",15,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,27,60,141,11 + EDITTEXT IDC_ALERT_TIME,137,101,61,12,ES_AUTOHSCROLL | ES_NUMBER, + WS_EX_RIGHT + LTEXT "Show alert for x seconds:",IDC_ALERT_TIME_TEXT,40,103, + 83,9 + CONTROL "Alert Hotkey",IDC_ALERT_HOTKEY,"msctls_hotkey32", + WS_BORDER | WS_TABSTOP,137,74,61,13 + LTEXT "Close all alerts hotkey:",IDC_ALERT_HOTKEY_TEXT,39,75, + 76,10 + CONTROL "Leave alerts open indefinately",16,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,27,88,115,11 + CONTROL "Blink Icon to alert me about events",18,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,16,18,127,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_EVENTS, DIALOG + BEGIN + BOTTOMMARGIN, 56 + END + + IDD_SETTINGS, DIALOG + BEGIN + BOTTOMMARGIN, 66 + END + + IDD_ALERT, DIALOG + BEGIN + RIGHTMARGIN, 150 + BOTTOMMARGIN, 26 + END + + IDD_PREF, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 232 + TOPMARGIN, 7 + BOTTOMMARGIN, 176 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 209 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + END + + IDD_ALERTS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 208 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "xtray.h\0" +END + +4 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,2,3,0 + PRODUCTVERSION 1,2,3,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "SinisterDevelopments" + VALUE "FileDescription", "X-Tray" + VALUE "FileVersion", "1, 2, 3, 0" + VALUE "InternalName", "X-Tray" + VALUE "LegalCopyright", "Copyright © 2005" + VALUE "OriginalFilename", "X-Tray.dll" + VALUE "ProductName", "X-Tray - X-Chat Win32 System Tray Plugin" + VALUE "ProductVersion", "1, 2, 3, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_TRAY_MENU MENU +BEGIN + POPUP "TRAY" + BEGIN + MENUITEM "Restore", ACT_RESTORE + MENUITEM SEPARATOR + MENUITEM "Away", 65535 + MENUITEM "Settings", ACT_SETTINGS + MENUITEM SEPARATOR + MENUITEM "Exit", ACT_EXIT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +ICO_XCHAT ICON "icons\\xchat.ico" +ICO_BANNED ICON "icons\\banned.ico" +ICO_CHANMSG ICON "icons\\chan_msg.ico" +ICO_HIGHLIGHT ICON "icons\\highlight.ico" +ICO_KICKED ICON "icons\\kicked.ico" +ICO_PMSG ICON "icons\\priv_msg-1-2-2.ico" +ICO_SNOTICE ICON "icons\\server_notice.ico" +ICO_DISCONNECTED ICON "icons\\disconnected.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_SD_LOGO BITMAP "bitmaps\\sd.bmp" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +xtray.h +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/xtray/sdAlerts.cpp b/plugins/xtray/sdAlerts.cpp new file mode 100644 index 00000000..5e042806 --- /dev/null +++ b/plugins/xtray/sdAlerts.cpp @@ -0,0 +1,109 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include "utility.h" +#include "resource.h" +#include "sdAlerts.h" + +int g_iAlerts = 0; + +void sdSystemAlert(HINSTANCE hModule, UINT uiDialog, char *szMsg, char *szName, unsigned int iTime) +{ + TCHAR wszMsg[256]; + TCHAR wszName[64]; + + HWND hDialog; + RECT rcWorkArea, rcDlg; + int ixPos, iyPos; + int iNumPerCol; + + hDialog = CreateDialog(hModule, MAKEINTRESOURCE(uiDialog), NULL, (DLGPROC)sdAlertProc); + + SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0); + GetWindowRect(hDialog, &rcDlg); + + iNumPerCol = ((rcWorkArea.bottom - rcWorkArea.top) / (rcDlg.bottom - rcDlg.top)); + ixPos = rcWorkArea.right - (rcDlg.right - rcDlg.left) + 1; + iyPos = rcWorkArea.bottom - (rcDlg.bottom - rcDlg.top); + + if((g_iAlerts >= iNumPerCol) && (iNumPerCol > 0)) + { + ixPos -= ((g_iAlerts / iNumPerCol) * (rcDlg.right - rcDlg.left)); + iyPos -= ((g_iAlerts - (iNumPerCol * (g_iAlerts / iNumPerCol))) * (rcDlg.bottom - rcDlg.top)); + } + else + { + iyPos -= (g_iAlerts * (rcDlg.bottom - rcDlg.top)); + } + SetWindowPos(hDialog, HWND_TOPMOST, ixPos, iyPos, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); + + ConvertString(szName, wszName, 64); + ConvertString(szMsg, wszMsg, 256); + + SetWindowText(hDialog, wszName); + SetDlgItemText(hDialog, IDC_ALERT_MSG, wszMsg); + ShowWindow(hDialog, SW_SHOWNA); + + if(iTime > 0) + { + SetTimer(hDialog, 1, iTime, NULL); + } + + g_iAlerts++; +} + +void sdCloseAlerts() +{ + PostMessage(HWND_BROADCAST, RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows")), 0, 0); +} + +LRESULT CALLBACK sdAlertProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch(msg) + { + case WM_CLOSE: + if(g_iAlerts > 0){ g_iAlerts--; } + DestroyWindow(hwnd); + return TRUE; + break; + case WM_TIMER: + if(g_iAlerts > 0){ g_iAlerts--; } + AnimateWindow(hwnd, 600, AW_SLIDE | AW_HIDE | AW_VER_POSITIVE); + DestroyWindow(hwnd); + return TRUE; + break; + default: + if(msg == RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows"))) + { + if(g_iAlerts > 0){ g_iAlerts--; } + DestroyWindow(hwnd); + return TRUE; + } + break; + } + + return FALSE; +} + +int sdAlertNum() +{ + return g_iAlerts; +} \ No newline at end of file diff --git a/plugins/xtray/sdAlerts.h b/plugins/xtray/sdAlerts.h new file mode 100644 index 00000000..cd45a05b --- /dev/null +++ b/plugins/xtray/sdAlerts.h @@ -0,0 +1,26 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_SDALERTS_H +#define _H_SDALERTS_H + +void sdSystemAlert (HINSTANCE, UINT, char *, char *, UINT); +LRESULT CALLBACK sdAlertProc (HWND, UINT, WPARAM, LPARAM); +int sdAlertNum (); +void sdCloseAlerts (); +#endif \ No newline at end of file diff --git a/plugins/xtray/sdTray.cpp b/plugins/xtray/sdTray.cpp new file mode 100644 index 00000000..3a91a61b --- /dev/null +++ b/plugins/xtray/sdTray.cpp @@ -0,0 +1,207 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define _WIN32_IE 0x601 +#include +#include +#include +#include "sdTray.h" +#include "utility.h" + +HANDLE hThread; +iBlink *tData = NULL; + +int AddIcon(HWND hwnd, UINT id, HICON hicon, char *szTip, unsigned short flags, unsigned int cbMsg) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hIcon = hicon; + nidata.hWnd = hwnd; + nidata.uCallbackMessage = cbMsg; + nidata.uFlags = flags; + nidata.uID = id; + + if(szTip != NULL) + { + TCHAR *szTemp = new TCHAR[64]; + + ConvertString(szTip, szTemp, 64); + _tcsncpy(nidata.szTip, szTemp, 64); + + delete[] szTemp; + } + + return Shell_NotifyIcon(NIM_ADD, &nidata); +} + +int RemoveIcon(HWND hwnd, UINT id) +{ + if(hThread != NULL) + { + TerminateThread(hThread, 0); + hThread = NULL; + + delete tData; + } + + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + + return Shell_NotifyIcon(NIM_DELETE, &nidata); +} + +int SetIcon(HWND hwnd, UINT id, HICON hicon) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + nidata.hIcon = hicon; + nidata.uFlags = NIF_ICON; + + return Shell_NotifyIcon(NIM_MODIFY, &nidata); +} + +int SetTooltip(HWND hwnd, UINT id, char *szTip) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + nidata.uFlags = NIF_TIP; + + if(szTip != NULL) + { + TCHAR *szTemp = new TCHAR[64]; + ConvertString(szTip, szTemp, 64); + _tcsncpy(nidata.szTip, szTemp, 64); + delete[] szTemp; + } + + return Shell_NotifyIcon(NIM_MODIFY, &nidata); +} + +int ShowBalloon(HWND hwnd, UINT id, char *szInfo, char *szTitle, UINT time, UINT infoFlags) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = hwnd; + nidata.uID = id; + nidata.uFlags = NIF_INFO; + nidata.dwInfoFlags = infoFlags; + + if(time > 0) + nidata.uTimeout = time; + else + nidata.uTimeout = 500000; + + if(szInfo != NULL) + { + TCHAR *szTemp = new TCHAR[255]; + + ConvertString(szInfo, szTemp, 251); + szTemp[250] = 0; + + if(strlen(szInfo) > 255) + { + _sntprintf(szTemp, 255, _T("%s..."), szTemp); + } + _tcsncpy(nidata.szInfo, szTemp, 255); + + delete[] szTemp; + } + if(szTitle != NULL) + { + TCHAR *wszTitle = new TCHAR[64]; + ConvertString(szTitle, wszTitle, 64); + _tcsncpy(nidata.szInfoTitle, wszTitle, 64); + delete[] wszTitle; + } + + return Shell_NotifyIcon(NIM_MODIFY, &nidata); +} + + +DWORD WINAPI BlinkThread(LPVOID lpParam) +{ + NOTIFYICONDATA nidata; + + nidata.cbSize = NOTIFYICONDATA_V2_SIZE; + nidata.hWnd = tData->hwnd; + nidata.uID = tData->id; + nidata.uFlags = NIF_ICON; + + for(UINT i = 0; i < tData->num; i++) + { + nidata.hIcon = tData->hBlink; + Shell_NotifyIcon(NIM_MODIFY, &nidata); + + Sleep(tData->time); + + nidata.hIcon = tData->hBase; + Shell_NotifyIcon(NIM_MODIFY, &nidata); + + Sleep(tData->time); + } + + delete tData; + hThread = NULL; + + return 0; +} + +int BlinkIcon(HWND hwnd, UINT id, HICON hBase, HICON hBlink, UINT time, UINT num) +{ + if(hThread != NULL) + { + StopBlink(hwnd, id, hBase); + } + + DWORD dwThreadID; + tData = new iBlink; + + tData->hwnd = hwnd; + tData->id = id; + tData->hBase = hBase; + tData->hBlink = hBlink; + tData->time = time; + tData->num = num; + + hThread = CreateThread(NULL, 0, BlinkThread, tData, 0, &dwThreadID); + + return 0; +} + +void StopBlink(HWND hwnd, UINT id, HICON hBase) +{ + if(hThread != NULL) + { + TerminateThread(hThread, 0); + hThread = NULL; + + delete tData; + } + + SetIcon(hwnd, id, hBase); +} \ No newline at end of file diff --git a/plugins/xtray/sdTray.h b/plugins/xtray/sdTray.h new file mode 100644 index 00000000..68469fe0 --- /dev/null +++ b/plugins/xtray/sdTray.h @@ -0,0 +1,39 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_SDTRAY_H +#define _H_SDTRAY_H + +int AddIcon (HWND, UINT, HICON, char *, unsigned short, UINT); +int ShowBalloon (HWND, UINT, char *, char *, UINT, UINT); +int BlinkIcon (HWND, UINT, HICON, HICON, UINT, UINT); +int SetTooltip (HWND, UINT, char *); +int SetIcon (HWND, UINT, HICON); +void StopBlink (HWND, UINT, HICON); +int RemoveIcon (HWND, UINT); + +typedef struct IBLINK +{ + HICON hBase; + HICON hBlink; + HWND hwnd; + UINT id; + UINT time; + UINT num; +}iBlink; +#endif \ No newline at end of file diff --git a/plugins/xtray/utility.cpp b/plugins/xtray/utility.cpp new file mode 100644 index 00000000..909517df --- /dev/null +++ b/plugins/xtray/utility.cpp @@ -0,0 +1,568 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include "utility.h" +#include "plugin.h" +#include "xtray.h" +#include "callbacks.h" +#include "resource.h" + +TCHAR BACKUP_INI_FILE[] = _T(".\\plugins\\config\\xTray.ini"); +struct HOTKEY g_hHotKey; + +void SavePrefs(int iDlg) +{ + /**************************************************************************************************/ + /********** allocate space for our string, and then set it to the currently logged on user ********/ + /**************************************************************************************************/ + DWORD dBuff = 257; + TCHAR szUser[257]; + + GetUserName(szUser, &dBuff); + + /**************************************************************************************************/ + /*********************** Test if the file exists, If it doesn't, Create It ************************/ + /**************************************************************************************************/ + TCHAR XTRAY_INI_FILE[1024]; + +#ifdef UNICODE + char temp[1024]; + TCHAR TEMP_INI_FILE[1024]; + + _snprintf(temp, 1024, "%s\\xtray.ini", xchat_get_info(ph, "xchatdir")); + ConvertString(temp, TEMP_INI_FILE, 1024); + + // ok this one is really ugly + // it checks to see if the file exists in two locations + // X-Chat default config dir, if that fails it trys xchat\plugins\config + // if neither one exists it tries to create it in + // X-Chat default config dir, if that fails it trys xchat\plugins\config + // In either case it writes \xFF\xFE to the file ( on creation ) + // so that we can save unicode away messages WritePrivateProfile doesn't + // do this for us, though I think it really should + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + else + { + HANDLE xTemp; + DWORD dwBytesTemp; + + if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); + } + CloseHandle(xTemp); + } + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + HANDLE xBackup; + DWORD dwBytesBackup; + + if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); + } + + CloseHandle(xBackup); + } + + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + } + } + } + +#else + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); +#endif + + WritePrivateProfileInt(szUser, _T("SETTINGS"), g_dwPrefs, XTRAY_INI_FILE); + WritePrivateProfileInt(szUser, _T("AOT"), g_iTime, XTRAY_INI_FILE); + WritePrivateProfileInt(szUser, _T("KEY"), g_hHotKey.key, XTRAY_INI_FILE); + WritePrivateProfileInt(szUser, _T("MOD"), g_hHotKey.mod, XTRAY_INI_FILE); + WritePrivateProfileString(szUser, _T("AWAY"), g_szAway, XTRAY_INI_FILE); +} + +void LoadPrefs() +{ + /**************************************************************************************************/ + /*********************** Our Settings Section *****************************************************/ + /**************************************************************************************************/ + DWORD dBuff = 257; + TCHAR szUser[257]; + + GetUserName(szUser, &dBuff); + + /**************************************************************************************************/ + /*********************** Test if the file exists, If it doesn't, Create It ************************/ + /**************************************************************************************************/ + TCHAR XTRAY_INI_FILE[1024]; + +#ifdef UNICODE + char temp[1024]; + TCHAR TEMP_INI_FILE[1024]; + + _snprintf(temp, 1024, "%s\\xtray.ini", xchat_get_info(ph, "xchatdir")); + ConvertString(temp, TEMP_INI_FILE, 1024); + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + else + { + HANDLE xTemp; + DWORD dwBytesTemp; + + if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); + } + + CloseHandle(xTemp); + } + + if(FileExists(TEMP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); + } + else + { + HANDLE xBackup; + DWORD dwBytesBackup; + + if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) + { + if(GetLastError() != ERROR_ALREADY_EXISTS) + { + WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); + } + + CloseHandle(xBackup); + } + + if(FileExists(BACKUP_INI_FILE)) + { + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); + } + } + } + } + +#else + _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); +#endif + + /**************************************************************************************************/ + /*************************** Get the value for each of our preferances ****************************/ + /**************************************************************************************************/ + g_dwPrefs = GetPrivateProfileInt(szUser, _T("SETTINGS"), 0, XTRAY_INI_FILE); + + // backwards compatability + // also allows us to set defaults if its a new installation + if(g_dwPrefs == 0) + { + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("HILIGHT"), 1, XTRAY_INI_FILE)<<1); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("INVITE"), 1, XTRAY_INI_FILE)<<2); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOPIC"), 1, XTRAY_INI_FILE)<<3); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("BANNED"), 1, XTRAY_INI_FILE)<<4); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KICKED"), 1, XTRAY_INI_FILE)<<5); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("CTCP"), 1, XTRAY_INI_FILE)<<6); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("PMSG"), 1, XTRAY_INI_FILE)<<7); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KILLED"), 1, XTRAY_INI_FILE)<<8); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("NOTICE"), 1, XTRAY_INI_FILE)<<9); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("DISCONNECT"), 1, XTRAY_INI_FILE)<<10); + + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AOM"), 0, XTRAY_INI_FILE)<<11); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOT"), 1, XTRAY_INI_FILE)<<12); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AMAE"), 1, XTRAY_INI_FILE)<<13); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("OSBWM"), 0, XTRAY_INI_FILE)<<14); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("UWIOB"), 0, XTRAY_INI_FILE)<<15); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KAOI"), 0, XTRAY_INI_FILE)<<16); + g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("MIOC"), 0, XTRAY_INI_FILE)<<17); + } + + g_hHotKey.key = GetPrivateProfileInt(szUser, _T("KEY"), 84, XTRAY_INI_FILE); + g_hHotKey.mod = GetPrivateProfileInt(szUser, _T("MOD"), (MOD_CONTROL | MOD_SHIFT), XTRAY_INI_FILE); + g_iTime = GetPrivateProfileInt(szUser, _T("AOT"), 5, XTRAY_INI_FILE); + + GetPrivateProfileString(szUser, _T("AWAY"), _T(""), g_szAway, 1024, XTRAY_INI_FILE); + + /**************************************************************************************************/ + /******************************** Register our hotkey with windows ********************************/ + /**************************************************************************************************/ + if(g_dwPrefs & (1< + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_UTILITY_H +#define _H_UTILITY_H + +int SetOption (HWND, unsigned int, unsigned int); +int SetCheck (HWND, unsigned int, unsigned int); +int SetToggle (HWND, unsigned int, unsigned int, bool); +void ErrorDebug (LPTSTR lpszFunction); +void SetDialog (HWND, int); +void CheckPrefs (HWND, int); +bool FileExists (TCHAR *); +DWORD WINAPI HoldCloseThread (LPVOID); +void SavePrefs (int); +void LoadPrefs (); +void HoldClose (); + +void ConvertString(const char *in, wchar_t *out, int size); +void ConvertString(const wchar_t *in, char *out, int size); +void ConvertString(const char *in, char *out, int size); + +int WritePrivateProfileIntA(char *, char *, int, char *); +int WritePrivateProfileIntW(wchar_t *, wchar_t *, int, wchar_t *); + +#ifdef UNICODE +#define WritePrivateProfileInt WritePrivateProfileIntW +#else +#define WritePrivateProfileInt WritePrivateProfileIntA +#endif + +struct HOTKEY +{ + WORD key; + WORD mod; +}; +#endif \ No newline at end of file diff --git a/plugins/xtray/xchat.cpp b/plugins/xtray/xchat.cpp new file mode 100644 index 00000000..581970f1 --- /dev/null +++ b/plugins/xtray/xchat.cpp @@ -0,0 +1,319 @@ +/* X-Tray + * Copyright (C) 1998, 2005 Peter Zelezny, Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include "plugin.h" +#include "xtray.h" +#include "resource.h" +#include "xchat.h" +#include "utility.h" + +// from util.c of xchat source code ( slightly modified to fit X-Tray Syntax ) +char *xchat_strip_color (char *text) +{ + int nc = 0; + int i = 0; + int col = 0; + int len = strlen(text); + char *new_str = (char *)malloc(len + 2); + + while (len > 0) + { + if ((col && isdigit(*text) && (nc < 2)) || (col && isdigit(*(text+1)) && (nc < 3) && (*text == ','))) + { + nc++; + + if(*text == ',') + { + nc = 0; + } + } + else + { + col = 0; + + switch (*text) + { + case '\003': /*ATTR_COLOR: */ + { + col = 1; + nc = 0; + } + break; + case '\007': /*ATTR_BEEP: */ + case '\017': /*ATTR_RESET: */ + case '\026': /*ATTR_REVERSE: */ + case '\002': /*ATTR_BOLD: */ + case '\037': /*ATTR_UNDERLINE: */ + break; + default: + { + new_str[i] = *text; + i++; + } + break; + } + } + + text++; + len--; + } + + new_str[i] = 0; + + return new_str; +} + +void check_special_chars (char *cmd) +{ + int occur = 0; + int len = strlen (cmd); + int i = 0, j = 0; + char *buf; + + if (!len) + return; + + buf = (char *)malloc (len + 1); + + if (buf) + { + while (cmd[j]) + { + switch (cmd[j]) + { + case '%': + { + occur++; + + switch (cmd[j + 1]) + { + case 'R': + buf[i] = '\026'; + break; + case 'U': + buf[i] = '\037'; + break; + case 'B': + buf[i] = '\002'; + break; + case 'C': + buf[i] = '\003'; + break; + case 'O': + buf[i] = '\017'; + break; + case '%': + buf[i] = '%'; + break; + default: + buf[i] = '%'; + j--; + break; + } + + j++; + } + break; + default: + { + buf[i] = cmd[j]; + } + break; + } + + j++; + i++; + } + + buf[i] = 0; + + if (occur) + strcpy (cmd, buf); + + free (buf); + } +} + +void xchat_globally_away(TCHAR *tszAway) +{ + char szTemp[512]; + char szAway[512]; + + ConvertString(tszAway, szAway, 512); + _snprintf(szTemp, 512, "ALLSERV AWAY %s\0", szAway); + check_special_chars(szTemp); + xchat_exec(szTemp); +} + +void xchat_away(TCHAR *tszAway) +{ + char szTemp[512]; + char szAway[512]; + + ConvertString(tszAway, szAway, 512); + _snprintf(szTemp, 512, szAway); + check_special_chars(szTemp); + xchat_commandf(ph, "AWAY %s\0", szTemp); +} + +void xchat_globally_back() +{ + std::vector xs; + std::vector::iterator xsi; + xchat_list *xl = xchat_list_get(ph, "channels"); + + if(xl) + { + while(xchat_list_next(ph, xl)) + { + xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); + + if((xsi == xs.end()) && + ((strlen(xchat_list_str(ph, xl, "server")) > 0) || + (strlen(xchat_list_str(ph, xl, "channel")) > 0))) + { + xs.push_back(xchat_list_int(ph, xl, "id")); + xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); + xchat_back(); + } + } + + xchat_list_free(ph, xl); + } +} + + + +void xchat_back() +{ + if(xchat_get_info(ph, "away")) + { + xchat_command(ph, "BACK"); + } +} + +HMENU setServerMenu() +{ + HMENU sTemp = CreateMenu(); + TCHAR wszServer[128]; + TCHAR wszNick[128]; + TCHAR wszMenuEntry[256]; + + std::vector xs; + std::vector::iterator xsi; + xchat_list *xl = xchat_list_get(ph, "channels"); + + AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away")); + AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back")); + AppendMenu(sTemp, MF_SEPARATOR, 0, NULL); + + if(xl) + { + while(xchat_list_next(ph, xl)) + { + xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); + + if( (xsi == xs.end()) && + ((strlen(xchat_list_str(ph, xl, "server")) > 0) || + (strlen(xchat_list_str(ph, xl, "channel")) > 0))) + { + xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); + xs.push_back(xchat_list_int(ph, xl, "id")); + + char *network = _strdup(xchat_list_str(ph, xl, "network")); + char *server = _strdup(xchat_list_str(ph, xl, "server")); + char *nick = _strdup(xchat_get_info(ph, "nick")); + + if(network != NULL) + { + ConvertString(network, wszServer, 128); + } + else + { + ConvertString(server, wszServer, 128); + } + + if(server != NULL) + { + ConvertString(nick, wszNick, 128); + _sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer); + + if(!xchat_get_info(ph, "away")) + { + AppendMenu(sTemp, MF_STRING, (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); + } + else + { + AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); + } + } + + free(network); + free(server); + free(nick); + } + } + + xchat_list_free(ph, xl); + } + + return sTemp; +} + +struct _xchat_context *xchat_find_server(int find_id) +{ + xchat_context *xc; + xchat_list *xl = xchat_list_get(ph, "channels"); + int id; + + if(!xl) + return NULL; + + while(xchat_list_next(ph, xl)) + { + id = xchat_list_int(ph, xl, "id"); + + if(id == -1) + { + return NULL; + } + else if(id == find_id) + { + xc = (xchat_context *)xchat_list_str(ph, xl, "context"); + + xchat_list_free(ph, xl); + + return xc; + } + } + + xchat_list_free(ph, xl); + + return NULL; +} + +void xchat_exec(char *command) +{ + xchat_set_context(ph, xchat_find_context(ph, NULL, NULL)); + xchat_command(ph, command); +} \ No newline at end of file diff --git a/plugins/xtray/xchat.h b/plugins/xtray/xchat.h new file mode 100644 index 00000000..76452aeb --- /dev/null +++ b/plugins/xtray/xchat.h @@ -0,0 +1,32 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _H_XCHAT_H +#define _H_XCHAT_H + +void xchat_exec (char *); +char *xchat_strip_color (char *); +void xchat_parse (char *); +struct _xchat_context *xchat_find_server (int); +void xchat_globally_away (TCHAR *); +void xchat_away (TCHAR *); +void xchat_globally_back (); +void xchat_back (); +HMENU setServerMenu (); + +#endif \ No newline at end of file diff --git a/plugins/xtray/xtray.cpp b/plugins/xtray/xtray.cpp new file mode 100644 index 00000000..688464ff --- /dev/null +++ b/plugins/xtray/xtray.cpp @@ -0,0 +1,226 @@ +/* X-Tray + * Copyright (C) 2005 Michael Hotaling + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define _WIN32_IE 0x0601 + +#include +#include +#include +#include +#include "resource.h" +#include "callbacks.h" +#include "plugin.h" +#include "utility.h" +#include "xtray.h" +#include "sdTray.h" +#include "sdAlerts.h" +#include "plugin.h" + +/*****************************************************/ +/**** Don't want to pollute the namespace do we? *****/ +/*****************************************************/ +std::list g_vHooks; + +/*****************************************************/ +/************ Global Identifiers *********************/ +/*****************************************************/ +WNDPROC g_hOldProc; +xchat_plugin *ph; + +/*****************************************************/ +/***************** Resources *************************/ +/*****************************************************/ +HWND g_hXchatWnd; +HWND g_hHotkeyWnd; +HWND g_hPrefDlg; +HMENU g_hTrayMenu; +HICON g_hIcons[11]; +HANDLE g_hInstance; +/*****************************************************/ +/***************** Preferences ***********************/ +/*****************************************************/ +unsigned int g_dwPrefs; +TCHAR g_szAway[512]; +int g_iTime; + + +BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpVoid) +{ + if((fdwReason == DLL_PROCESS_ATTACH) || (fdwReason == DLL_THREAD_ATTACH)) + { + g_hInstance = hModule; + } + + return TRUE; +} + +int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) +{ + ph = plugin_handle; + + *plugin_name = "X-Tray"; + *plugin_desc = "Minimize X-Chat to the windows systemtray"; + *plugin_version = "1.2.3 PR"; + + /***************************************************************************************************************************/ + /************************* Load our preferances from xTray.ini *************************************************************/ + /***************************************************************************************************************************/ + LoadPrefs(); + + /***************************************************************************************************************************/ + /************************* Finds the xChat window and saves it for later use ***********************************************/ + /***************************************************************************************************************************/ + g_hXchatWnd = (HWND)xchat_get_info(ph, "win_ptr"); + + if(g_hXchatWnd == NULL) + { + EnumThreadWindows(GetCurrentThreadId(), EnumWindowsProc, 0); + } + + g_hOldProc = (WNDPROC)GetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC); + SetWindowLong(g_hXchatWnd, GWLP_WNDPROC, (long)WindowProc); + + /***************************************************************************************************************************/ + /************************* Grab the xChat Icon, Load our menu, create the window to receive the hotkey messages ***********/ + /************************* and register the windows message so we know if explorer crashes ***********/ + /***************************************************************************************************************************/ + g_hTrayMenu = GetSubMenu(LoadMenu((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDR_TRAY_MENU)), 0); + g_hHotkeyWnd = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ALERT), NULL, (DLGPROC)HotKeyProc); + g_hPrefDlg = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_PREF), g_hXchatWnd, (DLGPROC)PrefProc); + + g_hIcons[0] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_XCHAT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[1] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_CHANMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[2] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_HIGHLIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[5] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_BANNED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[6] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_KICKED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[8] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_PMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[10]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_SNOTICE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + g_hIcons[11]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_DISCONNECTED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + + /***************************************************************************************************************************/ + /************************* Add our icon to the tray ************************************************************************/ + /***************************************************************************************************************************/ + char szVersion[64]; + _snprintf(szVersion, 64, "X-Chat [%s]", xchat_get_info(ph, "version")); + AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG); + + /***************************************************************************************************************************/ + /***************************************************************************************************************************/ + /***************************************************************************************************************************/ + if(g_dwPrefs & (1< + * + * X-Tray is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * X-Tray is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with X-Tray; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _XTRAY_H +#define _XTRAY_H + +/******************** Globals *************************/ +extern HWND g_hXchatWnd; +extern HWND g_hHotkeyWnd; +extern HWND g_hPrefDlg; +extern HMENU g_hTrayMenu; +extern HICON g_hIcons[11]; +extern HANDLE g_hInstance; +extern unsigned int g_dwPrefs; +extern TCHAR g_szAway[512]; +extern int g_iTime; +extern WNDPROC g_hOldProc; +extern struct _xchat_plugin *ph; +/******************************************************/ + +/******************** Messages ************************/ +#define WM_TRAYMSG WM_APP +/******************************************************/ + +/********************* Events *************************/ +#define CHAN_HILIGHT 1 +#define CHAN_INVITE 2 +#define CHAN_TOPIC_CHANGE 3 +#define CHAN_BANNED 4 +#define CHAN_KICKED 5 + +#define CTCP_GENERIC 6 +#define PMSG_RECEIVE 7 + +#define SERV_KILLED 8 +#define SERV_NOTICE 9 +#define SERV_DISCONNECT 10 + +#define PREF_AOM 11 // away on minimize +#define PREF_TOT 12 // Tray on Taskbar +#define PREF_AMAE 13 // alert me about events +#define PREF_OSBWM 14 // Only Show Balloon When Minimized +#define PREF_UWIOB 15 // Use Window Instead of Balloon +#define PREF_KAOI 16 // Keep alerts open indefinately +#define PREF_MIOC 17 // Minimize instead of close +#define PREF_BLINK 18 // blink icon +#define PREF_CICO 19 // change icon - not implemented +#define PREF_DNSIT 20 // Do not show in taskbar +/******************************************************/ +#endif diff --git a/src/common/dirent.h b/src/common/dirent.h new file mode 100644 index 00000000..64251740 --- /dev/null +++ b/src/common/dirent.h @@ -0,0 +1,230 @@ +/***************************************************************************** + * 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 + +#include +#include +#include + + +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 */ + int cached; /* Indicates un-processed entry in memory */ + HANDLE search_handle; /* File search handle */ + 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; +} + + +#endif /*DIRENT_H*/ diff --git a/src/common/makefile.mak b/src/common/makefile.mak new file mode 100644 index 00000000..ee046895 --- /dev/null +++ b/src/common/makefile.mak @@ -0,0 +1,13 @@ +include "..\makeinc.mak" + +all: $(COMMON_OBJECTS) xchatcommon.lib + +xchatcommon.lib: $(COMMON_OBJECTS) + lib -out:xchatcommon.lib $(COMMON_OBJECTS) + +.c.obj: + $(CC) $(CFLAGS) $(GLIB) $< + +clean: + del *.obj + del xchatcommon.lib diff --git a/src/fe-gtk/makefile.mak b/src/fe-gtk/makefile.mak new file mode 100644 index 00000000..3ce9cb5b --- /dev/null +++ b/src/fe-gtk/makefile.mak @@ -0,0 +1,37 @@ +include "..\makeinc.mak" + +!ifdef X64 +MACHINE_FLAG = /MACHINE:X64 +!else +MACHINE_FLAG = /MACHINE:X86 +!endif + +COMLIB = ..\common\xchatcommon.lib +PROG = xchat.exe + +all: $(PROG) + +mmx_cmod.o: mmx_cmod.S + gcc -DUNDERSCORE_SYMBOLS -c mmx_cmod.S + +.c.obj: + $(CC) $(CFLAGS) $(GLIB) $(GTK) $< + +$(PROG): $(FEGTK_OBJECTS) $(COMLIB) xchat-icon.obj + $(LINK) /out:$(PROG) /ENTRY:mainCRTStartup $(LDFLAGS) $(LIBS) $(FEGTK_OBJECTS) $(COMLIB) xchat-icon.obj + @dir $(PROG) + +xchat.rc: + echo XC_ICON ICON "../../xchat.ico" > xchat.rc + +xchat.res: xchat.rc ../../xchat.ico + rc /r xchat.rc + +xchat-icon.obj: xchat.res + cvtres /NOLOGO $(MACHINE_FLAG) /OUT:xchat-icon.obj xchat.res + +clean: + del *.obj + del $(PROG) + del xchat.rc + del xchat.RES diff --git a/src/makefile.mak b/src/makefile.mak new file mode 100644 index 00000000..89f897d7 --- /dev/null +++ b/src/makefile.mak @@ -0,0 +1,18 @@ +all: + copy ..\plugins\xchat-plugin.h common + @cd pixmaps + @-$(MAKE) -f makefile.mak $@ + @cd ..\common + @-$(MAKE) -f makefile.mak $@ + @cd ..\fe-gtk + @-$(MAKE) -f makefile.mak $@ + +clean: + del common\*.obj + del common\xchatcommon.lib + del fe-gtk\*.obj + del fe-gtk\mmx_cmod.o + del fe-gtk\xchat.exe + del fe-gtk\xchat.rc + del fe-gtk\xchat.RES + del pixmaps\*.h diff --git a/src/makeinc.mak b/src/makeinc.mak new file mode 100644 index 00000000..512c2f85 --- /dev/null +++ b/src/makeinc.mak @@ -0,0 +1,125 @@ +#uncomment this to have an x64 build +#X64 = YES +#OPENSSL = YES +IPV6 = YES + +CC = cl +LINK = link +CFLAGS = $(CFLAGS) /Ox /c /MD /nologo /DWIN32 /DG_DISABLE_CAST_CHECKS /Dstrcasecmp=stricmp /Dstrncasecmp=strnicmp /Dstrtoull=_strtoui64 +CPPFLAGS = /c /MD /nologo /DWIN32 +LDFLAGS = /subsystem:windows /nologo +LIBS = $(LIBS) gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.lib winmm.lib +!ifdef X64 +############################################################# +#x64 config +GLIB = -Ic:/mozilla-build/build/xchat-dev64/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/glib-2.0/include +GTK = -Ic:/mozilla-build/build/xchat-dev64/include/gtk-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/gtk-2.0/include -Ic:/mozilla-build/build/xchat-dev64/include/atk-1.0 -Ic:/mozilla-build/build/xchat-dev64/include/cairo -Ic:/mozilla-build/build/xchat-dev64/include/pango-1.0 -Ic:/mozilla-build/build/xchat-dev64/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/glib-2.0/include -Ic:/mozilla-build/build/xchat-dev64/include/freetype2 -Ic:/mozilla-build/build/xchat-dev64/include -Ic:/mozilla-build/build/xchat-dev64/include/libpng14 +LIBS = $(LIBS) /libpath:c:/mozilla-build/build/xchat-dev64/lib gtk-win32-2.0.lib gdk-win32-2.0.lib atk-1.0.lib gio-2.0.lib gdk_pixbuf-2.0.lib pangowin32-1.0.lib gdi32.lib pangocairo-1.0.lib pango-1.0.lib cairo.lib gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib intl.lib + +CFLAGS = $(CFLAGS) /favor:AMD64 +CPPFLAGS = $(CPPFLAGS) /favor:AMD64 /D_WIN64 +LDFLAGS = $(LDFLAGS) msvcrt_win2003.obj + +PERLPATH = c:\mozilla-build\perl-5.10-x64\lib\CORE +PYTHONPATH = c:\mozilla-build\python-2.5-x64 +TCLPATH = c:\mozilla-build\tcl-8.6-x64 +!else +############################################################# +#x86 config +GLIB = -Ic:/mozilla-build/build/xchat-dev32/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/glib-2.0/include +GTK = -Ic:/mozilla-build/build/xchat-dev32/include/gtk-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/gtk-2.0/include -Ic:/mozilla-build/build/xchat-dev32/include/atk-1.0 -Ic:/mozilla-build/build/xchat-dev32/include/cairo -Ic:/mozilla-build/build/xchat-dev32/include/pango-1.0 -Ic:/mozilla-build/build/xchat-dev32/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/glib-2.0/include -Ic:/mozilla-build/build/xchat-dev32/include/freetype2 -Ic:/mozilla-build/build/xchat-dev32/include -Ic:/mozilla-build/build/xchat-dev32/include/libpng14 +LIBS = $(LIBS) /libpath:c:/mozilla-build/build/xchat-dev32/lib gtk-win32-2.0.lib gdk-win32-2.0.lib atk-1.0.lib gio-2.0.lib gdk_pixbuf-2.0.lib pangowin32-1.0.lib gdi32.lib pangocairo-1.0.lib pango-1.0.lib cairo.lib gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib intl.lib + +LDFLAGS = $(LDFLAGS) msvcrt_winxp.obj + +PERLPATH = c:\mozilla-build\perl-5.10-x86\lib\CORE +PYTHONPATH = c:\mozilla-build\python-2.5-x86 +TCLPATH = c:\mozilla-build\tcl-8.6-x86 + +MMX = YES +!endif +############################################################# + +PERLLIB = perl510 +PERLOUTPUT = xcperl.dll + +PYTHONLIB = python25 +PYTHONOUTPUT = xcpython.dll + +TCLLIB = tcl86 +TCLOUTPUT = xctcl.dll + +!ifdef IPV6 +CFLAGS = $(CFLAGS) -DUSE_IPV6 +LIBS = $(LIBS) ws2_32.lib +!else +LIBS = $(LIBS) wsock32.lib +!endif + +!ifdef OPENSSL +CFLAGS = $(CFLAGS) /DUSE_OPENSSL +LIBS = $(LIBS) libeay32.lib ssleay32.lib +SSLOBJ = ssl.obj +!endif + +COMMON_OBJECTS = \ +cfgfiles.obj \ +chanopt.obj \ +ctcp.obj \ +dcc.obj \ +history.obj \ +identd.obj \ +ignore.obj \ +inbound.obj \ +modes.obj \ +network.obj \ +notify.obj \ +outbound.obj \ +plugin.obj \ +plugin-timer.obj \ +proto-irc.obj \ +server.obj \ +servlist.obj \ +$(SSLOBJ) \ +text.obj \ +tree.obj \ +url.obj \ +userlist.obj \ +util.obj \ +xchat.obj + +FEGTK_OBJECTS = \ +about.obj \ +ascii.obj \ +banlist.obj \ +chanlist.obj \ +chanview.obj \ +custom-list.obj \ +dccgui.obj \ +editlist.obj \ +fe-gtk.obj \ +fkeys.obj \ +gtkutil.obj \ +ignoregui.obj \ +joind.obj \ +maingui.obj \ +menu.obj \ +notifygui.obj \ +palette.obj \ +pixmaps.obj \ +plugingui.obj \ +plugin-tray.obj \ +rawlog.obj \ +search.obj \ +servlistgui.obj \ +setup.obj \ +sexy-spell-entry.obj \ +textgui.obj \ +urlgrab.obj \ +userlistgui.obj \ +xtext.obj + +!ifdef MMX +FEGTK_OBJECTS = $(FEGTK_OBJECTS) mmx_cmod.o +CFLAGS = $(CFLAGS) -DUSE_MMX +!endif diff --git a/src/pixmaps/makefile.mak b/src/pixmaps/makefile.mak new file mode 100644 index 00000000..e113b591 --- /dev/null +++ b/src/pixmaps/makefile.mak @@ -0,0 +1,18 @@ +CONV = gdk-pixbuf-csource + +LIST = bookpng book.png \ + hoppng hop.png \ + oppng op.png \ + purplepng purple.png \ + redpng red.png \ + trayfilepng fileoffer.png \ + trayhilightpng highlight.png \ + traymsgpng message.png \ + voicepng voice.png \ + xchatpng ..\..\xchat.png + +all: + $(CONV) --build-list $(LIST) > inline_pngs.h + +clean: + del *.h diff --git a/xchat-wdk.patch b/xchat-wdk.patch index 20590869..31ee50a2 100644 --- a/xchat-wdk.patch +++ b/xchat-wdk.patch @@ -1,1647 +1,3 @@ -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/build-x64.bat xchat-wdk/build/build-x64.bat ---- xchat-wdk.orig/build/build-x64.bat 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/build-x64.bat 2010-03-31 12:01:10 +0200 -@@ -0,0 +1,33 @@ -+@echo off -+set INCLUDE=c:\WinDDK\7600.16385.1\inc\api;c:\WinDDK\7600.16385.1\inc\crt;c:\WinDDK\7600.16385.1\inc\api\crt\stl70;c:\mozilla-build\build\xchat-dev64\include;c:\mozilla-build\build\openssl-0.9.8j-wdk-x64\include -+set LIB=c:\WinDDK\7600.16385.1\lib\wnet\amd64;c:\WinDDK\7600.16385.1\lib\Crt\amd64;c:\mozilla-build\build\openssl-0.9.8j-wdk-x64\lib -+set OPATH=%PATH% -+set PATH=c:\WinDDK\7600.16385.1\bin\x86\amd64;c:\WinDDK\7600.16385.1\bin\x86;c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;c:\mozilla-build\build\xchat-dev64\bin;c:\mozilla-build\perl-5.10-x64\bin -+cd ..\src -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\plugins\dns -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\ewc -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\perl -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+::cd ..\python -+::nmake -f makefile.mak clean -+::nmake -f makefile.mak -+::cd ..\tcl -+::nmake -f makefile.mak clean -+::nmake -f makefile.mak -+cd ..\xtray -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\..\build -+set PATH=%PATH%;c:\mozilla-build\build\xchat-dev32\bin -+call compile-po-files.bat -+cd ..\build -+set PATH=%OPATH% -+call release-x64.bat -+pause -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/build-x86.bat xchat-wdk/build/build-x86.bat ---- xchat-wdk.orig/build/build-x86.bat 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/build-x86.bat 2010-03-31 12:00:41 +0200 -@@ -0,0 +1,32 @@ -+@echo off -+set INCLUDE=c:\WinDDK\7600.16385.1\inc\api;c:\WinDDK\7600.16385.1\inc\crt;c:\WinDDK\7600.16385.1\inc\api\crt\stl70;c:\mozilla-build\build\xchat-dev32\include;c:\mozilla-build\build\openssl-0.9.8j-wdk-x86\include -+set LIB=c:\WinDDK\7600.16385.1\lib\wxp\i386;c:\WinDDK\7600.16385.1\lib\Crt\i386;c:\mozilla-build\build\openssl-0.9.8j-wdk-x86\lib -+set OPATH=%PATH% -+set PATH=c:\WinDDK\7600.16385.1\bin\x86\x86;c:\WinDDK\7600.16385.1\bin\x86;c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin;c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin;c:\mozilla-build\build\xchat-dev32\bin;c:\mozilla-build\mingw\bin;c:\mozilla-build\perl-5.10-x86\bin -+cd ..\src -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\plugins\dns -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\ewc -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\perl -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+::cd ..\python -+::nmake -f makefile.mak clean -+::nmake -f makefile.mak -+cd ..\tcl -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\xtray -+nmake -f makefile.mak clean -+nmake -f makefile.mak -+cd ..\..\build -+call compile-po-files.bat -+cd ..\build -+set PATH=%OPATH% -+call release-x86.bat -+pause -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/compile-po-files.bat xchat-wdk/build/compile-po-files.bat ---- xchat-wdk.orig/build/compile-po-files.bat 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/compile-po-files.bat 2010-03-30 05:01:54 +0200 -@@ -0,0 +1,87 @@ -+@echo off -+ -+echo.Compiling translations . . . -+cd ..\po -+rmdir /Q /S locale -+mkdir locale -+ -+mkdir locale\be\LC_MESSAGES -+msgfmt -cvo locale\be\LC_MESSAGES\xchat.mo be.po -+ -+mkdir locale\ca\LC_MESSAGES -+msgfmt -cvo locale\ca\LC_MESSAGES\xchat.mo ca.po -+ -+mkdir locale\cs\LC_MESSAGES -+msgfmt -cvo locale\cs\LC_MESSAGES\xchat.mo cs.po -+ -+mkdir locale\de\LC_MESSAGES -+msgfmt -cvo locale\de\LC_MESSAGES\xchat.mo de.po -+ -+mkdir locale\el\LC_MESSAGES -+msgfmt -cvo locale\el\LC_MESSAGES\xchat.mo el.po -+ -+mkdir locale\es\LC_MESSAGES -+msgfmt -cvo locale\es\LC_MESSAGES\xchat.mo es.po -+ -+mkdir locale\fi\LC_MESSAGES -+msgfmt -cvo locale\fi\LC_MESSAGES\xchat.mo fi.po -+ -+mkdir locale\fr\LC_MESSAGES -+msgfmt -cvo locale\fr\LC_MESSAGES\xchat.mo fr.po -+ -+mkdir locale\gl\LC_MESSAGES -+msgfmt -cvo locale\gl\LC_MESSAGES\xchat.mo gl.po -+ -+mkdir locale\hu\LC_MESSAGES -+msgfmt -cvo locale\hu\LC_MESSAGES\xchat.mo hu.po -+ -+mkdir locale\it\LC_MESSAGES -+msgfmt -cvo locale\it\LC_MESSAGES\xchat.mo it.po -+ -+mkdir locale\ja\LC_MESSAGES -+msgfmt -cvo locale\ja\LC_MESSAGES\xchat.mo ja.po -+ -+mkdir locale\ko\LC_MESSAGES -+msgfmt -cvo locale\ko\LC_MESSAGES\xchat.mo ko.po -+ -+mkdir locale\lt\LC_MESSAGES -+msgfmt -cvo locale\lt\LC_MESSAGES\xchat.mo lt.po -+ -+mkdir locale\mk\LC_MESSAGES -+msgfmt -cvo locale\mk\LC_MESSAGES\xchat.mo mk.po -+ -+mkdir locale\nl\LC_MESSAGES -+msgfmt -cvo locale\nl\LC_MESSAGES\xchat.mo nl.po -+ -+mkdir locale\pa\LC_MESSAGES -+msgfmt -cvo locale\pa\LC_MESSAGES\xchat.mo pa.po -+ -+mkdir locale\pt\LC_MESSAGES -+msgfmt -cvo locale\pt\LC_MESSAGES\xchat.mo pt.po -+ -+mkdir locale\ru\LC_MESSAGES -+msgfmt -cvo locale\ru\LC_MESSAGES\xchat.mo ru.po -+ -+mkdir locale\sq\LC_MESSAGES -+msgfmt -cvo locale\sq\LC_MESSAGES\xchat.mo sq.po -+ -+mkdir locale\sr\LC_MESSAGES -+msgfmt -cvo locale\sr\LC_MESSAGES\xchat.mo sr.po -+ -+mkdir locale\sv\LC_MESSAGES -+msgfmt -cvo locale\sv\LC_MESSAGES\xchat.mo sv.po -+ -+mkdir locale\th\LC_MESSAGES -+msgfmt -cvo locale\th\LC_MESSAGES\xchat.mo th.po -+ -+mkdir locale\uk\LC_MESSAGES -+msgfmt -cvo locale\uk\LC_MESSAGES\xchat.mo uk.po -+ -+mkdir locale\vi\LC_MESSAGES -+msgfmt -cvo locale\vi\LC_MESSAGES\xchat.mo vi.po -+ -+mkdir locale\zh_CN\LC_MESSAGES -+msgfmt -cvo locale\zh_CN\LC_MESSAGES\xchat.mo zh_CN.po -+ -+mkdir locale\zh_TW\LC_MESSAGES -+msgfmt -cvo locale\zh_TW\LC_MESSAGES\xchat.mo zh_TW.po -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/etc/gtk-2.0/gtkrc xchat-wdk/build/etc/gtk-2.0/gtkrc ---- xchat-wdk.orig/build/etc/gtk-2.0/gtkrc 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/etc/gtk-2.0/gtkrc 2010-03-29 21:26:48 +0200 -@@ -0,0 +1,68 @@ -+gtk-font-name = "sans 8" -+ -+gtk-icon-sizes = "gtk-menu=13,13:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32" -+gtk-toolbar-icon-size = small-toolbar -+ -+# disable images in buttons. i've only seen ugly delphi apps use this feature. -+gtk-button-images = 0 -+ -+# enable/disable images in menus. most "stock" microsoft apps don't use these, except sparingly. -+# the office apps use them heavily, though. -+gtk-menu-images = 1 -+ -+# use the win32 button ordering instead of the GNOME HIG one, where applicable -+gtk-alternative-button-order = 1 -+ -+# use the win32 sort indicators direction, as in Explorer -+gtk-alternative-sort-arrows = 1 -+ -+# Windows users don't expect the PC Speaker beeping at them when they backspace in an empty textview and stuff like that -+gtk-error-bell = 0 -+ -+style "msw-default" -+{ -+ GtkWidget::interior-focus = 1 -+ GtkOptionMenu::indicator-size = { 9, 5 } -+ GtkOptionMenu::indicator-spacing = { 7, 5, 2, 2 } -+ GtkSpinButton::shadow-type = in -+ -+ # Owen and I disagree that these should be themable -+ #GtkUIManager::add-tearoffs = 0 -+ #GtkComboBox::add-tearoffs = 0 -+ -+ GtkComboBox::appears-as-list = 1 -+ GtkComboBox::focus-on-click = 0 -+ -+ GOComboBox::add_tearoffs = 0 -+ -+ GtkTreeView::allow-rules = 0 -+ GtkTreeView::expander-size = 12 -+ -+ GtkExpander::expander-size = 12 -+ -+ GtkScrolledWindow::scrollbar_spacing = 1 -+ -+ GtkSeparatorMenuItem::horizontal-padding = 2 -+ -+ engine "wimp" -+ { -+ } -+} -+class "*" style "msw-default" -+ -+binding "ms-windows-tree-view" -+{ -+ bind "Right" { "expand-collapse-cursor-row" (1,1,0) } -+ bind "Left" { "expand-collapse-cursor-row" (1,0,0) } -+} -+ -+class "GtkTreeView" binding "ms-windows-tree-view" -+ -+style "msw-combobox-thickness" = "msw-default" -+{ -+ xthickness = 0 -+ ythickness = 0 -+} -+ -+widget_class "*TreeView*ComboBox*" style "msw-combobox-thickness" -+widget_class "*ComboBox*GtkFrame*" style "msw-combobox-thickness" -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/release-x64.bat xchat-wdk/build/release-x64.bat ---- xchat-wdk.orig/build/release-x64.bat 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/release-x64.bat 2010-03-31 12:10:05 +0200 -@@ -0,0 +1,39 @@ -+@echo off -+set GTK_BIN=c:\mozilla-build\build\xchat-dev64\bin -+set SSL_BIN=c:\mozilla-build\build\openssl-0.9.8j-wdk-x64\bin -+set XCHAT_DEST=c:\mozilla-build\build\xchat-wdk-x64 -+rmdir /Q /S %XCHAT_DEST% -+mkdir %XCHAT_DEST% -+xcopy ..\src\fe-gtk\xchat.exe %XCHAT_DEST% -+xcopy %GTK_BIN%\libgtk-win32-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgdk_pixbuf-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgio-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libglib-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgmodule-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgobject-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpng14-14.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\zlib1.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgdk-win32-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libcairo-2.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libfontconfig-1.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libexpat-1.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libfreetype-6.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpango-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpangocairo-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpangoft2-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpangowin32-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libatk-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libintl-8.dll %XCHAT_DEST% -+xcopy /S /I %GTK_BIN%\..\lib\gtk-2.0 %XCHAT_DEST%\lib\gtk-2.0 -+rmdir /Q /S %XCHAT_DEST%\lib\gtk-2.0\include -+xcopy /S /I etc %XCHAT_DEST%\etc -+xcopy ..\COPYING %XCHAT_DEST% -+::xcopy %SSL_BIN%\libeay32.dll %XCHAT_DEST% -+::xcopy %SSL_BIN%\ssleay32.dll %XCHAT_DEST% -+xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\ -+::xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\ -+::xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\po\locale %XCHAT_DEST%\locale -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/release-x86.bat xchat-wdk/build/release-x86.bat ---- xchat-wdk.orig/build/release-x86.bat 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/release-x86.bat 2010-03-31 12:10:01 +0200 -@@ -0,0 +1,39 @@ -+@echo off -+set GTK_BIN=c:\mozilla-build\build\xchat-dev32\bin -+set SSL_BIN=c:\mozilla-build\build\openssl-0.9.8j-wdk-x86\bin -+set XCHAT_DEST=c:\mozilla-build\build\xchat-wdk-x86 -+rmdir /Q /S %XCHAT_DEST% -+mkdir %XCHAT_DEST% -+xcopy ..\src\fe-gtk\xchat.exe %XCHAT_DEST% -+xcopy %GTK_BIN%\libgtk-win32-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgdk_pixbuf-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgio-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libglib-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgmodule-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgobject-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpng14-14.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\zlib1.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libgdk-win32-2.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libcairo-2.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libfontconfig-1.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libexpat-1.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\freetype6.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpango-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpangocairo-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpangoft2-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libpangowin32-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\libatk-1.0-0.dll %XCHAT_DEST% -+xcopy %GTK_BIN%\intl.dll %XCHAT_DEST% -+xcopy /S /I %GTK_BIN%\..\lib\gtk-2.0 %XCHAT_DEST%\lib\gtk-2.0 -+rmdir /Q /S %XCHAT_DEST%\lib\gtk-2.0\include -+xcopy /S /I etc %XCHAT_DEST%\etc -+xcopy ..\COPYING %XCHAT_DEST% -+::xcopy %SSL_BIN%\libeay32.dll %XCHAT_DEST% -+::xcopy %SSL_BIN%\ssleay32.dll %XCHAT_DEST% -+xcopy /S /I ..\plugins\dns\xcdns.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\plugins\perl\xcperl.dll %XCHAT_DEST%\plugins\ -+::xcopy /S /I ..\plugins\python\xcpython.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\ -+xcopy /S /I ..\po\locale %XCHAT_DEST%\locale -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/test-x64.bat xchat-wdk/build/test-x64.bat ---- xchat-wdk.orig/build/test-x64.bat 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/test-x64.bat 2010-03-30 02:24:01 +0200 -@@ -0,0 +1,3 @@ -+@echo off -+set PATH=c:\mozilla-build\build\xchat-dev64\bin;c:\mozilla-build\perl-5.10-x64\bin;c:\mozilla-build\python-2.6-x64 -+..\src\fe-gtk\xchat.exe -diff -ruN --strip-trailing-cr xchat-wdk.orig/build/test-x86.bat xchat-wdk/build/test-x86.bat ---- xchat-wdk.orig/build/test-x86.bat 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/build/test-x86.bat 2010-03-30 02:24:19 +0200 -@@ -0,0 +1,3 @@ -+@echo off -+set PATH=c:\mozilla-build\build\xchat-dev32\bin;c:\mozilla-build\perl-5.10-x86\bin;c:\mozilla-build\python-2.6-x86 -+..\src\fe-gtk\xchat.exe -diff -ruN --strip-trailing-cr xchat-wdk.orig/config.h xchat-wdk/config.h ---- xchat-wdk.orig/config.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/config.h 2010-03-31 12:43:15 +0200 -@@ -0,0 +1,14 @@ -+#define LOCALEDIR "./locale" -+#define ENABLE_NLS -+#define USE_GMODULE -+#define USE_PLUGIN -+#define PACKAGE_NAME "xchat" -+#define PACKAGE_VERSION "r1409-6" -+#define XCHATLIBDIR "." -+#define XCHATSHAREDIR "." -+#define OLD_PERL -+#ifndef USE_IPV6 -+#define socklen_t int -+#endif -+#define GETTEXT_PACKAGE "xchat" -+#define PACKAGE_TARNAME "xchat-2.8.6" -diff -ruN --strip-trailing-cr xchat-wdk.orig/config.h.w32 xchat-wdk/config.h.w32 ---- xchat-wdk.orig/config.h.w32 2008-06-12 10:37:44 +0200 -+++ xchat-wdk/config.h.w32 1970-01-01 01:00:00 +0100 -@@ -1,12 +0,0 @@ --#define LOCALEDIR "./locale" --#define ENABLE_NLS --#define USE_GMODULE --#define USE_PLUGIN --#define PACKAGE_NAME "xchat" --#define PACKAGE_VERSION "2.8.6Unix" --#define XCHATLIBDIR "." --#define XCHATSHAREDIR "." --#define OLD_PERL --#ifndef USE_IPV6 --#define socklen_t int --#endif -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/dns/makefile.mak xchat-wdk/plugins/dns/makefile.mak ---- xchat-wdk.orig/plugins/dns/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/dns/makefile.mak 2010-03-31 10:41:23 +0200 -@@ -0,0 +1,19 @@ -+include "..\..\src\makeinc.mak" -+ -+xcdns.dll: plugin-dns.obj dns.def -+ link $(LDFLAGS) /dll /out:xcdns.dll /def:dns.def plugin-dns.obj ws2_32.lib -+ dir xcdns.dll -+ -+dns.def: -+ echo EXPORTS > dns.def -+ echo xchat_plugin_init >> dns.def -+ echo xchat_plugin_deinit >> dns.def -+ -+plugin-dns.obj: plugin-dns.c makefile.mak thread.c -+ cl $(CFLAGS) /I.. -Dsnprintf=_snprintf plugin-dns.c -+ -+clean: -+ del *.obj -+ del *.dll -+ del *.exp -+ del *.lib -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/dns/plugin-dns.c xchat-wdk/plugins/dns/plugin-dns.c ---- xchat-wdk.orig/plugins/dns/plugin-dns.c 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/dns/plugin-dns.c 2010-03-31 09:06:15 +0200 -@@ -0,0 +1,335 @@ -+/* XChat Win32 DNS Plugin -+ * Copyright (C) 2003-2004 Peter Zelezny. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -+ */ -+/* -+ * Requires MS Visual Studio and IPV6 headers to compile (run nmake). -+ * Compiling with gcc (mingw) will fail due to missing gai_strerror. -+ */ -+ -+#define DNS_VERSION "2.4" -+ -+#include -+#include -+#include -+#include -+ -+#define IPV6 -+ -+#ifdef _WIN32 -+#ifdef IPV6 -+#include -+#include -+#else -+#include -+#endif -+#else -+#include -+#include -+#endif -+ -+#include "xchat-plugin.h" -+#include "thread.c" -+ -+#define HELP "Usage: DNS \n" -+#define HEAD "\0034[DNS]\017\t" -+ -+#define PIPE_READ 0 -+#define PIPE_WRITE 1 -+#define MAX_HOSTNAME 128 -+ -+static xchat_plugin *ph; -+static thread *active_thread = NULL; -+ -+ -+static int -+waitline (void *source, char *buf, int bufsize) -+{ -+ int i = 0; -+ int len; -+ -+ while(1) -+ { -+ len = 1; -+ /* we can't read() here, due to glib's giowin32 */ -+ if(ph->xchat_read_fd(ph, source, buf + i, &len) != 0) -+ return -1; -+ if(buf[i] == '\n' || bufsize == i + 1) -+ { -+ buf[i] = 0; -+ return i; -+ } -+ i++; -+ } -+} -+ -+static void * -+thread_function (void *ud) -+{ -+#ifdef IPV6 -+ struct addrinfo *ent; -+ struct addrinfo *cur; -+ struct addrinfo hints; -+#else -+ struct hostent *ent; -+#endif -+ thread *th = ud; -+ int fd = th->pipe_fd[PIPE_WRITE]; -+ int ret; -+ char ipstring[MAX_HOSTNAME]; -+ char reverse[MAX_HOSTNAME]; -+// int i; -+ -+ active_thread = th; -+ -+#ifdef IPV6 -+ memset (&hints, 0, sizeof (hints)); -+ hints.ai_family = PF_UNSPEC; /* support ipv6 and ipv4 */ -+ hints.ai_flags = AI_CANONNAME; -+// hints.ai_socktype = SOCK_STREAM; -+ -+ ret = getaddrinfo (th->userdata, NULL, &hints, &ent); -+ if (ret != 0) -+ { -+ sprintf (ipstring, "1%d\n", ret); /* failed */ -+ write (fd, ipstring, strlen (ipstring)); -+// Sleep (3000); -+ active_thread = NULL; -+ return 0; -+ } -+ -+// i = 0; -+ cur = ent; -+ while (cur) -+ { -+ /* find the numeric IP number */ -+ ipstring[0] = 0; -+ getnameinfo (cur->ai_addr, cur->ai_addrlen, -+ ipstring, sizeof (ipstring), NULL, 0, NI_NUMERICHOST); -+ -+ if (cur->ai_canonname) -+ { -+ /* force reverse lookup if canonname & ipstring are the same */ -+ if (/*i == 0 &&*/ strcmp (cur->ai_canonname, ipstring) == 0) -+ goto lamecode; -+ } -+ -+ if (cur->ai_canonname) -+ { -+ write (fd, "0", 1); -+ write (fd, ipstring, strlen (ipstring)); -+ write (fd, "\n", 1); -+ write (fd, cur->ai_canonname, strlen (cur->ai_canonname)); -+ } else -+ { -+lamecode: -+ // ret = 1; -+ // if (i == 0) -+ { -+ /* reverse lookup */ -+ reverse[0] = 0; -+ ret = getnameinfo (cur->ai_addr, cur->ai_addrlen, -+ reverse, sizeof (reverse), NULL, 0, NI_NAMEREQD); -+ } -+ -+ write (fd, "0", 1); -+ write (fd, ipstring, strlen (ipstring)); -+ -+ write (fd, "\n", 1); -+ if (ret == 0) -+ write (fd, reverse, strlen (reverse)); -+ } -+ write (fd, "\n", 1); -+ -+// i++; -+ cur = cur->ai_next; -+ } -+ -+ /* tell the parent we're done */ -+ write (fd, "2\n", 2); -+ freeaddrinfo (ent); -+ -+#else -+ ent = gethostbyname (th->userdata); -+ if (ent) -+ { -+ write (fd, "0", 1); -+ write (fd, ent->h_name, strlen (ent->h_name)); -+ write (fd, "\n", 1); -+ write (fd, ent->h_name, strlen (ent->h_name)); -+ write (fd, "\n", 1); -+ write (fd, "2\n", 2); -+ } else -+ { -+ write (fd, "10\n", 1); -+ } -+#endif -+ -+// Sleep (3000); -+ active_thread = NULL; /* race condition, better than nothing */ -+ -+ return 0; -+} -+ -+static int -+dns_close_pipe (int fd) -+{ -+ close (fd); -+ return 0; -+} -+ -+/* read messages comming from the child (through the pipe) */ -+ -+static int -+dns_read_cb (int fd, int flags, thread *th, void *source) -+{ -+ char buf[512]; -+ char buf2[512]; -+ -+ while (waitline (source, buf, sizeof (buf))) -+ { -+ switch (buf[0]) -+ { -+ case '0': /* got data to show */ -+ waitline (source, buf2, sizeof (buf2)); -+ if (buf2[0] == 0) -+ xchat_printf(ph, HEAD"\002Numerical\002: %s\n", buf + 1); -+ else -+ xchat_printf(ph, HEAD"\002Canonical\002: %s \002Numerical\002: %s\n", buf2, buf + 1); -+ return 1; -+ -+ case '1': /* failed */ -+ xchat_printf(ph, HEAD"Lookup failed. %s\n", gai_strerrorA (atoi (buf + 1))); -+ -+ case '2': /* done */ -+ // close (th->pipe_fd[PIPE_WRITE]); -+ // close (th->pipe_fd[PIPE_READ]); -+ xchat_hook_timer(ph, 3000, dns_close_pipe, (void *)th->pipe_fd[PIPE_WRITE]); -+ xchat_hook_timer(ph, 4000, dns_close_pipe, (void *)th->pipe_fd[PIPE_READ]); -+ free (th->userdata); /* hostname strdup'ed */ -+ free (th); -+ return 0; -+ } -+ } -+ -+ return 1; -+} -+ -+/* find hostname from nickname (search the userlist, current chan only) */ -+ -+static char * -+find_nick_host (char *nick) -+{ -+ xchat_list *list; -+ char *at; -+ const char *host; -+ -+ list = xchat_list_get (ph, "users"); -+ if (!list) -+ return NULL; -+ -+ while (xchat_list_next (ph, list)) -+ { -+ if (stricmp (nick, xchat_list_str (ph, list, "nick")) == 0) -+ { -+ host = xchat_list_str (ph, list, "host"); -+ if (host) -+ { -+ at = strrchr (host, '@'); -+ if (at) -+ return at + 1; -+ } -+ break; -+ } -+ } -+ -+ return NULL; -+} -+ -+static int -+dns_cmd_cb (char *word[], char *word_eol[], void *ud) -+{ -+ thread *th; -+ char *nickhost; -+ -+ if (!word[2][0]) -+ { -+ xchat_print (ph, HELP); -+ return XCHAT_EAT_ALL; -+ } -+ -+ th = thread_new (); -+ if (th) -+ { -+ nickhost = find_nick_host (word[2]); -+ if (nickhost) -+ { -+ xchat_printf (ph, HEAD"Looking up %s (%s)...\n", nickhost, word[2]); -+ th->userdata = strdup (nickhost); -+ } else -+ { -+ xchat_printf (ph, HEAD"Looking up %s...\n", word[2]); -+ th->userdata = strdup (word[2]); -+ } -+ -+ if (thread_start (th, thread_function, th)) -+ { -+ xchat_hook_fd(ph, th->pipe_fd[PIPE_READ], -+ XCHAT_FD_READ | XCHAT_FD_EXCEPTION | XCHAT_FD_NOTSOCKET, -+ (void *)dns_read_cb, th); -+ -+ } -+ } -+ -+ return XCHAT_EAT_ALL; -+} -+ -+int -+xchat_plugin_deinit (xchat_plugin *plugin_handle) -+{ -+ while (active_thread) /* children will set this var to NULL soon... */ -+ { -+ Sleep (1000); -+ } -+ return 1; -+} -+ -+int -+#ifdef STATIC -+exec_plugin_init -+#else -+xchat_plugin_init -+#endif -+ (xchat_plugin *plugin_handle, char **plugin_name, -+ char **plugin_desc, char **plugin_version, char *arg) -+{ -+ /* we need to save this for use with any xchat_* functions */ -+ ph = plugin_handle; -+ -+ /*if((void *)ph->xchat_read_fd == ph->dummy7) -+ { -+ xchat_print(ph, HEAD"This version of xchat is too old.\n"); -+ return 0; -+ }*/ -+ -+ *plugin_name = "DNS"; -+ *plugin_desc = "Threaded IPv4/6 DNS Command"; -+ *plugin_version = DNS_VERSION; -+ -+ xchat_hook_command(ph, "DNS", XCHAT_PRI_LOW, dns_cmd_cb, HELP, 0); -+ -+ return 1; /* return 1 for success */ -+} -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/dns/thread.c xchat-wdk/plugins/dns/thread.c ---- xchat-wdk.orig/plugins/dns/thread.c 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/dns/thread.c 2010-03-31 07:48:40 +0200 -@@ -0,0 +1,111 @@ -+#include -+ -+#define USE_PTHREAD -+ -+#ifdef WIN32 -+ -+#include -+#define pthread_t DWORD -+#define pipe(a) _pipe(a,4096,_O_BINARY) -+ -+#else -+#ifdef USE_PTHREAD -+ -+#include -+ -+#else -+ -+#include -+#include -+#include -+#define pthread_t int -+ -+#endif -+#endif -+ -+ -+typedef struct -+{ -+ pthread_t threadid; -+ int pipe_fd[2]; -+ void *userdata; -+} thread; -+ -+thread * -+thread_new (void) -+{ -+ thread *th; -+ -+ th = calloc (1, sizeof (*th)); -+ if (!th) -+ return NULL; -+ -+ if (pipe (th->pipe_fd) == -1) -+ { -+ free (th); -+ return NULL; -+ } -+ -+#ifdef __EMX__ /* os/2 */ -+ setmode (pipe_fd[0], O_BINARY); -+ setmode (pipe_fd[1], O_BINARY); -+#endif -+ -+ return th; -+} -+ -+int -+thread_start (thread *th, void *(*start_routine)(void *), void *arg) -+{ -+ pthread_t id; -+ -+#ifdef WIN32 -+ CloseHandle (CreateThread (NULL, 0, -+ (LPTHREAD_START_ROUTINE)start_routine, -+ arg, 0, (DWORD *)&id)); -+#else -+#ifdef USE_PTHREAD -+ if (pthread_create (&id, NULL, start_routine, arg) != 0) -+ return 0; -+#else -+ switch (id = fork ()) -+ { -+ case -1: -+ return 0; -+ case 0: -+ /* this is the child */ -+ setuid (getuid ()); -+ start_routine (arg); -+ _exit (0); -+ } -+#endif -+#endif -+ -+ th->threadid = id; -+ -+ return 1; -+} -+ -+/*void -+thread_kill (thread *th) -+{ -+#ifdef WIN32 -+ PostThreadMessage (th->threadid, WM_QUIT, 0, 0); -+#else -+#ifdef USE_PTHREAD -+ pthread_cancel (th->threadid); -+ pthread_join (th->threadid, (void *)&th); -+#else -+ kill (th->threadid, SIGKILL); -+ waitpid (th->threadid, NULL, 0); -+#endif -+#endif -+} -+ -+void -+thread_free (thread *th) -+{ -+ close (th->pipe_fd[0]); -+ close (th->pipe_fd[1]); -+ free (th); -+}*/ -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/ewc/COPYING xchat-wdk/plugins/ewc/COPYING ---- xchat-wdk.orig/plugins/ewc/COPYING 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/ewc/COPYING 2010-03-31 08:46:17 +0200 -@@ -0,0 +1,502 @@ -+ GNU LESSER GENERAL PUBLIC LICENSE -+ Version 2.1, February 1999 -+ -+ Copyright (C) 1991, 1999 Free Software Foundation, Inc. -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+[This is the first released version of the Lesser GPL. It also counts -+ as the successor of the GNU Library Public License, version 2, hence -+ the version number 2.1.] -+ -+ Preamble -+ -+ The licenses for most software are designed to take away your -+freedom to share and change it. By contrast, the GNU General Public -+Licenses are intended to guarantee your freedom to share and change -+free software--to make sure the software is free for all its users. -+ -+ This license, the Lesser General Public License, applies to some -+specially designated software packages--typically libraries--of the -+Free Software Foundation and other authors who decide to use it. You -+can use it too, but we suggest you first think carefully about whether -+this license or the ordinary General Public License is the better -+strategy to use in any particular case, based on the explanations below. -+ -+ When we speak of free software, we are referring to freedom of use, -+not price. Our General Public Licenses are designed to make sure that -+you have the freedom to distribute copies of free software (and charge -+for this service if you wish); that you receive source code or can get -+it if you want it; that you can change the software and use pieces of -+it in new free programs; and that you are informed that you can do -+these things. -+ -+ To protect your rights, we need to make restrictions that forbid -+distributors to deny you these rights or to ask you to surrender these -+rights. These restrictions translate to certain responsibilities for -+you if you distribute copies of the library or if you modify it. -+ -+ For example, if you distribute copies of the library, whether gratis -+or for a fee, you must give the recipients all the rights that we gave -+you. You must make sure that they, too, receive or can get the source -+code. If you link other code with the library, you must provide -+complete object files to the recipients, so that they can relink them -+with the library after making changes to the library and recompiling -+it. And you must show them these terms so they know their rights. -+ -+ We protect your rights with a two-step method: (1) we copyright the -+library, and (2) we offer you this license, which gives you legal -+permission to copy, distribute and/or modify the library. -+ -+ To protect each distributor, we want to make it very clear that -+there is no warranty for the free library. Also, if the library is -+modified by someone else and passed on, the recipients should know -+that what they have is not the original version, so that the original -+author's reputation will not be affected by problems that might be -+introduced by others. -+ -+ Finally, software patents pose a constant threat to the existence of -+any free program. We wish to make sure that a company cannot -+effectively restrict the users of a free program by obtaining a -+restrictive license from a patent holder. Therefore, we insist that -+any patent license obtained for a version of the library must be -+consistent with the full freedom of use specified in this license. -+ -+ Most GNU software, including some libraries, is covered by the -+ordinary GNU General Public License. This license, the GNU Lesser -+General Public License, applies to certain designated libraries, and -+is quite different from the ordinary General Public License. We use -+this license for certain libraries in order to permit linking those -+libraries into non-free programs. -+ -+ When a program is linked with a library, whether statically or using -+a shared library, the combination of the two is legally speaking a -+combined work, a derivative of the original library. The ordinary -+General Public License therefore permits such linking only if the -+entire combination fits its criteria of freedom. The Lesser General -+Public License permits more lax criteria for linking other code with -+the library. -+ -+ We call this license the "Lesser" General Public License because it -+does Less to protect the user's freedom than the ordinary General -+Public License. It also provides other free software developers Less -+of an advantage over competing non-free programs. These disadvantages -+are the reason we use the ordinary General Public License for many -+libraries. However, the Lesser license provides advantages in certain -+special circumstances. -+ -+ For example, on rare occasions, there may be a special need to -+encourage the widest possible use of a certain library, so that it becomes -+a de-facto standard. To achieve this, non-free programs must be -+allowed to use the library. A more frequent case is that a free -+library does the same job as widely used non-free libraries. In this -+case, there is little to gain by limiting the free library to free -+software only, so we use the Lesser General Public License. -+ -+ In other cases, permission to use a particular library in non-free -+programs enables a greater number of people to use a large body of -+free software. For example, permission to use the GNU C Library in -+non-free programs enables many more people to use the whole GNU -+operating system, as well as its variant, the GNU/Linux operating -+system. -+ -+ Although the Lesser General Public License is Less protective of the -+users' freedom, it does ensure that the user of a program that is -+linked with the Library has the freedom and the wherewithal to run -+that program using a modified version of the Library. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. Pay close attention to the difference between a -+"work based on the library" and a "work that uses the library". The -+former contains code derived from the library, whereas the latter must -+be combined with the library in order to run. -+ -+ GNU LESSER GENERAL PUBLIC LICENSE -+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -+ -+ 0. This License Agreement applies to any software library or other -+program which contains a notice placed by the copyright holder or -+other authorized party saying it may be distributed under the terms of -+this Lesser General Public License (also called "this License"). -+Each licensee is addressed as "you". -+ -+ A "library" means a collection of software functions and/or data -+prepared so as to be conveniently linked with application programs -+(which use some of those functions and data) to form executables. -+ -+ The "Library", below, refers to any such software library or work -+which has been distributed under these terms. A "work based on the -+Library" means either the Library or any derivative work under -+copyright law: that is to say, a work containing the Library or a -+portion of it, either verbatim or with modifications and/or translated -+straightforwardly into another language. (Hereinafter, translation is -+included without limitation in the term "modification".) -+ -+ "Source code" for a work means the preferred form of the work for -+making modifications to it. For a library, complete source code means -+all the source code for all modules it contains, plus any associated -+interface definition files, plus the scripts used to control compilation -+and installation of the library. -+ -+ Activities other than copying, distribution and modification are not -+covered by this License; they are outside its scope. The act of -+running a program using the Library is not restricted, and output from -+such a program is covered only if its contents constitute a work based -+on the Library (independent of the use of the Library in a tool for -+writing it). Whether that is true depends on what the Library does -+and what the program that uses the Library does. -+ -+ 1. You may copy and distribute verbatim copies of the Library's -+complete source code as you receive it, in any medium, provided that -+you conspicuously and appropriately publish on each copy an -+appropriate copyright notice and disclaimer of warranty; keep intact -+all the notices that refer to this License and to the absence of any -+warranty; and distribute a copy of this License along with the -+Library. -+ -+ You may charge a fee for the physical act of transferring a copy, -+and you may at your option offer warranty protection in exchange for a -+fee. -+ -+ 2. You may modify your copy or copies of the Library or any portion -+of it, thus forming a work based on the Library, and copy and -+distribute such modifications or work under the terms of Section 1 -+above, provided that you also meet all of these conditions: -+ -+ a) The modified work must itself be a software library. -+ -+ b) You must cause the files modified to carry prominent notices -+ stating that you changed the files and the date of any change. -+ -+ c) You must cause the whole of the work to be licensed at no -+ charge to all third parties under the terms of this License. -+ -+ d) If a facility in the modified Library refers to a function or a -+ table of data to be supplied by an application program that uses -+ the facility, other than as an argument passed when the facility -+ is invoked, then you must make a good faith effort to ensure that, -+ in the event an application does not supply such function or -+ table, the facility still operates, and performs whatever part of -+ its purpose remains meaningful. -+ -+ (For example, a function in a library to compute square roots has -+ a purpose that is entirely well-defined independent of the -+ application. Therefore, Subsection 2d requires that any -+ application-supplied function or table used by this function must -+ be optional: if the application does not supply it, the square -+ root function must still compute square roots.) -+ -+These requirements apply to the modified work as a whole. If -+identifiable sections of that work are not derived from the Library, -+and can be reasonably considered independent and separate works in -+themselves, then this License, and its terms, do not apply to those -+sections when you distribute them as separate works. But when you -+distribute the same sections as part of a whole which is a work based -+on the Library, the distribution of the whole must be on the terms of -+this License, whose permissions for other licensees extend to the -+entire whole, and thus to each and every part regardless of who wrote -+it. -+ -+Thus, it is not the intent of this section to claim rights or contest -+your rights to work written entirely by you; rather, the intent is to -+exercise the right to control the distribution of derivative or -+collective works based on the Library. -+ -+In addition, mere aggregation of another work not based on the Library -+with the Library (or with a work based on the Library) on a volume of -+a storage or distribution medium does not bring the other work under -+the scope of this License. -+ -+ 3. You may opt to apply the terms of the ordinary GNU General Public -+License instead of this License to a given copy of the Library. To do -+this, you must alter all the notices that refer to this License, so -+that they refer to the ordinary GNU General Public License, version 2, -+instead of to this License. (If a newer version than version 2 of the -+ordinary GNU General Public License has appeared, then you can specify -+that version instead if you wish.) Do not make any other change in -+these notices. -+ -+ Once this change is made in a given copy, it is irreversible for -+that copy, so the ordinary GNU General Public License applies to all -+subsequent copies and derivative works made from that copy. -+ -+ This option is useful when you wish to copy part of the code of -+the Library into a program that is not a library. -+ -+ 4. You may copy and distribute the Library (or a portion or -+derivative of it, under Section 2) in object code or executable form -+under the terms of Sections 1 and 2 above provided that you accompany -+it with the complete corresponding machine-readable source code, which -+must be distributed under the terms of Sections 1 and 2 above on a -+medium customarily used for software interchange. -+ -+ If distribution of object code is made by offering access to copy -+from a designated place, then offering equivalent access to copy the -+source code from the same place satisfies the requirement to -+distribute the source code, even though third parties are not -+compelled to copy the source along with the object code. -+ -+ 5. A program that contains no derivative of any portion of the -+Library, but is designed to work with the Library by being compiled or -+linked with it, is called a "work that uses the Library". Such a -+work, in isolation, is not a derivative work of the Library, and -+therefore falls outside the scope of this License. -+ -+ However, linking a "work that uses the Library" with the Library -+creates an executable that is a derivative of the Library (because it -+contains portions of the Library), rather than a "work that uses the -+library". The executable is therefore covered by this License. -+Section 6 states terms for distribution of such executables. -+ -+ When a "work that uses the Library" uses material from a header file -+that is part of the Library, the object code for the work may be a -+derivative work of the Library even though the source code is not. -+Whether this is true is especially significant if the work can be -+linked without the Library, or if the work is itself a library. The -+threshold for this to be true is not precisely defined by law. -+ -+ If such an object file uses only numerical parameters, data -+structure layouts and accessors, and small macros and small inline -+functions (ten lines or less in length), then the use of the object -+file is unrestricted, regardless of whether it is legally a derivative -+work. (Executables containing this object code plus portions of the -+Library will still fall under Section 6.) -+ -+ Otherwise, if the work is a derivative of the Library, you may -+distribute the object code for the work under the terms of Section 6. -+Any executables containing that work also fall under Section 6, -+whether or not they are linked directly with the Library itself. -+ -+ 6. As an exception to the Sections above, you may also combine or -+link a "work that uses the Library" with the Library to produce a -+work containing portions of the Library, and distribute that work -+under terms of your choice, provided that the terms permit -+modification of the work for the customer's own use and reverse -+engineering for debugging such modifications. -+ -+ You must give prominent notice with each copy of the work that the -+Library is used in it and that the Library and its use are covered by -+this License. You must supply a copy of this License. If the work -+during execution displays copyright notices, you must include the -+copyright notice for the Library among them, as well as a reference -+directing the user to the copy of this License. Also, you must do one -+of these things: -+ -+ a) Accompany the work with the complete corresponding -+ machine-readable source code for the Library including whatever -+ changes were used in the work (which must be distributed under -+ Sections 1 and 2 above); and, if the work is an executable linked -+ with the Library, with the complete machine-readable "work that -+ uses the Library", as object code and/or source code, so that the -+ user can modify the Library and then relink to produce a modified -+ executable containing the modified Library. (It is understood -+ that the user who changes the contents of definitions files in the -+ Library will not necessarily be able to recompile the application -+ to use the modified definitions.) -+ -+ b) Use a suitable shared library mechanism for linking with the -+ Library. A suitable mechanism is one that (1) uses at run time a -+ copy of the library already present on the user's computer system, -+ rather than copying library functions into the executable, and (2) -+ will operate properly with a modified version of the library, if -+ the user installs one, as long as the modified version is -+ interface-compatible with the version that the work was made with. -+ -+ c) Accompany the work with a written offer, valid for at -+ least three years, to give the same user the materials -+ specified in Subsection 6a, above, for a charge no more -+ than the cost of performing this distribution. -+ -+ d) If distribution of the work is made by offering access to copy -+ from a designated place, offer equivalent access to copy the above -+ specified materials from the same place. -+ -+ e) Verify that the user has already received a copy of these -+ materials or that you have already sent this user a copy. -+ -+ For an executable, the required form of the "work that uses the -+Library" must include any data and utility programs needed for -+reproducing the executable from it. However, as a special exception, -+the materials to be distributed need not include anything that is -+normally distributed (in either source or binary form) with the major -+components (compiler, kernel, and so on) of the operating system on -+which the executable runs, unless that component itself accompanies -+the executable. -+ -+ It may happen that this requirement contradicts the license -+restrictions of other proprietary libraries that do not normally -+accompany the operating system. Such a contradiction means you cannot -+use both them and the Library together in an executable that you -+distribute. -+ -+ 7. You may place library facilities that are a work based on the -+Library side-by-side in a single library together with other library -+facilities not covered by this License, and distribute such a combined -+library, provided that the separate distribution of the work based on -+the Library and of the other library facilities is otherwise -+permitted, and provided that you do these two things: -+ -+ a) Accompany the combined library with a copy of the same work -+ based on the Library, uncombined with any other library -+ facilities. This must be distributed under the terms of the -+ Sections above. -+ -+ b) Give prominent notice with the combined library of the fact -+ that part of it is a work based on the Library, and explaining -+ where to find the accompanying uncombined form of the same work. -+ -+ 8. You may not copy, modify, sublicense, link with, or distribute -+the Library except as expressly provided under this License. Any -+attempt otherwise to copy, modify, sublicense, link with, or -+distribute the Library is void, and will automatically terminate your -+rights under this License. However, parties who have received copies, -+or rights, from you under this License will not have their licenses -+terminated so long as such parties remain in full compliance. -+ -+ 9. You are not required to accept this License, since you have not -+signed it. However, nothing else grants you permission to modify or -+distribute the Library or its derivative works. These actions are -+prohibited by law if you do not accept this License. Therefore, by -+modifying or distributing the Library (or any work based on the -+Library), you indicate your acceptance of this License to do so, and -+all its terms and conditions for copying, distributing or modifying -+the Library or works based on it. -+ -+ 10. Each time you redistribute the Library (or any work based on the -+Library), the recipient automatically receives a license from the -+original licensor to copy, distribute, link with or modify the Library -+subject to these terms and conditions. You may not impose any further -+restrictions on the recipients' exercise of the rights granted herein. -+You are not responsible for enforcing compliance by third parties with -+this License. -+ -+ 11. If, as a consequence of a court judgment or allegation of patent -+infringement or for any other reason (not limited to patent issues), -+conditions are imposed on you (whether by court order, agreement or -+otherwise) that contradict the conditions of this License, they do not -+excuse you from the conditions of this License. If you cannot -+distribute so as to satisfy simultaneously your obligations under this -+License and any other pertinent obligations, then as a consequence you -+may not distribute the Library at all. For example, if a patent -+license would not permit royalty-free redistribution of the Library by -+all those who receive copies directly or indirectly through you, then -+the only way you could satisfy both it and this License would be to -+refrain entirely from distribution of the Library. -+ -+If any portion of this section is held invalid or unenforceable under any -+particular circumstance, the balance of the section is intended to apply, -+and the section as a whole is intended to apply in other circumstances. -+ -+It is not the purpose of this section to induce you to infringe any -+patents or other property right claims or to contest validity of any -+such claims; this section has the sole purpose of protecting the -+integrity of the free software distribution system which is -+implemented by public license practices. Many people have made -+generous contributions to the wide range of software distributed -+through that system in reliance on consistent application of that -+system; it is up to the author/donor to decide if he or she is willing -+to distribute software through any other system and a licensee cannot -+impose that choice. -+ -+This section is intended to make thoroughly clear what is believed to -+be a consequence of the rest of this License. -+ -+ 12. If the distribution and/or use of the Library is restricted in -+certain countries either by patents or by copyrighted interfaces, the -+original copyright holder who places the Library under this License may add -+an explicit geographical distribution limitation excluding those countries, -+so that distribution is permitted only in or among countries not thus -+excluded. In such case, this License incorporates the limitation as if -+written in the body of this License. -+ -+ 13. The Free Software Foundation may publish revised and/or new -+versions of the Lesser General Public License from time to time. -+Such new versions will be similar in spirit to the present version, -+but may differ in detail to address new problems or concerns. -+ -+Each version is given a distinguishing version number. If the Library -+specifies a version number of this License which applies to it and -+"any later version", you have the option of following the terms and -+conditions either of that version or of any later version published by -+the Free Software Foundation. If the Library does not specify a -+license version number, you may choose any version ever published by -+the Free Software Foundation. -+ -+ 14. If you wish to incorporate parts of the Library into other free -+programs whose distribution conditions are incompatible with these, -+write to the author to ask for permission. For software which is -+copyrighted by the Free Software Foundation, write to the Free -+Software Foundation; we sometimes make exceptions for this. Our -+decision will be guided by the two goals of preserving the free status -+of all derivatives of our free software and of promoting the sharing -+and reuse of software generally. -+ -+ NO WARRANTY -+ -+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -+ -+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -+DAMAGES. -+ -+ END OF TERMS AND CONDITIONS -+ -+ How to Apply These Terms to Your New Libraries -+ -+ If you develop a new library, and you want it to be of the greatest -+possible use to the public, we recommend making it free software that -+everyone can redistribute and change. You can do so by permitting -+redistribution under these terms (or, alternatively, under the terms of the -+ordinary General Public License). -+ -+ To apply these terms, attach the following notices to the library. It is -+safest to attach them to the start of each source file to most effectively -+convey the exclusion of warranty; and each file should have at least the -+"copyright" line and a pointer to where the full notice is found. -+ -+ -+ Copyright (C) -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ This library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ -+Also add information on how to contact you by electronic and paper mail. -+ -+You should also get your employer (if you work as a programmer) or your -+school, if any, to sign a "copyright disclaimer" for the library, if -+necessary. Here is a sample; alter the names: -+ -+ Yoyodyne, Inc., hereby disclaims all copyright interest in the -+ library `Frob' (a library for tweaking knobs) written by James Random Hacker. -+ -+ , 1 April 1990 -+ Ty Coon, President of Vice -+ -+That's all there is to it! -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/ewc/ewc.c xchat-wdk/plugins/ewc/ewc.c ---- xchat-wdk.orig/plugins/ewc/ewc.c 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/ewc/ewc.c 2010-03-31 08:56:53 +0200 -@@ -0,0 +1,231 @@ -+/* -+EasyWinampControl - A Winamp "What's playing" plugin for Xchat -+Copyright (C) Yann HAMON & contributors -+ -+This library is free software; you can redistribute it and/or -+modify it under the terms of the GNU Lesser General Public -+License as published by the Free Software Foundation; either -+version 2.1 of the License, or (at your option) any later version. -+ -+This library is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+Lesser General Public License for more details. -+ -+You should have received a copy of the GNU Lesser General Public -+License along with this library; if not, write to the Free Software -+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+*/ -+ -+#include "xchat-plugin.h" -+#include -+ -+static xchat_plugin *ph; /* plugin handle */ -+static int enable = 1; -+ -+// For example, circularstrstr("winamp", "pwi", 3) would return 5 (the index of p) -+int circularstrstr(char* a, char* b, int nb) -+{ -+ int equal = 1; -+ int length; -+ int pos=-1; -+ int i, j; -+ -+ length = strlen(a); -+ -+ for (i=0; ititle && *p != '-') p--; -+ *p = '\0'; -+ } -+} -+ -+ -+// Controlling winamp -+static int wcmd_cb(char *word[], char *word_eol[], void *userdata) -+{ -+ // Everything's here : http://winamp.com/nsdn/winamp2x/dev/sdk/api.php -+ // The previous url seems dead, see http://forums.winamp.com/showthread.php?threadid=180297 -+ HWND hwndWinamp = NULL; -+ -+ if ((hwndWinamp = FindWindow("Winamp v1.x",NULL)) == NULL) { -+ xchat_print(ph, "Winamp's window not found - Is winamp really running?\n"); -+ } -+ else { -+ if (strcmp(word[1], "") == 0) -+ xchat_print(ph, "Usage: wcmd [command]\n"); -+ else if (strcmp(word[2], "next") == 0) { -+ xchat_print(ph, "Loading next song...\n"); -+ SendMessage (hwndWinamp, WM_COMMAND, 40048, 0); -+ } -+ else if (strcmp(word[2], "prev") == 0) { -+ xchat_print(ph, "Loading previous song...\n"); -+ SendMessage (hwndWinamp, WM_COMMAND, 40044, 0); -+ } -+ else if (strcmp(word[2], "play") == 0) { -+ xchat_print(ph, "Playin'...\n"); -+ SendMessage (hwndWinamp, WM_COMMAND, 40045, 0); -+ } -+ else if (strcmp(word[2], "stop") == 0) { -+ xchat_print(ph, "Winamp stopped!...\n"); -+ SendMessage (hwndWinamp, WM_COMMAND, 40047, 0); -+ } -+ else if (strcmp(word[2], "pause") == 0) { -+ SendMessage (hwndWinamp, WM_COMMAND, 40046, 0); -+ } -+ } -+ -+ return XCHAT_EAT_ALL; -+} -+ -+ -+// Display current song -+static int wp_cb(char *word[], char *word_eol[], void *userdata) -+{ -+ HWND hwndWinamp = NULL; -+ int bitrate, length, elapsed, minutes, seconds, eminutes, eseconds, samplerate, nbchannels; -+ char elapsedtime[7]; -+ char totaltime[7]; -+ char this_title[1024]; -+ -+ if ((hwndWinamp = FindWindow("Winamp v1.x",NULL)) == NULL) -+ xchat_print(ph, "Winamp's window not found - Is winamp really running?\n"); -+ else { -+ //Winamp's running -+ // Seems buggy when winamp2's agent is running, and winamp not (or winamp3) -> crashes xchat. -+ SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)125); -+ -+ if ((samplerate = SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)126)) == 0) { -+ xchat_print(ph, "Could not get current song's samplerate... !?\n"); -+ return XCHAT_EAT_ALL; -+ } -+ if ((bitrate = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)126)) == 0) { -+ xchat_print(ph, "Could not get current song's bitrate... !?\n"); -+ return XCHAT_EAT_ALL; -+ } -+ if ((nbchannels = SendMessage(hwndWinamp, WM_USER, (WPARAM)2, (LPARAM)126)) == 0) { -+ xchat_print(ph, "Could not get the number of channels... !?\n"); -+ return XCHAT_EAT_ALL; -+ } -+ if ((length = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)105)) == 0) { -+ // Could be buggy when streaming audio or video, returned length is unexpected; -+ // How to detect is Winamp is streaming, and display ??:?? in that case? -+ xchat_print(ph, "Could not get current song's length... !?\n"); -+ return XCHAT_EAT_ALL; -+ } -+ else { -+ minutes = length/60; -+ seconds = length%60; -+ -+ if (seconds>9) -+ wsprintf(totaltime, "%d:%d", minutes, seconds); -+ else -+ wsprintf(totaltime, "%d:0%d", minutes, seconds); -+ } -+ if ((elapsed = SendMessage(hwndWinamp, WM_USER, (WPARAM)0, (LPARAM)105)) == 0) { -+ xchat_print(ph, "Could not get current song's elapsed time... !?\n"); -+ return XCHAT_EAT_ALL; -+ } -+ else { -+ eminutes = (elapsed/1000)/60; /* kinda stupid sounding, but e is for elapsed */ -+ eseconds = (elapsed/1000)%60; -+ -+ if (eseconds>9) -+ wsprintf(elapsedtime, "%d:%d", eminutes, eseconds); -+ else -+ wsprintf(elapsedtime, "%d:0%d", eminutes, eseconds); -+ } -+ -+ if ((bitrate = SendMessage(hwndWinamp, WM_USER, (WPARAM)1, (LPARAM)126)) == 0) { -+ xchat_print(ph, "Could not get current song's bitrate... !?\n"); -+ return XCHAT_EAT_ALL; -+ } -+ -+ GetCurrentSongsName(hwndWinamp, this_title, 1024); -+ -+ xchat_commandf(ph, "dispcurrsong %d %d %d %s %s %s", samplerate, bitrate, nbchannels, elapsedtime, totaltime, this_title); -+ } -+ -+ return XCHAT_EAT_ALL; /* eat this command so xchat and other plugins can't process it */ -+} -+ -+ -+ -+int xchat_plugin_init(xchat_plugin *plugin_handle, -+ char **plugin_name, -+ char **plugin_desc, -+ char **plugin_version, -+ char *arg) -+{ -+ /* we need to save this for use with any xchat_* functions */ -+ ph = plugin_handle; -+ -+ *plugin_name = "EasyWinampControl"; -+ *plugin_desc = "Some commands to remotely control winamp"; -+ *plugin_version = "1.2"; -+ -+ xchat_hook_command(ph, "wp", XCHAT_PRI_NORM, wp_cb, -+ "Usage: wp", 0); -+ -+ xchat_hook_command(ph, "wcmd", XCHAT_PRI_NORM, wcmd_cb, -+ "Usage: wcmd [play|pause|stop|prev|next]", 0); -+ -+ xchat_print(ph, "EasyWinampControl 1.2 plugin loaded successfully!\n"); -+ -+ return 1; /* return 1 for success */ -+} -+ -+int xchat_plugin_deinit(void) -+{ -+ xchat_print(ph, "EasyWinampControl 1.2 plugin unloaded successfully!\n"); -+ return 1; -+} -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/ewc/makefile.mak xchat-wdk/plugins/ewc/makefile.mak ---- xchat-wdk.orig/plugins/ewc/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/ewc/makefile.mak 2010-03-31 10:41:16 +0200 -@@ -0,0 +1,19 @@ -+include "..\..\src\makeinc.mak" -+ -+xcewc.dll: ewc.obj ewc.def -+ link $(LDFLAGS) $(LIBS) /dll /out:xcewc.dll /def:ewc.def ewc.obj -+ dir xcewc.dll -+ -+ewc.def: -+ echo EXPORTS > ewc.def -+ echo xchat_plugin_init >> ewc.def -+ echo xchat_plugin_deinit >> ewc.def -+ -+ewc.obj: ewc.c makefile.mak -+ cl $(CFLAGS) /I.. ewc.c -+ -+clean: -+ del *.obj -+ del *.dll -+ del *.exp -+ del *.lib -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/perl/makefile.mak xchat-wdk/plugins/perl/makefile.mak ---- xchat-wdk.orig/plugins/perl/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/perl/makefile.mak 2010-03-31 07:55:16 +0200 -@@ -0,0 +1,29 @@ -+include "..\..\src\makeinc.mak" -+ -+TARGET = $(PERLOUTPUT) -+ -+all: $(TARGET) -+ -+perl.def: -+ echo EXPORTS > perl.def -+ echo xchat_plugin_init >> perl.def -+ echo xchat_plugin_deinit >> perl.def -+ echo xchat_plugin_get_info >> perl.def -+ -+perl.obj: perl.c -+ $(CC) $(CFLAGS) perl.c $(GLIB) -I.. -I$(PERLPATH) -DPERL_DLL=\"$(PERLLIB).dll\" -+ -+perl.c: xchat.pm.h -+ -+xchat.pm.h: Xchat.pm IRC.pm -+ perl.exe generate_header -+ -+$(TARGET): perl.obj perl.def -+ $(LINK) /DLL /out:$(TARGET) perl.obj $(LDFLAGS) $(PERLLIB).lib /LIBPATH:$(PERLPATH) /DELAYLOAD:$(PERLLIB).dll DELAYIMP.LIB user32.lib shell32.lib advapi32.lib /def:perl.def -+ -+clean: -+ del $(TARGET) -+ del *.obj -+ del perl.def -+ del *.lib -+ del *.exp 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-03-23 01:06:59 +0100 +++ xchat-wdk/plugins/perl/perl.c 2010-03-30 01:17:15 +0200 @@ -1661,37 +17,9 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/perl/perl.c xchat-wdk/plugi #ifdef ENABLE_NLS #include #endif -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/python/makefile.mak xchat-wdk/plugins/python/makefile.mak ---- xchat-wdk.orig/plugins/python/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/python/makefile.mak 2010-03-31 07:56:12 +0200 -@@ -0,0 +1,24 @@ -+include "..\..\src\makeinc.mak" -+ -+TARGET = $(PYTHONOUTPUT) -+ -+all: $(TARGET) -+ -+python.def: -+ echo EXPORTS > python.def -+ echo xchat_plugin_init >> python.def -+ echo xchat_plugin_deinit >> python.def -+ echo xchat_plugin_get_info >> python.def -+ -+python.obj: python.c -+ $(CC) $(CFLAGS) /Dusleep=_sleep /DPATH_MAX=255 python.c $(GLIB) /I.. /I$(PYTHONPATH)\INCLUDE /DPYTHON_DLL=\"$(PYTHONLIB).dll\" -+ -+$(TARGET): python.obj python.def -+ $(LINK) /DLL /out:$(TARGET) $(LDFLAGS) python.obj $(PYTHONLIB).lib /LIBPATH:$(PYTHONPATH)\LIBS $(PYTHONLIB).lib $(LIBS) /def:python.def -+ -+clean: -+ del $(TARGET) -+ del *.obj -+ del python.def -+ del *.lib -+ del *.exp 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-03-17 09:07:51 +0100 -+++ xchat-wdk/plugins/python/python.c 2010-03-30 02:59:44 +0200 ++++ xchat-wdk/plugins/python/python.c 2010-03-31 13:25:58 +0200 @@ -51,12 +51,13 @@ * */ @@ -1713,36 +41,10 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/python/python.c xchat-wdk/p #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 python24.dll */ ++#define VERSION "0.8/2.5" /* Linked to python24.dll */ #else #define VERSION "0.8" #endif -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/tcl/makefile.mak xchat-wdk/plugins/tcl/makefile.mak ---- xchat-wdk.orig/plugins/tcl/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/tcl/makefile.mak 2010-03-31 07:56:43 +0200 -@@ -0,0 +1,22 @@ -+include "..\..\src\makeinc.mak" -+ -+TARGET = $(TCLOUTPUT) -+ -+all: $(TARGET) -+ -+tcl.def: -+ echo EXPORTS > tcl.def -+ echo xchat_plugin_init >> tcl.def -+ echo xchat_plugin_deinit >> tcl.def -+ echo xchat_plugin_get_info >> tcl.def -+ -+tclplugin.obj: tclplugin.c -+ $(CC) $(CFLAGS) tclplugin.c /I$(TCLPATH)\INCLUDE /I../../include /I.. /DTCL_DLL=\"$(TCLLIB).dll\" -+ -+$(TARGET): tclplugin.obj tcl.def -+ $(LINK) /DLL /out:$(TARGET) $(LDFLAGS) tclplugin.obj /LIBPATH:$(TCLPATH)\LIB $(TCLLIB).lib /DELAYLOAD:$(TCLLIB).dll DELAYIMP.LIB /def:tcl.def -+ -+clean: -+ del $(TARGET) -+ del *.obj -+ del tcl.def 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-03-29 12:57:17 +0200 @@ -1755,3224 +57,6 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/tcl/tclplugin.c xchat-wdk/p #endif #include "xchat-plugin.h" -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/callbacks.cpp xchat-wdk/plugins/xtray/callbacks.cpp ---- xchat-wdk.orig/plugins/xtray/callbacks.cpp 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/callbacks.cpp 2005-11-06 13:24:08 +0100 -@@ -0,0 +1,729 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#define _WIN32_IE 0x0601 -+ -+#include -+#include -+#include -+#include -+#include "utility.h" -+#include "plugin.h" -+#include "xtray.h" -+#include "xchat.h" -+#include "callbacks.h" -+#include "resource.h" -+#include "sdTray.h" -+#include "sdAlerts.h" -+ -+HWND g_hPrefTabEvents; -+HWND g_hPrefTabSettings; -+HWND g_hPrefTabAlerts; -+HWND g_hPrefTabAbout; -+bool g_bCanQuit; -+int g_iIsActive = 1; -+ -+ -+BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) -+{ -+ TCHAR szTitle[10]; -+ GetWindowText(hWnd, szTitle, 9); -+ -+ if(_tcsstr(szTitle, _T("X-Chat ["))) -+ { -+ g_hXchatWnd = hWnd; -+ return false; -+ } -+ -+ return true; -+} -+ -+/***********************************************************************************************/ -+/******* our xchat event call back, get the name and info for each event and save it ***********/ -+/******* for our alerts later ***********/ -+/***********************************************************************************************/ -+int event_cb(char *word[], void *userdata) -+{ -+ int iEvent = (int)userdata; -+ -+ if(iEvent > 10) -+ return XCHAT_EAT_NONE; -+ -+ /***************************************************************************************/ -+ /***** if the window is minimized or if we're allowed to show alerts when its not **/ -+ /***** and if the option to show the specified alert is true and if we're even **/ -+ /***** allowed to show alerts at all then we show them (a bit confusing but it works) **/ -+ /***************************************************************************************/ -+ if(((g_iIsActive == 0) || !(g_dwPrefs & (1< 0) -+ { -+ xchat_set_context(ph, xchat_find_server(msg-1)); -+ -+ if(!xchat_get_info(ph, "away")) -+ { -+ xchat_away(g_szAway); -+ } -+ else -+ { -+ xchat_back(); -+ } -+ } -+ } -+ break; -+ } -+ -+ return 1; -+} -+ -+int CALLBACK PrefProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -+{ -+ switch(msg) -+ { -+ case WM_INITDIALOG: -+ { -+ TCITEM tci1; -+ TCITEM tci2; -+ TCITEM tci3; -+ TCITEM tci4; -+ -+ tci1.mask = TCIF_TEXT; -+ tci1.pszText = _T("Settings"); -+ tci1.cchTextMax = strlen("Settings"); -+ SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 0, (LPARAM)&tci1); -+ -+ tci2.mask = TCIF_TEXT; -+ tci2.pszText = _T("Alerts"); -+ tci2.cchTextMax = strlen("Alerts"); -+ SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 1, (LPARAM)&tci2); -+ -+ tci3.mask = TCIF_TEXT; -+ tci3.pszText = _T("Events"); -+ tci3.cchTextMax = strlen("Events"); -+ SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 2, (LPARAM)&tci3); -+ -+ tci4.mask = TCIF_TEXT; -+ tci4.pszText = _T("About"); -+ tci4.cchTextMax = strlen("About"); -+ SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_INSERTITEM, 3, (LPARAM)&tci4); -+ -+ -+ /***********************************************************************************/ -+ /***********************************************************************************/ -+ /***********************************************************************************/ -+ -+ g_hPrefTabSettings = CreateDialog((HINSTANCE)g_hInstance, -+ MAKEINTRESOURCE(IDD_SETTINGS), -+ hWnd, -+ (DLGPROC)SettingsProc); -+ SetDialog(g_hPrefTabSettings, IDD_SETTINGS); -+ -+ g_hPrefTabAlerts = CreateDialog((HINSTANCE)g_hInstance, -+ MAKEINTRESOURCE(IDD_ALERTS), -+ hWnd, -+ (DLGPROC)AlertsProc); -+ SetDialog(g_hPrefTabAlerts, IDD_ALERTS); -+ -+ g_hPrefTabEvents = CreateDialog((HINSTANCE)g_hInstance, -+ MAKEINTRESOURCE(IDD_EVENTS), -+ hWnd, -+ (DLGPROC)EventsProc); -+ SetDialog(g_hPrefTabEvents, IDD_EVENTS); -+ -+ g_hPrefTabAbout = CreateDialog((HINSTANCE)g_hInstance, -+ MAKEINTRESOURCE(IDD_ABOUT), -+ hWnd, -+ (DLGPROC)AboutProc); -+ } -+ break; -+ case WM_SHOWWINDOW: -+ { -+ if(wparam) -+ { -+ SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_SETCURSEL, 0, 0); -+ ShowWindow(g_hPrefTabSettings, SW_SHOW); -+ ShowWindow(g_hPrefTabAlerts, SW_HIDE); -+ ShowWindow(g_hPrefTabEvents, SW_HIDE); -+ ShowWindow(g_hPrefTabAbout, SW_HIDE); -+ } -+ } -+ break; -+ case WM_NOTIFY: -+ { -+ NMHDR *pData = (NMHDR *)lparam; -+ -+ switch(pData->code) -+ { -+ case TCN_SELCHANGE: -+ { -+ switch(SendDlgItemMessage(hWnd, IDC_TAB_CONTROL, TCM_GETCURSEL, 0, 0)) -+ { -+ case 0: -+ { -+ ShowWindow(g_hPrefTabSettings, SW_SHOW); -+ ShowWindow(g_hPrefTabAlerts, SW_HIDE); -+ ShowWindow(g_hPrefTabEvents, SW_HIDE); -+ ShowWindow(g_hPrefTabAbout, SW_HIDE); -+ } -+ break; -+ case 1: -+ { -+ ShowWindow(g_hPrefTabSettings, SW_HIDE); -+ ShowWindow(g_hPrefTabAlerts, SW_SHOW); -+ ShowWindow(g_hPrefTabEvents, SW_HIDE); -+ ShowWindow(g_hPrefTabAbout, SW_HIDE); -+ } -+ break; -+ case 2: -+ { -+ ShowWindow(g_hPrefTabSettings, SW_HIDE); -+ ShowWindow(g_hPrefTabAlerts, SW_HIDE); -+ ShowWindow(g_hPrefTabEvents, SW_SHOW); -+ ShowWindow(g_hPrefTabAbout, SW_HIDE); -+ } -+ break; -+ case 3: -+ { -+ ShowWindow(g_hPrefTabSettings, SW_HIDE); -+ ShowWindow(g_hPrefTabAlerts, SW_HIDE); -+ ShowWindow(g_hPrefTabEvents, SW_HIDE); -+ ShowWindow(g_hPrefTabAbout, SW_SHOW); -+ } -+ break; -+ } -+ } -+ break; -+ } -+ } -+ break; -+ case WM_CLOSE: -+ { -+ ShowWindow(g_hPrefTabEvents, SW_HIDE); -+ ShowWindow(g_hPrefTabSettings, SW_HIDE); -+ ShowWindow(g_hPrefTabAlerts, SW_HIDE); -+ ShowWindow(g_hPrefTabAbout, SW_HIDE); -+ ShowWindow(hWnd, SW_HIDE); -+ return TRUE; -+ } -+ break; -+ case WM_COMMAND: -+ { -+ switch(wparam) -+ { -+ case IDC_PREF_OK: -+ { -+ CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); -+ CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); -+ CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); -+ -+ SavePrefs(0); -+ -+ ShowWindow(g_hPrefTabEvents, SW_HIDE); -+ ShowWindow(g_hPrefTabSettings, SW_HIDE); -+ ShowWindow(g_hPrefTabAlerts, SW_HIDE); -+ ShowWindow(g_hPrefTabAbout, SW_HIDE); -+ ShowWindow(hWnd, SW_HIDE); -+ return TRUE; -+ } -+ break; -+ case IDC_PREF_CANCEL: -+ { -+ ShowWindow(g_hPrefTabEvents, SW_HIDE); -+ ShowWindow(g_hPrefTabSettings, SW_HIDE); -+ ShowWindow(g_hPrefTabAlerts, SW_HIDE); -+ ShowWindow(g_hPrefTabAbout, SW_HIDE); -+ ShowWindow(hWnd, SW_HIDE); -+ return TRUE; -+ } -+ break; -+ case IDC_PREF_APPLY: -+ { -+ CheckPrefs(g_hPrefTabEvents, IDD_EVENTS); -+ CheckPrefs(g_hPrefTabSettings, IDD_SETTINGS); -+ CheckPrefs(g_hPrefTabAlerts, IDD_ALERTS); -+ -+ SavePrefs(0); -+ return FALSE; -+ } -+ break; -+ } -+ } -+ break; -+ case WM_DESTROY: -+ { -+ SendMessage(g_hPrefTabEvents, WM_CLOSE, 0, 0); -+ SendMessage(g_hPrefTabSettings, WM_CLOSE, 0, 0); -+ SendMessage(g_hPrefTabAbout, WM_CLOSE, 0, 0); -+ SendMessage(g_hPrefTabAlerts, WM_CLOSE, 0, 0); -+ } -+ break; -+ } -+ -+ return FALSE; -+} -+ -+/****************************************************/ -+/****************************************************/ -+/****************************************************/ -+LRESULT CALLBACK AlertsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -+{ -+ switch(msg) -+ { -+ case WM_CLOSE: -+ { -+ DestroyWindow(hWnd); -+ return TRUE; -+ break; -+ } -+ break; -+ case WM_COMMAND: -+ { -+ switch(LOWORD(wparam)) -+ { -+ case PREF_AMAE: -+ { -+ SetToggle(hWnd, PREF_OSBWM, PREF_AMAE, TRUE); -+ SetToggle(hWnd, PREF_UWIOB, PREF_AMAE, TRUE); -+ SetToggle(hWnd, PREF_KAOI, PREF_AMAE, TRUE); -+ -+ if(IsDlgButtonChecked(hWnd, PREF_AMAE)) -+ { -+ SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); -+ SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); -+ SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); -+ SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); -+ } -+ else -+ { -+ SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_AMAE, TRUE); -+ SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_AMAE, TRUE); -+ SetToggle(hWnd, IDC_ALERT_TIME, PREF_AMAE, TRUE); -+ SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_AMAE, TRUE); -+ } -+ } -+ break; -+ case PREF_UWIOB: -+ { -+ SetToggle(hWnd, IDC_ALERT_HOTKEY, PREF_UWIOB, TRUE); -+ SetToggle(hWnd, IDC_ALERT_HOTKEY_TEXT, PREF_UWIOB, TRUE); -+ } -+ break; -+ case PREF_KAOI: -+ { -+ SetToggle(hWnd, IDC_ALERT_TIME, PREF_KAOI, FALSE); -+ SetToggle(hWnd, IDC_ALERT_TIME_TEXT, PREF_KAOI, FALSE); -+ } -+ break; -+ } -+ break; -+ } -+ } -+ -+ return FALSE; -+} -+ -+/****************************************************/ -+/****************************************************/ -+/****************************************************/ -+LRESULT CALLBACK AboutProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -+{ -+ if(msg == WM_CLOSE) -+ { -+ DestroyWindow(hWnd); -+ return true; -+ } -+ -+ return FALSE; -+} -+ -+/*****************************************************/ -+/** Process the events for our event dialog **********/ -+/*****************************************************/ -+LRESULT CALLBACK EventsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -+{ -+ if(msg == WM_CLOSE) -+ { -+ DestroyWindow(hWnd); -+ return true; -+ } -+ -+ return FALSE; -+} -+ -+/*****************************************************/ -+/** Process the events for our settings dialog this **/ -+/** is alot more complicated because options are **/ -+/** enabled/disabled based on the state of others **/ -+/*****************************************************/ -+LRESULT CALLBACK SettingsProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -+{ -+ if(msg == WM_CLOSE) -+ { -+ DestroyWindow(hWnd); -+ return true; -+ } -+ -+ return FALSE; -+} -+ -+/*****************************************************/ -+/** this is the hotkey message processing function **/ -+/** this window is always open and ready to be told **/ -+/** if someone has hit the hotkey, if they did, we **/ -+/** need to close out all of the tray alerts, for **/ -+/** this I wrote sdCloseAlerts, more info there **/ -+/*****************************************************/ -+LRESULT CALLBACK HotKeyProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) -+{ -+ if(msg == WM_CLOSE) -+ { -+ DestroyWindow(hWnd); -+ return true; -+ } -+ else if(msg == WM_HOTKEY) -+ { -+ sdCloseAlerts(); -+ } -+ -+ return FALSE; -+} -+ -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/callbacks.h xchat-wdk/plugins/xtray/callbacks.h ---- xchat-wdk.orig/plugins/xtray/callbacks.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/callbacks.h 2005-10-25 15:08:30 +0200 -@@ -0,0 +1,37 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _H_CALLBACKS_H -+#define _H_CALLBACKS_H -+ -+int event_cb (char *word[], void *userdata); -+int command_cb (char *word[], char *word_eol[], void *userdata); -+ -+LRESULT CALLBACK WindowProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+BOOL CALLBACK EnumWindowsProc (HWND hWnd, LPARAM lParam); -+LRESULT CALLBACK sdTrayProc (HWND hwnd, int msg); -+ -+LRESULT CALLBACK AlertProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+LRESULT CALLBACK HotKeyProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+LRESULT CALLBACK EventsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+LRESULT CALLBACK AboutProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+LRESULT CALLBACK AlertsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+LRESULT CALLBACK SettingsProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+int CALLBACK PrefProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -+ -+#endif -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/makefile.mak xchat-wdk/plugins/xtray/makefile.mak ---- xchat-wdk.orig/plugins/xtray/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/makefile.mak 2010-03-31 07:59:07 +0200 -@@ -0,0 +1,37 @@ -+include "..\..\src\makeinc.mak" -+ -+TARGET = xtray.dll -+ -+TRAY_OBJECTS = \ -+callbacks.obj \ -+sdAlerts.obj \ -+sdTray.obj \ -+utility.obj \ -+xchat.obj \ -+xtray.obj -+ -+CPPFLAGS = $(CPPFLAGS) /D_STL70_ /D_STATIC_CPPLIB /EHsc -+ -+all: $(TRAY_OBJECTS) $(TARGET) -+ -+xtray.def: -+ echo EXPORTS > xtray.def -+ echo xchat_plugin_init >> xtray.def -+ echo xchat_plugin_deinit >> xtray.def -+ -+.cpp.obj: -+ $(CC) $(CPPFLAGS) /c $< -+ -+res: -+ rc resource.rc -+ -+$(TARGET): $(TRAY_OBJECTS) xtray.def res -+ $(LINK) /DLL /out:$(TARGET) $(LDFLAGS) $(TRAY_OBJECTS) ntstc_msvcrt.lib $(LIBS) /def:xtray.def resource.res -+ -+clean: -+ del $(TARGET) -+ del *.obj -+ del xtray.def -+ del resource.res -+ del *.lib -+ del *.exp -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/plugin.h xchat-wdk/plugins/xtray/plugin.h ---- xchat-wdk.orig/plugins/xtray/plugin.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/plugin.h 2005-03-22 17:20:36 +0100 -@@ -0,0 +1,335 @@ -+/* You can distribute this header with your plugins for easy compilation */ -+#ifndef XCHAT_PLUGIN_H -+#define XCHAT_PLUGIN_H -+ -+#include -+ -+#define XCHAT_IFACE_MAJOR 1 -+#define XCHAT_IFACE_MINOR 9 -+#define XCHAT_IFACE_MICRO 11 -+#define XCHAT_IFACE_VERSION ((XCHAT_IFACE_MAJOR * 10000) + \ -+ (XCHAT_IFACE_MINOR * 100) + \ -+ (XCHAT_IFACE_MICRO)) -+ -+#define XCHAT_PRI_HIGHEST 127 -+#define XCHAT_PRI_HIGH 64 -+#define XCHAT_PRI_NORM 0 -+#define XCHAT_PRI_LOW (-64) -+#define XCHAT_PRI_LOWEST (-128) -+ -+#define XCHAT_FD_READ 1 -+#define XCHAT_FD_WRITE 2 -+#define XCHAT_FD_EXCEPTION 4 -+#define XCHAT_FD_NOTSOCKET 8 -+ -+#define XCHAT_EAT_NONE 0 /* pass it on through! */ -+#define XCHAT_EAT_XCHAT 1 /* don't let xchat see this event */ -+#define XCHAT_EAT_PLUGIN 2 /* don't let other plugins see this event */ -+#define XCHAT_EAT_ALL (XCHAT_EAT_XCHAT|XCHAT_EAT_PLUGIN) /* don't let anything see this event */ -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+typedef struct _xchat_plugin xchat_plugin; -+typedef struct _xchat_list xchat_list; -+typedef struct _xchat_hook xchat_hook; -+#ifndef PLUGIN_C -+typedef struct _xchat_context xchat_context; -+#endif -+ -+#ifndef PLUGIN_C -+struct _xchat_plugin -+{ -+ /* these are only used on win32 */ -+ xchat_hook *(*xchat_hook_command) (xchat_plugin *ph, -+ const char *name, -+ int pri, -+ int (*callback) (char *word[], char *word_eol[], void *user_data), -+ const char *help_text, -+ void *userdata); -+ xchat_hook *(*xchat_hook_server) (xchat_plugin *ph, -+ const char *name, -+ int pri, -+ int (*callback) (char *word[], char *word_eol[], void *user_data), -+ void *userdata); -+ xchat_hook *(*xchat_hook_print) (xchat_plugin *ph, -+ const char *name, -+ int pri, -+ int (*callback) (char *word[], void *user_data), -+ void *userdata); -+ xchat_hook *(*xchat_hook_timer) (xchat_plugin *ph, -+ int timeout, -+ int (*callback) (void *user_data), -+ void *userdata); -+ xchat_hook *(*xchat_hook_fd) (xchat_plugin *ph, -+ int fd, -+ int flags, -+ int (*callback) (int fd, int flags, void *user_data), -+ void *userdata); -+ void *(*xchat_unhook) (xchat_plugin *ph, -+ xchat_hook *hook); -+ void (*xchat_print) (xchat_plugin *ph, -+ const char *text); -+ void (*xchat_printf) (xchat_plugin *ph, -+ const char *format, ...); -+ void (*xchat_command) (xchat_plugin *ph, -+ const char *command); -+ void (*xchat_commandf) (xchat_plugin *ph, -+ const char *format, ...); -+ int (*xchat_nickcmp) (xchat_plugin *ph, -+ const char *s1, -+ const char *s2); -+ int (*xchat_set_context) (xchat_plugin *ph, -+ xchat_context *ctx); -+ xchat_context *(*xchat_find_context) (xchat_plugin *ph, -+ const char *servname, -+ const char *channel); -+ xchat_context *(*xchat_get_context) (xchat_plugin *ph); -+ const char *(*xchat_get_info) (xchat_plugin *ph, -+ const char *id); -+ int (*xchat_get_prefs) (xchat_plugin *ph, -+ const char *name, -+ const char **string, -+ int *integer); -+ xchat_list * (*xchat_list_get) (xchat_plugin *ph, -+ const char *name); -+ void (*xchat_list_free) (xchat_plugin *ph, -+ xchat_list *xlist); -+ const char * const * (*xchat_list_fields) (xchat_plugin *ph, -+ const char *name); -+ int (*xchat_list_next) (xchat_plugin *ph, -+ xchat_list *xlist); -+ const char * (*xchat_list_str) (xchat_plugin *ph, -+ xchat_list *xlist, -+ const char *name); -+ int (*xchat_list_int) (xchat_plugin *ph, -+ xchat_list *xlist, -+ const char *name); -+ void * (*xchat_plugingui_add) (xchat_plugin *ph, -+ const char *filename, -+ const char *name, -+ const char *desc, -+ const char *version, -+ char *reserved); -+ void (*xchat_plugingui_remove) (xchat_plugin *ph, -+ void *handle); -+ int (*xchat_emit_print) (xchat_plugin *ph, -+ const char *event_name, ...); -+ int (*xchat_read_fd) (xchat_plugin *ph, -+ void *src, -+ char *buf, -+ int *len); -+ time_t (*xchat_list_time) (xchat_plugin *ph, -+ xchat_list *xlist, -+ const char *name); -+ char *(*xchat_gettext) (xchat_plugin *ph, -+ const char *msgid); -+ void (*xchat_send_modes) (xchat_plugin *ph, -+ const char **targets, -+ int ntargets, -+ int modes_per_line, -+ char sign, -+ char mode); -+ char *(*xchat_strip) (xchat_plugin *ph, -+ const char *str, -+ int len, -+ int flags); -+ void (*xchat_free) (xchat_plugin *ph, -+ void *ptr); -+}; -+#endif -+ -+ -+ -+xchat_hook * -+xchat_hook_command (xchat_plugin *ph, -+ const char *name, -+ int pri, -+ int (*callback) (char *word[], char *word_eol[], void *user_data), -+ const char *help_text, -+ void *userdata); -+ -+xchat_hook * -+xchat_hook_server (xchat_plugin *ph, -+ const char *name, -+ int pri, -+ int (*callback) (char *word[], char *word_eol[], void *user_data), -+ void *userdata); -+ -+xchat_hook * -+xchat_hook_print (xchat_plugin *ph, -+ const char *name, -+ int pri, -+ int (*callback) (char *word[], void *user_data), -+ void *userdata); -+ -+xchat_hook * -+xchat_hook_timer (xchat_plugin *ph, -+ int timeout, -+ int (*callback) (void *user_data), -+ void *userdata); -+ -+xchat_hook * -+xchat_hook_fd (xchat_plugin *ph, -+ int fd, -+ int flags, -+ int (*callback) (int fd, int flags, void *user_data), -+ void *userdata); -+ -+void * -+xchat_unhook (xchat_plugin *ph, -+ xchat_hook *hook); -+ -+void -+xchat_print (xchat_plugin *ph, -+ const char *text); -+ -+void -+xchat_printf (xchat_plugin *ph, -+ const char *format, ...); -+ -+void -+xchat_command (xchat_plugin *ph, -+ const char *command); -+ -+void -+xchat_commandf (xchat_plugin *ph, -+ const char *format, ...); -+ -+int -+xchat_nickcmp (xchat_plugin *ph, -+ const char *s1, -+ const char *s2); -+ -+int -+xchat_set_context (xchat_plugin *ph, -+ xchat_context *ctx); -+ -+xchat_context * -+xchat_find_context (xchat_plugin *ph, -+ const char *servname, -+ const char *channel); -+ -+xchat_context * -+xchat_get_context (xchat_plugin *ph); -+ -+const char * -+xchat_get_info (xchat_plugin *ph, -+ const char *id); -+ -+int -+xchat_get_prefs (xchat_plugin *ph, -+ const char *name, -+ const char **string, -+ int *integer); -+ -+xchat_list * -+xchat_list_get (xchat_plugin *ph, -+ const char *name); -+ -+void -+xchat_list_free (xchat_plugin *ph, -+ xchat_list *xlist); -+ -+const char * const * -+xchat_list_fields (xchat_plugin *ph, -+ const char *name); -+ -+int -+xchat_list_next (xchat_plugin *ph, -+ xchat_list *xlist); -+ -+const char * -+xchat_list_str (xchat_plugin *ph, -+ xchat_list *xlist, -+ const char *name); -+ -+int -+xchat_list_int (xchat_plugin *ph, -+ xchat_list *xlist, -+ const char *name); -+ -+time_t -+xchat_list_time (xchat_plugin *ph, -+ xchat_list *xlist, -+ const char *name); -+ -+void * -+xchat_plugingui_add (xchat_plugin *ph, -+ const char *filename, -+ const char *name, -+ const char *desc, -+ const char *version, -+ char *reserved); -+ -+void -+xchat_plugingui_remove (xchat_plugin *ph, -+ void *handle); -+ -+int -+xchat_emit_print (xchat_plugin *ph, -+ const char *event_name, ...); -+ -+char * -+xchat_gettext (xchat_plugin *ph, -+ const char *msgid); -+ -+void -+xchat_send_modes (xchat_plugin *ph, -+ const char **targets, -+ int ntargets, -+ int modes_per_line, -+ char sign, -+ char mode); -+ -+char * -+xchat_strip (xchat_plugin *ph, -+ const char *str, -+ int len, -+ int flags); -+ -+void -+xchat_free (xchat_plugin *ph, -+ void *ptr); -+ -+#if !defined(PLUGIN_C) && defined(WIN32) -+#ifndef XCHAT_PLUGIN_HANDLE -+#define XCHAT_PLUGIN_HANDLE (ph) -+#endif -+#define xchat_hook_command ((XCHAT_PLUGIN_HANDLE)->xchat_hook_command) -+#define xchat_hook_server ((XCHAT_PLUGIN_HANDLE)->xchat_hook_server) -+#define xchat_hook_print ((XCHAT_PLUGIN_HANDLE)->xchat_hook_print) -+#define xchat_hook_timer ((XCHAT_PLUGIN_HANDLE)->xchat_hook_timer) -+#define xchat_hook_fd ((XCHAT_PLUGIN_HANDLE)->xchat_hook_fd) -+#define xchat_unhook ((XCHAT_PLUGIN_HANDLE)->xchat_unhook) -+#define xchat_print ((XCHAT_PLUGIN_HANDLE)->xchat_print) -+#define xchat_printf ((XCHAT_PLUGIN_HANDLE)->xchat_printf) -+#define xchat_command ((XCHAT_PLUGIN_HANDLE)->xchat_command) -+#define xchat_commandf ((XCHAT_PLUGIN_HANDLE)->xchat_commandf) -+#define xchat_nickcmp ((XCHAT_PLUGIN_HANDLE)->xchat_nickcmp) -+#define xchat_set_context ((XCHAT_PLUGIN_HANDLE)->xchat_set_context) -+#define xchat_find_context ((XCHAT_PLUGIN_HANDLE)->xchat_find_context) -+#define xchat_get_context ((XCHAT_PLUGIN_HANDLE)->xchat_get_context) -+#define xchat_get_info ((XCHAT_PLUGIN_HANDLE)->xchat_get_info) -+#define xchat_get_prefs ((XCHAT_PLUGIN_HANDLE)->xchat_get_prefs) -+#define xchat_list_get ((XCHAT_PLUGIN_HANDLE)->xchat_list_get) -+#define xchat_list_free ((XCHAT_PLUGIN_HANDLE)->xchat_list_free) -+#define xchat_list_fields ((XCHAT_PLUGIN_HANDLE)->xchat_list_fields) -+#define xchat_list_str ((XCHAT_PLUGIN_HANDLE)->xchat_list_str) -+#define xchat_list_int ((XCHAT_PLUGIN_HANDLE)->xchat_list_int) -+#define xchat_list_time ((XCHAT_PLUGIN_HANDLE)->xchat_list_time) -+#define xchat_list_next ((XCHAT_PLUGIN_HANDLE)->xchat_list_next) -+#define xchat_plugingui_add ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_add) -+#define xchat_plugingui_remove ((XCHAT_PLUGIN_HANDLE)->xchat_plugingui_remove) -+#define xchat_emit_print ((XCHAT_PLUGIN_HANDLE)->xchat_emit_print) -+#define xchat_gettext ((XCHAT_PLUGIN_HANDLE)->xchat_gettext) -+#define xchat_send_modes ((XCHAT_PLUGIN_HANDLE)->xchat_send_modes) -+#define xchat_strip ((XCHAT_PLUGIN_HANDLE)->xchat_strip) -+#define xchat_free ((XCHAT_PLUGIN_HANDLE)->xchat_free) -+#endif -+ -+#ifdef __cplusplus -+} -+#endif -+#endif -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/resource.h xchat-wdk/plugins/xtray/resource.h ---- xchat-wdk.orig/plugins/xtray/resource.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/resource.h 2005-03-22 18:54:44 +0100 -@@ -0,0 +1,47 @@ -+//{{NO_DEPENDENCIES}} -+// Microsoft Visual C++ generated include file. -+// Used by resource.rc -+// -+#define IDD_ALERTS 104 -+#define IDD_EVENTS 105 -+#define IDD_SETTINGS 106 -+#define IDD_ALERT 107 -+#define IDD_PREF 108 -+#define IDD_ABOUT 109 -+#define IDR_TRAY_MENU 110 -+#define ICO_XCHAT 111 -+#define ICO_BANNED 112 -+#define ICO_CHANMSG 113 -+#define ICO_DISCONNECTED 114 -+#define ICO_HIGHLIGHT 115 -+#define ICO_KICKED 116 -+#define ICO_PMSG 117 -+#define ICO_SNOTICE 118 -+#define IDB_SD_LOGO 119 -+#define IDC_PREF_OK 1014 -+#define IDC_PREF_CANCEL 1015 -+#define IDC_PREF_APPLY 1016 -+#define IDC_AWAY_MSG 1017 -+#define IDC_ALERT_TIME 1018 -+#define IDC_TAB_CONTROL 1019 -+#define IDC_ALERT_HOTKEY 1020 -+#define IDC_ALERT_MSG 1021 -+#define IDC_ALERT_HOTKEY_TEXT 1022 -+#define IDC_ALERT_TIME_TEXT 1023 -+#define ACT_EXIT 40001 -+#define ACT_SETTINGS 40002 -+#define ACT_AWAY 40003 -+#define ACT_BACK 40004 -+#define ACT_RESTORE 40005 -+#define IDC_STATIC -1 -+ -+// Next default values for new objects -+// -+#ifdef APSTUDIO_INVOKED -+#ifndef APSTUDIO_READONLY_SYMBOLS -+#define _APS_NEXT_RESOURCE_VALUE 120 -+#define _APS_NEXT_COMMAND_VALUE 40006 -+#define _APS_NEXT_CONTROL_VALUE 1024 -+#define _APS_NEXT_SYMED_VALUE 101 -+#endif -+#endif -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/resource.rc xchat-wdk/plugins/xtray/resource.rc ---- xchat-wdk.orig/plugins/xtray/resource.rc 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/resource.rc 2010-03-30 11:32:11 +0200 -@@ -0,0 +1,318 @@ -+// Microsoft Visual C++ generated resource script. -+// -+#include "resource.h" -+ -+#define APSTUDIO_READONLY_SYMBOLS -+///////////////////////////////////////////////////////////////////////////// -+// -+// Generated from the TEXTINCLUDE 2 resource. -+// -+#define APSTUDIO_HIDDEN_SYMBOLS -+#include "windows.h" -+#undef APSTUDIO_HIDDEN_SYMBOLS -+ -+///////////////////////////////////////////////////////////////////////////// -+#undef APSTUDIO_READONLY_SYMBOLS -+ -+///////////////////////////////////////////////////////////////////////////// -+// English (U.S.) resources -+ -+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -+#ifdef _WIN32 -+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -+#pragma code_page(1252) -+#endif //_WIN32 -+ -+///////////////////////////////////////////////////////////////////////////// -+// -+// Dialog -+// -+ -+IDD_EVENTS DIALOGEX 8, 20, 216, 143 -+STYLE DS_SETFONT | DS_SETFOREGROUND | WS_CHILD -+FONT 8, "Tahoma", 0, 0, 0x0 -+BEGIN -+ GROUPBOX "X-Chat Events",IDC_STATIC,5,5,205,77 -+ CONTROL "Server Notice",9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, -+ 145,32,55,10 -+ CONTROL "Topic Change",3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, -+ 145,18,55,10 -+ CONTROL "Banned",4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,18, -+ 49,10 -+ CONTROL "Kicked",5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,32, -+ 49,10 -+ CONTROL "Killed",8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46, -+ 49,10 -+ CONTROL "Disconnect",10,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16, -+ 60,49,10 -+ CONTROL "Private Message",7,"Button",BS_AUTOCHECKBOX | -+ WS_TABSTOP,70,18,69,10 -+ CONTROL "CTCP",6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,32,69, -+ 10 -+ CONTROL "Invite",2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,46, -+ 69,10 -+ CONTROL "Highlight",1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70, -+ 60,69,10 -+END -+ -+IDD_SETTINGS DIALOGEX 8, 20, 216, 143 -+STYLE DS_SETFONT | WS_CHILD -+FONT 8, "Tahoma", 0, 0, 0x0 -+BEGIN -+ GROUPBOX "Options",IDC_STATIC,5,5,205,135 -+ CONTROL "Auto away on minimize",11,"Button",BS_AUTOCHECKBOX | -+ WS_TABSTOP,16,60,100,10 -+ CONTROL "Minimize X-Chat to the system tray",12,"Button", -+ BS_AUTOCHECKBOX | WS_TABSTOP,16,18,133,10 -+ CONTROL "Minimize to the tray instead of closing",17,"Button", -+ BS_AUTOCHECKBOX | WS_TABSTOP,16,32,174,9 -+ EDITTEXT IDC_AWAY_MSG,33,86,169,50,ES_AUTOHSCROLL -+ LTEXT "Away Msg:",IDC_STATIC,27,72,35,8 -+ CONTROL "Remove X-Chat from the taskbar ( Only show in tray )", -+ 20,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,191,9 -+END -+ -+IDD_ALERT DIALOGEX 0, 0, 151, 28 -+STYLE DS_LOCALEDIT | DS_SETFONT | DS_NOIDLEMSG | DS_CENTER | WS_CAPTION | -+ WS_SYSMENU -+EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_TOOLWINDOW -+CAPTION "Event Name" -+FONT 8, "Tahoma", 0, 0, 0x1 -+BEGIN -+ LTEXT "Event Text",IDC_ALERT_MSG,3,0,147,27 -+END -+ -+IDD_PREF DIALOGEX 0, 0, 233, 190 -+STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | -+ WS_SYSMENU -+CAPTION "X-Tray Preferences" -+FONT 8, "Tahoma", 0, 0, 0x0 -+BEGIN -+ DEFPUSHBUTTON "Ok",IDC_PREF_OK,57,173,50,14 -+ PUSHBUTTON "Cancel",IDC_PREF_CANCEL,115,173,50,14 -+ PUSHBUTTON "Apply",IDC_PREF_APPLY,175,173,50,14 -+ CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",0x0,7,7,218,159 -+END -+ -+IDD_ABOUT DIALOGEX 8, 20, 216, 143 -+STYLE DS_SETFONT | WS_CHILD -+FONT 8, "Tahoma", 0, 0, 0x0 -+BEGIN -+ CONTROL 119,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN | -+ WS_BORDER,3,6,88,81 -+ CTEXT "X-Tray\r\nBy: Michael Hotaling\r\n www.SinisterDevelopments.com", -+ IDC_STATIC,95,33,118,30 -+ LTEXT "Folken\r\nBasket\r\nDonatzsky\r\nDaemon404",IDC_STATIC, -+ 15,103,64,33 -+ GROUPBOX "Special Thanks To:",IDC_STATIC,3,91,89,50 -+ GROUPBOX "Version Information:",IDC_STATIC,101,92,109,49 -+ LTEXT "1.2.3 PR",IDC_STATIC,170,105,33,8,0,WS_EX_RIGHT -+ LTEXT "Compiled On: ",IDC_STATIC,110,116,46,8 -+ LTEXT "11/06/05",IDC_STATIC,174,117,30,8 -+ LTEXT "Version Number:",IDC_STATIC,110,105,54,8 -+END -+ -+IDD_ALERTS DIALOGEX 8, 20, 216, 143 -+STYLE DS_SETFONT | WS_CHILD -+FONT 8, "Tahoma", 0, 0, 0x0 -+BEGIN -+ GROUPBOX "Alerts",IDC_STATIC,5,5,205,117 -+ CONTROL "Only show alerts while minimized",14,"Button", -+ BS_AUTOCHECKBOX | WS_TABSTOP,27,46,117,10 -+ CONTROL "Use tray alerts to notify me about events",13,"Button", -+ BS_AUTOCHECKBOX | WS_TABSTOP,16,32,152,10 -+ CONTROL "Use window instead of balloons",15,"Button", -+ BS_AUTOCHECKBOX | WS_TABSTOP,27,60,141,11 -+ EDITTEXT IDC_ALERT_TIME,137,101,61,12,ES_AUTOHSCROLL | ES_NUMBER, -+ WS_EX_RIGHT -+ LTEXT "Show alert for x seconds:",IDC_ALERT_TIME_TEXT,40,103, -+ 83,9 -+ CONTROL "Alert Hotkey",IDC_ALERT_HOTKEY,"msctls_hotkey32", -+ WS_BORDER | WS_TABSTOP,137,74,61,13 -+ LTEXT "Close all alerts hotkey:",IDC_ALERT_HOTKEY_TEXT,39,75, -+ 76,10 -+ CONTROL "Leave alerts open indefinately",16,"Button", -+ BS_AUTOCHECKBOX | WS_TABSTOP,27,88,115,11 -+ CONTROL "Blink Icon to alert me about events",18,"Button", -+ BS_AUTOCHECKBOX | WS_TABSTOP,16,18,127,10 -+END -+ -+ -+///////////////////////////////////////////////////////////////////////////// -+// -+// DESIGNINFO -+// -+ -+#ifdef APSTUDIO_INVOKED -+GUIDELINES DESIGNINFO -+BEGIN -+ IDD_EVENTS, DIALOG -+ BEGIN -+ BOTTOMMARGIN, 56 -+ END -+ -+ IDD_SETTINGS, DIALOG -+ BEGIN -+ BOTTOMMARGIN, 66 -+ END -+ -+ IDD_ALERT, DIALOG -+ BEGIN -+ RIGHTMARGIN, 150 -+ BOTTOMMARGIN, 26 -+ END -+ -+ IDD_PREF, DIALOG -+ BEGIN -+ LEFTMARGIN, 7 -+ RIGHTMARGIN, 232 -+ TOPMARGIN, 7 -+ BOTTOMMARGIN, 176 -+ END -+ -+ IDD_ABOUT, DIALOG -+ BEGIN -+ LEFTMARGIN, 7 -+ RIGHTMARGIN, 209 -+ TOPMARGIN, 7 -+ BOTTOMMARGIN, 136 -+ END -+ -+ IDD_ALERTS, DIALOG -+ BEGIN -+ LEFTMARGIN, 7 -+ RIGHTMARGIN, 208 -+ TOPMARGIN, 7 -+ BOTTOMMARGIN, 136 -+ END -+END -+#endif // APSTUDIO_INVOKED -+ -+ -+#ifdef APSTUDIO_INVOKED -+///////////////////////////////////////////////////////////////////////////// -+// -+// TEXTINCLUDE -+// -+ -+1 TEXTINCLUDE -+BEGIN -+ "resource.h\0" -+END -+ -+2 TEXTINCLUDE -+BEGIN -+ "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" -+ "#include ""windows.h""\r\n" -+ "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" -+ "\0" -+END -+ -+3 TEXTINCLUDE -+BEGIN -+ "xtray.h\0" -+END -+ -+4 TEXTINCLUDE -+BEGIN -+ "\r\n" -+ "\0" -+END -+ -+#endif // APSTUDIO_INVOKED -+ -+ -+///////////////////////////////////////////////////////////////////////////// -+// -+// Version -+// -+ -+VS_VERSION_INFO VERSIONINFO -+ FILEVERSION 1,2,3,0 -+ PRODUCTVERSION 1,2,3,0 -+ FILEFLAGSMASK 0x3fL -+#ifdef _DEBUG -+ FILEFLAGS 0x1L -+#else -+ FILEFLAGS 0x0L -+#endif -+ FILEOS 0x40004L -+ FILETYPE 0x2L -+ FILESUBTYPE 0x0L -+BEGIN -+ BLOCK "StringFileInfo" -+ BEGIN -+ BLOCK "040904b0" -+ BEGIN -+ VALUE "CompanyName", "SinisterDevelopments" -+ VALUE "FileDescription", "X-Tray" -+ VALUE "FileVersion", "1, 2, 3, 0" -+ VALUE "InternalName", "X-Tray" -+ VALUE "LegalCopyright", "Copyright © 2005" -+ VALUE "OriginalFilename", "X-Tray.dll" -+ VALUE "ProductName", "X-Tray - X-Chat Win32 System Tray Plugin" -+ VALUE "ProductVersion", "1, 2, 3, 0" -+ END -+ END -+ BLOCK "VarFileInfo" -+ BEGIN -+ VALUE "Translation", 0x409, 1200 -+ END -+END -+ -+ -+///////////////////////////////////////////////////////////////////////////// -+// -+// Menu -+// -+ -+IDR_TRAY_MENU MENU -+BEGIN -+ POPUP "TRAY" -+ BEGIN -+ MENUITEM "Restore", ACT_RESTORE -+ MENUITEM SEPARATOR -+ MENUITEM "Away", 65535 -+ MENUITEM "Settings", ACT_SETTINGS -+ MENUITEM SEPARATOR -+ MENUITEM "Exit", ACT_EXIT -+ END -+END -+ -+ -+///////////////////////////////////////////////////////////////////////////// -+// -+// Icon -+// -+ -+// Icon with lowest ID value placed first to ensure application icon -+// remains consistent on all systems. -+ICO_XCHAT ICON "icons\\xchat.ico" -+ICO_BANNED ICON "icons\\banned.ico" -+ICO_CHANMSG ICON "icons\\chan_msg.ico" -+ICO_HIGHLIGHT ICON "icons\\highlight.ico" -+ICO_KICKED ICON "icons\\kicked.ico" -+ICO_PMSG ICON "icons\\priv_msg-1-2-2.ico" -+ICO_SNOTICE ICON "icons\\server_notice.ico" -+ICO_DISCONNECTED ICON "icons\\disconnected.ico" -+ -+///////////////////////////////////////////////////////////////////////////// -+// -+// Bitmap -+// -+ -+IDB_SD_LOGO BITMAP "bitmaps\\sd.bmp" -+#endif // English (U.S.) resources -+///////////////////////////////////////////////////////////////////////////// -+ -+ -+ -+#ifndef APSTUDIO_INVOKED -+///////////////////////////////////////////////////////////////////////////// -+// -+// Generated from the TEXTINCLUDE 3 resource. -+// -+xtray.h -+///////////////////////////////////////////////////////////////////////////// -+#endif // not APSTUDIO_INVOKED -+ -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/sdAlerts.cpp xchat-wdk/plugins/xtray/sdAlerts.cpp ---- xchat-wdk.orig/plugins/xtray/sdAlerts.cpp 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/sdAlerts.cpp 2005-07-16 20:57:08 +0200 -@@ -0,0 +1,109 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include "utility.h" -+#include "resource.h" -+#include "sdAlerts.h" -+ -+int g_iAlerts = 0; -+ -+void sdSystemAlert(HINSTANCE hModule, UINT uiDialog, char *szMsg, char *szName, unsigned int iTime) -+{ -+ TCHAR wszMsg[256]; -+ TCHAR wszName[64]; -+ -+ HWND hDialog; -+ RECT rcWorkArea, rcDlg; -+ int ixPos, iyPos; -+ int iNumPerCol; -+ -+ hDialog = CreateDialog(hModule, MAKEINTRESOURCE(uiDialog), NULL, (DLGPROC)sdAlertProc); -+ -+ SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0); -+ GetWindowRect(hDialog, &rcDlg); -+ -+ iNumPerCol = ((rcWorkArea.bottom - rcWorkArea.top) / (rcDlg.bottom - rcDlg.top)); -+ ixPos = rcWorkArea.right - (rcDlg.right - rcDlg.left) + 1; -+ iyPos = rcWorkArea.bottom - (rcDlg.bottom - rcDlg.top); -+ -+ if((g_iAlerts >= iNumPerCol) && (iNumPerCol > 0)) -+ { -+ ixPos -= ((g_iAlerts / iNumPerCol) * (rcDlg.right - rcDlg.left)); -+ iyPos -= ((g_iAlerts - (iNumPerCol * (g_iAlerts / iNumPerCol))) * (rcDlg.bottom - rcDlg.top)); -+ } -+ else -+ { -+ iyPos -= (g_iAlerts * (rcDlg.bottom - rcDlg.top)); -+ } -+ SetWindowPos(hDialog, HWND_TOPMOST, ixPos, iyPos, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); -+ -+ ConvertString(szName, wszName, 64); -+ ConvertString(szMsg, wszMsg, 256); -+ -+ SetWindowText(hDialog, wszName); -+ SetDlgItemText(hDialog, IDC_ALERT_MSG, wszMsg); -+ ShowWindow(hDialog, SW_SHOWNA); -+ -+ if(iTime > 0) -+ { -+ SetTimer(hDialog, 1, iTime, NULL); -+ } -+ -+ g_iAlerts++; -+} -+ -+void sdCloseAlerts() -+{ -+ PostMessage(HWND_BROADCAST, RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows")), 0, 0); -+} -+ -+LRESULT CALLBACK sdAlertProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -+{ -+ switch(msg) -+ { -+ case WM_CLOSE: -+ if(g_iAlerts > 0){ g_iAlerts--; } -+ DestroyWindow(hwnd); -+ return TRUE; -+ break; -+ case WM_TIMER: -+ if(g_iAlerts > 0){ g_iAlerts--; } -+ AnimateWindow(hwnd, 600, AW_SLIDE | AW_HIDE | AW_VER_POSITIVE); -+ DestroyWindow(hwnd); -+ return TRUE; -+ break; -+ default: -+ if(msg == RegisterWindowMessage(TEXT("xTray:CloseAllAlertWindows"))) -+ { -+ if(g_iAlerts > 0){ g_iAlerts--; } -+ DestroyWindow(hwnd); -+ return TRUE; -+ } -+ break; -+ } -+ -+ return FALSE; -+} -+ -+int sdAlertNum() -+{ -+ return g_iAlerts; -+} -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/sdAlerts.h xchat-wdk/plugins/xtray/sdAlerts.h ---- xchat-wdk.orig/plugins/xtray/sdAlerts.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/sdAlerts.h 2005-05-28 18:38:16 +0200 -@@ -0,0 +1,26 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _H_SDALERTS_H -+#define _H_SDALERTS_H -+ -+void sdSystemAlert (HINSTANCE, UINT, char *, char *, UINT); -+LRESULT CALLBACK sdAlertProc (HWND, UINT, WPARAM, LPARAM); -+int sdAlertNum (); -+void sdCloseAlerts (); -+#endif -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/sdTray.cpp xchat-wdk/plugins/xtray/sdTray.cpp ---- xchat-wdk.orig/plugins/xtray/sdTray.cpp 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/sdTray.cpp 2005-07-16 20:58:58 +0200 -@@ -0,0 +1,207 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+#define _WIN32_IE 0x601 -+#include -+#include -+#include -+#include "sdTray.h" -+#include "utility.h" -+ -+HANDLE hThread; -+iBlink *tData = NULL; -+ -+int AddIcon(HWND hwnd, UINT id, HICON hicon, char *szTip, unsigned short flags, unsigned int cbMsg) -+{ -+ NOTIFYICONDATA nidata; -+ -+ nidata.cbSize = NOTIFYICONDATA_V2_SIZE; -+ nidata.hIcon = hicon; -+ nidata.hWnd = hwnd; -+ nidata.uCallbackMessage = cbMsg; -+ nidata.uFlags = flags; -+ nidata.uID = id; -+ -+ if(szTip != NULL) -+ { -+ TCHAR *szTemp = new TCHAR[64]; -+ -+ ConvertString(szTip, szTemp, 64); -+ _tcsncpy(nidata.szTip, szTemp, 64); -+ -+ delete[] szTemp; -+ } -+ -+ return Shell_NotifyIcon(NIM_ADD, &nidata); -+} -+ -+int RemoveIcon(HWND hwnd, UINT id) -+{ -+ if(hThread != NULL) -+ { -+ TerminateThread(hThread, 0); -+ hThread = NULL; -+ -+ delete tData; -+ } -+ -+ NOTIFYICONDATA nidata; -+ -+ nidata.cbSize = NOTIFYICONDATA_V2_SIZE; -+ nidata.hWnd = hwnd; -+ nidata.uID = id; -+ -+ return Shell_NotifyIcon(NIM_DELETE, &nidata); -+} -+ -+int SetIcon(HWND hwnd, UINT id, HICON hicon) -+{ -+ NOTIFYICONDATA nidata; -+ -+ nidata.cbSize = NOTIFYICONDATA_V2_SIZE; -+ nidata.hWnd = hwnd; -+ nidata.uID = id; -+ nidata.hIcon = hicon; -+ nidata.uFlags = NIF_ICON; -+ -+ return Shell_NotifyIcon(NIM_MODIFY, &nidata); -+} -+ -+int SetTooltip(HWND hwnd, UINT id, char *szTip) -+{ -+ NOTIFYICONDATA nidata; -+ -+ nidata.cbSize = NOTIFYICONDATA_V2_SIZE; -+ nidata.hWnd = hwnd; -+ nidata.uID = id; -+ nidata.uFlags = NIF_TIP; -+ -+ if(szTip != NULL) -+ { -+ TCHAR *szTemp = new TCHAR[64]; -+ ConvertString(szTip, szTemp, 64); -+ _tcsncpy(nidata.szTip, szTemp, 64); -+ delete[] szTemp; -+ } -+ -+ return Shell_NotifyIcon(NIM_MODIFY, &nidata); -+} -+ -+int ShowBalloon(HWND hwnd, UINT id, char *szInfo, char *szTitle, UINT time, UINT infoFlags) -+{ -+ NOTIFYICONDATA nidata; -+ -+ nidata.cbSize = NOTIFYICONDATA_V2_SIZE; -+ nidata.hWnd = hwnd; -+ nidata.uID = id; -+ nidata.uFlags = NIF_INFO; -+ nidata.dwInfoFlags = infoFlags; -+ -+ if(time > 0) -+ nidata.uTimeout = time; -+ else -+ nidata.uTimeout = 500000; -+ -+ if(szInfo != NULL) -+ { -+ TCHAR *szTemp = new TCHAR[255]; -+ -+ ConvertString(szInfo, szTemp, 251); -+ szTemp[250] = 0; -+ -+ if(strlen(szInfo) > 255) -+ { -+ _sntprintf(szTemp, 255, _T("%s..."), szTemp); -+ } -+ _tcsncpy(nidata.szInfo, szTemp, 255); -+ -+ delete[] szTemp; -+ } -+ if(szTitle != NULL) -+ { -+ TCHAR *wszTitle = new TCHAR[64]; -+ ConvertString(szTitle, wszTitle, 64); -+ _tcsncpy(nidata.szInfoTitle, wszTitle, 64); -+ delete[] wszTitle; -+ } -+ -+ return Shell_NotifyIcon(NIM_MODIFY, &nidata); -+} -+ -+ -+DWORD WINAPI BlinkThread(LPVOID lpParam) -+{ -+ NOTIFYICONDATA nidata; -+ -+ nidata.cbSize = NOTIFYICONDATA_V2_SIZE; -+ nidata.hWnd = tData->hwnd; -+ nidata.uID = tData->id; -+ nidata.uFlags = NIF_ICON; -+ -+ for(UINT i = 0; i < tData->num; i++) -+ { -+ nidata.hIcon = tData->hBlink; -+ Shell_NotifyIcon(NIM_MODIFY, &nidata); -+ -+ Sleep(tData->time); -+ -+ nidata.hIcon = tData->hBase; -+ Shell_NotifyIcon(NIM_MODIFY, &nidata); -+ -+ Sleep(tData->time); -+ } -+ -+ delete tData; -+ hThread = NULL; -+ -+ return 0; -+} -+ -+int BlinkIcon(HWND hwnd, UINT id, HICON hBase, HICON hBlink, UINT time, UINT num) -+{ -+ if(hThread != NULL) -+ { -+ StopBlink(hwnd, id, hBase); -+ } -+ -+ DWORD dwThreadID; -+ tData = new iBlink; -+ -+ tData->hwnd = hwnd; -+ tData->id = id; -+ tData->hBase = hBase; -+ tData->hBlink = hBlink; -+ tData->time = time; -+ tData->num = num; -+ -+ hThread = CreateThread(NULL, 0, BlinkThread, tData, 0, &dwThreadID); -+ -+ return 0; -+} -+ -+void StopBlink(HWND hwnd, UINT id, HICON hBase) -+{ -+ if(hThread != NULL) -+ { -+ TerminateThread(hThread, 0); -+ hThread = NULL; -+ -+ delete tData; -+ } -+ -+ SetIcon(hwnd, id, hBase); -+} -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/sdTray.h xchat-wdk/plugins/xtray/sdTray.h ---- xchat-wdk.orig/plugins/xtray/sdTray.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/sdTray.h 2005-05-28 19:37:18 +0200 -@@ -0,0 +1,39 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _H_SDTRAY_H -+#define _H_SDTRAY_H -+ -+int AddIcon (HWND, UINT, HICON, char *, unsigned short, UINT); -+int ShowBalloon (HWND, UINT, char *, char *, UINT, UINT); -+int BlinkIcon (HWND, UINT, HICON, HICON, UINT, UINT); -+int SetTooltip (HWND, UINT, char *); -+int SetIcon (HWND, UINT, HICON); -+void StopBlink (HWND, UINT, HICON); -+int RemoveIcon (HWND, UINT); -+ -+typedef struct IBLINK -+{ -+ HICON hBase; -+ HICON hBlink; -+ HWND hwnd; -+ UINT id; -+ UINT time; -+ UINT num; -+}iBlink; -+#endif -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/utility.cpp xchat-wdk/plugins/xtray/utility.cpp ---- xchat-wdk.orig/plugins/xtray/utility.cpp 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/utility.cpp 2010-03-30 12:39:21 +0200 -@@ -0,0 +1,568 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include "utility.h" -+#include "plugin.h" -+#include "xtray.h" -+#include "callbacks.h" -+#include "resource.h" -+ -+TCHAR BACKUP_INI_FILE[] = _T(".\\plugins\\config\\xTray.ini"); -+struct HOTKEY g_hHotKey; -+ -+void SavePrefs(int iDlg) -+{ -+ /**************************************************************************************************/ -+ /********** allocate space for our string, and then set it to the currently logged on user ********/ -+ /**************************************************************************************************/ -+ DWORD dBuff = 257; -+ TCHAR szUser[257]; -+ -+ GetUserName(szUser, &dBuff); -+ -+ /**************************************************************************************************/ -+ /*********************** Test if the file exists, If it doesn't, Create It ************************/ -+ /**************************************************************************************************/ -+ TCHAR XTRAY_INI_FILE[1024]; -+ -+#ifdef UNICODE -+ char temp[1024]; -+ TCHAR TEMP_INI_FILE[1024]; -+ -+ _snprintf(temp, 1024, "%s\\xtray.ini", xchat_get_info(ph, "xchatdir")); -+ ConvertString(temp, TEMP_INI_FILE, 1024); -+ -+ // ok this one is really ugly -+ // it checks to see if the file exists in two locations -+ // X-Chat default config dir, if that fails it trys xchat\plugins\config -+ // if neither one exists it tries to create it in -+ // X-Chat default config dir, if that fails it trys xchat\plugins\config -+ // In either case it writes \xFF\xFE to the file ( on creation ) -+ // so that we can save unicode away messages WritePrivateProfile doesn't -+ // do this for us, though I think it really should -+ -+ if(FileExists(TEMP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); -+ } -+ else -+ { -+ if(FileExists(BACKUP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -+ } -+ else -+ { -+ HANDLE xTemp; -+ DWORD dwBytesTemp; -+ -+ if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) -+ { -+ if(GetLastError() != ERROR_ALREADY_EXISTS) -+ { -+ WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); -+ } -+ CloseHandle(xTemp); -+ } -+ -+ if(FileExists(TEMP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); -+ } -+ else -+ { -+ HANDLE xBackup; -+ DWORD dwBytesBackup; -+ -+ if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) -+ { -+ if(GetLastError() != ERROR_ALREADY_EXISTS) -+ { -+ WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); -+ } -+ -+ CloseHandle(xBackup); -+ } -+ -+ if(FileExists(BACKUP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -+ } -+ } -+ } -+ } -+ -+#else -+ _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -+#endif -+ -+ WritePrivateProfileInt(szUser, _T("SETTINGS"), g_dwPrefs, XTRAY_INI_FILE); -+ WritePrivateProfileInt(szUser, _T("AOT"), g_iTime, XTRAY_INI_FILE); -+ WritePrivateProfileInt(szUser, _T("KEY"), g_hHotKey.key, XTRAY_INI_FILE); -+ WritePrivateProfileInt(szUser, _T("MOD"), g_hHotKey.mod, XTRAY_INI_FILE); -+ WritePrivateProfileString(szUser, _T("AWAY"), g_szAway, XTRAY_INI_FILE); -+} -+ -+void LoadPrefs() -+{ -+ /**************************************************************************************************/ -+ /*********************** Our Settings Section *****************************************************/ -+ /**************************************************************************************************/ -+ DWORD dBuff = 257; -+ TCHAR szUser[257]; -+ -+ GetUserName(szUser, &dBuff); -+ -+ /**************************************************************************************************/ -+ /*********************** Test if the file exists, If it doesn't, Create It ************************/ -+ /**************************************************************************************************/ -+ TCHAR XTRAY_INI_FILE[1024]; -+ -+#ifdef UNICODE -+ char temp[1024]; -+ TCHAR TEMP_INI_FILE[1024]; -+ -+ _snprintf(temp, 1024, "%s\\xtray.ini", xchat_get_info(ph, "xchatdir")); -+ ConvertString(temp, TEMP_INI_FILE, 1024); -+ -+ if(FileExists(TEMP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); -+ } -+ else -+ { -+ if(FileExists(BACKUP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -+ } -+ else -+ { -+ HANDLE xTemp; -+ DWORD dwBytesTemp; -+ -+ if(xTemp = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) -+ { -+ if(GetLastError() != ERROR_ALREADY_EXISTS) -+ { -+ WriteFile(xTemp, _T("\xFF\xFE"), 4, &dwBytesTemp, NULL); -+ } -+ -+ CloseHandle(xTemp); -+ } -+ -+ if(FileExists(TEMP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, TEMP_INI_FILE); -+ } -+ else -+ { -+ HANDLE xBackup; -+ DWORD dwBytesBackup; -+ -+ if(xBackup = CreateFile(TEMP_INI_FILE, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)) -+ { -+ if(GetLastError() != ERROR_ALREADY_EXISTS) -+ { -+ WriteFile(xBackup, _T("\xFF\xFE"), 4, &dwBytesBackup, NULL); -+ } -+ -+ CloseHandle(xBackup); -+ } -+ -+ if(FileExists(BACKUP_INI_FILE)) -+ { -+ _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -+ } -+ } -+ } -+ } -+ -+#else -+ _tcscpy(XTRAY_INI_FILE, BACKUP_INI_FILE); -+#endif -+ -+ /**************************************************************************************************/ -+ /*************************** Get the value for each of our preferances ****************************/ -+ /**************************************************************************************************/ -+ g_dwPrefs = GetPrivateProfileInt(szUser, _T("SETTINGS"), 0, XTRAY_INI_FILE); -+ -+ // backwards compatability -+ // also allows us to set defaults if its a new installation -+ if(g_dwPrefs == 0) -+ { -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("HILIGHT"), 1, XTRAY_INI_FILE)<<1); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("INVITE"), 1, XTRAY_INI_FILE)<<2); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOPIC"), 1, XTRAY_INI_FILE)<<3); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("BANNED"), 1, XTRAY_INI_FILE)<<4); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KICKED"), 1, XTRAY_INI_FILE)<<5); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("CTCP"), 1, XTRAY_INI_FILE)<<6); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("PMSG"), 1, XTRAY_INI_FILE)<<7); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KILLED"), 1, XTRAY_INI_FILE)<<8); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("NOTICE"), 1, XTRAY_INI_FILE)<<9); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("DISCONNECT"), 1, XTRAY_INI_FILE)<<10); -+ -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AOM"), 0, XTRAY_INI_FILE)<<11); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("TOT"), 1, XTRAY_INI_FILE)<<12); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("AMAE"), 1, XTRAY_INI_FILE)<<13); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("OSBWM"), 0, XTRAY_INI_FILE)<<14); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("UWIOB"), 0, XTRAY_INI_FILE)<<15); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("KAOI"), 0, XTRAY_INI_FILE)<<16); -+ g_dwPrefs |= (GetPrivateProfileInt(szUser, _T("MIOC"), 0, XTRAY_INI_FILE)<<17); -+ } -+ -+ g_hHotKey.key = GetPrivateProfileInt(szUser, _T("KEY"), 84, XTRAY_INI_FILE); -+ g_hHotKey.mod = GetPrivateProfileInt(szUser, _T("MOD"), (MOD_CONTROL | MOD_SHIFT), XTRAY_INI_FILE); -+ g_iTime = GetPrivateProfileInt(szUser, _T("AOT"), 5, XTRAY_INI_FILE); -+ -+ GetPrivateProfileString(szUser, _T("AWAY"), _T(""), g_szAway, 1024, XTRAY_INI_FILE); -+ -+ /**************************************************************************************************/ -+ /******************************** Register our hotkey with windows ********************************/ -+ /**************************************************************************************************/ -+ if(g_dwPrefs & (1< -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _H_UTILITY_H -+#define _H_UTILITY_H -+ -+int SetOption (HWND, unsigned int, unsigned int); -+int SetCheck (HWND, unsigned int, unsigned int); -+int SetToggle (HWND, unsigned int, unsigned int, bool); -+void ErrorDebug (LPTSTR lpszFunction); -+void SetDialog (HWND, int); -+void CheckPrefs (HWND, int); -+bool FileExists (TCHAR *); -+DWORD WINAPI HoldCloseThread (LPVOID); -+void SavePrefs (int); -+void LoadPrefs (); -+void HoldClose (); -+ -+void ConvertString(const char *in, wchar_t *out, int size); -+void ConvertString(const wchar_t *in, char *out, int size); -+void ConvertString(const char *in, char *out, int size); -+ -+int WritePrivateProfileIntA(char *, char *, int, char *); -+int WritePrivateProfileIntW(wchar_t *, wchar_t *, int, wchar_t *); -+ -+#ifdef UNICODE -+#define WritePrivateProfileInt WritePrivateProfileIntW -+#else -+#define WritePrivateProfileInt WritePrivateProfileIntA -+#endif -+ -+struct HOTKEY -+{ -+ WORD key; -+ WORD mod; -+}; -+#endif -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/xchat.cpp xchat-wdk/plugins/xtray/xchat.cpp ---- xchat-wdk.orig/plugins/xtray/xchat.cpp 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/xchat.cpp 2005-10-24 19:35:18 +0200 -@@ -0,0 +1,319 @@ -+/* X-Tray -+ * Copyright (C) 1998, 2005 Peter Zelezny, Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include "plugin.h" -+#include "xtray.h" -+#include "resource.h" -+#include "xchat.h" -+#include "utility.h" -+ -+// from util.c of xchat source code ( slightly modified to fit X-Tray Syntax ) -+char *xchat_strip_color (char *text) -+{ -+ int nc = 0; -+ int i = 0; -+ int col = 0; -+ int len = strlen(text); -+ char *new_str = (char *)malloc(len + 2); -+ -+ while (len > 0) -+ { -+ if ((col && isdigit(*text) && (nc < 2)) || (col && isdigit(*(text+1)) && (nc < 3) && (*text == ','))) -+ { -+ nc++; -+ -+ if(*text == ',') -+ { -+ nc = 0; -+ } -+ } -+ else -+ { -+ col = 0; -+ -+ switch (*text) -+ { -+ case '\003': /*ATTR_COLOR: */ -+ { -+ col = 1; -+ nc = 0; -+ } -+ break; -+ case '\007': /*ATTR_BEEP: */ -+ case '\017': /*ATTR_RESET: */ -+ case '\026': /*ATTR_REVERSE: */ -+ case '\002': /*ATTR_BOLD: */ -+ case '\037': /*ATTR_UNDERLINE: */ -+ break; -+ default: -+ { -+ new_str[i] = *text; -+ i++; -+ } -+ break; -+ } -+ } -+ -+ text++; -+ len--; -+ } -+ -+ new_str[i] = 0; -+ -+ return new_str; -+} -+ -+void check_special_chars (char *cmd) -+{ -+ int occur = 0; -+ int len = strlen (cmd); -+ int i = 0, j = 0; -+ char *buf; -+ -+ if (!len) -+ return; -+ -+ buf = (char *)malloc (len + 1); -+ -+ if (buf) -+ { -+ while (cmd[j]) -+ { -+ switch (cmd[j]) -+ { -+ case '%': -+ { -+ occur++; -+ -+ switch (cmd[j + 1]) -+ { -+ case 'R': -+ buf[i] = '\026'; -+ break; -+ case 'U': -+ buf[i] = '\037'; -+ break; -+ case 'B': -+ buf[i] = '\002'; -+ break; -+ case 'C': -+ buf[i] = '\003'; -+ break; -+ case 'O': -+ buf[i] = '\017'; -+ break; -+ case '%': -+ buf[i] = '%'; -+ break; -+ default: -+ buf[i] = '%'; -+ j--; -+ break; -+ } -+ -+ j++; -+ } -+ break; -+ default: -+ { -+ buf[i] = cmd[j]; -+ } -+ break; -+ } -+ -+ j++; -+ i++; -+ } -+ -+ buf[i] = 0; -+ -+ if (occur) -+ strcpy (cmd, buf); -+ -+ free (buf); -+ } -+} -+ -+void xchat_globally_away(TCHAR *tszAway) -+{ -+ char szTemp[512]; -+ char szAway[512]; -+ -+ ConvertString(tszAway, szAway, 512); -+ _snprintf(szTemp, 512, "ALLSERV AWAY %s\0", szAway); -+ check_special_chars(szTemp); -+ xchat_exec(szTemp); -+} -+ -+void xchat_away(TCHAR *tszAway) -+{ -+ char szTemp[512]; -+ char szAway[512]; -+ -+ ConvertString(tszAway, szAway, 512); -+ _snprintf(szTemp, 512, szAway); -+ check_special_chars(szTemp); -+ xchat_commandf(ph, "AWAY %s\0", szTemp); -+} -+ -+void xchat_globally_back() -+{ -+ std::vector xs; -+ std::vector::iterator xsi; -+ xchat_list *xl = xchat_list_get(ph, "channels"); -+ -+ if(xl) -+ { -+ while(xchat_list_next(ph, xl)) -+ { -+ xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); -+ -+ if((xsi == xs.end()) && -+ ((strlen(xchat_list_str(ph, xl, "server")) > 0) || -+ (strlen(xchat_list_str(ph, xl, "channel")) > 0))) -+ { -+ xs.push_back(xchat_list_int(ph, xl, "id")); -+ xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); -+ xchat_back(); -+ } -+ } -+ -+ xchat_list_free(ph, xl); -+ } -+} -+ -+ -+ -+void xchat_back() -+{ -+ if(xchat_get_info(ph, "away")) -+ { -+ xchat_command(ph, "BACK"); -+ } -+} -+ -+HMENU setServerMenu() -+{ -+ HMENU sTemp = CreateMenu(); -+ TCHAR wszServer[128]; -+ TCHAR wszNick[128]; -+ TCHAR wszMenuEntry[256]; -+ -+ std::vector xs; -+ std::vector::iterator xsi; -+ xchat_list *xl = xchat_list_get(ph, "channels"); -+ -+ AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away")); -+ AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back")); -+ AppendMenu(sTemp, MF_SEPARATOR, 0, NULL); -+ -+ if(xl) -+ { -+ while(xchat_list_next(ph, xl)) -+ { -+ xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id")); -+ -+ if( (xsi == xs.end()) && -+ ((strlen(xchat_list_str(ph, xl, "server")) > 0) || -+ (strlen(xchat_list_str(ph, xl, "channel")) > 0))) -+ { -+ xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context")); -+ xs.push_back(xchat_list_int(ph, xl, "id")); -+ -+ char *network = _strdup(xchat_list_str(ph, xl, "network")); -+ char *server = _strdup(xchat_list_str(ph, xl, "server")); -+ char *nick = _strdup(xchat_get_info(ph, "nick")); -+ -+ if(network != NULL) -+ { -+ ConvertString(network, wszServer, 128); -+ } -+ else -+ { -+ ConvertString(server, wszServer, 128); -+ } -+ -+ if(server != NULL) -+ { -+ ConvertString(nick, wszNick, 128); -+ _sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer); -+ -+ if(!xchat_get_info(ph, "away")) -+ { -+ AppendMenu(sTemp, MF_STRING, (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); -+ } -+ else -+ { -+ AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry); -+ } -+ } -+ -+ free(network); -+ free(server); -+ free(nick); -+ } -+ } -+ -+ xchat_list_free(ph, xl); -+ } -+ -+ return sTemp; -+} -+ -+struct _xchat_context *xchat_find_server(int find_id) -+{ -+ xchat_context *xc; -+ xchat_list *xl = xchat_list_get(ph, "channels"); -+ int id; -+ -+ if(!xl) -+ return NULL; -+ -+ while(xchat_list_next(ph, xl)) -+ { -+ id = xchat_list_int(ph, xl, "id"); -+ -+ if(id == -1) -+ { -+ return NULL; -+ } -+ else if(id == find_id) -+ { -+ xc = (xchat_context *)xchat_list_str(ph, xl, "context"); -+ -+ xchat_list_free(ph, xl); -+ -+ return xc; -+ } -+ } -+ -+ xchat_list_free(ph, xl); -+ -+ return NULL; -+} -+ -+void xchat_exec(char *command) -+{ -+ xchat_set_context(ph, xchat_find_context(ph, NULL, NULL)); -+ xchat_command(ph, command); -+} -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/xchat.h xchat-wdk/plugins/xtray/xchat.h ---- xchat-wdk.orig/plugins/xtray/xchat.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/xchat.h 2005-10-24 19:36:42 +0200 -@@ -0,0 +1,32 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _H_XCHAT_H -+#define _H_XCHAT_H -+ -+void xchat_exec (char *); -+char *xchat_strip_color (char *); -+void xchat_parse (char *); -+struct _xchat_context *xchat_find_server (int); -+void xchat_globally_away (TCHAR *); -+void xchat_away (TCHAR *); -+void xchat_globally_back (); -+void xchat_back (); -+HMENU setServerMenu (); -+ -+#endif -\ No newline at end of file -diff -ruN --strip-trailing-cr xchat-wdk.orig/plugins/xtray/xtray.cpp xchat-wdk/plugins/xtray/xtray.cpp ---- xchat-wdk.orig/plugins/xtray/xtray.cpp 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/plugins/xtray/xtray.cpp 2010-03-30 12:41:58 +0200 -@@ -0,0 +1,226 @@ -+/* X-Tray -+ * Copyright (C) 2005 Michael Hotaling -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#define _WIN32_IE 0x0601 -+ -+#include -+#include -+#include -+#include -+#include "resource.h" -+#include "callbacks.h" -+#include "plugin.h" -+#include "utility.h" -+#include "xtray.h" -+#include "sdTray.h" -+#include "sdAlerts.h" -+#include "plugin.h" -+ -+/*****************************************************/ -+/**** Don't want to pollute the namespace do we? *****/ -+/*****************************************************/ -+std::list g_vHooks; -+ -+/*****************************************************/ -+/************ Global Identifiers *********************/ -+/*****************************************************/ -+WNDPROC g_hOldProc; -+xchat_plugin *ph; -+ -+/*****************************************************/ -+/***************** Resources *************************/ -+/*****************************************************/ -+HWND g_hXchatWnd; -+HWND g_hHotkeyWnd; -+HWND g_hPrefDlg; -+HMENU g_hTrayMenu; -+HICON g_hIcons[11]; -+HANDLE g_hInstance; -+/*****************************************************/ -+/***************** Preferences ***********************/ -+/*****************************************************/ -+unsigned int g_dwPrefs; -+TCHAR g_szAway[512]; -+int g_iTime; -+ -+ -+BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpVoid) -+{ -+ if((fdwReason == DLL_PROCESS_ATTACH) || (fdwReason == DLL_THREAD_ATTACH)) -+ { -+ g_hInstance = hModule; -+ } -+ -+ return TRUE; -+} -+ -+int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) -+{ -+ ph = plugin_handle; -+ -+ *plugin_name = "X-Tray"; -+ *plugin_desc = "Minimize X-Chat to the windows systemtray"; -+ *plugin_version = "1.2.3 PR"; -+ -+ /***************************************************************************************************************************/ -+ /************************* Load our preferances from xTray.ini *************************************************************/ -+ /***************************************************************************************************************************/ -+ LoadPrefs(); -+ -+ /***************************************************************************************************************************/ -+ /************************* Finds the xChat window and saves it for later use ***********************************************/ -+ /***************************************************************************************************************************/ -+ g_hXchatWnd = (HWND)xchat_get_info(ph, "win_ptr"); -+ -+ if(g_hXchatWnd == NULL) -+ { -+ EnumThreadWindows(GetCurrentThreadId(), EnumWindowsProc, 0); -+ } -+ -+ g_hOldProc = (WNDPROC)GetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC); -+ SetWindowLong(g_hXchatWnd, GWLP_WNDPROC, (long)WindowProc); -+ -+ /***************************************************************************************************************************/ -+ /************************* Grab the xChat Icon, Load our menu, create the window to receive the hotkey messages ***********/ -+ /************************* and register the windows message so we know if explorer crashes ***********/ -+ /***************************************************************************************************************************/ -+ g_hTrayMenu = GetSubMenu(LoadMenu((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDR_TRAY_MENU)), 0); -+ g_hHotkeyWnd = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ALERT), NULL, (DLGPROC)HotKeyProc); -+ g_hPrefDlg = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_PREF), g_hXchatWnd, (DLGPROC)PrefProc); -+ -+ g_hIcons[0] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_XCHAT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ g_hIcons[1] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_CHANMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ g_hIcons[2] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_HIGHLIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ g_hIcons[5] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_BANNED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ g_hIcons[6] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_KICKED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ g_hIcons[8] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_PMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ g_hIcons[10]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_SNOTICE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ g_hIcons[11]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_DISCONNECTED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); -+ -+ /***************************************************************************************************************************/ -+ /************************* Add our icon to the tray ************************************************************************/ -+ /***************************************************************************************************************************/ -+ char szVersion[64]; -+ _snprintf(szVersion, 64, "X-Chat [%s]", xchat_get_info(ph, "version")); -+ AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG); -+ -+ /***************************************************************************************************************************/ -+ /***************************************************************************************************************************/ -+ /***************************************************************************************************************************/ -+ if(g_dwPrefs & (1< -+ * -+ * X-Tray is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * X-Tray is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with X-Tray; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ */ -+ -+#ifndef _XTRAY_H -+#define _XTRAY_H -+ -+/******************** Globals *************************/ -+extern HWND g_hXchatWnd; -+extern HWND g_hHotkeyWnd; -+extern HWND g_hPrefDlg; -+extern HMENU g_hTrayMenu; -+extern HICON g_hIcons[11]; -+extern HANDLE g_hInstance; -+extern unsigned int g_dwPrefs; -+extern TCHAR g_szAway[512]; -+extern int g_iTime; -+extern WNDPROC g_hOldProc; -+extern struct _xchat_plugin *ph; -+/******************************************************/ -+ -+/******************** Messages ************************/ -+#define WM_TRAYMSG WM_APP -+/******************************************************/ -+ -+/********************* Events *************************/ -+#define CHAN_HILIGHT 1 -+#define CHAN_INVITE 2 -+#define CHAN_TOPIC_CHANGE 3 -+#define CHAN_BANNED 4 -+#define CHAN_KICKED 5 -+ -+#define CTCP_GENERIC 6 -+#define PMSG_RECEIVE 7 -+ -+#define SERV_KILLED 8 -+#define SERV_NOTICE 9 -+#define SERV_DISCONNECT 10 -+ -+#define PREF_AOM 11 // away on minimize -+#define PREF_TOT 12 // Tray on Taskbar -+#define PREF_AMAE 13 // alert me about events -+#define PREF_OSBWM 14 // Only Show Balloon When Minimized -+#define PREF_UWIOB 15 // Use Window Instead of Balloon -+#define PREF_KAOI 16 // Keep alerts open indefinately -+#define PREF_MIOC 17 // Minimize instead of close -+#define PREF_BLINK 18 // blink icon -+#define PREF_CICO 19 // change icon - not implemented -+#define PREF_DNSIT 20 // Do not show in taskbar -+/******************************************************/ -+#endif 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 2009-01-02 06:56:12 +0100 +++ xchat-wdk/src/common/cfgfiles.c 2010-03-29 12:57:41 +0200 @@ -5035,240 +119,6 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/dcc.c xchat-wdk/src/comm #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/dirent.h xchat-wdk/src/common/dirent.h ---- xchat-wdk.orig/src/common/dirent.h 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/src/common/dirent.h 2009-12-15 23:10:54 +0100 -@@ -0,0 +1,230 @@ -+/***************************************************************************** -+ * 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 -+ -+#include -+#include -+#include -+ -+ -+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 */ -+ int cached; /* Indicates un-processed entry in memory */ -+ HANDLE search_handle; /* File search handle */ -+ 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; -+} -+ -+ -+#endif /*DIRENT_H*/ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/identd.c xchat-wdk/src/common/identd.c --- xchat-wdk.orig/src/common/identd.c 2004-05-24 15:47:58 +0200 +++ xchat-wdk/src/common/identd.c 2010-03-29 18:04:55 +0200 @@ -5333,23 +183,6 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/inet.h xchat-wdk/src/com #endif #define set_blocking(sok) { \ -diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/makefile.mak xchat-wdk/src/common/makefile.mak ---- xchat-wdk.orig/src/common/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/src/common/makefile.mak 2010-03-31 08:00:55 +0200 -@@ -0,0 +1,13 @@ -+include "..\makeinc.mak" -+ -+all: $(COMMON_OBJECTS) xchatcommon.lib -+ -+xchatcommon.lib: $(COMMON_OBJECTS) -+ lib -out:xchatcommon.lib $(COMMON_OBJECTS) -+ -+.c.obj: -+ $(CC) $(CFLAGS) $(GLIB) $< -+ -+clean: -+ del *.obj -+ del xchatcommon.lib 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-03-29 12:58:13 +0200 @@ -5798,47 +631,6 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/maingui.c xchat-wdk/src/ button = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (button); -diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/makefile.mak xchat-wdk/src/fe-gtk/makefile.mak ---- xchat-wdk.orig/src/fe-gtk/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/src/fe-gtk/makefile.mak 2010-03-31 08:11:21 +0200 -@@ -0,0 +1,37 @@ -+include "..\makeinc.mak" -+ -+!ifdef X64 -+MACHINE_FLAG = /MACHINE:X64 -+!else -+MACHINE_FLAG = /MACHINE:X86 -+!endif -+ -+COMLIB = ..\common\xchatcommon.lib -+PROG = xchat.exe -+ -+all: $(PROG) -+ -+mmx_cmod.o: mmx_cmod.S -+ gcc -DUNDERSCORE_SYMBOLS -c mmx_cmod.S -+ -+.c.obj: -+ $(CC) $(CFLAGS) $(GLIB) $(GTK) $< -+ -+$(PROG): $(FEGTK_OBJECTS) $(COMLIB) xchat-icon.obj -+ $(LINK) /out:$(PROG) /ENTRY:mainCRTStartup $(LDFLAGS) $(LIBS) $(FEGTK_OBJECTS) $(COMLIB) xchat-icon.obj -+ @dir $(PROG) -+ -+xchat.rc: -+ echo XC_ICON ICON "../../xchat.ico" > xchat.rc -+ -+xchat.res: xchat.rc ../../xchat.ico -+ rc /r xchat.rc -+ -+xchat-icon.obj: xchat.res -+ cvtres /NOLOGO $(MACHINE_FLAG) /OUT:xchat-icon.obj xchat.res -+ -+clean: -+ del *.obj -+ del $(PROG) -+ del xchat.rc -+ del xchat.RES 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 2008-06-10 14:05:00 +0200 +++ xchat-wdk/src/fe-gtk/menu.c 2010-03-29 13:00:13 +0200 @@ -5935,176 +727,3 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/xtext.c xchat-wdk/src/fe #include #include #include -diff -ruN --strip-trailing-cr xchat-wdk.orig/src/makefile.mak xchat-wdk/src/makefile.mak ---- xchat-wdk.orig/src/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/src/makefile.mak 2010-03-31 07:54:25 +0200 -@@ -0,0 +1,18 @@ -+all: -+ copy ..\plugins\xchat-plugin.h common -+ @cd pixmaps -+ @-$(MAKE) -f makefile.mak $@ -+ @cd ..\common -+ @-$(MAKE) -f makefile.mak $@ -+ @cd ..\fe-gtk -+ @-$(MAKE) -f makefile.mak $@ -+ -+clean: -+ del common\*.obj -+ del common\xchatcommon.lib -+ del fe-gtk\*.obj -+ del fe-gtk\mmx_cmod.o -+ del fe-gtk\xchat.exe -+ del fe-gtk\xchat.rc -+ del fe-gtk\xchat.RES -+ del pixmaps\*.h -diff -ruN --strip-trailing-cr xchat-wdk.orig/src/makeinc.mak xchat-wdk/src/makeinc.mak ---- xchat-wdk.orig/src/makeinc.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/src/makeinc.mak 2010-03-31 12:03:41 +0200 -@@ -0,0 +1,125 @@ -+#uncomment this to have an x64 build -+#X64 = YES -+#OPENSSL = YES -+IPV6 = YES -+ -+CC = cl -+LINK = link -+CFLAGS = $(CFLAGS) /Ox /c /MD /nologo /DWIN32 /DG_DISABLE_CAST_CHECKS /Dstrcasecmp=stricmp /Dstrncasecmp=strnicmp /Dstrtoull=_strtoui64 -+CPPFLAGS = /c /MD /nologo /DWIN32 -+LDFLAGS = /subsystem:windows /nologo -+LIBS = $(LIBS) gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.lib winmm.lib -+!ifdef X64 -+############################################################# -+#x64 config -+GLIB = -Ic:/mozilla-build/build/xchat-dev64/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/glib-2.0/include -+GTK = -Ic:/mozilla-build/build/xchat-dev64/include/gtk-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/gtk-2.0/include -Ic:/mozilla-build/build/xchat-dev64/include/atk-1.0 -Ic:/mozilla-build/build/xchat-dev64/include/cairo -Ic:/mozilla-build/build/xchat-dev64/include/pango-1.0 -Ic:/mozilla-build/build/xchat-dev64/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev64/lib/glib-2.0/include -Ic:/mozilla-build/build/xchat-dev64/include/freetype2 -Ic:/mozilla-build/build/xchat-dev64/include -Ic:/mozilla-build/build/xchat-dev64/include/libpng14 -+LIBS = $(LIBS) /libpath:c:/mozilla-build/build/xchat-dev64/lib gtk-win32-2.0.lib gdk-win32-2.0.lib atk-1.0.lib gio-2.0.lib gdk_pixbuf-2.0.lib pangowin32-1.0.lib gdi32.lib pangocairo-1.0.lib pango-1.0.lib cairo.lib gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib intl.lib -+ -+CFLAGS = $(CFLAGS) /favor:AMD64 -+CPPFLAGS = $(CPPFLAGS) /favor:AMD64 /D_WIN64 -+LDFLAGS = $(LDFLAGS) msvcrt_win2003.obj -+ -+PERLPATH = c:\mozilla-build\perl-5.10-x64\lib\CORE -+PYTHONPATH = c:\mozilla-build\python-2.6-x64 -+TCLPATH = c:\mozilla-build\tcl-8.6-x64 -+!else -+############################################################# -+#x86 config -+GLIB = -Ic:/mozilla-build/build/xchat-dev32/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/glib-2.0/include -+GTK = -Ic:/mozilla-build/build/xchat-dev32/include/gtk-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/gtk-2.0/include -Ic:/mozilla-build/build/xchat-dev32/include/atk-1.0 -Ic:/mozilla-build/build/xchat-dev32/include/cairo -Ic:/mozilla-build/build/xchat-dev32/include/pango-1.0 -Ic:/mozilla-build/build/xchat-dev32/include/glib-2.0 -Ic:/mozilla-build/build/xchat-dev32/lib/glib-2.0/include -Ic:/mozilla-build/build/xchat-dev32/include/freetype2 -Ic:/mozilla-build/build/xchat-dev32/include -Ic:/mozilla-build/build/xchat-dev32/include/libpng14 -+LIBS = $(LIBS) /libpath:c:/mozilla-build/build/xchat-dev32/lib gtk-win32-2.0.lib gdk-win32-2.0.lib atk-1.0.lib gio-2.0.lib gdk_pixbuf-2.0.lib pangowin32-1.0.lib gdi32.lib pangocairo-1.0.lib pango-1.0.lib cairo.lib gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib intl.lib -+ -+LDFLAGS = $(LDFLAGS) msvcrt_winxp.obj -+ -+PERLPATH = c:\mozilla-build\perl-5.10-x86\lib\CORE -+PYTHONPATH = c:\mozilla-build\python-2.6-x86 -+TCLPATH = c:\mozilla-build\tcl-8.6-x86 -+ -+MMX = YES -+!endif -+############################################################# -+ -+PERLLIB = perl510 -+PERLOUTPUT = xcperl.dll -+ -+PYTHONLIB = python26 -+PYTHONOUTPUT = xcpython.dll -+ -+TCLLIB = tcl86 -+TCLOUTPUT = xctcl.dll -+ -+!ifdef IPV6 -+CFLAGS = $(CFLAGS) -DUSE_IPV6 -+LIBS = $(LIBS) ws2_32.lib -+!else -+LIBS = $(LIBS) wsock32.lib -+!endif -+ -+!ifdef OPENSSL -+CFLAGS = $(CFLAGS) /DUSE_OPENSSL -+LIBS = $(LIBS) libeay32.lib ssleay32.lib -+SSLOBJ = ssl.obj -+!endif -+ -+COMMON_OBJECTS = \ -+cfgfiles.obj \ -+chanopt.obj \ -+ctcp.obj \ -+dcc.obj \ -+history.obj \ -+identd.obj \ -+ignore.obj \ -+inbound.obj \ -+modes.obj \ -+network.obj \ -+notify.obj \ -+outbound.obj \ -+plugin.obj \ -+plugin-timer.obj \ -+proto-irc.obj \ -+server.obj \ -+servlist.obj \ -+$(SSLOBJ) \ -+text.obj \ -+tree.obj \ -+url.obj \ -+userlist.obj \ -+util.obj \ -+xchat.obj -+ -+FEGTK_OBJECTS = \ -+about.obj \ -+ascii.obj \ -+banlist.obj \ -+chanlist.obj \ -+chanview.obj \ -+custom-list.obj \ -+dccgui.obj \ -+editlist.obj \ -+fe-gtk.obj \ -+fkeys.obj \ -+gtkutil.obj \ -+ignoregui.obj \ -+joind.obj \ -+maingui.obj \ -+menu.obj \ -+notifygui.obj \ -+palette.obj \ -+pixmaps.obj \ -+plugingui.obj \ -+plugin-tray.obj \ -+rawlog.obj \ -+search.obj \ -+servlistgui.obj \ -+setup.obj \ -+sexy-spell-entry.obj \ -+textgui.obj \ -+urlgrab.obj \ -+userlistgui.obj \ -+xtext.obj -+ -+!ifdef MMX -+FEGTK_OBJECTS = $(FEGTK_OBJECTS) mmx_cmod.o -+CFLAGS = $(CFLAGS) -DUSE_MMX -+!endif -diff -ruN --strip-trailing-cr xchat-wdk.orig/src/pixmaps/makefile.mak xchat-wdk/src/pixmaps/makefile.mak ---- xchat-wdk.orig/src/pixmaps/makefile.mak 1970-01-01 01:00:00 +0100 -+++ xchat-wdk/src/pixmaps/makefile.mak 2010-03-29 13:15:26 +0200 -@@ -0,0 +1,18 @@ -+CONV = gdk-pixbuf-csource -+ -+LIST = bookpng book.png \ -+ hoppng hop.png \ -+ oppng op.png \ -+ purplepng purple.png \ -+ redpng red.png \ -+ trayfilepng fileoffer.png \ -+ trayhilightpng highlight.png \ -+ traymsgpng message.png \ -+ voicepng voice.png \ -+ xchatpng ..\..\xchat.png -+ -+all: -+ $(CONV) --build-list $(LIST) > inline_pngs.h -+ -+clean: -+ del *.h