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 + 2 files changed, 37 insertions(+) create mode 100644 src/fe-gtk/check-version.c create mode 100644 src/fe-gtk/check-version.h (limited to 'src/fe-gtk') 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 (); -- cgit 1.4.1