summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Hudson <nick.hudson@isode.com>2014-02-07 16:33:32 (GMT)
committerKevin Smith <git@kismith.co.uk>2014-03-22 22:17:19 (GMT)
commit0bb2f5b6e811842c52500eef6685cc64367bd611 (patch)
tree744b5c8d2ee6e873fecb282ac9e79f65acf75b22 /Swiften/Client
parent01a76f36fe0e2ad5ea778a3ece63f39866c50362 (diff)
downloadswift-contrib-0bb2f5b6e811842c52500eef6685cc64367bd611.zip
swift-contrib-0bb2f5b6e811842c52500eef6685cc64367bd611.tar.bz2
Move hardcoded XMPP SRV information from Connector into CoreClient
The Connector class had "_xmpp-client._tcp." hard-coded in it, which meant that it was not suitable for non-XMPP clients. This change means that the Connector can now be used by clients who are interested in arbitrary SRV records; the CoreClient class is updated accordingly. Test-information: Built and ran Swift - seems to work as expected Ran unit-tests ("scons test=unit") - reports OK Change-Id: I0fea9aa90f5d1d5e3a4b90f3362b663fe9d8e207
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/CoreClient.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index 4438135..f6a3bb8 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2011 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -7,6 +7,7 @@
#include <Swiften/Client/CoreClient.h>
#include <boost/bind.hpp>
+#include <boost/optional.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/IDGenerator.h>
@@ -108,9 +109,13 @@ void CoreClient::connect(const ClientOptions& o) {
// Create connector
std::string host = o.manualHostname.empty() ? jid_.getDomain() : o.manualHostname;
int port = o.manualPort;
+ boost::optional<std::string> serviceLookupPrefix;
+ if (o.manualHostname.empty()) {
+ serviceLookupPrefix = "_xmpp-client._tcp.";
+ }
assert(!connector_);
if (options.boshURL.isEmpty()) {
- connector_ = boost::make_shared<ChainedConnector>(host, port, o.manualHostname.empty(), networkFactories->getDomainNameResolver(), connectionFactories, networkFactories->getTimerFactory());
+ connector_ = boost::make_shared<ChainedConnector>(host, port, serviceLookupPrefix, networkFactories->getDomainNameResolver(), connectionFactories, networkFactories->getTimerFactory());
connector_->onConnectFinished.connect(boost::bind(&CoreClient::handleConnectorFinished, this, _1, _2));
connector_->setTimeoutMilliseconds(2*60*1000);
connector_->start();