summaryrefslogtreecommitdiff
path: root/updater/socket.cpp
diff options
context:
space:
mode:
author(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2009-03-31 23:59:07 +0000
committer(no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10>2009-03-31 23:59:07 +0000
commit15f01647e8854d2f21bfb9a6310b7aeb4cad3e47 (patch)
tree8c8e180a75a14d918246d579a5cbf6e8089b2e23 /updater/socket.cpp
parent99d21912f00a44a6bb83e9bb3ae248facb235b69 (diff)
added pescuma's version string patch (thx)
version bump git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@453 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'updater/socket.cpp')
-rw-r--r--updater/socket.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/updater/socket.cpp b/updater/socket.cpp
index d066a9d..7e5db53 100644
--- a/updater/socket.cpp
+++ b/updater/socket.cpp
@@ -81,6 +81,28 @@ bool GetFile(char *url, TCHAR *temp_folder, char *plugin_name, char *version, bo
ext = ".zip";
}
+ // replace version text in URL
+ char tmp_url[1024];
+ if (version != NULL) {
+ char *p;
+ size_t pos = 0;
+ size_t version_len = strlen(version);
+ while ((p = strstr(url, "%VERSION%")) != NULL && (p - url + version_len < sizeof(tmp_url) - 1)) {
+ strncpy(&tmp_url[pos], url, p - url);
+ pos += p - url;
+ strcpy(&tmp_url[pos], version);
+ pos += version_len;
+ url += p - url + 9; // 9 == strlen("%VERSION%")
+ }
+ if (strlen(url) < sizeof(tmp_url) - 1) {
+ strcpy(&tmp_url[pos], url);
+ pos += strlen(url);
+ }
+ tmp_url[pos] = 0;
+ url = tmp_url;
+ }
+
+
NETLIBHTTPREQUEST req = {0};
req.cbSize = sizeof(req);