summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-04-19 09:20:46 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-04-19 12:33:41 (GMT)
commit32444b8b7cff886e79579891a82bf70aab6f207a (patch)
treef9d6f6f08ae766183ba29a06115142019d6213a0 /Swiften/Network
parent8ec81c322186e7ac0f053061ee61d5e371417efb (diff)
downloadswift-contrib-32444b8b7cff886e79579891a82bf70aab6f207a.zip
swift-contrib-32444b8b7cff886e79579891a82bf70aab6f207a.tar.bz2
Fixed OS X ProxyProvider compilation.
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/MacOSXProxyProvider.cpp55
-rw-r--r--Swiften/Network/MacOSXProxyProvider.h5
-rw-r--r--Swiften/Network/NullProxyProvider.cpp20
-rw-r--r--Swiften/Network/NullProxyProvider.h19
-rw-r--r--Swiften/Network/SConscript3
5 files changed, 75 insertions, 27 deletions
diff --git a/Swiften/Network/MacOSXProxyProvider.cpp b/Swiften/Network/MacOSXProxyProvider.cpp
index babcc7f..cd994e1 100644
--- a/Swiften/Network/MacOSXProxyProvider.cpp
+++ b/Swiften/Network/MacOSXProxyProvider.cpp
@@ -4,35 +4,21 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+#include <Swiften/Base/Platform.h>
+#include <Swiften/Network/MacOSXProxyProvider.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <utility>
-#include "Swiften/Network/MacOSXProxyProvider.h"
+#ifdef SWIFTEN_PLATFORM_IPHONE
#include <SystemConfiguration/SystemConfiguration.h>
+#endif
-namespace Swift {
-
-MacOSXProxyProvider::MacOSXProxyProvider()
-: ProxyProvider()
-{
- CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL);
- if(proxies != NULL) {
- socksProxy = getFromDictionary(proxies, kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort);
- httpProxy = getFromDictionary(proxies, kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort);
- }
-}
-
-HostAddressPort MacOSXProxyProvider::getHTTPConnectProxy() const {
- return httpProxy;
-}
-HostAddressPort MacOSXProxyProvider::getSOCKS5Proxy() const {
- return socksProxy;
-}
-
-HostAddressPort MacOSXProxyProvider::getFromDictionary(CFDictionaryRef dict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey) {
+#ifndef SWIFTEN_PLATFORM_IPHONE
+static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey) {
CFNumberRef numberValue = NULL;
HostAddressPort ret = HostAddressPort(HostAddress(), 0);
@@ -79,5 +65,32 @@ HostAddressPort MacOSXProxyProvider::getFromDictionary(CFDictionaryRef dict, CFS
}
return ret;
}
+#endif
+namespace Swift {
+
+MacOSXProxyProvider::MacOSXProxyProvider() {
+}
+
+HostAddressPort MacOSXProxyProvider::getHTTPConnectProxy() const {
+ HostAddressPort result;
+#ifndef SWIFTEN_PLATFORM_IPHONE
+ CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL);
+ if(proxies != NULL) {
+ result = getFromDictionary(proxies, kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort);
+ }
+#endif
+ return result;
+}
+
+HostAddressPort MacOSXProxyProvider::getSOCKS5Proxy() const {
+ HostAddressPort result;
+#ifndef SWIFTEN_PLATFORM_IPHONE
+ CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL);
+ if(proxies != NULL) {
+ result = getFromDictionary(proxies, kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort);
+ }
+#endif
+ return result;
+}
}
diff --git a/Swiften/Network/MacOSXProxyProvider.h b/Swiften/Network/MacOSXProxyProvider.h
index 1cb001f..5e7ff8a 100644
--- a/Swiften/Network/MacOSXProxyProvider.h
+++ b/Swiften/Network/MacOSXProxyProvider.h
@@ -14,10 +14,5 @@ namespace Swift {
MacOSXProxyProvider();
virtual HostAddressPort getHTTPConnectProxy() const;
virtual HostAddressPort getSOCKS5Proxy() const;
-
- private:
- HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabledKey, CFStringRef hostKey, CFStringRef portKey);
- HostAddressPort socksProxy;
- HostAddressPort httpProxy;
};
}
diff --git a/Swiften/Network/NullProxyProvider.cpp b/Swiften/Network/NullProxyProvider.cpp
new file mode 100644
index 0000000..3b9d94d
--- /dev/null
+++ b/Swiften/Network/NullProxyProvider.cpp
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Network/NullProxyProvider.h>
+
+using namespace Swift;
+
+NullProxyProvider::NullProxyProvider() {
+}
+
+HostAddressPort NullProxyProvider::getHTTPConnectProxy() const {
+ return HostAddressPort();
+}
+
+HostAddressPort NullProxyProvider::getSOCKS5Proxy() const {
+ return HostAddressPort();
+}
diff --git a/Swiften/Network/NullProxyProvider.h b/Swiften/Network/NullProxyProvider.h
new file mode 100644
index 0000000..544bea2
--- /dev/null
+++ b/Swiften/Network/NullProxyProvider.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Network/ProxyProvider.h>
+
+namespace Swift {
+ class NullProxyProvider : public ProxyProvider {
+ public:
+ NullProxyProvider();
+
+ virtual HostAddressPort getHTTPConnectProxy() const;
+ virtual HostAddressPort getSOCKS5Proxy() const;
+ };
+}
diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript
index ecfc66a..183d09c 100644
--- a/Swiften/Network/SConscript
+++ b/Swiften/Network/SConscript
@@ -37,7 +37,8 @@ sourceList = [
"BoostNetworkFactories.cpp",
"Timer.cpp",
"BoostTimer.cpp",
- "ProxyProvider.cpp"
+ "ProxyProvider.cpp",
+ "NullProxyProvider.cpp"
]
if myenv.get("HAVE_CARES", False) :