Proxy from command line arg
This commit is contained in:
parent
73a18998f6
commit
346e9d2168
@ -244,9 +244,12 @@ std::map<std::string, std::string> readArguments(int argc, char * argv[])
|
||||
{
|
||||
arguments["scale"] = std::string(argv[i]+6);
|
||||
}
|
||||
else if (!strncmp(argv[i], "proxy:", 6) && argv[i]+6)
|
||||
else if (!strncmp(argv[i], "proxy:", 6))
|
||||
{
|
||||
if(argv[i]+6)
|
||||
arguments["proxy"] = std::string(argv[i]+6);
|
||||
else
|
||||
arguments["proxy"] = "false";
|
||||
}
|
||||
else if (!strncmp(argv[i], "nohud", 5))
|
||||
{
|
||||
@ -319,6 +322,27 @@ int main(int argc, char * argv[])
|
||||
Client::Ref().SetPref("Scale", tempScale);
|
||||
}
|
||||
|
||||
std::string proxyString = "";
|
||||
if(arguments["proxy"].length())
|
||||
{
|
||||
if(arguments["proxy"] == "false")
|
||||
{
|
||||
proxyString = "";
|
||||
Client::Ref().SetPref("Proxy", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
proxyString = (arguments["proxy"]);
|
||||
Client::Ref().SetPref("Proxy", arguments["proxy"]);
|
||||
}
|
||||
}
|
||||
else if(Client::Ref().GetPrefString("Proxy", "").length())
|
||||
{
|
||||
proxyString = (Client::Ref().GetPrefString("Proxy", ""));
|
||||
}
|
||||
|
||||
Client::Ref().Initialise(proxyString);
|
||||
|
||||
if(tempScale != 1 && tempScale != 2)
|
||||
tempScale = 1;
|
||||
|
||||
|
@ -39,10 +39,10 @@ extern "C"
|
||||
|
||||
Client::Client():
|
||||
authUser(0, ""),
|
||||
updateAvailable(false)
|
||||
updateAvailable(false),
|
||||
versionCheckRequest(NULL)
|
||||
{
|
||||
int i = 0;
|
||||
std::string proxyString("");
|
||||
for(i = 0; i < THUMB_CACHE_SIZE; i++)
|
||||
{
|
||||
thumbnailCache[i] = NULL;
|
||||
@ -89,6 +89,10 @@ Client::Client():
|
||||
}
|
||||
configFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
void Client::Initialise(std::string proxyString)
|
||||
{
|
||||
|
||||
if(GetPrefBool("version.update", false)==true)
|
||||
{
|
||||
@ -96,15 +100,10 @@ Client::Client():
|
||||
update_finish();
|
||||
}
|
||||
|
||||
proxyString = GetPrefString("proxy", "");
|
||||
if(proxyString.length())
|
||||
{
|
||||
http_init((char*)proxyString.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
http_init(NULL);
|
||||
}
|
||||
|
||||
//Read stamps library
|
||||
std::ifstream stampsLib;
|
||||
@ -125,6 +124,15 @@ Client::Client():
|
||||
versionCheckRequest = http_async_req_start(NULL, SERVER "/Download/Version.json", NULL, 0, 1);
|
||||
}
|
||||
|
||||
void Client::SetProxy(std::string proxy)
|
||||
{
|
||||
http_done();
|
||||
if(proxy.length())
|
||||
http_init((char*)proxy.c_str());
|
||||
else
|
||||
http_init(NULL);
|
||||
}
|
||||
|
||||
std::vector<std::string> Client::DirectorySearch(std::string directory, std::string search, std::string extension)
|
||||
{
|
||||
std::vector<std::string> extensions;
|
||||
|
@ -88,6 +88,9 @@ public:
|
||||
|
||||
std::vector<unsigned char> ReadFile(std::string filename);
|
||||
|
||||
void Initialise(std::string proxyString);
|
||||
void SetProxy(std::string proxy);
|
||||
|
||||
void WriteFile(std::vector<unsigned char> fileData, std::string filename);
|
||||
void WriteFile(std::vector<char> fileData, std::string filename);
|
||||
bool FileExists(std::string filename);
|
||||
|
Loading…
Reference in New Issue
Block a user