summaryrefslogtreecommitdiff
path: root/src/net/download.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-26 21:45:57 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-26 22:01:51 +0300
commit5889bd94d241b8454268804861a67c79315a7731 (patch)
treeb37aaec28083110308fbbc5fa3a2c4bb07ce2ed7 /src/net/download.cpp
parentbae784c3718b2d28bef80ef57f23c47cc4342c64 (diff)
downloadmv-5889bd94d241b8454268804861a67c79315a7731.tar.gz
mv-5889bd94d241b8454268804861a67c79315a7731.tar.bz2
mv-5889bd94d241b8454268804861a67c79315a7731.tar.xz
mv-5889bd94d241b8454268804861a67c79315a7731.zip
add chat command for uploading main config.xml
New chat command: /uploadconfig
Diffstat (limited to 'src/net/download.cpp')
-rw-r--r--src/net/download.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 22f5d9aa4..2abffba0c 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -58,7 +58,7 @@ enum
namespace Net
{
-std::string Download::mUploadRssponse = "";
+std::string Download::mUploadResponse = "";
Download::Download(void *const ptr, const std::string &url,
const DownloadUpdate updateFunction,
@@ -228,10 +228,7 @@ int Download::downloadProgress(void *clientp, double dltotal, double dlnow,
Download *const d = reinterpret_cast<Download *const>(clientp);
if (!d)
- {
- logger->log("downloadProgress error");
return -5;
- }
if (d->mUpload)
return 0;
@@ -295,7 +292,7 @@ int Download::downloadThread(void *ptr)
curl_easy_setopt(d->mCurl, CURLOPT_HTTPPOST, d->mFormPost);
curl_easy_setopt(d->mCurl, CURLOPT_WRITEFUNCTION,
&Download::writeFunction);
- mUploadRssponse.clear();
+ mUploadResponse.clear();
}
else
{
@@ -457,6 +454,8 @@ int Download::downloadThread(void *ptr)
attempts++;
}
+ d->mThread = nullptr;
+
if (d->mOptions.cancel)
{
// Nothing to do...
@@ -470,7 +469,6 @@ int Download::downloadThread(void *ptr)
d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_COMPLETE, 0, 0);
}
- d->mThread = nullptr;
return 0;
}
@@ -569,8 +567,7 @@ size_t Download::writeFunction(void *ptr, size_t size,
char *buf = new char[totalMem + 1];
memcpy(buf, ptr, totalMem);
buf[totalMem] = 0;
- mUploadRssponse.append(buf);
- logger->log("data: %s", buf);
+ mUploadResponse.append(buf);
return totalMem;
}