From b2ba474f06268afaff76b409ba5790b7db9bbbed Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Mon, 30 Aug 2010 10:08:17 +0200 Subject: [PATCH] preliminary update checker --- src/fe-gtk/check-version.c | 36 +++++++++++++++++++ src/fe-gtk/check-version.h | 1 + src/makeinc.skel | 3 +- xchat-wdk.patch | 73 ++++++++++++++++++++++++++------------ 4 files changed, 89 insertions(+), 24 deletions(-) create mode 100644 src/fe-gtk/check-version.c create mode 100644 src/fe-gtk/check-version.h diff --git a/src/fe-gtk/check-version.c b/src/fe-gtk/check-version.c new file mode 100644 index 00000000..504b2316 --- /dev/null +++ b/src/fe-gtk/check-version.c @@ -0,0 +1,36 @@ +#include +#include + +char* check_version () +{ + HINTERNET hINet, hFile; + hINet = InternetOpen("XChat-WDK Update Checker", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 ); + + if (!hINet) + { + return "error"; + } + + hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/hg/version.txt", NULL, 0, 0, 0); + + if (hFile) + { + static char buffer[1024]; + DWORD dwRead; + while (InternetReadFile(hFile, buffer, 1023, &dwRead)) + { + if (dwRead == 0) + { + break; + } + buffer[dwRead] = 0; + } + + return buffer; + InternetCloseHandle (hFile); + } + + InternetCloseHandle (hINet); + + return "error"; +} diff --git a/src/fe-gtk/check-version.h b/src/fe-gtk/check-version.h new file mode 100644 index 00000000..3c4f1e71 --- /dev/null +++ b/src/fe-gtk/check-version.h @@ -0,0 +1 @@ +char* check_version (); diff --git a/src/makeinc.skel b/src/makeinc.skel index 0c53bf36..95e92b2e 100644 --- a/src/makeinc.skel +++ b/src/makeinc.skel @@ -4,7 +4,7 @@ CFLAGS = $(CFLAGS) /Ox /c /MD /MP2 /W0 /nologo /DWIN32 /DG_DISABLE_CAST_CHECKS / CFLAGS = $(CFLAGS) -Ic:\mozilla-build\build\xchat-wdk\plugins CPPFLAGS = /c /MD /W0 /nologo /DWIN32 LDFLAGS = /subsystem:windows /nologo -LIBS = $(LIBS) gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.lib winmm.lib ws2_32.lib +LIBS = $(LIBS) gdi32.lib shell32.lib user32.lib advapi32.lib imm32.lib ole32.lib winmm.lib ws2_32.lib wininet.lib !ifdef X64 ############################################################# @@ -89,6 +89,7 @@ ascii.obj \ banlist.obj \ chanlist.obj \ chanview.obj \ +check-version.obj \ custom-list.obj \ dccgui.obj \ editlist.obj \ diff --git a/xchat-wdk.patch b/xchat-wdk.patch index e912b5ec..0c250bd4 100644 --- a/xchat-wdk.patch +++ b/xchat-wdk.patch @@ -655,47 +655,74 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/xchat.h xchat-wdk/src/co #define X_OK 1 diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/about.c xchat-wdk/src/fe-gtk/about.c --- xchat-wdk.orig/src/fe-gtk/about.c 2010-05-16 09:43:49 +0200 -+++ xchat-wdk/src/fe-gtk/about.c 2010-08-26 15:53:53 +0200 -@@ -39,6 +39,7 @@ ++++ xchat-wdk/src/fe-gtk/about.c 2010-08-30 10:02:36 +0200 +@@ -39,6 +39,8 @@ #include "../common/xchat.h" #include "../common/util.h" +#include "../common/portable.h" ++#include "check-version.h" #include "palette.h" #include "pixmaps.h" #include "gtkutil.h" -@@ -117,7 +118,7 @@ - "%s\n\n" +@@ -114,35 +116,41 @@ + g_get_charset (&locale); + (snprintf) (buf, sizeof (buf), + ""DISPLAY_NAME" "PACKAGE_VERSION"\n\n" +- "%s\n\n" #ifdef WIN32 ++ "Latest Version: r%s\n\n" /* leave this message to avoid time wasting bug reports! */ - "This version is unofficial and comes with no support.\n\n" +-#endif + "This version is unofficial and\ncomes with no support.\n\n" - #endif "%s\n" "Charset: %s " -@@ -126,7 +127,11 @@ - #else - "Renderer: %s\n" - #endif -- "Compiled: "__DATE__"\n\n" +-#ifdef WIN32 + "GTK+: %i.%i.%i\n" + "Compiled: "__DATE__"\n" -+#ifdef WIN32 + "Portable Mode: %s\n\n" + "XChat Base: 2.8.8\n\n" -+#endif - "\302\251 1998-2010 Peter \305\275elezn\303\275 <zed@xchat.org>", - _("A multiplatform IRC Client"), - get_cpu_str(), -@@ -134,7 +139,8 @@ - #ifdef WIN32 - gtk_major_version, - gtk_minor_version, -- gtk_micro_version -+ gtk_micro_version, -+ (portable_mode() ? "Yes" : "No") ++ "\302\251 1998-2010 Peter \305\275elezn\303\275 <zed@xchat.org>", ++ check_version(), ++ get_cpu_str(), ++ locale, ++ gtk_major_version, ++ gtk_minor_version, ++ gtk_micro_version, ++ (portable_mode() ? "Yes" : "No") #else ++ "%s\n\n" ++ "%s\n" ++ "Charset: %s " + "Renderer: %s\n" +-#endif + "Compiled: "__DATE__"\n\n" + "\302\251 1998-2010 Peter \305\275elezn\303\275 <zed@xchat.org>", +- _("A multiplatform IRC Client"), +- get_cpu_str(), +- locale, +-#ifdef WIN32 +- gtk_major_version, +- gtk_minor_version, +- gtk_micro_version +-#else ++ _("A multiplatform IRC Client"), ++ get_cpu_str(), ++ locale, #ifdef USE_XFT - "Xft" +- "Xft" ++ "Xft" + #else +- "Pango" ++ "Pango" + #endif + #endif +- ); ++ ); + gtk_label_set_markup (GTK_LABEL (label), buf); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); + diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/banlist.c xchat-wdk/src/fe-gtk/banlist.c --- xchat-wdk.orig/src/fe-gtk/banlist.c 2010-05-16 05:20:22 +0200 +++ xchat-wdk/src/fe-gtk/banlist.c 2010-08-26 15:53:53 +0200