diff options
Diffstat (limited to 'Swiften/Client/CoreClient.cpp')
-rw-r--r-- | Swiften/Client/CoreClient.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index c2f8fd7..3d75d8b 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -1,47 +1,46 @@ /* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Client/CoreClient.h> #include <memory> #include <boost/bind.hpp> #include <boost/optional.hpp> #include <Swiften/Base/Algorithm.h> #include <Swiften/Base/IDGenerator.h> #include <Swiften/Base/Log.h> -#include <Swiften/Base/foreach.h> #include <Swiften/Client/ClientSession.h> #include <Swiften/Client/ClientSessionStanzaChannel.h> #include <Swiften/Network/ChainedConnector.h> #include <Swiften/Network/DomainNameResolveError.h> #include <Swiften/Network/HTTPConnectProxiedConnectionFactory.h> #include <Swiften/Network/NetworkFactories.h> #include <Swiften/Network/ProxyProvider.h> #include <Swiften/Network/SOCKS5ProxiedConnectionFactory.h> #include <Swiften/Queries/IQRouter.h> #include <Swiften/Session/BOSHSessionStream.h> #include <Swiften/Session/BasicSessionStream.h> #include <Swiften/TLS/CertificateVerificationError.h> #include <Swiften/TLS/PKCS12Certificate.h> #include <Swiften/TLS/TLSError.h> namespace Swift { CoreClient::CoreClient(const JID& jid, const SafeByteArray& password, NetworkFactories* networkFactories) : jid_(jid), password_(password), networkFactories(networkFactories), disconnectRequested_(false), certificateTrustChecker(nullptr) { stanzaChannel_ = new ClientSessionStanzaChannel(); stanzaChannel_->onMessageReceived.connect(boost::bind(&CoreClient::handleMessageReceived, this, _1)); stanzaChannel_->onPresenceReceived.connect(boost::bind(&CoreClient::handlePresenceReceived, this, _1)); stanzaChannel_->onStanzaAcked.connect(boost::bind(&CoreClient::handleStanzaAcked, this, _1)); stanzaChannel_->onAvailableChanged.connect(boost::bind(&CoreClient::handleStanzaChannelAvailableChanged, this, _1)); iqRouter_ = new IQRouter(stanzaChannel_); iqRouter_->setJID(jid); } CoreClient::~CoreClient() { forceReset(); @@ -416,61 +415,61 @@ bool CoreClient::isAvailable() const { } bool CoreClient::getStreamManagementEnabled() const { return stanzaChannel_->getStreamManagementEnabled(); } bool CoreClient::isStreamEncrypted() const { return sessionStream_->isTLSEncrypted(); } StanzaChannel* CoreClient::getStanzaChannel() const { return stanzaChannel_; } const JID& CoreClient::getJID() const { if (session_) { return session_->getLocalJID(); } else { return jid_; } } void CoreClient::purgePassword() { safeClear(password_); } void CoreClient::resetConnector() { connector_->onConnectFinished.disconnect(boost::bind(&CoreClient::handleConnectorFinished, this, _1, _2)); connector_.reset(); - foreach(ConnectionFactory* f, proxyConnectionFactories) { + for (auto f : proxyConnectionFactories) { delete f; } proxyConnectionFactories.clear(); } void CoreClient::resetSession() { session_->onFinished.disconnect(boost::bind(&CoreClient::handleSessionFinished, this, _1)); session_->onNeedCredentials.disconnect(boost::bind(&CoreClient::handleNeedCredentials, this)); sessionStream_->onDataRead.disconnect(boost::bind(&CoreClient::handleDataRead, this, _1)); sessionStream_->onDataWritten.disconnect(boost::bind(&CoreClient::handleDataWritten, this, _1)); if (connection_) { connection_->disconnect(); } else if (std::dynamic_pointer_cast<BOSHSessionStream>(sessionStream_)) { sessionStream_->close(); } sessionStream_.reset(); connection_.reset(); } void CoreClient::forceReset() { if (connector_) { SWIFT_LOG(warning) << "Client not disconnected properly: Connector still active" << std::endl; resetConnector(); } if (sessionStream_ || connection_) { SWIFT_LOG(warning) << "Client not disconnected properly: Session still active" << std::endl; resetSession(); |