preliminary update checker

This commit is contained in:
berkeviktor@aol.com 2010-08-30 10:08:17 +02:00
parent fe5cb63a59
commit b2ba474f06
4 changed files with 89 additions and 24 deletions

View File

@ -0,0 +1,36 @@
#include <windows.h>
#include <wininet.h>
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";
}

View File

@ -0,0 +1 @@
char* check_version ();

View File

@ -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 CFLAGS = $(CFLAGS) -Ic:\mozilla-build\build\xchat-wdk\plugins
CPPFLAGS = /c /MD /W0 /nologo /DWIN32 CPPFLAGS = /c /MD /W0 /nologo /DWIN32
LDFLAGS = /subsystem:windows /nologo 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 !ifdef X64
############################################################# #############################################################
@ -89,6 +89,7 @@ ascii.obj \
banlist.obj \ banlist.obj \
chanlist.obj \ chanlist.obj \
chanview.obj \ chanview.obj \
check-version.obj \
custom-list.obj \ custom-list.obj \
dccgui.obj \ dccgui.obj \
editlist.obj \ editlist.obj \

View File

@ -655,47 +655,74 @@ diff -ruN --strip-trailing-cr xchat-wdk.orig/src/common/xchat.h xchat-wdk/src/co
#define X_OK 1 #define X_OK 1
diff -ruN --strip-trailing-cr xchat-wdk.orig/src/fe-gtk/about.c xchat-wdk/src/fe-gtk/about.c 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.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 +++ xchat-wdk/src/fe-gtk/about.c 2010-08-30 10:02:36 +0200
@@ -39,6 +39,7 @@ @@ -39,6 +39,8 @@
#include "../common/xchat.h" #include "../common/xchat.h"
#include "../common/util.h" #include "../common/util.h"
+#include "../common/portable.h" +#include "../common/portable.h"
+#include "check-version.h"
#include "palette.h" #include "palette.h"
#include "pixmaps.h" #include "pixmaps.h"
#include "gtkutil.h" #include "gtkutil.h"
@@ -117,7 +118,7 @@ @@ -114,35 +116,41 @@
"%s\n\n" g_get_charset (&locale);
(snprintf) (buf, sizeof (buf),
"<span size=\"x-large\"><b>"DISPLAY_NAME" "PACKAGE_VERSION"</b></span>\n\n"
- "%s\n\n"
#ifdef WIN32 #ifdef WIN32
+ "<b>Latest Version</b>: r%s\n\n"
/* leave this message to avoid time wasting bug reports! */ /* leave this message to avoid time wasting bug reports! */
- "This version is unofficial and comes with no support.\n\n" - "This version is unofficial and comes with no support.\n\n"
-#endif
+ "This version is unofficial and\ncomes with no support.\n\n" + "This version is unofficial and\ncomes with no support.\n\n"
#endif
"%s\n" "%s\n"
"<b>Charset</b>: %s " "<b>Charset</b>: %s "
@@ -126,7 +127,11 @@ -#ifdef WIN32
#else "<b>GTK+</b>: %i.%i.%i\n"
"<b>Renderer</b>: %s\n"
#endif
- "<b>Compiled</b>: "__DATE__"\n\n"
+ "<b>Compiled</b>: "__DATE__"\n" + "<b>Compiled</b>: "__DATE__"\n"
+#ifdef WIN32
+ "<b>Portable Mode</b>: %s\n\n" + "<b>Portable Mode</b>: %s\n\n"
+ "<b>XChat Base</b>: 2.8.8\n\n" + "<b>XChat Base</b>: 2.8.8\n\n"
+#endif + "<small>\302\251 1998-2010 Peter \305\275elezn\303\275 &lt;zed@xchat.org></small>",
"<small>\302\251 1998-2010 Peter \305\275elezn\303\275 &lt;zed@xchat.org></small>", + check_version(),
_("A multiplatform IRC Client"), + get_cpu_str(),
get_cpu_str(), + locale,
@@ -134,7 +139,8 @@ + gtk_major_version,
#ifdef WIN32 + gtk_minor_version,
gtk_major_version, + gtk_micro_version,
gtk_minor_version, + (portable_mode() ? "Yes" : "No")
- gtk_micro_version
+ gtk_micro_version,
+ (portable_mode() ? "Yes" : "No")
#else #else
+ "%s\n\n"
+ "%s\n"
+ "<b>Charset</b>: %s "
"<b>Renderer</b>: %s\n"
-#endif
"<b>Compiled</b>: "__DATE__"\n\n"
"<small>\302\251 1998-2010 Peter \305\275elezn\303\275 &lt;zed@xchat.org></small>",
- _("A multiplatform IRC Client"),
- get_cpu_str(),
- locale,
-#ifdef WIN32
- gtk_major_version,
- gtk_minor_version,
- gtk_micro_version
-#else
+ _("A multiplatform IRC Client"),
+ get_cpu_str(),
+ locale,
#ifdef USE_XFT #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 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.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 +++ xchat-wdk/src/fe-gtk/banlist.c 2010-08-26 15:53:53 +0200