From b2ba474f06268afaff76b409ba5790b7db9bbbed Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Mon, 30 Aug 2010 10:08:17 +0200 Subject: preliminary update checker --- src/fe-gtk/check-version.c | 36 ++++++++++++++++++++++++++++++++++++ src/fe-gtk/check-version.h | 1 + src/makeinc.skel | 3 ++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/fe-gtk/check-version.c create mode 100644 src/fe-gtk/check-version.h (limited to 'src') 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 \ -- cgit 1.4.1