summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Base/Platform.h4
-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
6 files changed, 79 insertions, 27 deletions
diff --git a/Swiften/Base/Platform.h b/Swiften/Base/Platform.h
index 6cdb667..395747c 100644
--- a/Swiften/Base/Platform.h
+++ b/Swiften/Base/Platform.h
@@ -25,6 +25,10 @@
#define SWIFTEN_PLATFORM_BEOS
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
#define SWIFTEN_PLATFORM_MACOSX
+#include <TargetConditionals.h>
+# if defined(TARGET_OS_IPHONE)
+# define SWIFTEN_PLATFORM_IPHONE
+# endif
#elif defined(__IBMCPP__) || defined(_AIX)
#define SWIFTEN_PLATFORM_AIX
#elif defined(__amigaos__)
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) :