summaryrefslogtreecommitdiff
path: root/client/Dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/Dialog.cpp')
-rw-r--r--client/Dialog.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/client/Dialog.cpp b/client/Dialog.cpp
index e996add..de421dd 100644
--- a/client/Dialog.cpp
+++ b/client/Dialog.cpp
@@ -168,6 +168,26 @@ void ProxyDialog::ProxyToggled(bool on)
if (on)
{
vector<Proxy> active = proxifier->GetActiveProxies();
+
+ // check if we are going to add another http/https proxy
+ if (active.size() != 0)
+ {
+ bool isHttp = (stricmp(proxy->type.c_str(), "http") == 0);
+ for (unsigned i = 0; i < active.size(); i++)
+ {
+ if (isHttp && (stricmp(active[i].type.c_str(), "http") == 0))
+ {
+ QMessageBox otherHttpProxy;
+ otherHttpProxy.setText("Two HTTP proxy in one chain are not allowed");
+ otherHttpProxy.setWindowTitle("Information");
+ otherHttpProxy.setStandardButtons(QMessageBox::Ok);
+ otherHttpProxy.setIcon(QMessageBox::Information);
+ otherHttpProxy.exec();
+ return;
+ }
+ }
+ }
+
for (unsigned i = 0; i < active.size(); i++)
{
ProxyEntryGeneric* genProxy = cfg->GetGenericProxy(active[i].host, active[i].port);
@@ -197,11 +217,34 @@ void ProxyDialog::StaticProxyToggled(bool on)
Logger::Error("Static proxy with name '%s' was not found\n", proxyName.toStdString().c_str());
return;
}
+
Proxifier *proxifier = Proxifier::GetInstance();
if (!proxifier->IsValid())
{
Logger::Fatal("No valid proxifier configuration file found!\n");
}
+
+ // check if we are going to add another http proxy
+ vector<Proxy> active = proxifier->GetActiveProxies();
+ if (on && (active.size() != 0))
+ {
+ bool isHttp = (stricmp(proxy->type.c_str(), "http") == 0);
+ for (unsigned i = 0; i < active.size(); i++)
+ {
+ if (isHttp && (stricmp(active[i].type.c_str(), "http") == 0))
+ {
+ //QString msg = QString::fromLocal8Bit(cfg->ConfigLoadedMsg.c_str());
+ QMessageBox otherHttpProxy;
+ otherHttpProxy.setText("Two HTTP proxy in one chain are not allowed");
+ otherHttpProxy.setWindowTitle("Information");
+ otherHttpProxy.setStandardButtons(QMessageBox::Ok);
+ otherHttpProxy.setIcon(QMessageBox::Information);
+ otherHttpProxy.exec();
+ return;
+ }
+ }
+ }
+
if (on)
{
proxifier->TurnProxyOn(*proxy);