Merge branch 'v1.8.6' into issue5186-different-dpi

This commit is contained in:
Jerry (Xinyu Hou)
2016-10-31 16:31:30 +00:00
19 changed files with 144 additions and 25 deletions

View File

@@ -116,7 +116,6 @@ CurlFacade::urlEncode(const String& url)
char* resultCStr = curl_easy_escape(m_curl, url.c_str(), 0);
if (resultCStr == NULL) {
curl_free(resultCStr);
throw XArch("CURL escape failed.");
}

View File

@@ -195,6 +195,10 @@ ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
args.m_notifyActivation = true;
return true;
}
else if (isArg(i, argc, argv, NULL, "--notify-update", 0)) {
args.m_notifyUpdate = true;
return true;
}
else {
return false;
}

View File

@@ -1,11 +1,11 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014-2016 Symless Ltd.
*
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -80,6 +80,9 @@ ToolApp::run(int argc, char** argv)
else if (m_args.m_getArch) {
std::cout << ARCH->getPlatformName() << std::endl;
}
else if (m_args.m_notifyUpdate) {
notifyUpdate();
}
else if (m_args.m_notifyActivation) {
notifyActivation();
}
@@ -134,7 +137,30 @@ ToolApp::loginAuth()
}
}
void
void
ToolApp::notifyUpdate()
{
String data;
std::cin >> data;
std::vector<String> parts = synergy::string::splitString(data, ':');
size_t count = parts.size();
if (count == 3) {
std::stringstream ss;
ss << JSON_URL << "notify/update";
ss << "?from=" << parts[0];
ss << "&to=" << parts[1];
ss << "&serial=" << parts[2];
std::cout << ARCH->internet().get(ss.str()) << std::endl;
}
else {
throw XSynergy("Invalid update data.");
}
}
void
ToolApp::notifyActivation()
{
String info;

View File

@@ -30,6 +30,7 @@ public:
private:
void loginAuth();
void notifyActivation();
void notifyUpdate();
private:
ToolArgs m_args;

View File

@@ -23,6 +23,7 @@ ToolArgs::ToolArgs() :
m_getInstalledDir(false),
m_getProfileDir(false),
m_getArch(false),
m_notifyActivation(false)
m_notifyActivation(false),
m_notifyUpdate(false)
{
}

View File

@@ -30,4 +30,5 @@ public:
bool m_getProfileDir;
bool m_getArch;
bool m_notifyActivation;
bool m_notifyUpdate;
};