summaryrefslogtreecommitdiff
path: root/client/Proxifier.cpp
diff options
context:
space:
mode:
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;