From d03d6e606b40157d910ddf99ab018156abeb8ef0 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Mon, 28 Feb 2011 18:59:32 +0100 Subject: add wdk changes to named branch --- plugins/upd/upd.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 plugins/upd/upd.c (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c new file mode 100644 index 00000000..001cd9d2 --- /dev/null +++ b/plugins/upd/upd.c @@ -0,0 +1,111 @@ +/* XChat-WDK + * Copyright (c) 2010-2011 Berke Viktor. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include "xchat-plugin.h" + +static xchat_plugin *ph; /* plugin handle */ + +static char* +check_version () +{ + HINTERNET hINet, hFile; + hINet = InternetOpen ("Update Checker", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); + + if (!hINet) + { + return "Unknown"; + } + + 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; + } + + InternetCloseHandle (hFile); + return buffer; + } + + InternetCloseHandle (hINet); + return "Unknown"; +} + +static void +print_version () +{ + char *version = check_version (); + + if (strcmp (version, xchat_get_info (ph, "wdk_version")) == 0) + { + xchat_printf (ph, "You have the latest version of XChat-WDK installed!\n"); + } + else if (strcmp (version, "Unknown") == 0) + { + xchat_printf (ph, "Unable to check for XChat-WDK updates!\n"); + } + else + { + xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s.exe\n", version); + } +} + +int +xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) +{ + ph = plugin_handle; + + *plugin_name = "Update Checker"; + *plugin_desc = "Plugin for checking for XChat-WDK updates"; + *plugin_version = "1.2"; + + xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); + xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); + + xchat_print (ph, "Update Checker plugin loaded\n"); + print_version (); + + return 1; /* return 1 for success */ +} + +int +xchat_plugin_deinit (void) +{ + xchat_command (ph, "MENU DEL \"Help/Check for updates\""); + xchat_print (ph, "Update Checker plugin unloaded\n"); + return 1; +} -- cgit 1.4.1 From 31297031119aa50cf4fb241be1aa7f917786e686 Mon Sep 17 00:00:00 2001 From: "berkeviktor@aol.com" Date: Sat, 16 Apr 2011 19:48:59 +0200 Subject: update the update checker plugin according to google code hosting changes, preserve the file in default branch for a while for compatibility reasons --- plugins/upd/upd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 001cd9d2..a3a6acc4 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -42,7 +42,7 @@ check_version () return "Unknown"; } - hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/hg/version.txt", NULL, 0, 0, 0); + hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/hg/version.txt?r=wdk", NULL, 0, 0, 0); if (hFile) { @@ -91,7 +91,7 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi *plugin_name = "Update Checker"; *plugin_desc = "Plugin for checking for XChat-WDK updates"; - *plugin_version = "1.2"; + *plugin_version = "1.3"; xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); -- cgit 1.4.1 From 162fc1ead323cef91079ba5be9f47d99b3ca39d4 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Tue, 9 Aug 2011 14:05:57 +0200 Subject: update the update checker to use our shiny new git repo --- plugins/upd/upd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index a3a6acc4..724b37c1 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -42,7 +42,7 @@ check_version () return "Unknown"; } - hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/hg/version.txt?r=wdk", NULL, 0, 0, 0); + hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/git/version.txt?r=wdk", NULL, 0, 0, 0); if (hFile) { @@ -91,7 +91,7 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi *plugin_name = "Update Checker"; *plugin_desc = "Plugin for checking for XChat-WDK updates"; - *plugin_version = "1.3"; + *plugin_version = "1.4"; xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); -- cgit 1.4.1 From d00f7dce5a022b17c76479c458461308ccf8ab7e Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Tue, 9 Aug 2011 14:42:40 +0200 Subject: do not cache update info --- plugins/upd/upd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 724b37c1..8c88f0e5 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -42,7 +42,7 @@ check_version () return "Unknown"; } - hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/git/version.txt?r=wdk", NULL, 0, 0, 0); + hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/git/version.txt?r=wdk", NULL, 0, INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, 0); if (hFile) { -- cgit 1.4.1 From 0709b95732214f48e191d591de9a652b0c9ddf82 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Thu, 11 Aug 2011 08:12:35 +0200 Subject: minor formatting --- plugins/checksum/checksum.c | 2 +- plugins/upd/upd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/checksum/checksum.c b/plugins/checksum/checksum.c index 170daa5b..2b5f801a 100644 --- a/plugins/checksum/checksum.c +++ b/plugins/checksum/checksum.c @@ -13,7 +13,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 8c88f0e5..92b7d06e 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -11,7 +11,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -- cgit 1.4.1 From b2c45b196c9a09fd2c1c7e86fe7f4391e93e0c1a Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 23 Nov 2011 02:57:45 +0100 Subject: fix update checker for separate installers --- plugins/upd/upd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 92b7d06e..00319910 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -80,7 +80,11 @@ print_version () } else { - xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s.exe\n", version); +#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for some reason */ + xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s%%20x64.exe\n", version); +#else + xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s%%20x86.exe\n", version); +#endif } } -- cgit 1.4.1 From 34a77fdbc573d2302a8f15660b4a4f93fe89f1a9 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 23 Nov 2011 04:37:57 +0100 Subject: forgot to bump updater version number --- plugins/upd/upd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 00319910..72da7f5c 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -95,7 +95,7 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi *plugin_name = "Update Checker"; *plugin_desc = "Plugin for checking for XChat-WDK updates"; - *plugin_version = "1.4"; + *plugin_version = "1.5"; xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); -- cgit 1.4.1 From 408487f89bce1d0fdbf54e3c42e01e92f61a1c25 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 25 Nov 2011 21:44:08 +0100 Subject: perform periodic update checks automatically --- plugins/upd/upd.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 72da7f5c..b4fa5704 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -65,7 +65,7 @@ check_version () return "Unknown"; } -static void +static int print_version () { char *version = check_version (); @@ -73,10 +73,12 @@ print_version () if (strcmp (version, xchat_get_info (ph, "wdk_version")) == 0) { xchat_printf (ph, "You have the latest version of XChat-WDK installed!\n"); + return 0; } else if (strcmp (version, "Unknown") == 0) { xchat_printf (ph, "Unable to check for XChat-WDK updates!\n"); + return 0; } else { @@ -85,9 +87,30 @@ print_version () #else xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s%%20x86.exe\n", version); #endif + return 1; } } +static int +print_version_quiet (void *userdata) +{ + char *version = check_version (); + + /* if it's not the current version AND not network error */ + if (!(strcmp (version, xchat_get_info (ph, "wdk_version")) == 0) && !(strcmp (version, "Unknown") == 0)) + { +#ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for plugins for some reason */ + xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s%%20x64.exe\n", version); +#else + xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s%%20x86.exe\n", version); +#endif + /* print update url once, then stop the timer */ + return 0; + } + /* keep checking */ + return 1; +} + int xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { @@ -95,13 +118,19 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi *plugin_name = "Update Checker"; *plugin_desc = "Plugin for checking for XChat-WDK updates"; - *plugin_version = "1.5"; + *plugin_version = "2.0"; xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); - xchat_print (ph, "Update Checker plugin loaded\n"); - print_version (); + xchat_printf (ph, "%s plugin loaded\n", *plugin_name); + + /* only start the timer if there's no update available during startup */ + if (!print_version ()) + { + /* check for updates every 6 hours */ + xchat_hook_timer (ph, 21600000, print_version_quiet, NULL); + } return 1; /* return 1 for success */ } -- cgit 1.4.1 From cc0726d83a2f5eaba42dcd0ed02e0f1f91d6b264 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sun, 27 Nov 2011 11:17:22 +0100 Subject: fix the update checker, return correctly with callback --- plugins/upd/upd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index b4fa5704..a6ece301 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -31,6 +31,9 @@ static xchat_plugin *ph; /* plugin handle */ +/* we need this to store the result of the initial update check since the return value is preserved for XCHAT_EAT */ +static int update_available; + static char* check_version () { @@ -73,12 +76,12 @@ print_version () if (strcmp (version, xchat_get_info (ph, "wdk_version")) == 0) { xchat_printf (ph, "You have the latest version of XChat-WDK installed!\n"); - return 0; + update_available = 0; } else if (strcmp (version, "Unknown") == 0) { xchat_printf (ph, "Unable to check for XChat-WDK updates!\n"); - return 0; + update_available = 0; } else { @@ -87,8 +90,10 @@ print_version () #else xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s%%20x86.exe\n", version); #endif - return 1; + update_available = 1; } + + return XCHAT_EAT_XCHAT; } static int @@ -126,7 +131,7 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi xchat_printf (ph, "%s plugin loaded\n", *plugin_name); /* only start the timer if there's no update available during startup */ - if (!print_version ()) + if (!update_available) { /* check for updates every 6 hours */ xchat_hook_timer (ph, 21600000, print_version_quiet, NULL); -- cgit 1.4.1 From 7c0baeffbc302ff0851790b7bc7f87e033368d07 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Tue, 29 Nov 2011 02:04:08 +0100 Subject: relicense own plugins under the MIT license --- plugins/checksum/checksum.c | 37 ++++++++++++++++--------------------- plugins/exec/exec.c | 36 ++++++++++++++++-------------------- plugins/gtkpref/gtkpref.c | 36 ++++++++++++++++-------------------- plugins/upd/upd.c | 36 ++++++++++++++++-------------------- 4 files changed, 64 insertions(+), 81 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/checksum/checksum.c b/plugins/checksum/checksum.c index 2b5f801a..12fc0d93 100644 --- a/plugins/checksum/checksum.c +++ b/plugins/checksum/checksum.c @@ -1,29 +1,23 @@ /* XChat-WDK * Copyright (c) 2010-2011 Berke Viktor. * - * Use of OpenSSL SHA256 interface: http://adamlamers.com/?p=5 + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ #include @@ -50,6 +44,7 @@ static xchat_plugin *ph; /* plugin handle */ static int config_fail; /* variable for config availability */ +/* Use of OpenSSL SHA256 interface: http://adamlamers.com/?p=5 */ static void sha256_hash_string (unsigned char hash[SHA256_DIGEST_LENGTH], char outputBuffer[65]) { diff --git a/plugins/exec/exec.c b/plugins/exec/exec.c index 9571faad..b043ae83 100644 --- a/plugins/exec/exec.c +++ b/plugins/exec/exec.c @@ -1,27 +1,23 @@ /* XChat-WDK * Copyright (c) 2011 Berke Viktor. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ #include diff --git a/plugins/gtkpref/gtkpref.c b/plugins/gtkpref/gtkpref.c index 3816abcc..5cc754bf 100644 --- a/plugins/gtkpref/gtkpref.c +++ b/plugins/gtkpref/gtkpref.c @@ -1,27 +1,23 @@ /* XChat-WDK * Copyright (c) 2011 Berke Viktor. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ #include diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index a6ece301..3eec06dc 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -1,27 +1,23 @@ /* XChat-WDK * Copyright (c) 2010-2011 Berke Viktor. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ #include -- cgit 1.4.1 From e2acf19d42b874eecd1b142a0e1192721fb295f5 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 2 Dec 2011 01:05:59 +0100 Subject: don't use hardcoded strings for plugin names --- plugins/checksum/checksum.c | 13 ++++++++----- plugins/exec/exec.c | 13 ++++++++----- plugins/upd/upd.c | 13 ++++++++----- plugins/winsys/winsys.cpp | 15 +++++++++------ 4 files changed, 33 insertions(+), 21 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/checksum/checksum.c b/plugins/checksum/checksum.c index 12fc0d93..103a80ca 100644 --- a/plugins/checksum/checksum.c +++ b/plugins/checksum/checksum.c @@ -42,6 +42,9 @@ #endif static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "Checksum"; +static const char desc[] = "Calculate checksum for DCC file transfers"; +static const char version[] = "2.0"; static int config_fail; /* variable for config availability */ /* Use of OpenSSL SHA256 interface: http://adamlamers.com/?p=5 */ @@ -324,9 +327,9 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "Checksum"; - *plugin_desc = "Calculate checksum for DCC file transfers"; - *plugin_version = "2.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; init (); @@ -334,13 +337,13 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi xchat_hook_print (ph, "DCC RECV Complete", XCHAT_PRI_NORM, dccrecv_cb, NULL); xchat_hook_print (ph, "DCC Offer", XCHAT_PRI_NORM, dccoffer_cb, NULL); - xchat_print (ph, "Checksum plugin loaded\n"); + xchat_printf (ph, "%s plugin loaded\n", name); return 1; } int xchat_plugin_deinit (void) { - xchat_print (ph, "Checksum plugin unloaded\n"); + xchat_printf (ph, "%s plugin unloaded\n", name); return 1; } diff --git a/plugins/exec/exec.c b/plugins/exec/exec.c index b043ae83..fc8c8ec9 100644 --- a/plugins/exec/exec.c +++ b/plugins/exec/exec.c @@ -26,6 +26,9 @@ #include "xchat-plugin.h" static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "Exec"; +static const char desc[] = "Execute commands inside XChat"; +static const char version[] = "1.0"; static int run_command (char *word[], char *word_eol[], void *userdata) @@ -107,12 +110,12 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "Exec"; - *plugin_desc = "Execute commands inside XChat"; - *plugin_version = "1.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; xchat_hook_command (ph, "EXEC", XCHAT_PRI_NORM, run_command, 0, 0); - xchat_printf (ph, "%s plugin loaded\n", *plugin_name); + xchat_printf (ph, "%s plugin loaded\n", name); return 1; /* return 1 for success */ } @@ -120,6 +123,6 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi int xchat_plugin_deinit (void) { - xchat_print (ph, "Exec plugin unloaded\n"); + xchat_print (ph, "%s plugin unloaded\n", name); return 1; } diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 3eec06dc..7ab5edca 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -26,6 +26,9 @@ #include "xchat-plugin.h" static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "Update Checker"; +static const char desc[] = "Check for XChat-WDK updates automatically"; +static const char version[] = "2.0"; /* we need this to store the result of the initial update check since the return value is preserved for XCHAT_EAT */ static int update_available; @@ -117,14 +120,14 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "Update Checker"; - *plugin_desc = "Plugin for checking for XChat-WDK updates"; - *plugin_version = "2.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); - xchat_printf (ph, "%s plugin loaded\n", *plugin_name); + xchat_printf (ph, "%s plugin loaded\n", name); /* only start the timer if there's no update available during startup */ if (!update_available) @@ -140,6 +143,6 @@ int xchat_plugin_deinit (void) { xchat_command (ph, "MENU DEL \"Help/Check for updates\""); - xchat_print (ph, "Update Checker plugin unloaded\n"); + xchat_printf (ph, "%s plugin unloaded\n", name); return 1; } diff --git a/plugins/winsys/winsys.cpp b/plugins/winsys/winsys.cpp index 2f68f75b..55a5ddaf 100644 --- a/plugins/winsys/winsys.cpp +++ b/plugins/winsys/winsys.cpp @@ -28,6 +28,9 @@ #include "xchat-plugin.h" static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "WinSys"; +static const char desc[] = "Display info about your hardware and OS"; +static const char version[] = "1.0"; static int firstRun; static char *wmiOs; static char *wmiCpu; @@ -352,7 +355,7 @@ printInfo (char *word[], char *word_eol[], void *user_data) /* query WMI info only at the first time WinSys is called, then cache it to save time */ if (firstRun) { - xchat_printf (ph, "WinSys first execution, querying and caching WMI info...\n"); + xchat_printf (ph, "%s first execution, querying and caching WMI info...\n", name); wmiOs = getWmiInfo (0); wmiCpu = getWmiInfo (1); wmiVga = getWmiInfo (2); @@ -388,16 +391,16 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "WinSys"; - *plugin_desc = "Display info about your hardware and OS"; - *plugin_version = "1.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; firstRun = 1; xchat_hook_command (ph, "WINSYS", XCHAT_PRI_NORM, printInfo, NULL, NULL); xchat_command (ph, "MENU -ietc\\system.png ADD \"Window/Display System Info\" \"WINSYS\""); - xchat_printf (ph, "%s plugin loaded\n", *plugin_name); + xchat_printf (ph, "%s plugin loaded\n", name); return 1; /* return 1 for success */ } @@ -407,6 +410,6 @@ int xchat_plugin_deinit (void) { xchat_command (ph, "MENU DEL \"Window/Display System Info\""); - xchat_print (ph, "WinSys plugin unloaded\n"); + xchat_printf (ph, "%s plugin unloaded\n", name); return 1; } -- cgit 1.4.1 From 6ccfa8aaeafd315fe8c305e42756248e1d4e6f0c Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 2 Dec 2011 12:21:33 +0100 Subject: fix automatic update checking --- plugins/upd/upd.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 7ab5edca..578da0d9 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -30,9 +30,6 @@ static const char name[] = "Update Checker"; static const char desc[] = "Check for XChat-WDK updates automatically"; static const char version[] = "2.0"; -/* we need this to store the result of the initial update check since the return value is preserved for XCHAT_EAT */ -static int update_available; - static char* check_version () { @@ -75,12 +72,10 @@ print_version () if (strcmp (version, xchat_get_info (ph, "wdk_version")) == 0) { xchat_printf (ph, "You have the latest version of XChat-WDK installed!\n"); - update_available = 0; } else if (strcmp (version, "Unknown") == 0) { xchat_printf (ph, "Unable to check for XChat-WDK updates!\n"); - update_available = 0; } else { @@ -89,7 +84,6 @@ print_version () #else xchat_printf (ph, "An XChat-WDK update is available! You can download it from here:\nhttp://xchat-wdk.googlecode.com/files/XChat-WDK%%20%s%%20x86.exe\n", version); #endif - update_available = 1; } return XCHAT_EAT_XCHAT; @@ -126,11 +120,10 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); - xchat_printf (ph, "%s plugin loaded\n", name); /* only start the timer if there's no update available during startup */ - if (!update_available) + if (print_version_quiet (NULL)) { /* check for updates every 6 hours */ xchat_hook_timer (ph, 21600000, print_version_quiet, NULL); -- cgit 1.4.1 From c73149cf44779965b76377526ffe6789dfef2131 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 4 Feb 2012 17:41:02 +0100 Subject: fix update checking errors due to GC HTTP bug - manual IE tweaking's still required --- plugins/upd/upd.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 578da0d9..b85755cb 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -28,11 +28,21 @@ static xchat_plugin *ph; /* plugin handle */ static const char name[] = "Update Checker"; static const char desc[] = "Check for XChat-WDK updates automatically"; -static const char version[] = "2.0"; +static const char version[] = "2.1"; static char* check_version () { +#if 0 + /* Google Code's messing up with requests, use HTTP/1.0 as suggested. More info: + + http://code.google.com/p/support/issues/detail?id=6095 + + Of course it would be still too simple, coz IE will override settings, so + you have to disable HTTP/1.1 manually and globally. More info: + + http://support.microsoft.com/kb/258425 + */ HINTERNET hINet, hFile; hINet = InternetOpen ("Update Checker", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); @@ -62,6 +72,68 @@ check_version () InternetCloseHandle (hINet); return "Unknown"; +#endif + + static char buffer[1024]; + DWORD dwRead; + HINTERNET hOpen, hConnect, hResource; + + hOpen = InternetOpen (TEXT("Update Checker"), + INTERNET_OPEN_TYPE_PRECONFIG, + NULL, + NULL, + 0); + if (!hOpen) + { + return "Unknown"; + } + + hConnect = InternetConnect (hOpen, + TEXT("xchat-wdk.googlecode.com"), + INTERNET_INVALID_PORT_NUMBER, + NULL, + NULL, + INTERNET_SERVICE_HTTP, + 0, + 0); + if (!hConnect) + { + InternetCloseHandle (hOpen); + return "Unknown"; + } + + hResource = HttpOpenRequest (hConnect, + TEXT("GET"), + TEXT("/git/version.txt?r=wdk"), + TEXT("HTTP/1.0"), + NULL, + NULL, + INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_AUTH, + 0); + if (!hResource) + { + InternetCloseHandle (hConnect); + InternetCloseHandle (hOpen); + return "Unknown"; + } + else + { + HttpSendRequest (hResource, NULL, 0, NULL, 0); + + while (InternetReadFile (hResource, buffer, 1023, &dwRead)) + { + if (dwRead == 0) + { + break; + } + buffer[dwRead] = 0; + } + + InternetCloseHandle (hResource); + InternetCloseHandle (hConnect); + InternetCloseHandle (hOpen); + return buffer; + } } static int -- cgit 1.4.1 From 8849fb4c108f5f6341e341bcbf6db50bf6f84737 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 4 Feb 2012 20:24:30 +0100 Subject: use old code since disabling HTTP/1.1 works with that too --- plugins/upd/upd.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index b85755cb..baf5b85b 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -33,26 +33,20 @@ static const char version[] = "2.1"; static char* check_version () { -#if 0 - /* Google Code's messing up with requests, use HTTP/1.0 as suggested. More info: - - http://code.google.com/p/support/issues/detail?id=6095 - - Of course it would be still too simple, coz IE will override settings, so - you have to disable HTTP/1.1 manually and globally. More info: - - http://support.microsoft.com/kb/258425 - */ HINTERNET hINet, hFile; hINet = InternetOpen ("Update Checker", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); - + if (!hINet) { return "Unknown"; } - hFile = InternetOpenUrl (hINet, "http://xchat-wdk.googlecode.com/git/version.txt?r=wdk", NULL, 0, INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, 0); - + hFile = InternetOpenUrl (hINet, + "http://xchat-wdk.googlecode.com/git/version.txt?r=wdk", + NULL, + 0, + INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, + 0); if (hFile) { static char buffer[1024]; @@ -67,12 +61,26 @@ check_version () } InternetCloseHandle (hFile); + InternetCloseHandle (hINet); return buffer; } - + InternetCloseHandle (hINet); return "Unknown"; -#endif + +#if 0 + /* Google Code's messing up with requests, use HTTP/1.0 as suggested. More info: + + http://code.google.com/p/support/issues/detail?id=6095 + + Of course it would be still too simple, coz IE will override settings, so + you have to disable HTTP/1.1 manually and globally. More info: + + http://support.microsoft.com/kb/258425 + + So this code's basically useless since disabling HTTP/1.1 will work with the + above code too. + */ static char buffer[1024]; DWORD dwRead; @@ -134,6 +142,7 @@ check_version () InternetCloseHandle (hOpen); return buffer; } +#endif } static int -- cgit 1.4.1 From 067ee4fc5b71872a1fb2758e07fae960832022d9 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Wed, 8 Feb 2012 21:52:27 +0100 Subject: supposed workaround for disabling chunked encoding (snq-) --- plugins/upd/upd.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'plugins/upd/upd.c') diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index baf5b85b..1659162c 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -33,6 +33,7 @@ static const char version[] = "2.1"; static char* check_version () { +#if 0 HINTERNET hINet, hFile; hINet = InternetOpen ("Update Checker", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); @@ -67,8 +68,8 @@ check_version () InternetCloseHandle (hINet); return "Unknown"; +#endif -#if 0 /* Google Code's messing up with requests, use HTTP/1.0 as suggested. More info: http://code.google.com/p/support/issues/detail?id=6095 @@ -80,13 +81,13 @@ check_version () So this code's basically useless since disabling HTTP/1.1 will work with the above code too. + + Update: a Connection: close header seems to disable chunked encoding. */ - static char buffer[1024]; - DWORD dwRead; HINTERNET hOpen, hConnect, hResource; - hOpen = InternetOpen (TEXT("Update Checker"), + hOpen = InternetOpen (TEXT ("Update Checker"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, @@ -97,7 +98,7 @@ check_version () } hConnect = InternetConnect (hOpen, - TEXT("xchat-wdk.googlecode.com"), + TEXT ("xchat-wdk.googlecode.com"), INTERNET_INVALID_PORT_NUMBER, NULL, NULL, @@ -111,9 +112,9 @@ check_version () } hResource = HttpOpenRequest (hConnect, - TEXT("GET"), - TEXT("/git/version.txt?r=wdk"), - TEXT("HTTP/1.0"), + TEXT ("GET"), + TEXT ("/git/version.txt?r=wdk"), + TEXT ("HTTP/1.0"), NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_AUTH, @@ -126,6 +127,10 @@ check_version () } else { + static char buffer[1024]; + DWORD dwRead; + + HttpAddRequestHeaders (hResource, TEXT ("Connection: close\r\n"), -1L, HTTP_ADDREQ_FLAG_ADD); /* workaround for GC bug */ HttpSendRequest (hResource, NULL, 0, NULL, 0); while (InternetReadFile (hResource, buffer, 1023, &dwRead)) @@ -142,7 +147,6 @@ check_version () InternetCloseHandle (hOpen); return buffer; } -#endif } static int -- cgit 1.4.1