summaryrefslogtreecommitdiff
path: root/client/Proxifier.cpp
diff options
context:
space:
mode:
authorAlex Borisov <b0ris@b0ris-satellite.localdomain>2012-01-07 04:45:01 +0200
committerAlex Borisov <b0ris@b0ris-satellite.localdomain>2012-01-07 04:45:01 +0200
commite23f72738a41ada892e8979aaa9cea318e9d941a (patch)
tree4560631e0698bb98a967c79704de0d64a5505c01 /client/Proxifier.cpp
parent04a67fd43d8a2d003ea79c7a1f1d94745a78d33c (diff)
FIX turn off generic proxies correctly
Diffstat (limited to 'client/Proxifier.cpp')
-rw-r--r--client/Proxifier.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/client/Proxifier.cpp b/client/Proxifier.cpp
index c3d9d6a..e2185b9 100644
--- a/client/Proxifier.cpp
+++ b/client/Proxifier.cpp
@@ -78,6 +78,51 @@ bool Proxifier::IsOn(string& addr, short port)
return false;
}
+vector<Proxy> Proxifier::GetActiveProxies()
+{
+ vector<Proxy> result;
+ // check for Client chain
+ int chainId = 0;
+ if (!isChainExists(defaultChain, &chainId))
+ {
+ return result;
+ }
+ /**
+ * @todo check if Client chain is enabled
+ */
+ // find proxies in the chain
+ for (unsigned i = 0; i < chainList.size(); i++)
+ {
+ if (chainList[i].name.compare(defaultChain) != 0)
+ {
+ continue;
+ }
+ map<int, bool>::iterator it = chainList[i].proxies.begin();
+ for ( ; it != chainList[i].proxies.end(); it++)
+ {
+ if (!it->second)
+ {
+ continue;
+ }
+ for (unsigned i = 0; i < proxyList.size(); i++)
+ {
+ if (proxyList[i].id != it->first)
+ {
+ continue;
+ }
+ Proxy proxy;
+ proxy.login = proxyList[i].login;
+ proxy.password = proxyList[i].password;
+ proxy.host = proxyList[i].host;
+ proxy.port = proxyList[i].port;
+ proxy.type = proxyList[i].type;
+ result.push_back(proxy);
+ }
+ }
+ }
+ return result;
+}
+
bool Proxifier::TurnProxyOn(Proxy& proxy)
{
if (!valid)
@@ -200,6 +245,9 @@ bool Proxifier::TurnProxyOff(Proxy& proxy)
SetRuleAction(defaultRule, action);
}
RemoveProxyFromChain(proxyId, chainId);
+ /**
+ * @todo remove proxy entry from Proxifier's config
+ */
// update config to reflect last changes
ReadConfig();
break;