summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorberkeviktor@aol.com <berkeviktor@aol.com>2010-08-30 10:08:17 +0200
committerberkeviktor@aol.com <berkeviktor@aol.com>2010-08-30 10:08:17 +0200
commitb2ba474f06268afaff76b409ba5790b7db9bbbed (patch)
tree1bf1e69091dc7adf334dec35a2355c98766a4b42
parentfe5cb63a5944de53bc64c3fb5549f4eaa9d97a69 (diff)
preliminary update checker
-rw-r--r--src/fe-gtk/check-version.c36
-rw-r--r--src/fe-gtk/check-version.h1
-rw-r--r--src/makeinc.skel3
-rw-r--r--xchat-wdk.patch71
4 files changed, 88 insertions, 23 deletions
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 <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";
+}
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),
+ 				"<span size=\"x-large\"><b>"DISPLAY_NAME" "PACKAGE_VERSION"</b></span>\n\n"
+-				"%s\n\n"
  #ifdef WIN32
++				"<b>Latest Version</b>: 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"
  				"<b>Charset</b>: %s "
-@@ -126,7 +127,11 @@
- #else
- 				"<b>Renderer</b>: %s\n"
- #endif
--				"<b>Compiled</b>: "__DATE__"\n\n"
+-#ifdef WIN32 
+ 				"<b>GTK+</b>: %i.%i.%i\n"
 +				"<b>Compiled</b>: "__DATE__"\n"
-+#ifdef WIN32
 +				"<b>Portable Mode</b>: %s\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>",
++				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"
++				"<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(),
-@@ -134,7 +139,8 @@
- #ifdef WIN32
- 					gtk_major_version,
- 					gtk_minor_version,
+-					_("A multiplatform IRC Client"),
+-					get_cpu_str(),
+-					locale,
+-#ifdef WIN32
+-					gtk_major_version,
+-					gtk_minor_version,
 -					gtk_micro_version
-+					gtk_micro_version,
-+					(portable_mode() ? "Yes" : "No")
- #else
+-#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