summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-01 17:23:49 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-04 08:28:23 (GMT)
commit741c45b74d5f634622eb5f757c49323274fb8937 (patch)
treeb9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swiften/Client
parenteddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff)
downloadswift-741c45b74d5f634622eb5f757c49323274fb8937.zip
swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed' replacement calls to all source files: 's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g' 's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g' 's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g' 's/boost::make_shared/std::make_shared/g' 's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g' 's/boost::shared_ptr/std::shared_ptr/g' 's/boost::weak_ptr/std::weak_ptr/g' 's/boost::enable_shared_from_this/std::enable_shared_from_this/g' The remaining issues have been fixed manually. Test-Information: Code builds on OS X 10.11.4 and unit tests pass. Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/Client.h6
-rw-r--r--Swiften/Client/ClientBlockListManager.cpp42
-rw-r--r--Swiften/Client/ClientBlockListManager.h14
-rw-r--r--Swiften/Client/ClientError.h11
-rw-r--r--Swiften/Client/ClientOptions.h4
-rw-r--r--Swiften/Client/ClientSession.cpp78
-rw-r--r--Swiften/Client/ClientSession.h40
-rw-r--r--Swiften/Client/ClientSessionStanzaChannel.cpp24
-rw-r--r--Swiften/Client/ClientSessionStanzaChannel.h22
-rw-r--r--Swiften/Client/CoreClient.cpp29
-rw-r--r--Swiften/Client/CoreClient.h33
-rw-r--r--Swiften/Client/DummyStanzaChannel.h24
-rw-r--r--Swiften/Client/NickResolver.cpp3
-rw-r--r--Swiften/Client/NickResolver.h3
-rw-r--r--Swiften/Client/StanzaChannel.h12
-rw-r--r--Swiften/Client/UnitTest/BlockListImplTest.cpp6
-rw-r--r--Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp18
-rw-r--r--Swiften/Client/UnitTest/ClientSessionTest.cpp152
-rw-r--r--Swiften/Client/UnitTest/NickResolverTest.cpp4
19 files changed, 262 insertions, 263 deletions
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h
index 7763745..9c51065 100644
--- a/Swiften/Client/Client.h
+++ b/Swiften/Client/Client.h
@@ -93,12 +93,12 @@ namespace Swift {
/**
* Returns the last received presence for the given (full) JID.
*/
- boost::shared_ptr<Presence> getLastPresence(const JID& jid) const;
+ std::shared_ptr<Presence> getLastPresence(const JID& jid) const;
/**
* Returns the presence with the highest priority received for the given JID.
*/
- boost::shared_ptr<Presence> getHighestPriorityPresence(const JID& bareJID) const;
+ std::shared_ptr<Presence> getHighestPriorityPresence(const JID& bareJID) const;
PresenceOracle* getPresenceOracle() const {
return presenceOracle;
@@ -169,7 +169,7 @@ namespace Swift {
/**
* This signal is emitted when a JID changes presence.
*/
- boost::signal<void (boost::shared_ptr<Presence>)> onPresenceChange;
+ boost::signal<void (std::shared_ptr<Presence>)> onPresenceChange;
private:
Storages* getStorages() const;
diff --git a/Swiften/Client/ClientBlockListManager.cpp b/Swiften/Client/ClientBlockListManager.cpp
index 84a5639..bfdec30 100644
--- a/Swiften/Client/ClientBlockListManager.cpp
+++ b/Swiften/Client/ClientBlockListManager.cpp
@@ -7,9 +7,9 @@
#include <Swiften/Client/ClientBlockListManager.h>
#include <cassert>
+#include <memory>
#include <boost/bind.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Client/BlockListImpl.h>
@@ -18,15 +18,15 @@ using namespace Swift;
namespace {
class BlockResponder : public SetResponder<BlockPayload> {
public:
- BlockResponder(boost::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<BlockPayload>(iqRouter), blockList(blockList) {
+ BlockResponder(std::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<BlockPayload>(iqRouter), blockList(blockList) {
}
- virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<BlockPayload> payload) {
+ virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<BlockPayload> payload) {
if (getIQRouter()->isAccountJID(from)) {
if (payload) {
blockList->addItems(payload->getItems());
}
- sendResponse(from, id, boost::shared_ptr<BlockPayload>());
+ sendResponse(from, id, std::shared_ptr<BlockPayload>());
}
else {
sendError(from, id, ErrorPayload::NotAuthorized, ErrorPayload::Cancel);
@@ -35,15 +35,15 @@ namespace {
}
private:
- boost::shared_ptr<BlockListImpl> blockList;
+ std::shared_ptr<BlockListImpl> blockList;
};
class UnblockResponder : public SetResponder<UnblockPayload> {
public:
- UnblockResponder(boost::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<UnblockPayload>(iqRouter), blockList(blockList) {
+ UnblockResponder(std::shared_ptr<BlockListImpl> blockList, IQRouter* iqRouter) : SetResponder<UnblockPayload>(iqRouter), blockList(blockList) {
}
- virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, boost::shared_ptr<UnblockPayload> payload) {
+ virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, std::shared_ptr<UnblockPayload> payload) {
if (getIQRouter()->isAccountJID(from)) {
if (payload) {
if (payload->getItems().empty()) {
@@ -53,7 +53,7 @@ namespace {
blockList->removeItems(payload->getItems());
}
}
- sendResponse(from, id, boost::shared_ptr<UnblockPayload>());
+ sendResponse(from, id, std::shared_ptr<UnblockPayload>());
}
else {
sendError(from, id, ErrorPayload::NotAuthorized, ErrorPayload::Cancel);
@@ -62,7 +62,7 @@ namespace {
}
private:
- boost::shared_ptr<BlockListImpl> blockList;
+ std::shared_ptr<BlockListImpl> blockList;
};
}
@@ -77,20 +77,20 @@ ClientBlockListManager::~ClientBlockListManager() {
}
}
-boost::shared_ptr<BlockList> ClientBlockListManager::getBlockList() {
+std::shared_ptr<BlockList> ClientBlockListManager::getBlockList() {
if (!blockList) {
- blockList = boost::make_shared<BlockListImpl>();
+ blockList = std::make_shared<BlockListImpl>();
blockList->setState(BlockList::Init);
}
return blockList;
}
-boost::shared_ptr<BlockList> ClientBlockListManager::requestBlockList() {
+std::shared_ptr<BlockList> ClientBlockListManager::requestBlockList() {
if (!blockList) {
- blockList = boost::make_shared<BlockListImpl>();
+ blockList = std::make_shared<BlockListImpl>();
}
blockList->setState(BlockList::Requesting);
- boost::shared_ptr<GenericRequest<BlockListPayload> > getRequest = boost::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), boost::make_shared<BlockListPayload>(), iqRouter);
+ std::shared_ptr<GenericRequest<BlockListPayload> > getRequest = std::make_shared< GenericRequest<BlockListPayload> >(IQ::Get, JID(), std::make_shared<BlockListPayload>(), iqRouter);
getRequest->onResponse.connect(boost::bind(&ClientBlockListManager::handleBlockListReceived, this, _1, _2));
getRequest->send();
return blockList;
@@ -101,8 +101,8 @@ GenericRequest<BlockPayload>::ref ClientBlockListManager::createBlockJIDRequest(
}
GenericRequest<BlockPayload>::ref ClientBlockListManager::createBlockJIDsRequest(const std::vector<JID>& jids) {
- boost::shared_ptr<BlockPayload> payload = boost::make_shared<BlockPayload>(jids);
- return boost::make_shared< GenericRequest<BlockPayload> >(IQ::Set, JID(), payload, iqRouter);
+ std::shared_ptr<BlockPayload> payload = std::make_shared<BlockPayload>(jids);
+ return std::make_shared< GenericRequest<BlockPayload> >(IQ::Set, JID(), payload, iqRouter);
}
GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDRequest(const JID& jid) {
@@ -110,8 +110,8 @@ GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDRequ
}
GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockJIDsRequest(const std::vector<JID>& jids) {
- boost::shared_ptr<UnblockPayload> payload = boost::make_shared<UnblockPayload>(jids);
- return boost::make_shared< GenericRequest<UnblockPayload> >(IQ::Set, JID(), payload, iqRouter);
+ std::shared_ptr<UnblockPayload> payload = std::make_shared<UnblockPayload>(jids);
+ return std::make_shared< GenericRequest<UnblockPayload> >(IQ::Set, JID(), payload, iqRouter);
}
GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockAllRequest() {
@@ -119,7 +119,7 @@ GenericRequest<UnblockPayload>::ref ClientBlockListManager::createUnblockAllRequ
}
-void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockListPayload> payload, ErrorPayload::ref error) {
+void ClientBlockListManager::handleBlockListReceived(std::shared_ptr<BlockListPayload> payload, ErrorPayload::ref error) {
if (error || !payload) {
blockList->setState(BlockList::Error);
}
@@ -127,11 +127,11 @@ void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockList
blockList->setItems(payload->getItems());
blockList->setState(BlockList::Available);
if (!blockResponder) {
- blockResponder = boost::make_shared<BlockResponder>(blockList, iqRouter);
+ blockResponder = std::make_shared<BlockResponder>(blockList, iqRouter);
blockResponder->start();
}
if (!unblockResponder) {
- unblockResponder = boost::make_shared<UnblockResponder>(blockList, iqRouter);
+ unblockResponder = std::make_shared<UnblockResponder>(blockList, iqRouter);
unblockResponder->start();
}
}
diff --git a/Swiften/Client/ClientBlockListManager.h b/Swiften/Client/ClientBlockListManager.h
index 63ff1cd..44e3ee1 100644
--- a/Swiften/Client/ClientBlockListManager.h
+++ b/Swiften/Client/ClientBlockListManager.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -30,12 +30,12 @@ namespace Swift {
/**
* Returns the blocklist.
*/
- boost::shared_ptr<BlockList> getBlockList();
+ std::shared_ptr<BlockList> getBlockList();
/**
* Get the blocklist from the server.
*/
- boost::shared_ptr<BlockList> requestBlockList();
+ std::shared_ptr<BlockList> requestBlockList();
GenericRequest<BlockPayload>::ref createBlockJIDRequest(const JID& jid);
GenericRequest<BlockPayload>::ref createBlockJIDsRequest(const std::vector<JID>& jids);
@@ -45,13 +45,13 @@ namespace Swift {
GenericRequest<UnblockPayload>::ref createUnblockAllRequest();
private:
- void handleBlockListReceived(boost::shared_ptr<BlockListPayload> payload, ErrorPayload::ref);
+ void handleBlockListReceived(std::shared_ptr<BlockListPayload> payload, ErrorPayload::ref);
private:
IQRouter* iqRouter;
- boost::shared_ptr<SetResponder<BlockPayload> > blockResponder;
- boost::shared_ptr<SetResponder<UnblockPayload> > unblockResponder;
- boost::shared_ptr<BlockListImpl> blockList;
+ std::shared_ptr<SetResponder<BlockPayload> > blockResponder;
+ std::shared_ptr<SetResponder<UnblockPayload> > unblockResponder;
+ std::shared_ptr<BlockListImpl> blockList;
};
}
diff --git a/Swiften/Client/ClientError.h b/Swiften/Client/ClientError.h
index 5ae1086..3453611 100644
--- a/Swiften/Client/ClientError.h
+++ b/Swiften/Client/ClientError.h
@@ -1,12 +1,13 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
+
#include <boost/system/system_error.hpp>
namespace Swift {
@@ -54,12 +55,12 @@ namespace Swift {
Type getType() const { return type_; }
- void setErrorCode(boost::shared_ptr<boost::system::error_code> errorCode) { errorCode_ = errorCode; }
+ void setErrorCode(std::shared_ptr<boost::system::error_code> errorCode) { errorCode_ = errorCode; }
- boost::shared_ptr<boost::system::error_code> getErrorCode() const { return errorCode_; }
+ std::shared_ptr<boost::system::error_code> getErrorCode() const { return errorCode_; }
private:
Type type_;
- boost::shared_ptr<boost::system::error_code> errorCode_;
+ std::shared_ptr<boost::system::error_code> errorCode_;
};
}
diff --git a/Swiften/Client/ClientOptions.h b/Swiften/Client/ClientOptions.h
index c902388..3a93197 100644
--- a/Swiften/Client/ClientOptions.h
+++ b/Swiften/Client/ClientOptions.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/SafeString.h>
@@ -152,7 +152,7 @@ namespace Swift {
* This can be initialized with a custom HTTPTrafficFilter, which allows HTTP CONNECT
* proxy initialization to be customized.
*/
- boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter;
+ std::shared_ptr<HTTPTrafficFilter> httpTrafficFilter;
/**
* Options passed to the TLS stack
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index 1b67c96..c301881 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -10,7 +10,7 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
+#include <memory>
#include <Swiften/Base/Platform.h>
#include <Swiften/Base/Log.h>
@@ -57,7 +57,7 @@ namespace Swift {
ClientSession::ClientSession(
const JID& jid,
- boost::shared_ptr<SessionStream> stream,
+ std::shared_ptr<SessionStream> stream,
IDNConverter* idnConverter,
CryptoProvider* crypto) :
localJID(jid),
@@ -104,7 +104,7 @@ void ClientSession::sendStreamHeader() {
stream->writeHeader(header);
}
-void ClientSession::sendStanza(boost::shared_ptr<Stanza> stanza) {
+void ClientSession::sendStanza(std::shared_ptr<Stanza> stanza) {
stream->writeElement(stanza);
if (stanzaAckRequester_) {
stanzaAckRequester_->handleStanzaSent(stanza);
@@ -116,17 +116,17 @@ void ClientSession::handleStreamStart(const ProtocolHeader&) {
state = Negotiating;
}
-void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
- if (boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element)) {
+void ClientSession::handleElement(std::shared_ptr<ToplevelElement> element) {
+ if (std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element)) {
if (stanzaAckResponder_) {
stanzaAckResponder_->handleStanzaReceived();
}
if (getState() == Initialized) {
onStanzaReceived(stanza);
}
- else if (boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(element)) {
+ else if (std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(element)) {
if (state == BindingResource) {
- boost::shared_ptr<ResourceBind> resourceBind(iq->getPayload<ResourceBind>());
+ std::shared_ptr<ResourceBind> resourceBind(iq->getPayload<ResourceBind>());
if (iq->getType() == IQ::Error && iq->getID() == "session-bind") {
finishSession(Error::ResourceBindError);
}
@@ -162,12 +162,12 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
}
}
}
- else if (boost::dynamic_pointer_cast<StanzaAckRequest>(element)) {
+ else if (std::dynamic_pointer_cast<StanzaAckRequest>(element)) {
if (stanzaAckResponder_) {
stanzaAckResponder_->handleAckRequestReceived();
}
}
- else if (boost::shared_ptr<StanzaAck> ack = boost::dynamic_pointer_cast<StanzaAck>(element)) {
+ else if (std::shared_ptr<StanzaAck> ack = std::dynamic_pointer_cast<StanzaAck>(element)) {
if (stanzaAckRequester_) {
if (ack->isValid()) {
stanzaAckRequester_->handleAckReceived(ack->getHandledStanzasCount());
@@ -180,11 +180,11 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
SWIFT_LOG(warning) << "Ignoring ack";
}
}
- else if (StreamError::ref streamError = boost::dynamic_pointer_cast<StreamError>(element)) {
+ else if (StreamError::ref streamError = std::dynamic_pointer_cast<StreamError>(element)) {
finishSession(Error::StreamError);
}
else if (getState() == Initialized) {
- boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element);
+ std::shared_ptr<Stanza> stanza = std::dynamic_pointer_cast<Stanza>(element);
if (stanza) {
if (stanzaAckResponder_) {
stanzaAckResponder_->handleStanzaReceived();
@@ -197,14 +197,14 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
if (streamFeatures->hasStartTLS() && stream->supportsTLSEncryption() && useTLS != NeverUseTLS) {
state = WaitingForEncrypt;
- stream->writeElement(boost::make_shared<StartTLSRequest>());
+ stream->writeElement(std::make_shared<StartTLSRequest>());
}
else if (useTLS == RequireTLS && !stream->isTLSEncrypted()) {
finishSession(Error::NoSupportedAuthMechanismsError);
}
else if (useStreamCompression && stream->supportsZLibCompression() && streamFeatures->hasCompressionMethod("zlib")) {
state = Compressing;
- stream->writeElement(boost::make_shared<CompressRequest>("zlib"));
+ stream->writeElement(std::make_shared<CompressRequest>("zlib"));
}
else if (streamFeatures->hasAuthenticationMechanisms()) {
#ifdef SWIFTEN_PLATFORM_WIN32
@@ -217,13 +217,13 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
}
else {
WindowsGSSAPIClientAuthenticator* gssapiAuthenticator = new WindowsGSSAPIClientAuthenticator(*authenticationHostname, localJID.getDomain(), authenticationPort);
- boost::shared_ptr<Error> error = boost::make_shared<Error>(Error::AuthenticationFailedError);
+ std::shared_ptr<Error> error = std::make_shared<Error>(Error::AuthenticationFailedError);
authenticator = gssapiAuthenticator;
if (!gssapiAuthenticator->isError()) {
state = Authenticating;
- stream->writeElement(boost::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse()));
+ stream->writeElement(std::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse()));
}
else {
error->errorCode = gssapiAuthenticator->getErrorCode();
@@ -237,7 +237,7 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
if (streamFeatures->hasAuthenticationMechanism("EXTERNAL")) {
authenticator = new EXTERNALClientAuthenticator();
state = Authenticating;
- stream->writeElement(boost::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray("")));
+ stream->writeElement(std::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray("")));
}
else {
finishSession(Error::TLSClientCertificateError);
@@ -246,7 +246,7 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
else if (streamFeatures->hasAuthenticationMechanism("EXTERNAL")) {
authenticator = new EXTERNALClientAuthenticator();
state = Authenticating;
- stream->writeElement(boost::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray("")));
+ stream->writeElement(std::make_shared<AuthRequest>("EXTERNAL", createSafeByteArray("")));
}
else if (streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1") || streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1-PLUS")) {
std::ostringstream s;
@@ -298,26 +298,26 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
}
}
}
- else if (boost::dynamic_pointer_cast<Compressed>(element)) {
+ else if (std::dynamic_pointer_cast<Compressed>(element)) {
CHECK_STATE_OR_RETURN(Compressing);
state = WaitingForStreamStart;
stream->addZLibCompression();
stream->resetXMPPParser();
sendStreamHeader();
}
- else if (boost::dynamic_pointer_cast<CompressFailure>(element)) {
+ else if (std::dynamic_pointer_cast<CompressFailure>(element)) {
finishSession(Error::CompressionFailedError);
}
- else if (boost::dynamic_pointer_cast<StreamManagementEnabled>(element)) {
- stanzaAckRequester_ = boost::make_shared<StanzaAckRequester>();
+ else if (std::dynamic_pointer_cast<StreamManagementEnabled>(element)) {
+ stanzaAckRequester_ = std::make_shared<StanzaAckRequester>();
stanzaAckRequester_->onRequestAck.connect(boost::bind(&ClientSession::requestAck, shared_from_this()));
stanzaAckRequester_->onStanzaAcked.connect(boost::bind(&ClientSession::handleStanzaAcked, shared_from_this(), _1));
- stanzaAckResponder_ = boost::make_shared<StanzaAckResponder>();
+ stanzaAckResponder_ = std::make_shared<StanzaAckResponder>();
stanzaAckResponder_->onAck.connect(boost::bind(&ClientSession::ack, shared_from_this(), _1));
needAcking = false;
continueSessionInitialization();
}
- else if (boost::dynamic_pointer_cast<StreamManagementFailed>(element)) {
+ else if (std::dynamic_pointer_cast<StreamManagementFailed>(element)) {
needAcking = false;
continueSessionInitialization();
}
@@ -325,11 +325,11 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
CHECK_STATE_OR_RETURN(Authenticating);
assert(authenticator);
if (authenticator->setChallenge(challenge->getValue())) {
- stream->writeElement(boost::make_shared<AuthResponse>(authenticator->getResponse()));
+ stream->writeElement(std::make_shared<AuthResponse>(authenticator->getResponse()));
}
#ifdef SWIFTEN_PLATFORM_WIN32
else if (WindowsGSSAPIClientAuthenticator* gssapiAuthenticator = dynamic_cast<WindowsGSSAPIClientAuthenticator*>(authenticator)) {
- boost::shared_ptr<Error> error = boost::make_shared<Error>(Error::AuthenticationFailedError);
+ std::shared_ptr<Error> error = std::make_shared<Error>(Error::AuthenticationFailedError);
error->errorCode = gssapiAuthenticator->getErrorCode();
finishSession(error);
@@ -374,7 +374,7 @@ void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
void ClientSession::continueSessionInitialization() {
if (needResourceBind) {
state = BindingResource;
- boost::shared_ptr<ResourceBind> resourceBind(boost::make_shared<ResourceBind>());
+ std::shared_ptr<ResourceBind> resourceBind(std::make_shared<ResourceBind>());
if (!localJID.getResource().empty()) {
resourceBind->setResource(localJID.getResource());
}
@@ -382,11 +382,11 @@ void ClientSession::continueSessionInitialization() {
}
else if (needAcking) {
state = EnablingSessionManagement;
- stream->writeElement(boost::make_shared<EnableStreamManagement>());
+ stream->writeElement(std::make_shared<EnableStreamManagement>());
}
else if (needSessionStart) {
state = StartingSession;
- sendStanza(IQ::createRequest(IQ::Set, JID(), "session-start", boost::make_shared<StartSession>()));
+ sendStanza(IQ::createRequest(IQ::Set, JID(), "session-start", std::make_shared<StartSession>()));
}
else {
state = Initialized;
@@ -407,14 +407,14 @@ void ClientSession::sendCredentials(const SafeByteArray& password) {
assert(authenticator);
state = Authenticating;
authenticator->setCredentials(localJID.getNode(), password);
- stream->writeElement(boost::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse()));
+ stream->writeElement(std::make_shared<AuthRequest>(authenticator->getName(), authenticator->getResponse()));
}
void ClientSession::handleTLSEncrypted() {
CHECK_STATE_OR_RETURN(Encrypting);
std::vector<Certificate::ref> certificateChain = stream->getPeerCertificateChain();
- boost::shared_ptr<CertificateVerificationError> verificationError = stream->getPeerCertificateVerificationError();
+ std::shared_ptr<CertificateVerificationError> verificationError = stream->getPeerCertificateVerificationError();
if (verificationError) {
checkTrustOrFinish(certificateChain, verificationError);
}
@@ -424,12 +424,12 @@ void ClientSession::handleTLSEncrypted() {
continueAfterTLSEncrypted();
}
else {
- checkTrustOrFinish(certificateChain, boost::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidServerIdentity));
+ checkTrustOrFinish(certificateChain, std::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidServerIdentity));
}
}
}
-void ClientSession::checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, boost::shared_ptr<CertificateVerificationError> error) {
+void ClientSession::checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, std::shared_ptr<CertificateVerificationError> error) {
if (certificateTrustChecker && certificateTrustChecker->isCertificateTrusted(certificateChain)) {
continueAfterTLSEncrypted();
}
@@ -444,7 +444,7 @@ void ClientSession::continueAfterTLSEncrypted() {
sendStreamHeader();
}
-void ClientSession::handleStreamClosed(boost::shared_ptr<Swift::Error> streamError) {
+void ClientSession::handleStreamClosed(std::shared_ptr<Swift::Error> streamError) {
State previousState = state;
state = Finished;
@@ -472,14 +472,14 @@ void ClientSession::handleStreamClosed(boost::shared_ptr<Swift::Error> streamErr
}
void ClientSession::finish() {
- finishSession(boost::shared_ptr<Error>());
+ finishSession(std::shared_ptr<Error>());
}
void ClientSession::finishSession(Error::Type error) {
- finishSession(boost::make_shared<Swift::ClientSession::Error>(error));
+ finishSession(std::make_shared<Swift::ClientSession::Error>(error));
}
-void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) {
+void ClientSession::finishSession(std::shared_ptr<Swift::Error> error) {
state = Finishing;
if (!error_) {
error_ = error;
@@ -500,15 +500,15 @@ void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) {
}
void ClientSession::requestAck() {
- stream->writeElement(boost::make_shared<StanzaAckRequest>());
+ stream->writeElement(std::make_shared<StanzaAckRequest>());
}
-void ClientSession::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) {
+void ClientSession::handleStanzaAcked(std::shared_ptr<Stanza> stanza) {
onStanzaAcked(stanza);
}
void ClientSession::ack(unsigned int handledStanzasCount) {
- stream->writeElement(boost::make_shared<StanzaAck>(handledStanzasCount));
+ stream->writeElement(std::make_shared<StanzaAck>(handledStanzasCount));
}
}
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h
index b1b6755..7309218 100644
--- a/Swiften/Client/ClientSession.h
+++ b/Swiften/Client/ClientSession.h
@@ -6,11 +6,9 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/Error.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -26,7 +24,7 @@ namespace Swift {
class IDNConverter;
class CryptoProvider;
- class SWIFTEN_API ClientSession : public boost::enable_shared_from_this<ClientSession> {
+ class SWIFTEN_API ClientSession : public std::enable_shared_from_this<ClientSession> {
public:
enum State {
Initial,
@@ -58,7 +56,7 @@ namespace Swift {
TLSError,
StreamError
} type;
- boost::shared_ptr<boost::system::error_code> errorCode;
+ std::shared_ptr<boost::system::error_code> errorCode;
Error(Type type) : type(type) {}
};
@@ -70,8 +68,8 @@ namespace Swift {
~ClientSession();
- static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) {
- return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream, idnConverter, crypto));
+ static std::shared_ptr<ClientSession> create(const JID& jid, std::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) {
+ return std::shared_ptr<ClientSession>(new ClientSession(jid, stream, idnConverter, crypto));
}
State getState() const {
@@ -121,7 +119,7 @@ namespace Swift {
}
void sendCredentials(const SafeByteArray& password);
- void sendStanza(boost::shared_ptr<Stanza>);
+ void sendStanza(std::shared_ptr<Stanza>);
void setCertificateTrustChecker(CertificateTrustChecker* checker) {
certificateTrustChecker = checker;
@@ -142,19 +140,19 @@ namespace Swift {
public:
boost::signal<void ()> onNeedCredentials;
boost::signal<void ()> onInitialized;
- boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished;
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived;
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked;
+ boost::signal<void (std::shared_ptr<Swift::Error>)> onFinished;
+ boost::signal<void (std::shared_ptr<Stanza>)> onStanzaReceived;
+ boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked;
private:
ClientSession(
const JID& jid,
- boost::shared_ptr<SessionStream>,
+ std::shared_ptr<SessionStream>,
IDNConverter* idnConverter,
CryptoProvider* crypto);
void finishSession(Error::Type error);
- void finishSession(boost::shared_ptr<Swift::Error> error);
+ void finishSession(std::shared_ptr<Swift::Error> error);
JID getRemoteJID() const {
return JID("", localJID.getDomain());
@@ -162,9 +160,9 @@ namespace Swift {
void sendStreamHeader();
- void handleElement(boost::shared_ptr<ToplevelElement>);
+ void handleElement(std::shared_ptr<ToplevelElement>);
void handleStreamStart(const ProtocolHeader&);
- void handleStreamClosed(boost::shared_ptr<Swift::Error>);
+ void handleStreamClosed(std::shared_ptr<Swift::Error>);
void handleTLSEncrypted();
@@ -172,15 +170,15 @@ namespace Swift {
void continueSessionInitialization();
void requestAck();
- void handleStanzaAcked(boost::shared_ptr<Stanza> stanza);
+ void handleStanzaAcked(std::shared_ptr<Stanza> stanza);
void ack(unsigned int handledStanzasCount);
void continueAfterTLSEncrypted();
- void checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, boost::shared_ptr<CertificateVerificationError> error);
+ void checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, std::shared_ptr<CertificateVerificationError> error);
private:
JID localJID;
State state;
- boost::shared_ptr<SessionStream> stream;
+ std::shared_ptr<SessionStream> stream;
IDNConverter* idnConverter;
CryptoProvider* crypto;
bool allowPLAINOverNonTLS;
@@ -192,9 +190,9 @@ namespace Swift {
bool needAcking;
bool rosterVersioningSupported;
ClientAuthenticator* authenticator;
- boost::shared_ptr<StanzaAckRequester> stanzaAckRequester_;
- boost::shared_ptr<StanzaAckResponder> stanzaAckResponder_;
- boost::shared_ptr<Swift::Error> error_;
+ std::shared_ptr<StanzaAckRequester> stanzaAckRequester_;
+ std::shared_ptr<StanzaAckResponder> stanzaAckResponder_;
+ std::shared_ptr<Swift::Error> error_;
CertificateTrustChecker* certificateTrustChecker;
bool singleSignOn;
int authenticationPort;
diff --git a/Swiften/Client/ClientSessionStanzaChannel.cpp b/Swiften/Client/ClientSessionStanzaChannel.cpp
index 1340b7c..f1cba5d 100644
--- a/Swiften/Client/ClientSessionStanzaChannel.cpp
+++ b/Swiften/Client/ClientSessionStanzaChannel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -22,7 +22,7 @@ ClientSessionStanzaChannel::~ClientSessionStanzaChannel() {
}
}
-void ClientSessionStanzaChannel::setSession(boost::shared_ptr<ClientSession> session) {
+void ClientSessionStanzaChannel::setSession(std::shared_ptr<ClientSession> session) {
assert(!this->session);
this->session = session;
session->onInitialized.connect(boost::bind(&ClientSessionStanzaChannel::handleSessionInitialized, this));
@@ -31,15 +31,15 @@ void ClientSessionStanzaChannel::setSession(boost::shared_ptr<ClientSession> ses
session->onStanzaAcked.connect(boost::bind(&ClientSessionStanzaChannel::handleStanzaAcked, this, _1));
}
-void ClientSessionStanzaChannel::sendIQ(boost::shared_ptr<IQ> iq) {
+void ClientSessionStanzaChannel::sendIQ(std::shared_ptr<IQ> iq) {
send(iq);
}
-void ClientSessionStanzaChannel::sendMessage(boost::shared_ptr<Message> message) {
+void ClientSessionStanzaChannel::sendMessage(std::shared_ptr<Message> message) {
send(message);
}
-void ClientSessionStanzaChannel::sendPresence(boost::shared_ptr<Presence> presence) {
+void ClientSessionStanzaChannel::sendPresence(std::shared_ptr<Presence> presence) {
send(presence);
}
@@ -47,7 +47,7 @@ std::string ClientSessionStanzaChannel::getNewIQID() {
return idGenerator.generateID();
}
-void ClientSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) {
+void ClientSessionStanzaChannel::send(std::shared_ptr<Stanza> stanza) {
if (!isAvailable()) {
std::cerr << "Warning: Client: Trying to send a stanza while disconnected." << std::endl;
return;
@@ -55,7 +55,7 @@ void ClientSessionStanzaChannel::send(boost::shared_ptr<Stanza> stanza) {
session->sendStanza(stanza);
}
-void ClientSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Error>) {
+void ClientSessionStanzaChannel::handleSessionFinished(std::shared_ptr<Error>) {
session->onFinished.disconnect(boost::bind(&ClientSessionStanzaChannel::handleSessionFinished, this, _1));
session->onStanzaReceived.disconnect(boost::bind(&ClientSessionStanzaChannel::handleStanza, this, _1));
session->onStanzaAcked.disconnect(boost::bind(&ClientSessionStanzaChannel::handleStanzaAcked, this, _1));
@@ -65,20 +65,20 @@ void ClientSessionStanzaChannel::handleSessionFinished(boost::shared_ptr<Error>)
onAvailableChanged(false);
}
-void ClientSessionStanzaChannel::handleStanza(boost::shared_ptr<Stanza> stanza) {
- boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(stanza);
+void ClientSessionStanzaChannel::handleStanza(std::shared_ptr<Stanza> stanza) {
+ std::shared_ptr<Message> message = std::dynamic_pointer_cast<Message>(stanza);
if (message) {
onMessageReceived(message);
return;
}
- boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(stanza);
+ std::shared_ptr<Presence> presence = std::dynamic_pointer_cast<Presence>(stanza);
if (presence) {
onPresenceReceived(presence);
return;
}
- boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(stanza);
+ std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(stanza);
if (iq) {
onIQReceived(iq);
return;
@@ -100,7 +100,7 @@ std::vector<Certificate::ref> ClientSessionStanzaChannel::getPeerCertificateChai
return std::vector<Certificate::ref>();
}
-void ClientSessionStanzaChannel::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) {
+void ClientSessionStanzaChannel::handleStanzaAcked(std::shared_ptr<Stanza> stanza) {
onStanzaAcked(stanza);
}
diff --git a/Swiften/Client/ClientSessionStanzaChannel.h b/Swiften/Client/ClientSessionStanzaChannel.h
index d3b302b..0527a5c 100644
--- a/Swiften/Client/ClientSessionStanzaChannel.h
+++ b/Swiften/Client/ClientSessionStanzaChannel.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/IDGenerator.h>
@@ -24,11 +24,11 @@ namespace Swift {
public:
virtual ~ClientSessionStanzaChannel();
- void setSession(boost::shared_ptr<ClientSession> session);
+ void setSession(std::shared_ptr<ClientSession> session);
- void sendIQ(boost::shared_ptr<IQ> iq);
- void sendMessage(boost::shared_ptr<Message> message);
- void sendPresence(boost::shared_ptr<Presence> presence);
+ void sendIQ(std::shared_ptr<IQ> iq);
+ void sendMessage(std::shared_ptr<Message> message);
+ void sendPresence(std::shared_ptr<Presence> presence);
bool getStreamManagementEnabled() const;
virtual std::vector<Certificate::ref> getPeerCertificateChain() const;
@@ -38,15 +38,15 @@ namespace Swift {
private:
std::string getNewIQID();
- void send(boost::shared_ptr<Stanza> stanza);
- void handleSessionFinished(boost::shared_ptr<Error> error);
- void handleStanza(boost::shared_ptr<Stanza> stanza);
- void handleStanzaAcked(boost::shared_ptr<Stanza> stanza);
+ void send(std::shared_ptr<Stanza> stanza);
+ void handleSessionFinished(std::shared_ptr<Error> error);
+ void handleStanza(std::shared_ptr<Stanza> stanza);
+ void handleStanzaAcked(std::shared_ptr<Stanza> stanza);
void handleSessionInitialized();
private:
IDGenerator idGenerator;
- boost::shared_ptr<ClientSession> session;
+ std::shared_ptr<ClientSession> session;
};
}
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index 44fadc6..c2f8fd7 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -6,9 +6,10 @@
#include <Swiften/Client/CoreClient.h>
+#include <memory>
+
#include <boost/bind.hpp>
#include <boost/optional.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Base/IDGenerator.h>
@@ -115,7 +116,7 @@ void CoreClient::connect(const ClientOptions& o) {
}
assert(!connector_);
if (options.boshURL.isEmpty()) {
- connector_ = boost::make_shared<ChainedConnector>(host, port, serviceLookupPrefix, networkFactories->getDomainNameResolver(), connectionFactories, networkFactories->getTimerFactory());
+ connector_ = std::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();
@@ -124,7 +125,7 @@ void CoreClient::connect(const ClientOptions& o) {
/* Autodiscovery of which proxy works is largely ok with a TCP session, because this is a one-off. With BOSH
* it would be quite painful given that potentially every stanza could be sent on a new connection.
*/
- boost::shared_ptr<BOSHSessionStream> boshSessionStream_ = boost::shared_ptr<BOSHSessionStream>(new BOSHSessionStream(
+ std::shared_ptr<BOSHSessionStream> boshSessionStream_ = std::shared_ptr<BOSHSessionStream>(new BOSHSessionStream(
options.boshURL,
getPayloadParserFactories(),
getPayloadSerializers(),
@@ -181,7 +182,7 @@ void CoreClient::bindSessionToStream() {
/**
* Only called for TCP sessions. BOSH is handled inside the BOSHSessionStream.
*/
-void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) {
+void CoreClient::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) {
resetConnector();
if (!connection) {
if (options.forgetPassword) {
@@ -189,7 +190,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio
}
boost::optional<ClientError> clientError;
if (!disconnectRequested_) {
- clientError = boost::dynamic_pointer_cast<DomainNameResolveError>(error) ? boost::optional<ClientError>(ClientError::DomainNameResolveError) : boost::optional<ClientError>(ClientError::ConnectionError);
+ clientError = std::dynamic_pointer_cast<DomainNameResolveError>(error) ? boost::optional<ClientError>(ClientError::DomainNameResolveError) : boost::optional<ClientError>(ClientError::ConnectionError);
}
onDisconnected(clientError);
}
@@ -205,7 +206,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio
connection_ = connection;
- sessionStream_ = boost::make_shared<BasicSessionStream>(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), networkFactories->getTLSContextFactory(), networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), options.tlsOptions);
+ sessionStream_ = std::make_shared<BasicSessionStream>(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), networkFactories->getTLSContextFactory(), networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory(), options.tlsOptions);
if (certificate_) {
sessionStream_->setTLSCertificate(certificate_);
}
@@ -232,7 +233,7 @@ void CoreClient::setCertificate(CertificateWithKey::ref certificate) {
certificate_ = certificate;
}
-void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) {
+void CoreClient::handleSessionFinished(std::shared_ptr<Error> error) {
if (options.forgetPassword) {
purgePassword();
}
@@ -241,7 +242,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) {
boost::optional<ClientError> actualError;
if (error) {
ClientError clientError;
- if (boost::shared_ptr<ClientSession::Error> actualError = boost::dynamic_pointer_cast<ClientSession::Error>(error)) {
+ if (std::shared_ptr<ClientSession::Error> actualError = std::dynamic_pointer_cast<ClientSession::Error>(error)) {
switch(actualError->type) {
case ClientSession::Error::AuthenticationFailedError:
clientError = ClientError(ClientError::AuthenticationFailedError);
@@ -276,7 +277,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) {
}
clientError.setErrorCode(actualError->errorCode);
}
- else if (boost::shared_ptr<TLSError> actualError = boost::dynamic_pointer_cast<TLSError>(error)) {
+ else if (std::shared_ptr<TLSError> actualError = std::dynamic_pointer_cast<TLSError>(error)) {
switch(actualError->getType()) {
case TLSError::CertificateCardRemoved:
clientError = ClientError(ClientError::CertificateCardRemoved);
@@ -286,7 +287,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) {
break;
}
}
- else if (boost::shared_ptr<SessionStream::SessionStreamError> actualError = boost::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) {
+ else if (std::shared_ptr<SessionStream::SessionStreamError> actualError = std::dynamic_pointer_cast<SessionStream::SessionStreamError>(error)) {
switch(actualError->type) {
case SessionStream::SessionStreamError::ParseError:
clientError = ClientError(ClientError::XMLError);
@@ -305,7 +306,7 @@ void CoreClient::handleSessionFinished(boost::shared_ptr<Error> error) {
break;
}
}
- else if (boost::shared_ptr<CertificateVerificationError> verificationError = boost::dynamic_pointer_cast<CertificateVerificationError>(error)) {
+ else if (std::shared_ptr<CertificateVerificationError> verificationError = std::dynamic_pointer_cast<CertificateVerificationError>(error)) {
switch(verificationError->getType()) {
case CertificateVerificationError::UnknownError:
clientError = ClientError(ClientError::UnknownCertificateError);
@@ -377,11 +378,11 @@ void CoreClient::handleStanzaChannelAvailableChanged(bool available) {
}
}
-void CoreClient::sendMessage(boost::shared_ptr<Message> message) {
+void CoreClient::sendMessage(std::shared_ptr<Message> message) {
stanzaChannel_->sendMessage(message);
}
-void CoreClient::sendPresence(boost::shared_ptr<Presence> presence) {
+void CoreClient::sendPresence(std::shared_ptr<Presence> presence) {
stanzaChannel_->sendPresence(presence);
}
@@ -458,7 +459,7 @@ void CoreClient::resetSession() {
if (connection_) {
connection_->disconnect();
}
- else if (boost::dynamic_pointer_cast<BOSHSessionStream>(sessionStream_)) {
+ else if (std::dynamic_pointer_cast<BOSHSessionStream>(sessionStream_)) {
sessionStream_->close();
}
sessionStream_.reset();
diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h
index 3efc38f..a1e4681 100644
--- a/Swiften/Client/CoreClient.h
+++ b/Swiften/Client/CoreClient.h
@@ -6,10 +6,9 @@
#pragma once
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -78,12 +77,12 @@ namespace Swift {
/**
* Sends a message.
*/
- void sendMessage(boost::shared_ptr<Message>);
+ void sendMessage(std::shared_ptr<Message>);
/**
* Sends a presence stanza.
*/
- void sendPresence(boost::shared_ptr<Presence>);
+ void sendPresence(std::shared_ptr<Presence>);
/**
* Sends raw, unchecked data.
@@ -177,12 +176,12 @@ namespace Swift {
/**
* Emitted when a message is received.
*/
- boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived;
+ boost::signal<void (std::shared_ptr<Message>)> onMessageReceived;
/**
* Emitted when a presence stanza is received.
*/
- boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived;
+ boost::signal<void (std::shared_ptr<Presence>) > onPresenceReceived;
/**
* Emitted when the server acknowledges receipt of a
@@ -190,10 +189,10 @@ namespace Swift {
*
* \see getStreamManagementEnabled()
*/
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked;
+ boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked;
protected:
- boost::shared_ptr<ClientSession> getSession() const {
+ std::shared_ptr<ClientSession> getSession() const {
return session_;
}
@@ -207,15 +206,15 @@ namespace Swift {
virtual void handleConnected() {}
private:
- void handleConnectorFinished(boost::shared_ptr<Connection>, boost::shared_ptr<Error> error);
+ void handleConnectorFinished(std::shared_ptr<Connection>, std::shared_ptr<Error> error);
void handleStanzaChannelAvailableChanged(bool available);
- void handleSessionFinished(boost::shared_ptr<Error>);
+ void handleSessionFinished(std::shared_ptr<Error>);
void handleNeedCredentials();
void handleDataRead(const SafeByteArray&);
void handleDataWritten(const SafeByteArray&);
- void handlePresenceReceived(boost::shared_ptr<Presence>);
- void handleMessageReceived(boost::shared_ptr<Message>);
- void handleStanzaAcked(boost::shared_ptr<Stanza>);
+ void handlePresenceReceived(std::shared_ptr<Presence>);
+ void handleMessageReceived(std::shared_ptr<Message>);
+ void handleStanzaAcked(std::shared_ptr<Stanza>);
void purgePassword();
void bindSessionToStream();
@@ -230,11 +229,11 @@ namespace Swift {
ClientSessionStanzaChannel* stanzaChannel_;
IQRouter* iqRouter_;
ClientOptions options;
- boost::shared_ptr<ChainedConnector> connector_;
+ std::shared_ptr<ChainedConnector> connector_;
std::vector<ConnectionFactory*> proxyConnectionFactories;
- boost::shared_ptr<Connection> connection_;
- boost::shared_ptr<SessionStream> sessionStream_;
- boost::shared_ptr<ClientSession> session_;
+ std::shared_ptr<Connection> connection_;
+ std::shared_ptr<SessionStream> sessionStream_;
+ std::shared_ptr<ClientSession> session_;
CertificateWithKey::ref certificate_;
bool disconnectRequested_;
CertificateTrustChecker* certificateTrustChecker;
diff --git a/Swiften/Client/DummyStanzaChannel.h b/Swiften/Client/DummyStanzaChannel.h
index 0e52f62..48b611c 100644
--- a/Swiften/Client/DummyStanzaChannel.h
+++ b/Swiften/Client/DummyStanzaChannel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -15,7 +15,7 @@ namespace Swift {
public:
DummyStanzaChannel() : available_(true) {}
- virtual void sendStanza(boost::shared_ptr<Stanza> stanza) {
+ virtual void sendStanza(std::shared_ptr<Stanza> stanza) {
sentStanzas.push_back(stanza);
}
@@ -24,15 +24,15 @@ namespace Swift {
onAvailableChanged(available);
}
- virtual void sendIQ(boost::shared_ptr<IQ> iq) {
+ virtual void sendIQ(std::shared_ptr<IQ> iq) {
sentStanzas.push_back(iq);
}
- virtual void sendMessage(boost::shared_ptr<Message> message) {
+ virtual void sendMessage(std::shared_ptr<Message> message) {
sentStanzas.push_back(message);
}
- virtual void sendPresence(boost::shared_ptr<Presence> presence) {
+ virtual void sendPresence(std::shared_ptr<Presence> presence) {
sentStanzas.push_back(presence);
}
@@ -52,7 +52,7 @@ namespace Swift {
if (index >= sentStanzas.size()) {
return false;
}
- boost::shared_ptr<IQ> iqStanza = boost::dynamic_pointer_cast<IQ>(sentStanzas[index]);
+ std::shared_ptr<IQ> iqStanza = std::dynamic_pointer_cast<IQ>(sentStanzas[index]);
return iqStanza && iqStanza->getType() == type && iqStanza->getTo() == jid && iqStanza->getPayload<T>();
}
@@ -60,7 +60,7 @@ namespace Swift {
if (index >= sentStanzas.size()) {
return false;
}
- boost::shared_ptr<IQ> iqStanza = boost::dynamic_pointer_cast<IQ>(sentStanzas[index]);
+ std::shared_ptr<IQ> iqStanza = std::dynamic_pointer_cast<IQ>(sentStanzas[index]);
return iqStanza && iqStanza->getType() == IQ::Result && iqStanza->getID() == id;
}
@@ -68,22 +68,22 @@ namespace Swift {
if (index >= sentStanzas.size()) {
return false;
}
- boost::shared_ptr<IQ> iqStanza = boost::dynamic_pointer_cast<IQ>(sentStanzas[index]);
+ std::shared_ptr<IQ> iqStanza = std::dynamic_pointer_cast<IQ>(sentStanzas[index]);
return iqStanza && iqStanza->getType() == IQ::Error && iqStanza->getID() == id;
}
- template<typename T> boost::shared_ptr<T> getStanzaAtIndex(size_t index) {
+ template<typename T> std::shared_ptr<T> getStanzaAtIndex(size_t index) {
if (sentStanzas.size() <= index) {
- return boost::shared_ptr<T>();
+ return std::shared_ptr<T>();
}
- return boost::dynamic_pointer_cast<T>(sentStanzas[index]);
+ return std::dynamic_pointer_cast<T>(sentStanzas[index]);
}
std::vector<Certificate::ref> getPeerCertificateChain() const {
return std::vector<Certificate::ref>();
}
- std::vector<boost::shared_ptr<Stanza> > sentStanzas;
+ std::vector<std::shared_ptr<Stanza> > sentStanzas;
bool available_;
};
}
diff --git a/Swiften/Client/NickResolver.cpp b/Swiften/Client/NickResolver.cpp
index c424447..394d490 100644
--- a/Swiften/Client/NickResolver.cpp
+++ b/Swiften/Client/NickResolver.cpp
@@ -6,8 +6,9 @@
#include <Swiften/Client/NickResolver.h>
+#include <memory>
+
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
#include <Swiften/MUC/MUCRegistry.h>
#include <Swiften/Roster/XMPPRoster.h>
diff --git a/Swiften/Client/NickResolver.h b/Swiften/Client/NickResolver.h
index b187796..0e46411 100644
--- a/Swiften/Client/NickResolver.h
+++ b/Swiften/Client/NickResolver.h
@@ -7,10 +7,9 @@
#pragma once
#include <map>
+#include <memory>
#include <string>
-#include <boost/shared_ptr.hpp>
-
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Elements/VCard.h>
diff --git a/Swiften/Client/StanzaChannel.h b/Swiften/Client/StanzaChannel.h
index ec36634..933d39d 100644
--- a/Swiften/Client/StanzaChannel.h
+++ b/Swiften/Client/StanzaChannel.h
@@ -6,7 +6,7 @@
#pragma once
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
@@ -18,15 +18,15 @@
namespace Swift {
class SWIFTEN_API StanzaChannel : public IQChannel {
public:
- virtual void sendMessage(boost::shared_ptr<Message>) = 0;
- virtual void sendPresence(boost::shared_ptr<Presence>) = 0;
+ virtual void sendMessage(std::shared_ptr<Message>) = 0;
+ virtual void sendPresence(std::shared_ptr<Presence>) = 0;
virtual bool isAvailable() const = 0;
virtual bool getStreamManagementEnabled() const = 0;
virtual std::vector<Certificate::ref> getPeerCertificateChain() const = 0;
boost::signal<void (bool /* isAvailable */)> onAvailableChanged;
- boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived;
- boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived;
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked;
+ boost::signal<void (std::shared_ptr<Message>)> onMessageReceived;
+ boost::signal<void (std::shared_ptr<Presence>) > onPresenceReceived;
+ boost::signal<void (std::shared_ptr<Stanza>)> onStanzaAcked;
};
}
diff --git a/Swiften/Client/UnitTest/BlockListImplTest.cpp b/Swiften/Client/UnitTest/BlockListImplTest.cpp
index 0502f46..b2e45e2 100644
--- a/Swiften/Client/UnitTest/BlockListImplTest.cpp
+++ b/Swiften/Client/UnitTest/BlockListImplTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -60,7 +60,7 @@ class BlockListImplTest : public CppUnit::TestFixture {
}
void setUp() {
- blockList_ = boost::make_shared<BlockListImpl>();
+ blockList_ = std::make_shared<BlockListImpl>();
addedJIDs_.clear();
removedJIDs_.clear();
blockList_->addItem(JID("a@example.com"));
@@ -83,7 +83,7 @@ class BlockListImplTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<BlockListImpl> blockList_;
+ std::shared_ptr<BlockListImpl> blockList_;
std::vector<JID> addedJIDs_;
std::vector<JID> removedJIDs_;
};
diff --git a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
index 2f33984..aaf99e0 100644
--- a/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
+++ b/Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp
@@ -61,7 +61,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
blockRequest->send();
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2);
CPPUNIT_ASSERT(request.get() != nullptr);
- boost::shared_ptr<BlockPayload> blockPayload = request->getPayload<BlockPayload>();
+ std::shared_ptr<BlockPayload> blockPayload = request->getPayload<BlockPayload>();
CPPUNIT_ASSERT(blockPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(JID("romeo@montague.net"), blockPayload->getItems().at(0));
@@ -72,7 +72,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), clientBlockListManager_->getBlockList()->getItems().size());
// send block push
- boost::shared_ptr<BlockPayload> pushPayload = boost::make_shared<BlockPayload>();
+ std::shared_ptr<BlockPayload> pushPayload = std::make_shared<BlockPayload>();
pushPayload->addItem(JID("romeo@montague.net"));
IQ::ref blockPush = IQ::createRequest(IQ::Set, ownJID_, "push1", pushPayload);
stanzaChannel_->sendIQ(blockPush);
@@ -95,7 +95,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
unblockRequest->send();
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2);
CPPUNIT_ASSERT(request.get() != nullptr);
- boost::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>();
+ std::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>();
CPPUNIT_ASSERT(unblockPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(JID("romeo@montague.net"), unblockPayload->getItems().at(0));
@@ -106,7 +106,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), clientBlockListManager_->getBlockList()->getItems().size());
// send block push
- boost::shared_ptr<UnblockPayload> pushPayload = boost::make_shared<UnblockPayload>();
+ std::shared_ptr<UnblockPayload> pushPayload = std::make_shared<UnblockPayload>();
pushPayload->addItem(JID("romeo@montague.net"));
IQ::ref unblockPush = IQ::createRequest(IQ::Set, ownJID_, "push1", pushPayload);
stanzaChannel_->sendIQ(unblockPush);
@@ -130,7 +130,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
unblockRequest->send();
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(2);
CPPUNIT_ASSERT(request.get() != nullptr);
- boost::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>();
+ std::shared_ptr<UnblockPayload> unblockPayload = request->getPayload<UnblockPayload>();
CPPUNIT_ASSERT(unblockPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(true, unblockPayload->getItems().empty());
@@ -141,7 +141,7 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), clientBlockListManager_->getBlockList()->getItems().size());
// send block push
- boost::shared_ptr<UnblockPayload> pushPayload = boost::make_shared<UnblockPayload>();
+ std::shared_ptr<UnblockPayload> pushPayload = std::make_shared<UnblockPayload>();
IQ::ref unblockPush = IQ::createRequest(IQ::Set, ownJID_, "push1", pushPayload);
stanzaChannel_->sendIQ(unblockPush);
stanzaChannel_->onIQReceived(unblockPush);
@@ -157,20 +157,20 @@ class ClientBlockListManagerTest : public CppUnit::TestFixture {
private:
void helperInitialBlockListFetch(const std::vector<JID>& blockedJids) {
- boost::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList();
+ std::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList();
CPPUNIT_ASSERT(blockList);
// check for IQ request
IQ::ref request = stanzaChannel_->getStanzaAtIndex<IQ>(0);
CPPUNIT_ASSERT(request.get() != nullptr);
- boost::shared_ptr<BlockListPayload> requestPayload = request->getPayload<BlockListPayload>();
+ std::shared_ptr<BlockListPayload> requestPayload = request->getPayload<BlockListPayload>();
CPPUNIT_ASSERT(requestPayload.get() != nullptr);
CPPUNIT_ASSERT_EQUAL(BlockList::Requesting, blockList->getState());
CPPUNIT_ASSERT_EQUAL(BlockList::Requesting, clientBlockListManager_->getBlockList()->getState());
// build IQ response
- boost::shared_ptr<BlockListPayload> responsePayload = boost::make_shared<BlockListPayload>();
+ std::shared_ptr<BlockListPayload> responsePayload = std::make_shared<BlockListPayload>();
foreach(const JID& jid, blockedJids) {
responsePayload->addItem(jid);
}
diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp
index 335b537..bd93f4b 100644
--- a/Swiften/Client/UnitTest/ClientSessionTest.cpp
+++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp
@@ -5,10 +5,10 @@
*/
#include <deque>
+#include <memory>
#include <boost/bind.hpp>
#include <boost/optional.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -75,9 +75,9 @@ class ClientSessionTest : public CppUnit::TestFixture {
public:
void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
- idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create());
- server = boost::make_shared<MockSessionStream>();
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ idnConverter = std::shared_ptr<IDNConverter>(PlatformIDNConverter::create());
+ server = std::make_shared<MockSessionStream>();
sessionFinishedReceived = false;
needCredentials = false;
blindCertificateTrustChecker = new BlindCertificateTrustChecker();
@@ -88,7 +88,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStart_Error() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->breakConnection();
@@ -98,7 +98,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStart_StreamError() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->sendStreamStart();
server->sendStreamError();
@@ -109,7 +109,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStartTLS() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->setCertificateTrustChecker(blindCertificateTrustChecker);
session->start();
server->receiveStreamStart();
@@ -127,7 +127,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStartTLS_ServerError() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -142,7 +142,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStartTLS_ConnectError() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -157,7 +157,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStartTLS_InvalidIdentity() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -171,11 +171,11 @@ class ClientSessionTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(ClientSession::Finished, session->getState());
CPPUNIT_ASSERT(sessionFinishedReceived);
CPPUNIT_ASSERT(sessionFinishedError);
- CPPUNIT_ASSERT_EQUAL(CertificateVerificationError::InvalidServerIdentity, boost::dynamic_pointer_cast<CertificateVerificationError>(sessionFinishedError)->getType());
+ CPPUNIT_ASSERT_EQUAL(CertificateVerificationError::InvalidServerIdentity, std::dynamic_pointer_cast<CertificateVerificationError>(sessionFinishedError)->getType());
}
void testStart_StreamFeaturesWithoutResourceBindingFails() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -187,7 +187,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testAuthenticate() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -203,7 +203,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testAuthenticate_Unauthorized() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -220,7 +220,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testAuthenticate_PLAINOverNonTLS() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->setAllowPLAINOverNonTLS(false);
session->start();
server->receiveStreamStart();
@@ -233,7 +233,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testAuthenticate_RequireTLS() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->setUseTLS(ClientSession::RequireTLS);
session->setAllowPLAINOverNonTLS(true);
session->start();
@@ -247,7 +247,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testAuthenticate_NoValidAuthMechanisms() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -259,7 +259,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testAuthenticate_EXTERNAL() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -272,7 +272,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testUnexpectedChallenge() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -287,7 +287,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStreamManagement() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -311,7 +311,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testStreamManagement_Failed() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -334,7 +334,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void testFinishAcksStanzas() {
- boost::shared_ptr<ClientSession> session(createSession());
+ std::shared_ptr<ClientSession> session(createSession());
initializeSession(session);
server->sendMessage();
server->sendMessage();
@@ -346,15 +346,15 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<ClientSession> createSession() {
- boost::shared_ptr<ClientSession> session = ClientSession::create(JID("me@foo.com"), server, idnConverter.get(), crypto.get());
+ std::shared_ptr<ClientSession> createSession() {
+ std::shared_ptr<ClientSession> session = ClientSession::create(JID("me@foo.com"), server, idnConverter.get(), crypto.get());
session->onFinished.connect(boost::bind(&ClientSessionTest::handleSessionFinished, this, _1));
session->onNeedCredentials.connect(boost::bind(&ClientSessionTest::handleSessionNeedCredentials, this));
session->setAllowPLAINOverNonTLS(true);
return session;
}
- void initializeSession(boost::shared_ptr<ClientSession> session) {
+ void initializeSession(std::shared_ptr<ClientSession> session) {
session->start();
server->receiveStreamStart();
server->sendStreamStart();
@@ -371,7 +371,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
server->sendStreamManagementEnabled();
}
- void handleSessionFinished(boost::shared_ptr<Error> error) {
+ void handleSessionFinished(std::shared_ptr<Error> error) {
sessionFinishedReceived = true;
sessionFinishedError = error;
}
@@ -383,11 +383,11 @@ class ClientSessionTest : public CppUnit::TestFixture {
class MockSessionStream : public SessionStream {
public:
struct Event {
- Event(boost::shared_ptr<ToplevelElement> element) : element(element), footer(false) {}
+ Event(std::shared_ptr<ToplevelElement> element) : element(element), footer(false) {}
Event(const ProtocolHeader& header) : header(header), footer(false) {}
Event() : footer(true) {}
- boost::shared_ptr<ToplevelElement> element;
+ std::shared_ptr<ToplevelElement> element;
boost::optional<ProtocolHeader> header;
bool footer;
};
@@ -396,7 +396,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
virtual void close() {
- onClosed(boost::shared_ptr<Error>());
+ onClosed(std::shared_ptr<Error>());
}
virtual bool isOpen() {
@@ -411,7 +411,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
receivedEvents.push_back(Event());
}
- virtual void writeElement(boost::shared_ptr<ToplevelElement> element) {
+ virtual void writeElement(std::shared_ptr<ToplevelElement> element) {
receivedEvents.push_back(Event(element));
}
@@ -442,8 +442,8 @@ class ClientSessionTest : public CppUnit::TestFixture {
return std::vector<Certificate::ref>();
}
- virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const {
- return boost::shared_ptr<CertificateVerificationError>();
+ virtual std::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const {
+ return std::shared_ptr<CertificateVerificationError>();
}
virtual bool supportsZLibCompression() {
@@ -463,11 +463,11 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void breakConnection() {
- onClosed(boost::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError));
+ onClosed(std::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::ConnectionReadError));
}
void breakTLS() {
- onClosed(boost::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::TLSError));
+ onClosed(std::make_shared<SessionStream::SessionStreamError>(SessionStream::SessionStreamError::TLSError));
}
@@ -478,29 +478,29 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void sendStreamFeaturesWithStartTLS() {
- boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
+ std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
streamFeatures->setHasStartTLS();
onElementReceived(streamFeatures);
}
void sendChallenge() {
- onElementReceived(boost::make_shared<AuthChallenge>());
+ onElementReceived(std::make_shared<AuthChallenge>());
}
void sendStreamError() {
- onElementReceived(boost::make_shared<StreamError>());
+ onElementReceived(std::make_shared<StreamError>());
}
void sendTLSProceed() {
- onElementReceived(boost::make_shared<TLSProceed>());
+ onElementReceived(std::make_shared<TLSProceed>());
}
void sendTLSFailure() {
- onElementReceived(boost::make_shared<StartTLSFailure>());
+ onElementReceived(std::make_shared<StartTLSFailure>());
}
void sendStreamFeaturesWithMultipleAuthentication() {
- boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
+ std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
streamFeatures->addAuthenticationMechanism("PLAIN");
streamFeatures->addAuthenticationMechanism("DIGEST-MD5");
streamFeatures->addAuthenticationMechanism("SCRAM-SHA1");
@@ -508,59 +508,59 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void sendStreamFeaturesWithPLAINAuthentication() {
- boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
+ std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
streamFeatures->addAuthenticationMechanism("PLAIN");
onElementReceived(streamFeatures);
}
void sendStreamFeaturesWithEXTERNALAuthentication() {
- boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
+ std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
streamFeatures->addAuthenticationMechanism("EXTERNAL");
onElementReceived(streamFeatures);
}
void sendStreamFeaturesWithUnknownAuthentication() {
- boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
+ std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
streamFeatures->addAuthenticationMechanism("UNKNOWN");
onElementReceived(streamFeatures);
}
void sendStreamFeaturesWithBindAndStreamManagement() {
- boost::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
+ std::shared_ptr<StreamFeatures> streamFeatures(new StreamFeatures());
streamFeatures->setHasResourceBind();
streamFeatures->setHasStreamManagement();
onElementReceived(streamFeatures);
}
void sendEmptyStreamFeatures() {
- onElementReceived(boost::make_shared<StreamFeatures>());
+ onElementReceived(std::make_shared<StreamFeatures>());
}
void sendAuthSuccess() {
- onElementReceived(boost::make_shared<AuthSuccess>());
+ onElementReceived(std::make_shared<AuthSuccess>());
}
void sendAuthFailure() {
- onElementReceived(boost::make_shared<AuthFailure>());
+ onElementReceived(std::make_shared<AuthFailure>());
}
void sendStreamManagementEnabled() {
- onElementReceived(boost::make_shared<StreamManagementEnabled>());
+ onElementReceived(std::make_shared<StreamManagementEnabled>());
}
void sendStreamManagementFailed() {
- onElementReceived(boost::make_shared<StreamManagementFailed>());
+ onElementReceived(std::make_shared<StreamManagementFailed>());
}
void sendBindResult() {
- boost::shared_ptr<ResourceBind> resourceBind(new ResourceBind());
+ std::shared_ptr<ResourceBind> resourceBind(new ResourceBind());
resourceBind->setJID(JID("foo@bar.com/bla"));
- boost::shared_ptr<IQ> iq = IQ::createResult(JID("foo@bar.com"), bindID, resourceBind);
+ std::shared_ptr<IQ> iq = IQ::createResult(JID("foo@bar.com"), bindID, resourceBind);
onElementReceived(iq);
}
void sendMessage() {
- boost::shared_ptr<Message> message = boost::make_shared<Message>();
+ std::shared_ptr<Message> message = std::make_shared<Message>();
message->setTo(JID("foo@bar.com/bla"));
onElementReceived(message);
}
@@ -573,13 +573,13 @@ class ClientSessionTest : public CppUnit::TestFixture {
void receiveStartTLS() {
Event event = popEvent();
CPPUNIT_ASSERT(event.element);
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<StartTLSRequest>(event.element));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<StartTLSRequest>(event.element));
}
void receiveAuthRequest(const std::string& mech) {
Event event = popEvent();
CPPUNIT_ASSERT(event.element);
- boost::shared_ptr<AuthRequest> request(boost::dynamic_pointer_cast<AuthRequest>(event.element));
+ std::shared_ptr<AuthRequest> request(std::dynamic_pointer_cast<AuthRequest>(event.element));
CPPUNIT_ASSERT(request);
CPPUNIT_ASSERT_EQUAL(mech, request->getMechanism());
}
@@ -587,13 +587,13 @@ class ClientSessionTest : public CppUnit::TestFixture {
void receiveStreamManagementEnable() {
Event event = popEvent();
CPPUNIT_ASSERT(event.element);
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<EnableStreamManagement>(event.element));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<EnableStreamManagement>(event.element));
}
void receiveBind() {
Event event = popEvent();
CPPUNIT_ASSERT(event.element);
- boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(event.element);
+ std::shared_ptr<IQ> iq = std::dynamic_pointer_cast<IQ>(event.element);
CPPUNIT_ASSERT(iq);
CPPUNIT_ASSERT(iq->getPayload<ResourceBind>());
bindID = iq->getID();
@@ -602,7 +602,7 @@ class ClientSessionTest : public CppUnit::TestFixture {
void receiveAck(unsigned int n) {
Event event = popEvent();
CPPUNIT_ASSERT(event.element);
- boost::shared_ptr<StanzaAck> ack = boost::dynamic_pointer_cast<StanzaAck>(event.element);
+ std::shared_ptr<StanzaAck> ack = std::dynamic_pointer_cast<StanzaAck>(event.element);
CPPUNIT_ASSERT(ack);
CPPUNIT_ASSERT_EQUAL(n, ack->getHandledStanzasCount());
}
@@ -624,20 +624,20 @@ class ClientSessionTest : public CppUnit::TestFixture {
std::deque<Event> receivedEvents;
};
- boost::shared_ptr<IDNConverter> idnConverter;
- boost::shared_ptr<MockSessionStream> server;
+ std::shared_ptr<IDNConverter> idnConverter;
+ std::shared_ptr<MockSessionStream> server;
bool sessionFinishedReceived;
bool needCredentials;
- boost::shared_ptr<Error> sessionFinishedError;
+ std::shared_ptr<Error> sessionFinishedError;
BlindCertificateTrustChecker* blindCertificateTrustChecker;
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
#if 0
void testAuthenticate() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
session->onNeedCredentials.connect(boost::bind(&ClientSessionTest::setNeedCredentials, this));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
@@ -658,7 +658,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testAuthenticate_Unauthorized() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeaturesWithAuthentication();
@@ -675,7 +675,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testAuthenticate_NoValidAuthMechanisms() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeaturesWithUnsupportedAuthentication();
@@ -687,7 +687,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testResourceBind() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeaturesWithResourceBind();
@@ -703,7 +703,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testResourceBind_ChangeResource() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeaturesWithResourceBind();
@@ -717,7 +717,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testResourceBind_EmptyResource() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeaturesWithResourceBind();
@@ -731,7 +731,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testResourceBind_Error() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeaturesWithResourceBind();
@@ -745,7 +745,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testSessionStart() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
session->onSessionStarted.connect(boost::bind(&ClientSessionTest::setSessionStarted, this));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
@@ -761,7 +761,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testSessionStart_Error() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeaturesWithSession();
@@ -775,7 +775,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testSessionStart_AfterResourceBind() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
session->onSessionStarted.connect(boost::bind(&ClientSessionTest::setSessionStarted, this));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
@@ -792,7 +792,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testWhitespacePing() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeatures();
@@ -802,7 +802,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
}
void testReceiveElementAfterSessionStarted() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
getMockServer()->sendStreamFeatures();
@@ -810,11 +810,11 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
processEvents();
getMockServer()->expectMessage();
- session->sendElement(boost::make_shared<Message>()));
+ session->sendElement(std::make_shared<Message>()));
}
void testSendElement() {
- boost::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
+ std::shared_ptr<MockSession> session(createSession("me@foo.com/Bar"));
session->onElementReceived.connect(boost::bind(&ClientSessionTest::addReceivedElement, this, _1));
getMockServer()->expectStreamStart();
getMockServer()->sendStreamStart();
@@ -824,6 +824,6 @@ CPPUNIT_TEST_SUITE_REGISTRATION(ClientSessionTest);
processEvents();
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(receivedElements_.size()));
- CPPUNIT_ASSERT(boost::dynamic_pointer_cast<Message>(receivedElements_[0]));
+ CPPUNIT_ASSERT(std::dynamic_pointer_cast<Message>(receivedElements_[0]));
}
#endif
diff --git a/Swiften/Client/UnitTest/NickResolverTest.cpp b/Swiften/Client/UnitTest/NickResolverTest.cpp
index 855b15a..2846173 100644
--- a/Swiften/Client/UnitTest/NickResolverTest.cpp
+++ b/Swiften/Client/UnitTest/NickResolverTest.cpp
@@ -36,7 +36,7 @@ class NickResolverTest : public CppUnit::TestFixture {
public:
void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
ownJID_ = JID("kev@wonderland.lit");
xmppRoster_ = new XMPPRosterImpl();
stanzaChannel_ = new DummyStanzaChannel();
@@ -147,7 +147,7 @@ class NickResolverTest : public CppUnit::TestFixture {
MUCRegistry* registry_;
NickResolver* resolver_;
JID ownJID_;
- boost::shared_ptr<CryptoProvider> crypto;
+ std::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(NickResolverTest);