summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-13 16:06:28 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-13 16:12:39 (GMT)
commita03cedb3942e4c7c90e62fe9a73c6d15e38fbb68 (patch)
treea6fc45bd8177cefaddf416881d3fb28b161ea04f
parent645876deedb72aa8ebd2a56773f7dd5bb0133b71 (diff)
downloadswift-a03cedb3942e4c7c90e62fe9a73c6d15e38fbb68.zip
swift-a03cedb3942e4c7c90e62fe9a73c6d15e38fbb68.tar.bz2
Privatize GConfProxyProvider in UnixProxyProvider.
-rw-r--r--Swiften/Network/UnixProxyProvider.cpp34
-rw-r--r--Swiften/Network/UnixProxyProvider.h13
2 files changed, 28 insertions, 19 deletions
diff --git a/Swiften/Network/UnixProxyProvider.cpp b/Swiften/Network/UnixProxyProvider.cpp
index 04c95e4..7790ad8 100644
--- a/Swiften/Network/UnixProxyProvider.cpp
+++ b/Swiften/Network/UnixProxyProvider.cpp
@@ -10,25 +10,33 @@
#include <Swiften/Base/foreach.h>
#include <Swiften/Network/UnixProxyProvider.h>
+#if defined(HAVE_GCONF)
+# include "Swiften/Network/GConfProxyProvider.h"
+#endif
namespace Swift {
UnixProxyProvider::UnixProxyProvider() :
-#if defined(HAVE_GCONF)
- gconfProxyProvider(),
-#endif
+ gconfProxyProvider(0),
environmentProxyProvider()
{
+#if defined(HAVE_GCONF)
+ gconfProxyProvider = new GConfProxyProvider();
+#endif
+}
+
+UnixProxyProvider::~UnixProxyProvider() {
+ delete gconfProxyProvider;
}
HostAddressPort UnixProxyProvider::getSOCKS5Proxy() const {
HostAddressPort proxy;
-#if defined(HAVE_GCONF)
- proxy = gconfProxyProvider.getSOCKS5Proxy();
- if(proxy.isValid()) {
- return proxy;
+ if (gconfProxyProvider) {
+ proxy = gconfProxyProvider.getSOCKS5Proxy();
+ if(proxy.isValid()) {
+ return proxy;
+ }
}
-#endif
proxy = environmentProxyProvider.getSOCKS5Proxy();
if(proxy.isValid()) {
return proxy;
@@ -38,12 +46,12 @@ HostAddressPort UnixProxyProvider::getSOCKS5Proxy() const {
HostAddressPort UnixProxyProvider::getHTTPConnectProxy() const {
HostAddressPort proxy;
-#if defined(HAVE_GCONF)
- proxy = gconfProxyProvider.getHTTPConnectProxy();
- if(proxy.isValid()) {
- return proxy;
+ if (gconfProxyProvider) {
+ proxy = gconfProxyProvider.getHTTPConnectProxy();
+ if(proxy.isValid()) {
+ return proxy;
+ }
}
-#endif
proxy = environmentProxyProvider.getHTTPConnectProxy();
if(proxy.isValid()) {
return proxy;
diff --git a/Swiften/Network/UnixProxyProvider.h b/Swiften/Network/UnixProxyProvider.h
index 8657a95..37a4d05 100644
--- a/Swiften/Network/UnixProxyProvider.h
+++ b/Swiften/Network/UnixProxyProvider.h
@@ -5,21 +5,22 @@
*/
#pragma once
-#if defined(HAVE_GCONF)
-# include "Swiften/Network/GConfProxyProvider.h"
-#endif
+
#include <Swiften/Network/EnvironmentProxyProvider.h>
namespace Swift {
+ class GConfProxyProvider;
+
class UnixProxyProvider : public ProxyProvider {
public:
UnixProxyProvider();
+ ~UnixProxyProvider();
+
virtual HostAddressPort getHTTPConnectProxy() const;
virtual HostAddressPort getSOCKS5Proxy() const;
+
private:
-#if defined(HAVE_GCONF)
- GConfProxyProvider gconfProxyProvider;
-#endif
+ GConfProxyProvider* gconfProxyProvider;
EnvironmentProxyProvider environmentProxyProvider;
};
}