summary refs log tree commit diff stats
path: root/src
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 /src
parentfe5cb63a5944de53bc64c3fb5549f4eaa9d97a69 (diff)
preliminary update checker
Diffstat (limited to 'src')
-rw-r--r--src/fe-gtk/check-version.c36
-rw-r--r--src/fe-gtk/check-version.h1
-rw-r--r--src/makeinc.skel3
3 files changed, 39 insertions, 1 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 \