diff options
author | Vladimir Matena <vlada.matena@gmail.com> | 2016-09-12 19:20:58 +0300 |
---|---|---|
committer | vitalyster <vitalyster@gmail.com> | 2016-09-12 19:20:58 +0300 |
commit | 6d2f8c1927613d87b5872b75601d211fe68dadb3 (patch) | |
tree | 5db11577fdbc570700dd6f74c4e5d5061c7a68cb /include | |
parent | d3919d6a84c0397cd5011d53e036a419ae91385d (diff) |
Switch from boost shared pointers to stl shared pointers (#162)
* Swiften 4 support
* using standard shared pointers when compiling with Swiften 4
Diffstat (limited to 'include')
61 files changed, 377 insertions, 231 deletions
diff --git a/include/Swiften/Elements/AttentionPayload.h b/include/Swiften/Elements/AttentionPayload.h index 9901843f..62528cc6 100644 --- a/include/Swiften/Elements/AttentionPayload.h +++ b/include/Swiften/Elements/AttentionPayload.h @@ -12,10 +12,12 @@ #include <Swiften/Elements/Payload.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class AttentionPayload : public Payload { public: - typedef boost::shared_ptr<AttentionPayload> ref; + typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<AttentionPayload> ref; public: AttentionPayload(); diff --git a/include/Swiften/Elements/InvisiblePayload.h b/include/Swiften/Elements/InvisiblePayload.h index 4966eddb..6a555ccf 100644 --- a/include/Swiften/Elements/InvisiblePayload.h +++ b/include/Swiften/Elements/InvisiblePayload.h @@ -12,12 +12,14 @@ #include <Swiften/Elements/Payload.h> +#include "Swiften/SwiftenCompat.h" + // This payload is NOT part of ANY XEP and it is only // libtransport related extension. namespace Swift { class InvisiblePayload : public Payload { public: - typedef boost::shared_ptr<InvisiblePayload> ref; + typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<InvisiblePayload> ref; public: InvisiblePayload(); diff --git a/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.cpp b/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.cpp index 102de374..3f98cbb9 100644 --- a/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.cpp +++ b/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.cpp @@ -31,30 +31,30 @@ CombinedOutgoingFileTransferManager::~CombinedOutgoingFileTransferManager() { delete idGenerator; } -boost::shared_ptr<OutgoingFileTransfer> CombinedOutgoingFileTransferManager::createOutgoingFileTransfer(const JID& from, const JID& receipient, boost::shared_ptr<ReadBytestream> readBytestream, const StreamInitiationFileInfo& fileInfo) { +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<OutgoingFileTransfer> CombinedOutgoingFileTransferManager::createOutgoingFileTransfer(const JID& from, const JID& receipient, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ReadBytestream> readBytestream, const StreamInitiationFileInfo& fileInfo) { // check if receipient support Jingle FT boost::optional<JID> fullJID = highestPriorityJIDSupportingJingle(receipient); if (!fullJID.is_initialized()) { fullJID = highestPriorityJIDSupportingSI(receipient); } else { - JingleSessionImpl::ref jingleSession = boost::make_shared<JingleSessionImpl>(from, receipient, idGenerator->generateID(), iqRouter); + JingleSessionImpl::ref jingleSession = SWIFTEN_SHRPTR_NAMESPACE::make_shared<JingleSessionImpl>(from, receipient, idGenerator->generateID(), iqRouter); //jsManager->getSession(receipient, idGenerator->generateID()); assert(jingleSession); jsManager->registerOutgoingSession(from, jingleSession); #if !HAVE_SWIFTEN_3 - boost::shared_ptr<OutgoingJingleFileTransfer> jingleFT = boost::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer(jingleSession, remoteFactory, localFactory, iqRouter, idGenerator, from, receipient, readBytestream, fileInfo, bytestreamRegistry, bytestreamProxy)); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<OutgoingJingleFileTransfer> jingleFT = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<OutgoingJingleFileTransfer>(new OutgoingJingleFileTransfer(jingleSession, remoteFactory, localFactory, iqRouter, idGenerator, from, receipient, readBytestream, fileInfo, bytestreamRegistry, bytestreamProxy)); return jingleFT; #endif } if (!fullJID.is_initialized()) { - return boost::shared_ptr<OutgoingFileTransfer>(); + return SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<OutgoingFileTransfer>(); } // otherwise try SI - boost::shared_ptr<MyOutgoingSIFileTransfer> jingleFT = boost::shared_ptr<MyOutgoingSIFileTransfer>(new MyOutgoingSIFileTransfer(idGenerator->generateID(), from, fullJID.get(), fileInfo.getName(), fileInfo.getSize(), fileInfo.getDescription(), readBytestream, iqRouter, bytestreamServer, bytestreamRegistry)); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<MyOutgoingSIFileTransfer> jingleFT = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<MyOutgoingSIFileTransfer>(new MyOutgoingSIFileTransfer(idGenerator->generateID(), from, fullJID.get(), fileInfo.getName(), fileInfo.getSize(), fileInfo.getDescription(), readBytestream, iqRouter, bytestreamServer, bytestreamRegistry)); // else fail return jingleFT; diff --git a/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.h b/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.h index 2a5a9ffb..4710c151 100644 --- a/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.h +++ b/include/Swiften/FileTransfer/CombinedOutgoingFileTransferManager.h @@ -12,6 +12,9 @@ #include <Swiften/JID/JID.h> #include "transport/PresenceOracle.h" + +#include "Swiften/SwiftenCompat.h" + #include <Swiften/FileTransfer/OutgoingFileTransfer.h> #include <Swiften/Version.h> #define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000) @@ -38,7 +41,7 @@ public: CombinedOutgoingFileTransferManager(JingleSessionManager* jingleSessionManager, IQRouter* router, EntityCapsProvider* capsProvider, RemoteJingleTransportCandidateSelectorFactory* remoteFactory, LocalJingleTransportCandidateGeneratorFactory* localFactory, SOCKS5BytestreamRegistry* bytestreamRegistry, SOCKS5BytestreamProxy* bytestreamProxy, Transport::PresenceOracle* presOracle, SOCKS5BytestreamServer *server); ~CombinedOutgoingFileTransferManager(); - boost::shared_ptr<OutgoingFileTransfer> createOutgoingFileTransfer(const JID& from, const JID& to, boost::shared_ptr<ReadBytestream>, const StreamInitiationFileInfo&); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<OutgoingFileTransfer> createOutgoingFileTransfer(const JID& from, const JID& to, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ReadBytestream>, const StreamInitiationFileInfo&); private: boost::optional<JID> highestPriorityJIDSupportingJingle(const JID& bareJID); diff --git a/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.cpp b/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.cpp index 5f1253ec..8c24a945 100644 --- a/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.cpp +++ b/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.cpp @@ -14,9 +14,11 @@ #include <Swiften/FileTransfer/SOCKS5BytestreamRegistry.h> #include <Swiften/FileTransfer/IBBSendSession.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { -MyOutgoingSIFileTransfer::MyOutgoingSIFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer, SOCKS5BytestreamRegistry* registry) : id(id), from(from), to(to), name(name), size(size), description(description), bytestream(bytestream), iqRouter(iqRouter), socksServer(socksServer), registry(registry) { +MyOutgoingSIFileTransfer::MyOutgoingSIFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer, SOCKS5BytestreamRegistry* registry) : id(id), from(from), to(to), name(name), size(size), description(description), bytestream(bytestream), iqRouter(iqRouter), socksServer(socksServer), registry(registry) { } void MyOutgoingSIFileTransfer::start() { @@ -69,7 +71,7 @@ void MyOutgoingSIFileTransfer::handleStreamInitiationRequestResponse(StreamIniti request->send(); } else if (response->getRequestedMethod() == "http://jabber.org/protocol/ibb") { - ibbSession = boost::shared_ptr<IBBSendSession>(new IBBSendSession(id, from, to, bytestream, iqRouter)); + ibbSession = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<IBBSendSession>(new IBBSendSession(id, from, to, bytestream, iqRouter)); ibbSession->onFinished.connect(boost::bind(&MyOutgoingSIFileTransfer::handleIBBSessionFinished, this, _1)); ibbSession->start(); #if !HAVE_SWIFTEN_3 diff --git a/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.h b/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.h index 369a29ac..528e739c 100644 --- a/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.h +++ b/include/Swiften/FileTransfer/MyOutgoingSIFileTransfer.h @@ -7,10 +7,12 @@ #pragma once #include <boost/shared_ptr.hpp> +#include <boost/signals.hpp> + +#include "Swiften/SwiftenCompat.h" #include <Swiften/FileTransfer/OutgoingFileTransfer.h> #include <Swiften/FileTransfer/ReadBytestream.h> -#include <Swiften/Base/boost_bsignals.h> #include <Swiften/FileTransfer/FileTransferError.h> #include <Swiften/FileTransfer/SOCKS5BytestreamServer.h> #include <Swiften/JID/JID.h> @@ -28,7 +30,7 @@ namespace Swift { class MyOutgoingSIFileTransfer : public OutgoingFileTransfer { public: - MyOutgoingSIFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer, SOCKS5BytestreamRegistry* registry); + MyOutgoingSIFileTransfer(const std::string& id, const JID& from, const JID& to, const std::string& name, int size, const std::string& description, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ReadBytestream> bytestream, IQRouter* iqRouter, SOCKS5BytestreamServer* socksServer, SOCKS5BytestreamRegistry* registry); virtual void start(); virtual void stop(); @@ -49,10 +51,10 @@ namespace Swift { std::string name; int size; std::string description; - boost::shared_ptr<ReadBytestream> bytestream; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ReadBytestream> bytestream; IQRouter* iqRouter; SOCKS5BytestreamServer* socksServer; - boost::shared_ptr<IBBSendSession> ibbSession; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<IBBSendSession> ibbSession; SOCKS5BytestreamRegistry *registry; }; } diff --git a/include/Swiften/Network/DummyConnectionServer.cpp b/include/Swiften/Network/DummyConnectionServer.cpp index e4c8ef2b..bd84ca0f 100644 --- a/include/Swiften/Network/DummyConnectionServer.cpp +++ b/include/Swiften/Network/DummyConnectionServer.cpp @@ -6,12 +6,15 @@ #include <Swiften/Network/DummyConnectionServer.h> +#include <boost/signal.hpp> #include <boost/bind.hpp> #include <boost/system/system_error.hpp> #include <boost/asio/placeholders.hpp> #include <Swiften/EventLoop/EventLoop.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { DummyConnectionServer::DummyConnectionServer(EventLoop* eventLoop) : eventLoop(eventLoop) { @@ -25,10 +28,10 @@ void DummyConnectionServer::stop() { } -void DummyConnectionServer::acceptConnection(boost::shared_ptr<Swift::Connection> connection) { +void DummyConnectionServer::acceptConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> connection) { eventLoop->postEvent( boost::bind(boost::ref(onNewConnection), connection), - shared_from_this()); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<DummyConnectionServer>(this)); // connection->listen(); } diff --git a/include/Swiften/Network/DummyConnectionServer.h b/include/Swiften/Network/DummyConnectionServer.h index b80e6af3..bbd2ef0d 100644 --- a/include/Swiften/Network/DummyConnectionServer.h +++ b/include/Swiften/Network/DummyConnectionServer.h @@ -10,28 +10,29 @@ #include <boost/asio/io_service.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/enable_shared_from_this.hpp> -#include <Swiften/Base/boost_bsignals.h> #include <Swiften/Network/DummyConnection.h> #include <Swiften/Network/ConnectionServer.h> #include <Swiften/EventLoop/EventOwner.h> #include <Swiften/Version.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class DummyConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<DummyConnectionServer> { public: - typedef boost::shared_ptr<DummyConnectionServer> ref; + typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<DummyConnectionServer> ref; enum Error { Conflict, UnknownError }; - static ref create(EventLoop* eventLoop) { - return ref(new DummyConnectionServer(eventLoop)); + static SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DummyConnectionServer> create(EventLoop* eventLoop) { + return SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DummyConnectionServer>(new DummyConnectionServer(eventLoop)); } - void acceptConnection(boost::shared_ptr<Swift::Connection> connection); + void acceptConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> connection); #if (SWIFTEN_VERSION >= 0x030000) virtual boost::optional<ConnectionServer::Error> tryStart() { diff --git a/include/Swiften/Network/DummyConnectionServerFactory.cpp b/include/Swiften/Network/DummyConnectionServerFactory.cpp index 4fbabbc2..4b49c2cc 100644 --- a/include/Swiften/Network/DummyConnectionServerFactory.cpp +++ b/include/Swiften/Network/DummyConnectionServerFactory.cpp @@ -12,11 +12,11 @@ namespace Swift { DummyConnectionServerFactory::DummyConnectionServerFactory(EventLoop* eventLoop) : eventLoop(eventLoop) { } -boost::shared_ptr<ConnectionServer> DummyConnectionServerFactory::createConnectionServer(int port) { +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> DummyConnectionServerFactory::createConnectionServer(int port) { return DummyConnectionServer::create(eventLoop); } -boost::shared_ptr<ConnectionServer> DummyConnectionServerFactory::createConnectionServer(const Swift::HostAddress &hostAddress, int port) { +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> DummyConnectionServerFactory::createConnectionServer(const Swift::HostAddress &hostAddress, int port) { return DummyConnectionServer::create(eventLoop); } diff --git a/include/Swiften/Network/DummyConnectionServerFactory.h b/include/Swiften/Network/DummyConnectionServerFactory.h index a4bdbfd2..e5a4356f 100644 --- a/include/Swiften/Network/DummyConnectionServerFactory.h +++ b/include/Swiften/Network/DummyConnectionServerFactory.h @@ -11,6 +11,8 @@ #include <Swiften/Network/ConnectionServerFactory.h> #include <Swiften/Network/DummyConnectionServer.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class ConnectionServer; @@ -18,9 +20,9 @@ namespace Swift { public: DummyConnectionServerFactory(EventLoop* eventLoop); - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(int port); + virtual SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> createConnectionServer(int port); - virtual boost::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress &hostAddress, int port); + virtual SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> createConnectionServer(const Swift::HostAddress &hostAddress, int port); private: EventLoop* eventLoop; diff --git a/include/Swiften/Network/DummyNetworkFactories.cpp b/include/Swiften/Network/DummyNetworkFactories.cpp index cbd258cc..16a35443 100644 --- a/include/Swiften/Network/DummyNetworkFactories.cpp +++ b/include/Swiften/Network/DummyNetworkFactories.cpp @@ -22,7 +22,7 @@ DummyNetworkFactories::DummyNetworkFactories(EventLoop* eventLoop) { timerFactory = new DummyTimerFactory(); connectionFactory = new DummyConnectionFactory(eventLoop); #if HAVE_SWIFTEN_3 - idnConverter = boost::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); + idnConverter = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<IDNConverter>(PlatformIDNConverter::create()); domainNameResolver = new PlatformDomainNameResolver(idnConverter.get(), eventLoop); cryptoProvider = PlatformCryptoProvider::create(); networkEnvironment = new PlatformNetworkEnvironment(); diff --git a/include/Swiften/Network/DummyNetworkFactories.h b/include/Swiften/Network/DummyNetworkFactories.h index 9f2662c1..db47a61a 100644 --- a/include/Swiften/Network/DummyNetworkFactories.h +++ b/include/Swiften/Network/DummyNetworkFactories.h @@ -16,6 +16,8 @@ #include <Swiften/IDN/PlatformIDNConverter.h> #endif +#include "Swiften/SwiftenCompat.h" + namespace Swift { class EventLoop; @@ -77,7 +79,7 @@ namespace Swift { TimerFactory* timerFactory; ConnectionFactory* connectionFactory; #if HAVE_SWIFTEN_3 - boost::shared_ptr<IDNConverter> idnConverter; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<IDNConverter> idnConverter; CryptoProvider* cryptoProvider; NetworkEnvironment* networkEnvironment; #endif diff --git a/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.cpp b/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.cpp index 53444af2..1497cb38 100644 --- a/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.cpp +++ b/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.cpp @@ -4,8 +4,10 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +#include <cassert> #include <Swiften/Parser/PayloadParsers/XHTMLIMParser.h> #include <Swiften/Parser/SerializingParser.h> +#include "Swiften/SwiftenCompat.h" namespace Swift { @@ -50,7 +52,7 @@ void XHTMLIMParser::handleCharacterData(const std::string& data) { } } -boost::shared_ptr<XHTMLIMPayload> XHTMLIMParser::getLabelPayload() const { +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XHTMLIMPayload> XHTMLIMParser::getLabelPayload() const { return getPayloadInternal(); } diff --git a/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.h b/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.h index 25b11056..390654ff 100644 --- a/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.h +++ b/include/Swiften/Parser/PayloadParsers/XHTMLIMParser.h @@ -9,6 +9,8 @@ #include <Swiften/Elements/XHTMLIMPayload.h> #include <Swiften/Parser/GenericPayloadParser.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class SerializingParser; @@ -19,7 +21,7 @@ namespace Swift { virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); virtual void handleEndElement(const std::string& element, const std::string&); virtual void handleCharacterData(const std::string& data); - boost::shared_ptr<XHTMLIMPayload> getLabelPayload() const; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XHTMLIMPayload> getLabelPayload() const; private: enum Level { TopLevel = 0, diff --git a/include/Swiften/Parser/StringTreeParser.h b/include/Swiften/Parser/StringTreeParser.h index 06089a7d..0a92282d 100644 --- a/include/Swiften/Parser/StringTreeParser.h +++ b/include/Swiften/Parser/StringTreeParser.h @@ -14,6 +14,8 @@ #include <Swiften/Parser/Tree/ParserElement.h> #include <Swiften/Parser/XMLParserClient.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { /** * Generics parser offering something a bit like a DOM to work with. @@ -24,7 +26,7 @@ namespace Swift { virtual void handleStartElement(const std::string& element, const std::string& xmlns, const AttributeMap& attributes) { if (!root_) { - root_ = boost::make_shared<ParserElement>(element, xmlns, attributes); + root_ = SWIFTEN_SHRPTR_NAMESPACE::make_shared<ParserElement>(element, xmlns, attributes); elementStack_.push_back(root_); } else { diff --git a/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.cpp b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.cpp index 2c305313..72682cfc 100644 --- a/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.cpp +++ b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.cpp @@ -17,7 +17,7 @@ namespace Swift { AttentionSerializer::AttentionSerializer() : GenericPayloadSerializer<AttentionPayload>() { } -std::string AttentionSerializer::serializePayload(boost::shared_ptr<AttentionPayload> attention) const { +std::string AttentionSerializer::serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<AttentionPayload> attention) const { XMLElement attentionElement("attention", "urn:xmpp:attention:0"); return attentionElement.serialize(); diff --git a/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.h b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.h index c067091b..5b37d71c 100644 --- a/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.h +++ b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.h @@ -9,11 +9,13 @@ #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Elements/AttentionPayload.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class AttentionSerializer : public GenericPayloadSerializer<AttentionPayload> { public: AttentionSerializer(); - virtual std::string serializePayload(boost::shared_ptr<AttentionPayload>) const; + virtual std::string serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<AttentionPayload>) const; }; } diff --git a/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.cpp b/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.cpp index 6b7cd9e7..c63351f5 100644 --- a/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.cpp +++ b/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.cpp @@ -11,27 +11,29 @@ #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/PayloadSerializerCollection.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { GatewayPayloadSerializer::GatewayPayloadSerializer() : GenericPayloadSerializer<GatewayPayload>() { } -std::string GatewayPayloadSerializer::serializePayload(boost::shared_ptr<GatewayPayload> payload) const { +std::string GatewayPayloadSerializer::serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<GatewayPayload> payload) const { XMLElement query("query", "jabber:iq:gateway"); if (payload->getJID().isValid()) { - boost::shared_ptr<XMLElement> jid(new XMLElement("jid", "", payload->getJID().toBare().toString())); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XMLElement> jid(new XMLElement("jid", "", payload->getJID().toBare().toString())); query.addNode(jid); } if (!payload->getDesc().empty()) { - boost::shared_ptr<XMLElement> desc(new XMLElement("desc", "", payload->getDesc())); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XMLElement> desc(new XMLElement("desc", "", payload->getDesc())); query.addNode(desc); } if (!payload->getPrompt().empty()) { - boost::shared_ptr<XMLElement> prompt(new XMLElement("prompt", "", payload->getPrompt())); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XMLElement> prompt(new XMLElement("prompt", "", payload->getPrompt())); query.addNode(prompt); } diff --git a/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.h b/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.h index 1b64ac17..6e94d112 100644 --- a/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.h +++ b/include/Swiften/Serializer/PayloadSerializers/GatewayPayloadSerializer.h @@ -9,11 +9,13 @@ #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Elements/GatewayPayload.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class GatewayPayloadSerializer : public GenericPayloadSerializer<GatewayPayload> { public: GatewayPayloadSerializer(); - virtual std::string serializePayload(boost::shared_ptr<GatewayPayload> item) const; + virtual std::string serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<GatewayPayload> item) const; }; } diff --git a/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.cpp b/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.cpp index 0cf1b1b9..eeb1a6a3 100644 --- a/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.cpp +++ b/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.cpp @@ -19,7 +19,7 @@ namespace Swift { InvisibleSerializer::InvisibleSerializer() : GenericPayloadSerializer<InvisiblePayload>() { } -std::string InvisibleSerializer::serializePayload(boost::shared_ptr<InvisiblePayload> attention) const { +std::string InvisibleSerializer::serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<InvisiblePayload> attention) const { XMLElement attentionElement("invisible", "urn:xmpp:invisible:0"); return attentionElement.serialize(); diff --git a/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.h b/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.h index 034ab2e1..66149b5d 100644 --- a/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.h +++ b/include/Swiften/Serializer/PayloadSerializers/InvisibleSerializer.h @@ -9,6 +9,8 @@ #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Elements/InvisiblePayload.h> +#include "Swiften/SwiftenCompat.h" + // This payload is NOT part of ANY XEP and it is only // libtransport related extension. namespace Swift { @@ -16,6 +18,6 @@ namespace Swift { public: InvisibleSerializer(); - virtual std::string serializePayload(boost::shared_ptr<InvisiblePayload>) const; + virtual std::string serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<InvisiblePayload>) const; }; } diff --git a/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.cpp b/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.cpp index 552e1936..9f7d70af 100644 --- a/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.cpp +++ b/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.cpp @@ -19,7 +19,7 @@ namespace Swift { SpectrumErrorSerializer::SpectrumErrorSerializer() : GenericPayloadSerializer<SpectrumErrorPayload>() { } -std::string SpectrumErrorSerializer::serializePayload(boost::shared_ptr<SpectrumErrorPayload> error) const { +std::string SpectrumErrorSerializer::serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SpectrumErrorPayload> error) const { std::string data; switch (error->getError()) { case SpectrumErrorPayload::CONNECTION_ERROR_NETWORK_ERROR: data = "CONNECTION_ERROR_NETWORK_ERROR"; break; diff --git a/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.h b/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.h index 112e79e2..2d713d79 100644 --- a/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.h +++ b/include/Swiften/Serializer/PayloadSerializers/SpectrumErrorSerializer.h @@ -9,11 +9,13 @@ #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Elements/SpectrumErrorPayload.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class SpectrumErrorSerializer : public GenericPayloadSerializer<SpectrumErrorPayload> { public: SpectrumErrorSerializer(); - virtual std::string serializePayload(boost::shared_ptr<SpectrumErrorPayload>) const; + virtual std::string serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SpectrumErrorPayload>) const; }; } diff --git a/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.cpp b/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.cpp index 0bd85f5f..41aa171a 100644 --- a/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.cpp +++ b/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.cpp @@ -13,15 +13,17 @@ #include <Swiften/Serializer/XML/XMLRawTextNode.h> #include <Swiften/Serializer/XML/XMLElement.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { StatsSerializer::StatsSerializer() : GenericPayloadSerializer<StatsPayload>() { } -std::string StatsSerializer::serializePayload(boost::shared_ptr<StatsPayload> stats) const { +std::string StatsSerializer::serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<StatsPayload> stats) const { XMLElement queryElement("query", "http://jabber.org/protocol/stats"); foreach(const StatsPayload::Item& item, stats->getItems()) { - boost::shared_ptr<XMLElement> statElement(new XMLElement("stat")); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XMLElement> statElement(new XMLElement("stat")); statElement->setAttribute("name", item.getName()); if (!item.getUnits().empty()) { statElement->setAttribute("units", item.getUnits()); diff --git a/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.h b/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.h index cf45941d..88ead07a 100644 --- a/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.h +++ b/include/Swiften/Serializer/PayloadSerializers/StatsSerializer.h @@ -9,11 +9,13 @@ #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Elements/StatsPayload.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class StatsSerializer : public GenericPayloadSerializer<StatsPayload> { public: StatsSerializer(); - virtual std::string serializePayload(boost::shared_ptr<StatsPayload>) const; + virtual std::string serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<StatsPayload>) const; }; } diff --git a/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.cpp b/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.cpp index 260aad2b..192ef7fc 100644 --- a/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.cpp +++ b/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.cpp @@ -10,16 +10,18 @@ #include <Swiften/Serializer/XML/XMLTextNode.h> #include <Swiften/Serializer/XML/XMLElement.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { XHTMLIMSerializer::XHTMLIMSerializer() : GenericPayloadSerializer<XHTMLIMPayload>() { } -std::string XHTMLIMSerializer::serializePayload(boost::shared_ptr<XHTMLIMPayload> payload) const { +std::string XHTMLIMSerializer::serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XHTMLIMPayload> payload) const { XMLElement html("html", "http://jabber.org/protocol/xhtml-im"); - boost::shared_ptr<XMLElement> body(new XMLElement("body", "http://www.w3.org/1999/xhtml")); - body->addNode(boost::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(payload->getBody()))); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XMLElement> body(new XMLElement("body", "http://www.w3.org/1999/xhtml")); + body->addNode(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XMLRawTextNode>(new XMLRawTextNode(payload->getBody()))); html.addNode(body); return html.serialize(); diff --git a/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.h b/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.h index 0abc523c..287f0a63 100644 --- a/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.h +++ b/include/Swiften/Serializer/PayloadSerializers/XHTMLIMSerializer.h @@ -9,11 +9,13 @@ #include <Swiften/Serializer/GenericPayloadSerializer.h> #include <Swiften/Elements/XHTMLIMPayload.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class XHTMLIMSerializer : public GenericPayloadSerializer<XHTMLIMPayload> { public: XHTMLIMSerializer(); - virtual std::string serializePayload(boost::shared_ptr<XHTMLIMPayload> xhtml) const; + virtual std::string serializePayload(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<XHTMLIMPayload> xhtml) const; }; } diff --git a/include/Swiften/Server/Server.cpp b/include/Swiften/Server/Server.cpp index 4313e1b3..c1606393 100644 --- a/include/Swiften/Server/Server.cpp +++ b/include/Swiften/Server/Server.cpp @@ -8,6 +8,7 @@ #include <string> #include <boost/bind.hpp> +#include <boost/signal.hpp> #include "Swiften/Base/String.h" #include "Swiften/Base/foreach.h" @@ -88,14 +89,14 @@ void Server::stop() { stopping = true; -// foreach(boost::shared_ptr<ServerFromClientSession> session, serverFromClientSessions) { +// foreach(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session, serverFromClientSessions) { // session->finishSession(); // } serverFromClientSessions.clear(); if (serverFromClientConnectionServer) { serverFromClientConnectionServer->stop(); - foreach(boost::bsignals::connection& connection, serverFromClientConnectionServerSignalConnections) { + foreach(SWIFTEN_SIGNAL_NAMESPACE::connection& connection, serverFromClientConnectionServerSignalConnections) { connection.disconnect(); } serverFromClientConnectionServerSignalConnections.clear(); @@ -106,9 +107,9 @@ void Server::stop() { // onStopped(e); } -void Server::handleNewClientConnection(boost::shared_ptr<Connection> connection) { +void Server::handleNewClientConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Connection> connection) { - boost::shared_ptr<ServerFromClientSession> serverFromClientSession = boost::shared_ptr<ServerFromClientSession>( + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> serverFromClientSession = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession>( new ServerFromClientSession(idGenerator.generateID(), connection, getPayloadParserFactories(), getPayloadSerializers(), userRegistry_, parserFactory_)); //serverFromClientSession->setAllowSASLEXTERNAL(); @@ -138,11 +139,11 @@ void Server::handleDataWritten(const SafeByteArray& data) { onDataWritten(data); } -void Server::handleSessionStarted(boost::shared_ptr<ServerFromClientSession> session) { +void Server::handleSessionStarted(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session) { dynamic_cast<ServerStanzaChannel *>(stanzaChannel_)->addSession(session); } -void Server::handleSessionFinished(boost::shared_ptr<ServerFromClientSession> session) { +void Server::handleSessionFinished(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session) { // if (!session->getRemoteJID().isValid()) { // Swift::Presence::ref presence = Swift::Presence::create(); // presence->setFrom(session->getBareJID()); diff --git a/include/Swiften/Server/Server.h b/include/Swiften/Server/Server.h index b32ae463..90bce626 100644 --- a/include/Swiften/Server/Server.h +++ b/include/Swiften/Server/Server.h @@ -8,6 +8,7 @@ #include <boost/shared_ptr.hpp> #include <boost/optional.hpp> +#include <boost/signals2.hpp> #include <vector> #include "Swiften/Network/BoostIOServiceThread.h" @@ -21,6 +22,7 @@ #include "Swiften/Entity/Entity.h" #include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h" #include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" +#include "Swiften/SwiftenCompat.h" #include <Swiften/TLS/CertificateWithKey.h> #include <Swiften/Parser/PlatformXMLParserFactory.h> @@ -53,7 +55,7 @@ namespace Swift { return iqRouter_; } - boost::shared_ptr<ConnectionServer> getConnectionServer() const { + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> getConnectionServer() const { return serverFromClientConnectionServer; } @@ -63,10 +65,10 @@ namespace Swift { void addTLSEncryption(TLSServerContextFactory* tlsContextFactory, CertificateWithKey::ref cert); private: - void handleNewClientConnection(boost::shared_ptr<Connection> c); - void handleSessionStarted(boost::shared_ptr<ServerFromClientSession>); - void handleSessionFinished(boost::shared_ptr<ServerFromClientSession>); - void handleElementReceived(boost::shared_ptr<Element> element, boost::shared_ptr<ServerFromClientSession> session); + void handleNewClientConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Connection> c); + void handleSessionStarted(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession>); + void handleSessionFinished(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession>); + void handleElementReceived(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element> element, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session); void handleDataRead(const SafeByteArray&); void handleDataWritten(const SafeByteArray&); @@ -77,9 +79,9 @@ namespace Swift { EventLoop* eventLoop; NetworkFactories* networkFactories_; bool stopping; - boost::shared_ptr<ConnectionServer> serverFromClientConnectionServer; - std::vector<boost::bsignals::connection> serverFromClientConnectionServerSignalConnections; - std::list<boost::shared_ptr<ServerFromClientSession> > serverFromClientSessions; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> serverFromClientConnectionServer; + std::vector<SWIFTEN_SIGNAL_NAMESPACE::connection> serverFromClientConnectionServerSignalConnections; + std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> > serverFromClientSessions; JID selfJID; StanzaChannel *stanzaChannel_; IQRouter *iqRouter_; diff --git a/include/Swiften/Server/ServerFromClientSession.cpp b/include/Swiften/Server/ServerFromClientSession.cpp index 49138fb9..304ca25e 100644 --- a/include/Swiften/Server/ServerFromClientSession.cpp +++ b/include/Swiften/Server/ServerFromClientSession.cpp @@ -29,6 +29,8 @@ #include <iostream> #include <Swiften/TLS/CertificateWithKey.h> +#include "Swiften/SwiftenCompat.h" + #include <Swiften/Version.h> #if (SWIFTEN_VERSION >= 0x030000) #include <Swiften/Elements/ToplevelElement.h> @@ -38,7 +40,7 @@ namespace Swift { ServerFromClientSession::ServerFromClientSession( const std::string& id, - boost::shared_ptr<Connection> connection, + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, UserRegistry* userRegistry, @@ -63,7 +65,7 @@ ServerFromClientSession::~ServerFromClientSession() { void ServerFromClientSession::handlePasswordValid() { if (!isInitialized()) { - getXMPPLayer()->writeElement(boost::shared_ptr<AuthSuccess>(new AuthSuccess())); + getXMPPLayer()->writeElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<AuthSuccess>(new AuthSuccess())); authenticated_ = true; getXMPPLayer()->resetParser(); } @@ -71,9 +73,9 @@ void ServerFromClientSession::handlePasswordValid() { void ServerFromClientSession::handlePasswordInvalid(const std::string &error) { if (!isInitialized()) { - getXMPPLayer()->writeElement(boost::shared_ptr<AuthFailure>(new AuthFailure)); + getXMPPLayer()->writeElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<AuthFailure>(new AuthFailure)); if (!error.empty()) { - boost::shared_ptr<StreamError> msg(new StreamError(StreamError::UndefinedCondition, error)); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<StreamError> msg(new StreamError(StreamError::UndefinedCondition, error)); getXMPPLayer()->writeElement(msg); } @@ -82,9 +84,9 @@ void ServerFromClientSession::handlePasswordInvalid(const std::string &error) { } #if (SWIFTEN_VERSION >= 0x030000) -void ServerFromClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { +void ServerFromClientSession::handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ToplevelElement> element) { #else -void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) { +void ServerFromClientSession::handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element> element) { #endif if (isInitialized()) { onElementReceived(element); @@ -93,7 +95,7 @@ void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) if (AuthRequest* authRequest = dynamic_cast<AuthRequest*>(element.get())) { if (authRequest->getMechanism() == "PLAIN" || (allowSASLEXTERNAL && authRequest->getMechanism() == "EXTERNAL")) { if (authRequest->getMechanism() == "EXTERNAL") { - getXMPPLayer()->writeElement(boost::shared_ptr<AuthSuccess>(new AuthSuccess())); + getXMPPLayer()->writeElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<AuthSuccess>(new AuthSuccess())); authenticated_ = true; getXMPPLayer()->resetParser(); } @@ -104,25 +106,25 @@ void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) } } else { - getXMPPLayer()->writeElement(boost::shared_ptr<AuthFailure>(new AuthFailure)); + getXMPPLayer()->writeElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<AuthFailure>(new AuthFailure)); finishSession(NoSupportedAuthMechanismsError); } } else if (dynamic_cast<StartTLSRequest*>(element.get()) != NULL) { - getXMPPLayer()->writeElement(boost::shared_ptr<TLSProceed>(new TLSProceed)); + getXMPPLayer()->writeElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<TLSProceed>(new TLSProceed)); getStreamStack()->addLayer(tlsLayer); tlsLayer->connect(); getXMPPLayer()->resetParser(); } else if (IQ* iq = dynamic_cast<IQ*>(element.get())) { - if (boost::shared_ptr<ResourceBind> resourceBind = iq->getPayload<ResourceBind>()) { + if (SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ResourceBind> resourceBind = iq->getPayload<ResourceBind>()) { std::string bucket = "abcdefghijklmnopqrstuvwxyz"; std::string uuid; for (int i = 0; i < 10; i++) { uuid += bucket[rand() % bucket.size()]; } setRemoteJID(JID(user_, getLocalJID().getDomain(), uuid)); - boost::shared_ptr<ResourceBind> resultResourceBind(new ResourceBind()); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ResourceBind> resultResourceBind(new ResourceBind()); resultResourceBind->setJID(getRemoteJID()); getXMPPLayer()->writeElement(IQ::createResult(JID(), iq->getID(), resultResourceBind)); } @@ -141,7 +143,7 @@ void ServerFromClientSession::handleStreamStart(const ProtocolHeader& incomingHe header.setID(id_); getXMPPLayer()->writeHeader(header); - boost::shared_ptr<StreamFeatures> features(new StreamFeatures()); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<StreamFeatures> features(new StreamFeatures()); if (!authenticated_) { if (tlsLayer && !tlsConnected) { @@ -177,7 +179,7 @@ void ServerFromClientSession::addTLSEncryption(TLSServerContextFactory* tlsConte if (!tlsLayer->setServerCertificate(cert)) { // std::cout << "error\n"; // TODO: -// onClosed(boost::shared_ptr<Error>(new Error(Error::InvalidTLSCertificateError))); +// onClosed(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Error>(new Error(Error::InvalidTLSCertificateError))); } else { tlsLayer->onError.connect(boost::bind(&ServerFromClientSession::handleTLSError, this)); diff --git a/include/Swiften/Server/ServerFromClientSession.h b/include/Swiften/Server/ServerFromClientSession.h index 4496bdf1..d78fedaa 100644 --- a/include/Swiften/Server/ServerFromClientSession.h +++ b/include/Swiften/Server/ServerFromClientSession.h @@ -7,8 +7,8 @@ #pragma once #include <boost/shared_ptr.hpp> -#include <Swiften/Base/boost_bsignals.h> #include <boost/enable_shared_from_this.hpp> +#include <boost/signals.hpp> #include <string> #include <Swiften/Session/Session.h> @@ -19,6 +19,8 @@ #include <Swiften/Version.h> #define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000) +#include "Swiften/SwiftenCompat.h" + namespace Swift { class ProtocolHeader; class Element; @@ -38,7 +40,7 @@ namespace Swift { public: ServerFromClientSession( const std::string& id, - boost::shared_ptr<Connection> connection, + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Connection> connection, PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, UserRegistry* userRegistry, @@ -63,9 +65,9 @@ namespace Swift { private: #if HAVE_SWIFTEN_3 - void handleElement(boost::shared_ptr<ToplevelElement>); + void handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ToplevelElement>); #else - void handleElement(boost::shared_ptr<Element>); + void handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element>); #endif void handleStreamStart(const ProtocolHeader& header); void handleSessionFinished(const boost::optional<SessionError>&); diff --git a/include/Swiften/Server/ServerSession.h b/include/Swiften/Server/ServerSession.h index 486ebaa8..73a9203a 100644 --- a/include/Swiften/Server/ServerSession.h +++ b/include/Swiften/Server/ServerSession.h @@ -10,6 +10,8 @@ #include <Swiften/Elements/Stanza.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class ServerSession { public: @@ -18,6 +20,6 @@ namespace Swift { virtual const JID& getJID() const = 0; virtual int getPriority() const = 0; - virtual void sendStanza(boost::shared_ptr<Stanza>) = 0; + virtual void sendStanza(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Stanza>) = 0; }; } diff --git a/include/Swiften/Server/ServerStanzaChannel.cpp b/include/Swiften/Server/ServerStanzaChannel.cpp index 8150d20d..dc3abe9b 100644 --- a/include/Swiften/Server/ServerStanzaChannel.cpp +++ b/include/Swiften/Server/ServerStanzaChannel.cpp @@ -21,41 +21,41 @@ namespace { struct HasJID { HasJID(const JID& jid) : jid(jid) {} - bool operator()(const boost::shared_ptr<ServerFromClientSession> session) const { + bool operator()(const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session) const { return session->getRemoteJID().equals(jid, JID::WithResource); } JID jid; }; } -void ServerStanzaChannel::addSession(boost::shared_ptr<ServerFromClientSession> session) { +void ServerStanzaChannel::addSession(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session) { sessions[session->getRemoteJID().toBare().toString()].push_back(session); session->onSessionFinished.connect(boost::bind(&ServerStanzaChannel::handleSessionFinished, this, _1, session)); session->onElementReceived.connect(boost::bind(&ServerStanzaChannel::handleElement, this, _1, session)); session->onDataRead.connect(boost::bind(&ServerStanzaChannel::handleDataRead, this, _1, session)); } -void ServerStanzaChannel::removeSession(boost::shared_ptr<ServerFromClientSession> session) { +void ServerStanzaChannel::removeSession(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session) { session->onSessionFinished.disconnect(boost::bind(&ServerStanzaChannel::handleSessionFinished, this, _1, session)); session->onElementReceived.disconnect(boost::bind(&ServerStanzaChannel::handleElement, this, _1, session)); session->onDataRead.disconnect(boost::bind(&ServerStanzaChannel::handleDataRead, this, _1, session)); - std::list<boost::shared_ptr<ServerFromClientSession> > &lst = sessions[session->getRemoteJID().toBare().toString()]; + std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> > &lst = sessions[session->getRemoteJID().toBare().toString()]; lst.erase(std::remove(lst.begin(), lst.end(), session), lst.end()); } -void ServerStanzaChannel::sendIQ(boost::shared_ptr<IQ> iq) { +void ServerStanzaChannel::sendIQ(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<IQ> iq) { send(iq); } -void ServerStanzaChannel::sendMessage(boost::shared_ptr<Message> message) { +void ServerStanzaChannel::sendMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Message> message) { send(message); } -void ServerStanzaChannel::sendPresence(boost::shared_ptr<Presence> presence) { +void ServerStanzaChannel::sendPresence(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Presence> presence) { send(presence); } -void ServerStanzaChannel::handleDataRead(const SafeByteArray &data, const boost::shared_ptr<ServerFromClientSession> &session) { +void ServerStanzaChannel::handleDataRead(const SafeByteArray &data, const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> &session) { if (safeByteArrayToString(data).find("</stream:stream>") != std::string::npos) { Swift::Presence::ref presence = Swift::Presence::create(); presence->setFrom(session->getRemoteJID()); @@ -64,16 +64,16 @@ void ServerStanzaChannel::handleDataRead(const SafeByteArray &data, const boost: } } #if HAVE_SWIFTEN_3 -void ServerStanzaChannel::finishSession(const JID& to, boost::shared_ptr<ToplevelElement> element, bool last) { +void ServerStanzaChannel::finishSession(const JID& to, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ToplevelElement> element, bool last) { #else -void ServerStanzaChannel::finishSession(const JID& to, boost::shared_ptr<Element> element, bool last) { +void ServerStanzaChannel::finishSession(const JID& to, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element> element, bool last) { #endif - std::vector<boost::shared_ptr<ServerFromClientSession> > candidateSessions; - for (std::list<boost::shared_ptr<ServerFromClientSession> >::const_iterator i = sessions[to.toBare().toString()].begin(); i != sessions[to.toBare().toString()].end(); ++i) { + std::vector<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> > candidateSessions; + for (std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> >::const_iterator i = sessions[to.toBare().toString()].begin(); i != sessions[to.toBare().toString()].end(); ++i) { candidateSessions.push_back(*i); } - for (std::vector<boost::shared_ptr<ServerFromClientSession> >::const_iterator i = candidateSessions.begin(); i != candidateSessions.end(); ++i) { + for (std::vector<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> >::const_iterator i = candidateSessions.begin(); i != candidateSessions.end(); ++i) { removeSession(*i); if (element) { (*i)->sendElement(element); @@ -98,7 +98,7 @@ std::string ServerStanzaChannel::getNewIQID() { return idGenerator.generateID(); } -void ServerStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { +void ServerStanzaChannel::send(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Stanza> stanza) { JID to = stanza->getTo(); assert(to.isValid()); @@ -108,7 +108,7 @@ void ServerStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { // For a full JID, first try to route to a session with the full JID if (!to.isBare()) { - std::list<boost::shared_ptr<ServerFromClientSession> >::const_iterator i = std::find_if(sessions[stanza->getTo().toBare().toString()].begin(), sessions[stanza->getTo().toBare().toString()].end(), HasJID(to)); + std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> >::const_iterator i = std::find_if(sessions[stanza->getTo().toBare().toString()].begin(), sessions[stanza->getTo().toBare().toString()].end(), HasJID(to)); if (i != sessions[stanza->getTo().toBare().toString()].end()) { (*i)->sendElement(stanza); return; @@ -117,8 +117,8 @@ void ServerStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { // Look for candidate sessions to = to.toBare(); - std::vector<boost::shared_ptr<ServerFromClientSession> > candidateSessions; - for (std::list<boost::shared_ptr<ServerFromClientSession> >::const_iterator i = sessions[stanza->getTo().toBare().toString()].begin(); i != sessions[stanza->getTo().toBare().toString()].end(); ++i) { + std::vector<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> > candidateSessions; + for (std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> >::const_iterator i = sessions[stanza->getTo().toBare().toString()].begin(); i != sessions[stanza->getTo().toBare().toString()].end(); ++i) { if ((*i)->getRemoteJID().equals(to, JID::WithoutResource)) { candidateSessions.push_back(*i); (*i)->sendElement(stanza); @@ -134,7 +134,7 @@ void ServerStanzaChannel::send(boost::shared_ptr<Stanza> stanza) { return; } -void ServerStanzaChannel::handleSessionFinished(const boost::optional<Session::SessionError>&, const boost::shared_ptr<ServerFromClientSession>& session) { +void ServerStanzaChannel::handleSessionFinished(const boost::optional<Session::SessionError>&, const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession>& session) { removeSession(session); // if (!session->initiatedFinish()) { @@ -145,8 +145,8 @@ void ServerStanzaChannel::handleSessionFinished(const boost::optional<Session::S // } } -void ServerStanzaChannel::handleElement(boost::shared_ptr<Element> element, const boost::shared_ptr<ServerFromClientSession>& session) { - boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element); +void ServerStanzaChannel::handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element> element, const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession>& session) { + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Stanza> stanza = SWIFTEN_SHRPTR_NAMESPACE::dynamic_pointer_cast<Stanza>(element); if (!stanza) { return; } @@ -157,19 +157,19 @@ void ServerStanzaChannel::handleElement(boost::shared_ptr<Element> element, cons return; - boost::shared_ptr<Message> message = boost::dynamic_pointer_cast<Message>(stanza); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Message> message = SWIFTEN_SHRPTR_NAMESPACE::dynamic_pointer_cast<Message>(stanza); if (message) { onMessageReceived(message); return; } - boost::shared_ptr<Presence> presence = boost::dynamic_pointer_cast<Presence>(stanza); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Presence> presence = SWIFTEN_SHRPTR_NAMESPACE::dynamic_pointer_cast<Presence>(stanza); if (presence) { onPresenceReceived(presence); return; } - boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(stanza); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<IQ> iq = SWIFTEN_SHRPTR_NAMESPACE::dynamic_pointer_cast<IQ>(stanza); if (iq) { onIQReceived(iq); return; diff --git a/include/Swiften/Server/ServerStanzaChannel.h b/include/Swiften/Server/ServerStanzaChannel.h index bf9cdb76..14aef853 100644 --- a/include/Swiften/Server/ServerStanzaChannel.h +++ b/include/Swiften/Server/ServerStanzaChannel.h @@ -25,16 +25,16 @@ namespace Swift { ServerStanzaChannel(const JID &selfJID) : StanzaChannel() { m_jid = selfJID; } - void addSession(boost::shared_ptr<ServerFromClientSession> session); - void removeSession(boost::shared_ptr<ServerFromClientSession> session); + void addSession(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session); + void removeSession(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session); - void sendIQ(boost::shared_ptr<IQ> iq); - void sendMessage(boost::shared_ptr<Message> message); - void sendPresence(boost::shared_ptr<Presence> presence); + void sendIQ(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<IQ> iq); + void sendMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Message> message); + void sendPresence(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Presence> presence); #if HAVE_SWIFTEN_3 - void finishSession(const JID& to, boost::shared_ptr<ToplevelElement> element, bool last = false); + void finishSession(const JID& to, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ToplevelElement> element, bool last = false); #else - void finishSession(const JID& to, boost::shared_ptr<Element> element, bool last = false); + void finishSession(const JID& to, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element> element, bool last = false); #endif bool getStreamManagementEnabled() const { return false; @@ -50,17 +50,17 @@ namespace Swift { private: std::string getNewIQID(); - void send(boost::shared_ptr<Stanza> stanza); - void handleSessionFinished(const boost::optional<Session::SessionError>&, const boost::shared_ptr<ServerFromClientSession> &session); - void handleElement(boost::shared_ptr<Element> element, const boost::shared_ptr<ServerFromClientSession> &session); - void handleDataRead(const SafeByteArray &data, const boost::shared_ptr<ServerFromClientSession> &session); + void send(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Stanza> stanza); + void handleSessionFinished(const boost::optional<Session::SessionError>&, const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> &session); + void handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element> element, const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> &session); + void handleDataRead(const SafeByteArray &data, const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> &session); void handleSessionInitialized(); private: JID m_jid; IDGenerator idGenerator; // [JID][resources][ServerFromClientSession] - std::map<std::string, std::list<boost::shared_ptr<ServerFromClientSession> > > sessions; + std::map<std::string, std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> > > sessions; }; } diff --git a/include/Swiften/Server/ServerStanzaRouter.cpp b/include/Swiften/Server/ServerStanzaRouter.cpp index 17253597..ee890f03 100644 --- a/include/Swiften/Server/ServerStanzaRouter.cpp +++ b/include/Swiften/Server/ServerStanzaRouter.cpp @@ -32,7 +32,7 @@ namespace { ServerStanzaRouter::ServerStanzaRouter() { } -bool ServerStanzaRouter::routeStanza(boost::shared_ptr<Stanza> stanza) { +bool ServerStanzaRouter::routeStanza(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Stanza> stanza) { JID to = stanza->getTo(); assert(to.isValid()); diff --git a/include/Swiften/Server/ServerStanzaRouter.h b/include/Swiften/Server/ServerStanzaRouter.h index 4a9493be..52c23057 100644 --- a/include/Swiften/Server/ServerStanzaRouter.h +++ b/include/Swiften/Server/ServerStanzaRouter.h @@ -12,6 +12,8 @@ #include <Swiften/JID/JID.h> #include <Swiften/Elements/Stanza.h> +#include "Swiften/SwiftenCompat.h" + namespace Swift { class ServerSession; @@ -19,7 +21,7 @@ namespace Swift { public: ServerStanzaRouter(); - bool routeStanza(boost::shared_ptr<Stanza>); + bool routeStanza(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Stanza>); void addClientSession(ServerSession*); void removeClientSession(ServerSession*); diff --git a/include/Swiften/StreamStack/TLSServerLayer.cpp b/include/Swiften/StreamStack/TLSServerLayer.cpp index 1e16ffcc..b2377708 100644 --- a/include/Swiften/StreamStack/TLSServerLayer.cpp +++ b/include/Swiften/StreamStack/TLSServerLayer.cpp @@ -45,7 +45,7 @@ Certificate::ref TLSServerLayer::getPeerCertificate() const { return context->getPeerCertificate(); } -boost::shared_ptr<CertificateVerificationError> TLSServerLayer::getPeerCertificateVerificationError() const { +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> TLSServerLayer::getPeerCertificateVerificationError() const { return context->getPeerCertificateVerificationError(); } diff --git a/include/Swiften/StreamStack/TLSServerLayer.h b/include/Swiften/StreamStack/TLSServerLayer.h index 752ca86b..34f99a03 100644 --- a/include/Swiften/StreamStack/TLSServerLayer.h +++ b/include/Swiften/StreamStack/TLSServerLayer.h @@ -4,13 +4,14 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Base/boost_bsignals.h" +#include <boost/signals.hpp> #include "Swiften/Base/SafeByteArray.h" #include "Swiften/StreamStack/StreamLayer.h" #include "Swiften/TLS/Certificate.h" #include <Swiften/TLS/CertificateWithKey.h> #include "Swiften/TLS/CertificateVerificationError.h" +#include "Swiften/SwiftenCompat.h" namespace Swift { class TLSServerContext; @@ -26,7 +27,7 @@ namespace Swift { bool setServerCertificate(CertificateWithKey::ref cert); Certificate::ref getPeerCertificate() const; - boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; void writeData(const SafeByteArray& data); void handleDataRead(const SafeByteArray& data); diff --git a/include/Swiften/SwiftenCompat.h b/include/Swiften/SwiftenCompat.h new file mode 100644 index 00000000..21fca92b --- /dev/null +++ b/include/Swiften/SwiftenCompat.h @@ -0,0 +1,44 @@ +/* + * Swift compatibility + * + * Copyright (c) 2016, Vladimir Matena <vlada.matena@gmail.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <Swiften/Version.h> + +/* + * Define macros for Swiften compatible shared pointer and signal namespaces. + * + * Using these it is possible to declare shared pointers and signals like this: + * + * SWIFTEN_SIGNAL_NAMESPACE::signal signal; + * SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Type> ptr; + * + * These are guaranteed to be the same implementation as Swift uses internally, + * thus can be used when passign/retrieveing data from/to swiften. + * + * This is due to Swift 4 moved from boost::shared_ptr to SWIFTEN_SHRPTR_NAMESPACE::shared_ptr + * and from boost::signals to boost::signals2 . + */ + +#if (SWIFTEN_VERSION >= 0x040000) +#define SWIFTEN_SHRPTR_NAMESPACE std +#define SWIFTEN_SIGNAL_NAMESPACE boost::signals2 +#else +#define SWIFTEN_SHRPTR_NAMESPACE boost +#define SWIFTEN_SIGNAL_NAMESPACE boost::signals +#endif diff --git a/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.cpp b/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.cpp index b12708a1..dd2b328e 100644 --- a/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.cpp +++ b/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.cpp @@ -181,7 +181,7 @@ void OpenSSLServerContext::sendPendingDataToApplication() { } bool OpenSSLServerContext::setServerCertificate(CertificateWithKey::ref certref) { - boost::shared_ptr<PKCS12Certificate> certificate = boost::dynamic_pointer_cast<PKCS12Certificate>(certref); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<PKCS12Certificate> certificate = SWIFTEN_SHRPTR_NAMESPACE::dynamic_pointer_cast<PKCS12Certificate>(certref); if (certificate->isNull()) { LOG4CXX_ERROR(logger, "TLS WILL NOT WORK: Certificate can't be loaded."); return false; @@ -190,7 +190,7 @@ bool OpenSSLServerContext::setServerCertificate(CertificateWithKey::ref certref) // Create a PKCS12 structure BIO* bio = BIO_new(BIO_s_mem()); BIO_write(bio, vecptr(certificate->getData()), certificate->getData().size()); - boost::shared_ptr<PKCS12> pkcs12(d2i_PKCS12_bio(bio, NULL), PKCS12_free); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<PKCS12> pkcs12(d2i_PKCS12_bio(bio, NULL), PKCS12_free); BIO_free(bio); if (!pkcs12) { LOG4CXX_ERROR(logger, "TLS WILL NOT WORK: Certificate is not in PKCS#12 format."); @@ -206,9 +206,9 @@ bool OpenSSLServerContext::setServerCertificate(CertificateWithKey::ref certref) LOG4CXX_ERROR(logger, "TLS WILL NOT WORK: Certificate is not in PKCS#12 format."); return false; } - boost::shared_ptr<X509> cert(certPtr, X509_free); - boost::shared_ptr<EVP_PKEY> privateKey(privateKeyPtr, EVP_PKEY_free); - boost::shared_ptr<STACK_OF(X509)> caCerts(caCertsPtr, freeX509Stack); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<X509> cert(certPtr, X509_free); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<EVP_PKEY> privateKey(privateKeyPtr, EVP_PKEY_free); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<STACK_OF(X509)> caCerts(caCertsPtr, freeX509Stack); // Use the key & certificates if (SSL_CTX_use_certificate(context_, cert.get()) != 1) { @@ -223,7 +223,7 @@ bool OpenSSLServerContext::setServerCertificate(CertificateWithKey::ref certref) } Certificate::ref OpenSSLServerContext::getPeerCertificate() const { - boost::shared_ptr<X509> x509Cert(SSL_get_peer_certificate(handle_), X509_free); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<X509> x509Cert(SSL_get_peer_certificate(handle_), X509_free); if (x509Cert) { return Certificate::ref(new OpenSSLCertificate(x509Cert)); } @@ -232,13 +232,13 @@ Certificate::ref OpenSSLServerContext::getPeerCertificate() const { } } -boost::shared_ptr<CertificateVerificationError> OpenSSLServerContext::getPeerCertificateVerificationError() const { +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> OpenSSLServerContext::getPeerCertificateVerificationError() const { int verifyResult = SSL_get_verify_result(handle_); if (verifyResult != X509_V_OK) { - return boost::shared_ptr<CertificateVerificationError>(new CertificateVerificationError(getVerificationErrorTypeForResult(verifyResult))); + return SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError>(new CertificateVerificationError(getVerificationErrorTypeForResult(verifyResult))); } else { - return boost::shared_ptr<CertificateVerificationError>(); + return SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError>(); } } diff --git a/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.h b/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.h index d913c4da..1cb0f733 100644 --- a/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.h +++ b/include/Swiften/TLS/OpenSSL/OpenSSLServerContext.h @@ -7,11 +7,11 @@ #pragma once #include <openssl/ssl.h> -#include "Swiften/Base/boost_bsignals.h" #include <boost/noncopyable.hpp> #include "Swiften/TLS/TLSServerContext.h" #include "Swiften/Base/ByteArray.h" +#include "Swiften/SwiftenCompat.h" #include <Swiften/TLS/CertificateWithKey.h> namespace Swift { @@ -29,7 +29,7 @@ namespace Swift { void handleDataFromApplication(const SafeByteArray&); Certificate::ref getPeerCertificate() const; - boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; virtual ByteArray getFinishMessage() const; diff --git a/include/Swiften/TLS/Schannel/SchannelServerContext.cpp b/include/Swiften/TLS/Schannel/SchannelServerContext.cpp index 96c090b5..7f796fca 100644 --- a/include/Swiften/TLS/Schannel/SchannelServerContext.cpp +++ b/include/Swiften/TLS/Schannel/SchannelServerContext.cpp @@ -520,7 +520,7 @@ void SchannelServerContext::encryptAndSendData(const SafeByteArray& data) bool SchannelServerContext::setServerCertificate(CertificateWithKey::ref certificate) { - boost::shared_ptr<CAPICertificate> capiCertificate = boost::dynamic_pointer_cast<CAPICertificate>(certificate); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CAPICertificate> capiCertificate = std::dynamic_pointer_cast<CAPICertificate>(certificate); if (!capiCertificate || capiCertificate->isNull()) { return false; } @@ -551,7 +551,7 @@ Certificate::ref SchannelServerContext::getPeerCertificate() const CertificateVerificationError::ref SchannelServerContext::getPeerCertificateVerificationError() const { - boost::shared_ptr<CertificateVerificationError> pCertError; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> pCertError; if (m_state == Error) pCertError.reset( new CertificateVerificationError(m_verificationError) ); diff --git a/include/Swiften/TLS/Schannel/SchannelServerContext.h b/include/Swiften/TLS/Schannel/SchannelServerContext.h index d9e91df0..4478339f 100644 --- a/include/Swiften/TLS/Schannel/SchannelServerContext.h +++ b/include/Swiften/TLS/Schannel/SchannelServerContext.h @@ -6,8 +6,6 @@ #pragma once -#include "Swiften/Base/boost_bsignals.h" - #include "Swiften/TLS/TLSServerContext.h" #include "Swiften/TLS/Schannel/SchannelUtil.h" #include <Swiften/TLS/CertificateWithKey.h> @@ -26,7 +24,7 @@ namespace Swift class SchannelServerContext : public TLSServerContext, boost::noncopyable { public: - typedef boost::shared_ptr<SchannelServerContext> sp_t; + typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SchannelServerContext> sp_t; public: SchannelServerContext(); diff --git a/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.h b/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.h index 1880787a..def8c81a 100644 --- a/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.h +++ b/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.h @@ -38,16 +38,16 @@ class SecureTransportServerContext : public TLSServerContext { static std::string stateToString(State state); void setState(State newState); - static boost::shared_ptr<TLSError> nativeToTLSError(OSStatus error); - boost::shared_ptr<CertificateVerificationError> CSSMErrorToVerificationError(OSStatus resultCode); + static SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<TLSError> nativeToTLSError(OSStatus error); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> CSSMErrorToVerificationError(OSStatus resultCode); void processHandshake(); void verifyServerCertificate(); - void fatalError(boost::shared_ptr<TLSError> error, boost::shared_ptr<CertificateVerificationError> certificateError); + void fatalError(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<TLSError> error, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> certificateError); private: - boost::shared_ptr<SSLContext> sslContext_; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SSLContext> sslContext_; SafeByteArray readingBuffer_; State state_; CertificateVerificationError::ref verificationError_; diff --git a/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.mm b/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.mm index 8dd40e73..c60160c3 100644 --- a/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.mm +++ b/include/Swiften/TLS/SecureTransport/SecureTransportServerContext.mm @@ -39,7 +39,7 @@ namespace { CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) { - boost::shared_ptr<PKCS12Certificate> pkcs12 = boost::dynamic_pointer_cast<PKCS12Certificate>(key); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<PKCS12Certificate> pkcs12 = std::dynamic_pointer_cast<PKCS12Certificate>(key); if (!key) { return NULL; } @@ -104,7 +104,7 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) } SecureTransportContext::SecureTransportServerContext(bool checkCertificateRevocation) : state_(None), checkCertificateRevocation_(checkCertificateRevocation) { - sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType), CFRelease); + sslContext_ = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SSLContext>(SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType), CFRelease); OSStatus error = noErr; // set IO callbacks @@ -163,7 +163,7 @@ void SecureTransportServerContext::connect() { if (clientCertificate_) { CFArrayRef certs = CreateClientCertificateChainAsCFArrayRef(clientCertificate_); if (certs) { - boost::shared_ptr<CFArray> certRefs(certs, CFRelease); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CFArray> certRefs(certs, CFRelease); OSStatus result = SSLSetCertificate(sslContext_.get(), certRefs.get()); if (result != noErr) { SWIFT_LOG(error) << "SSLSetCertificate failed with error " << result << "." << std::endl; @@ -191,7 +191,7 @@ void SecureTransportServerContext::processHandshake() { } else { SWIFT_LOG(debug) << "Error returned from SSLHandshake call is " << error << "." << std::endl; - fatalError(nativeToTLSError(error), boost::make_shared<CertificateVerificationError>()); + fatalError(nativeToTLSError(error), SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>()); } } @@ -203,15 +203,15 @@ void SecureTransportServerContext::verifyServerCertificate() { SecTrustRef trust = NULL; OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &trust); if (error != noErr) { - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(SWIFTEN_SHRPTR_NAMESPACE::make_shared<TLSError>(), SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>()); return; } - boost::shared_ptr<SecTrust> trustRef = boost::shared_ptr<SecTrust>(trust, CFRelease); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SecTrust> trustRef = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SecTrust>(trust, CFRelease); if (checkCertificateRevocation_) { error = SecTrustSetOptions(trust, kSecTrustOptionRequireRevPerCert | kSecTrustOptionFetchIssuerFromNet); if (error != noErr) { - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(SWIFTEN_SHRPTR_NAMESPACE::make_shared<TLSError>(), SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>()); return; } } @@ -219,7 +219,7 @@ void SecureTransportServerContext::verifyServerCertificate() { SecTrustResultType trustResult; error = SecTrustEvaluate(trust, &trustResult); if (error != errSecSuccess) { - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(SWIFTEN_SHRPTR_NAMESPACE::make_shared<TLSError>(), SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>()); return; } @@ -242,7 +242,7 @@ void SecureTransportServerContext::verifyServerCertificate() { CSSM_TP_APPLE_EVIDENCE_INFO* statusChain; error = SecTrustGetResult(trustRef.get(), &trustResult, &certChain, &statusChain); if (error == errSecSuccess) { - boost::shared_ptr<CFArray> certChainRef = boost::shared_ptr<CFArray>(certChain, CFRelease); + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CFArray> certChainRef = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CFArray>(certChain, CFRelease); for (CFIndex index = 0; index < CFArrayGetCount(certChainRef.get()); index++) { for (CFIndex n = 0; n < statusChain[index].NumStatusCodes; n++) { // Even though Secure Transport reported CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK on the whole certificate @@ -259,11 +259,11 @@ void SecureTransportServerContext::verifyServerCertificate() { } } else { - verificationError_ = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); + verificationError_ = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); } break; case kSecTrustResultOtherError: - verificationError_ = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); + verificationError_ = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); break; default: SWIFT_LOG(warning) << "Unhandled trust result " << trustResult << "." << std::endl; @@ -274,7 +274,7 @@ void SecureTransportServerContext::verifyServerCertificate() { setState(Error); SSLClose(sslContext_.get()); sslContext_.reset(); - onError(boost::make_shared<TLSError>()); + onError(SWIFTEN_SHRPTR_NAMESPACE::make_shared<TLSError>()); } else { // proceed with handshake @@ -326,7 +326,7 @@ void SecureTransportServerContext::handleDataFromNetwork(const SafeByteArray& da } else { SWIFT_LOG(error) << "SSLRead failed with error " << error << ", read bytes: " << bytesRead << "." << std::endl; - fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); + fatalError(SWIFTEN_SHRPTR_NAMESPACE::make_shared<TLSError>(), SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>()); return; } @@ -358,7 +358,7 @@ void SecureTransportServerContext::handleDataFromApplication(const SafeByteArray return; default: SWIFT_LOG(warning) << "SSLWrite returned error code: " << error << ", processed bytes: " << processedBytes << std::endl; - fatalError(boost::make_shared<TLSError>(), boost::shared_ptr<CertificateVerificationError>()); + fatalError(SWIFTEN_SHRPTR_NAMESPACE::make_shared<TLSError>(), SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError>()); } } @@ -367,18 +367,18 @@ std::vector<Certificate::ref> SecureTransportServerContext::getPeerCertificateCh if (sslContext_) { typedef boost::remove_pointer<SecTrustRef>::type SecTrust; - boost::shared_ptr<SecTrust> securityTrust; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SecTrust> securityTrust; SecTrustRef secTrust = NULL;; OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &secTrust); if (error == noErr) { - securityTrust = boost::shared_ptr<SecTrust>(secTrust, CFRelease); + securityTrust = SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<SecTrust>(secTrust, CFRelease); CFIndex chainSize = SecTrustGetCertificateCount(securityTrust.get()); for (CFIndex n = 0; n < chainSize; n++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(securityTrust.get(), n); if (certificate) { - peerCertificateChain.push_back(boost::make_shared<SecureTransportCertificate>(certificate)); + peerCertificateChain.push_back(SWIFTEN_SHRPTR_NAMESPACE::make_shared<SecureTransportCertificate>(certificate)); } } } @@ -436,30 +436,30 @@ OSStatus SecureTransportServerContext::SSLSocketWriteCallback(SSLConnectionRef c return retValue; } -boost::shared_ptr<TLSError> SecureTransportServerContext::nativeToTLSError(OSStatus /* error */) { - boost::shared_ptr<TLSError> swiftenError; - swiftenError = boost::make_shared<TLSError>(); +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<TLSError> SecureTransportServerContext::nativeToTLSError(OSStatus /* error */) { + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<TLSError> swiftenError; + swiftenError = SWIFTEN_SHRPTR_NAMESPACE::make_shared<TLSError>(); return swiftenError; } -boost::shared_ptr<CertificateVerificationError> SecureTransportServerContext::CSSMErrorToVerificationError(OSStatus resultCode) { - boost::shared_ptr<CertificateVerificationError> error; +SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> SecureTransportServerContext::CSSMErrorToVerificationError(OSStatus resultCode) { + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> error; switch(resultCode) { case CSSMERR_TP_NOT_TRUSTED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_NOT_TRUSTED" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::Untrusted); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::Untrusted); break; case CSSMERR_TP_CERT_NOT_VALID_YET: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_NOT_VALID_YET" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::NotYetValid); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::NotYetValid); break; case CSSMERR_TP_CERT_EXPIRED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_EXPIRED" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::Expired); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::Expired); break; case CSSMERR_TP_CERT_REVOKED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_CERT_REVOKED" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::Revoked); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::Revoked); break; case CSSMERR_TP_VERIFY_ACTION_FAILED: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_TP_VERIFY_ACTION_FAILED" << std::endl; @@ -467,28 +467,28 @@ boost::shared_ptr<CertificateVerificationError> SecureTransportServerContext::CS case CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK" << std::endl; if (checkCertificateRevocation_) { - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); } break; case CSSMERR_APPLETP_OCSP_UNAVAILABLE: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_OCSP_UNAVAILABLE" << std::endl; if (checkCertificateRevocation_) { - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::RevocationCheckFailed); } break; case CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE: SWIFT_LOG(debug) << "CSSM result code: CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE" << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidPurpose); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::InvalidPurpose); break; default: SWIFT_LOG(warning) << "unhandled CSSM error: " << resultCode << ", CSSM_TP_BASE_TP_ERROR: " << CSSM_TP_BASE_TP_ERROR << std::endl; - error = boost::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); + error = SWIFTEN_SHRPTR_NAMESPACE::make_shared<CertificateVerificationError>(CertificateVerificationError::UnknownError); break; } return error; } -void SecureTransportServerContext::fatalError(boost::shared_ptr<TLSError> error, boost::shared_ptr<CertificateVerificationError> certificateError) { +void SecureTransportServerContext::fatalError(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<TLSError> error, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<CertificateVerificationError> certificateError) { setState(Error); if (sslContext_) { SSLClose(sslContext_.get()); diff --git a/include/Swiften/TLS/TLSServerContext.h b/include/Swiften/TLS/TLSServerContext.h index ba34dc11..f42b271b 100644 --- a/include/Swiften/TLS/TLSServerContext.h +++ b/include/Swiften/TLS/TLSServerContext.h @@ -6,8 +6,8 @@ #pragma once -#include "Swiften/Base/boost_bsignals.h" #include <boost/shared_ptr.hpp> +#include <boost/signals.hpp> #include "Swiften/Base/SafeByteArray.h" #include "Swiften/TLS/Certificate.h" diff --git a/include/boost/dll/import.hpp b/include/boost/dll/import.hpp index 74f23bfc..f65d353a 100644 --- a/include/boost/dll/import.hpp +++ b/include/boost/dll/import.hpp @@ -30,11 +30,11 @@ namespace boost { namespace dll { namespace detail { template <class T> class refc_function { - boost::shared_ptr<shared_library> lib_; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<shared_library> lib_; T* func_ptr_; public: - refc_function(const boost::shared_ptr<shared_library>& lib, T* func_ptr) BOOST_NOEXCEPT + refc_function(const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<shared_library>& lib, T* func_ptr) BOOST_NOEXCEPT : lib_(lib) , func_ptr_(func_ptr) {} @@ -57,8 +57,8 @@ namespace detail { template <class T> struct import_type<T, typename boost::enable_if<boost::is_object<T> >::type> { - typedef boost::shared_ptr<T> base_type; - typedef boost::shared_ptr<T> type; + typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<T> base_type; + typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<T> type; }; } // namespace detail @@ -69,7 +69,7 @@ namespace detail { /*! -* Returns boost::function<T> or boost::shared_ptr<T> that holds an imported function or variable +* Returns boost::function<T> or SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<T> that holds an imported function or variable * from the loaded library and refcounts usage * of the loaded shared library, so that it won't get unload until all copies of return value * are not destroyed. @@ -82,7 +82,7 @@ namespace detail { * \b Examples: * \code * boost::function<int(int)> f = import<int(int)>( -* boost::make_shared<shared_library>("test_lib.so"), +* SWIFTEN_SHRPTR_NAMESPACE::make_shared<shared_library>("test_lib.so"), * "integer_func_name" * ); * \endcode @@ -92,7 +92,7 @@ namespace detail { * \endcode * * \code -* boost::shared_ptr<int> i = import<int>("test_lib.so", "integer_name"); +* SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<int> i = import<int>("test_lib.so", "integer_name"); * \endcode * * \b Template \b parameter \b T: Type of the symbol that we are going to import. Must be explicitly specified. @@ -101,7 +101,7 @@ namespace detail { * \param name Null-terminated C or C++ mangled name of the function to import. Can handle std::string, char*, const char*. * \param mode An mode that will be used on library load. * -* \return boost::function<T> if T is a function type, or boost::shared_ptr<T> if T is an object type. +* \return boost::function<T> if T is a function type, or SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<T> if T is an object type. * * \throw boost::system::system_error if symbol does not exist or if the DLL/DSO was not loaded. * Overload that accepts path also throws std::bad_alloc in case of insufficient memory. @@ -116,28 +116,28 @@ BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::filesystem::path& lib, const st load_mode::type mode = load_mode::default_mode) { return boost::dll::import<T>( - boost::make_shared<boost::dll::shared_library>(lib, mode), + SWIFTEN_SHRPTR_NAMESPACE::make_shared<boost::dll::shared_library>(lib, mode), name.c_str() ); } //! \overload boost::dll::import(const boost::filesystem::path& lib, const char* name, load_mode::type mode) template <class T> -BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::shared_ptr<shared_library>& lib, const char* name) { +BOOST_DLL_IMPORT_RESULT_TYPE import(const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<shared_library>& lib, const char* name) { typedef typename boost::dll::detail::import_type<T>::base_type type; return type(lib, &lib->get<T>(name)); } //! \overload boost::dll::import(const boost::filesystem::path& lib, const char* name, load_mode::type mode) template <class T> -BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::shared_ptr<shared_library>& lib, const std::string& name) { +BOOST_DLL_IMPORT_RESULT_TYPE import(const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<shared_library>& lib, const std::string& name) { return boost::dll::import<T>(lib, name.c_str()); } template <class T> BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::filesystem::path& lib, const char* name, load_mode::type mode) { return boost::dll::import<T>( - boost::make_shared<boost::dll::shared_library>(lib, mode), + SWIFTEN_SHRPTR_NAMESPACE::make_shared<boost::dll::shared_library>(lib, mode), name ); } @@ -146,7 +146,7 @@ BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::filesystem::path& lib, const ch /*! -* Returns boost::function<T> or boost::shared_ptr<T> that holds an imported function or variable +* Returns boost::function<T> or SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<T> that holds an imported function or variable * from the loaded library and refcounts usage * of the loaded shared library, so that it won't get unload until all copies of return value * are not destroyed. @@ -159,7 +159,7 @@ BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::filesystem::path& lib, const ch * \b Examples: * \code * boost::function<int(int)> f = import_alias<int(int)>( -* boost::make_shared<shared_library>("test_lib.so"), +* SWIFTEN_SHRPTR_NAMESPACE::make_shared<shared_library>("test_lib.so"), * "integer_func_alias_name" * ); * \endcode @@ -169,7 +169,7 @@ BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::filesystem::path& lib, const ch * \endcode * * \code -* boost::shared_ptr<int> i = import_alias<int>("test_lib.so", "integer_alias_name"); +* SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<int> i = import_alias<int>("test_lib.so", "integer_alias_name"); * \endcode * * \b Template \b parameter \b T: Type of the symbol alias that we are going to import. Must be explicitly specified. @@ -178,7 +178,7 @@ BOOST_DLL_IMPORT_RESULT_TYPE import(const boost::filesystem::path& lib, const ch * \param name Null-terminated C or C++ mangled name of the function or variable to import. Can handle std::string, char*, const char*. * \param mode An mode that will be used on library load. * -* \return boost::function<T> if T is a function type, or boost::shared_ptr<T> if T is an object type. +* \return boost::function<T> if T is a function type, or SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<T> if T is an object type. * * \throw boost::system::system_error if symbol does not exist or if the DLL/DSO was not loaded. * Overload that accepts path also throws std::bad_alloc in case of insufficient memory. @@ -193,20 +193,20 @@ BOOST_DLL_IMPORT_RESULT_TYPE import_alias(const boost::filesystem::path& lib, co load_mode::type mode = load_mode::default_mode) { return boost::dll::import_alias<T>( - boost::make_shared<boost::dll::shared_library>(lib, mode), + SWIFTEN_SHRPTR_NAMESPACE::make_shared<boost::dll::shared_library>(lib, mode), name.c_str() ); } //! \overload boost::dll::import_alias(const boost::filesystem::path& lib, const char* name, load_mode::type mode) template <class T> -BOOST_DLL_IMPORT_RESULT_TYPE import_alias(const boost::shared_ptr<shared_library>& lib, const std::string& name) { +BOOST_DLL_IMPORT_RESULT_TYPE import_alias(const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<shared_library>& lib, const std::string& name) { return boost::dll::import_alias<T>(lib, name.c_str()); } //! \overload boost::dll::import_alias(const boost::filesystem::path& lib, const char* name, load_mode::type mode) template <class T> -BOOST_DLL_IMPORT_RESULT_TYPE import_alias(const boost::shared_ptr<shared_library>& lib, const char* name) { +BOOST_DLL_IMPORT_RESULT_TYPE import_alias(const SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<shared_library>& lib, const char* name) { typedef typename boost::dll::detail::import_type<T>::base_type type; return type(lib, lib->get<T*>(name)); } @@ -214,7 +214,7 @@ BOOST_DLL_IMPORT_RESULT_TYPE import_alias(const boost::shared_ptr<shared_library template <class T> BOOST_DLL_IMPORT_RESULT_TYPE import_alias(const boost::filesystem::path& lib, const char* name, load_mode::type mode) { return boost::dll::import_alias<T>( - boost::make_shared<boost::dll::shared_library>(lib, mode), + SWIFTEN_SHRPTR_NAMESPACE::make_shared<boost::dll::shared_library>(lib, mode), name ); } diff --git a/include/boost/dll/shared_library.hpp b/include/boost/dll/shared_library.hpp index a3c7442d..d292c536 100644 --- a/include/boost/dll/shared_library.hpp +++ b/include/boost/dll/shared_library.hpp @@ -12,6 +12,9 @@ /// \brief Contains the boost::dll::shared_library class, core class for all the /// DLL/DSO operations. +// Walkaround for compatibility with boost 1.54 +#include <boost/move/move.hpp> + #include <boost/config.hpp> #include <boost/predef/os.h> #include <boost/utility/explicit_operator_bool.hpp> diff --git a/include/boost/signalslib.hpp b/include/boost/signalslib.hpp new file mode 100644 index 00000000..6517ddba --- /dev/null +++ b/include/boost/signalslib.hpp @@ -0,0 +1,33 @@ +/* + * Walkaroung for Boost, Qt namespace clash + * + * Taken from boost documantation: + * http://www.boost.org/doc/libs/1_55_0/doc/html/signals/s04.html + */ + + +#ifndef SIGNALSLIB_HPP_INCLUDED +#define SIGNALSLIB_HPP_INCLUDED + +#if defined(signals) && defined(QOBJECTDEFS_H) && \ + !defined(QT_MOC_CPP) +# undef signals +# define signals signals +#endif + +#include <boost/signal.hpp> +namespace boost +{ + namespace signalslib = signals; +} + +#if defined(signals) && defined(QOBJECTDEFS_H) && \ + !defined(QT_MOC_CPP) +# undef signals +// Restore the macro definition of "signals", as it was +// defined by Qt's <qobjectdefs.h>. +# define signals protected +#endif + +#endif + diff --git a/include/transport/Config.h b/include/transport/Config.h index 97044a1d..b4f1940a 100644 --- a/include/transport/Config.h +++ b/include/transport/Config.h @@ -26,7 +26,7 @@ #include <boost/algorithm/string.hpp> #include <boost/assign.hpp> #include <boost/bind.hpp> -#include <boost/signal.hpp> +#include <boost/signalslib.hpp> namespace Transport { diff --git a/include/transport/Conversation.h b/include/transport/Conversation.h index ab210e98..ad268008 100644 --- a/include/transport/Conversation.h +++ b/include/transport/Conversation.h @@ -25,6 +25,7 @@ #include <list> #include "Swiften/Elements/Message.h" #include "Swiften/Elements/Presence.h" +#include "Swiften/SwiftenCompat.h" namespace Transport { @@ -63,9 +64,9 @@ class Conversation { /// \param message Message received from legacy network. /// \param nickname For MUC conversation this is nickname of room participant who sent this message. - void handleMessage(boost::shared_ptr<Swift::Message> &message, const std::string &nickname = ""); + void handleMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> &message, const std::string &nickname = ""); - void handleRawMessage(boost::shared_ptr<Swift::Message> &message); + void handleRawMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> &message); void handleRawPresence(Swift::Presence::ref presence); /// Handles participant change in MUC. @@ -107,7 +108,7 @@ class Conversation { /// Sends message to Legacy network. /// \param message Message. - virtual void sendMessage(boost::shared_ptr<Swift::Message> &message) = 0; + virtual void sendMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> &message) = 0; /// Returns ConversationManager associated with this Conversation. @@ -147,7 +148,7 @@ class Conversation { private: Swift::Presence::ref generatePresence(const std::string &nick, int flag, int status, const std::string &statusMessage, const std::string &newname = "", const std::string &iconhash = ""); - void cacheMessage(boost::shared_ptr<Swift::Message> &message); + void cacheMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> &message); private: ConversationManager *m_conversationManager; @@ -167,8 +168,8 @@ class Conversation { // connected to single room, we store all those things 10 times. // It would be also great to store last 100 messages per room // every time, so we can get history messages for IRC for example. - boost::shared_ptr<Swift::Message> m_subject; - std::list<boost::shared_ptr<Swift::Message> > m_cachedMessages; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> m_subject; + std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> > m_cachedMessages; typedef struct { Swift::Presence::ref presence; diff --git a/include/transport/FileTransferManager.h b/include/transport/FileTransferManager.h index 97a0fa58..0fe2273f 100644 --- a/include/transport/FileTransferManager.h +++ b/include/transport/FileTransferManager.h @@ -49,16 +49,16 @@ class Buddy; class FileTransferManager { public: typedef struct Transfer { - boost::shared_ptr<Swift::OutgoingFileTransfer> ft; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::OutgoingFileTransfer> ft; Swift::JID from; Swift::JID to; - boost::shared_ptr<Swift::ReadBytestream> readByteStream; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::ReadBytestream> readByteStream; } Transfer; FileTransferManager(Component *component, UserManager *userManager); virtual ~FileTransferManager(); - FileTransferManager::Transfer sendFile(User *user, Buddy *buddy, boost::shared_ptr<Swift::ReadBytestream> byteStream, const Swift::StreamInitiationFileInfo &info); + FileTransferManager::Transfer sendFile(User *user, Buddy *buddy, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::ReadBytestream> byteStream, const Swift::StreamInitiationFileInfo &info); private: Component *m_component; diff --git a/include/transport/Frontend.h b/include/transport/Frontend.h index 075784f6..ed217992 100644 --- a/include/transport/Frontend.h +++ b/include/transport/Frontend.h @@ -30,6 +30,7 @@ #include "Swiften/Elements/IQ.h" #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/Elements/Presence.h" +#include "Swiften/SwiftenCompat.h" #include <boost/signal.hpp> @@ -74,11 +75,11 @@ class Frontend { virtual void sendRosterRequest(Swift::RosterPayload::ref, Swift::JID to) = 0; - virtual void sendMessage(boost::shared_ptr<Swift::Message> message) = 0; + virtual void sendMessage(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> message) = 0; - virtual void sendIQ(boost::shared_ptr<Swift::IQ>) = 0; + virtual void sendIQ(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::IQ>) = 0; - virtual boost::shared_ptr<Swift::DiscoInfo> sendCapabilitiesRequest(Swift::JID to) = 0; + virtual SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DiscoInfo> sendCapabilitiesRequest(Swift::JID to) = 0; virtual void reconnectUser(const std::string &user) = 0; @@ -98,14 +99,14 @@ class Frontend { virtual bool isRawXMLEnabled() { return false; } boost::signal<void (User *, const std::string &name, unsigned int id)> onVCardRequired; - boost::signal<void (User *, boost::shared_ptr<Swift::VCard> vcard)> onVCardUpdated; + boost::signal<void (User *, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::VCard> vcard)> onVCardUpdated; boost::signal<void (Buddy *, const Swift::RosterItemPayload &item)> onBuddyUpdated; boost::signal<void (Buddy *)> onBuddyRemoved; boost::signal<void (Buddy *, const Swift::RosterItemPayload &item)> onBuddyAdded; boost::signal<void (Swift::Message::ref message)> onMessageReceived; boost::signal<void (bool /* isAvailable */)> onAvailableChanged; - boost::signal<void (boost::shared_ptr<Swift::Presence>) > onPresenceReceived; - boost::signal<void (const Swift::JID& jid, boost::shared_ptr<Swift::DiscoInfo> info)> onCapabilitiesReceived; + boost::signal<void (SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Presence>) > onPresenceReceived; + boost::signal<void (const Swift::JID& jid, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DiscoInfo> info)> onCapabilitiesReceived; }; } diff --git a/include/transport/MemoryReadBytestream.h b/include/transport/MemoryReadBytestream.h index cb36389f..253c22c1 100644 --- a/include/transport/MemoryReadBytestream.h +++ b/include/transport/MemoryReadBytestream.h @@ -22,8 +22,10 @@ #include <string> #include <map> +#include <boost/signal.hpp> #include "Swiften/FileTransfer/ReadBytestream.h" +#include "Swiften/SwiftenCompat.h" namespace Transport { @@ -34,7 +36,7 @@ class MemoryReadBytestream : public Swift::ReadBytestream { unsigned long appendData(const std::string &data); - virtual boost::shared_ptr<std::vector<unsigned char> > read(size_t size); + virtual SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<std::vector<unsigned char> > read(size_t size); void setFinished() { m_finished = true; } bool isFinished() const; diff --git a/include/transport/NetworkPluginServer.h b/include/transport/NetworkPluginServer.h index 043e447c..50b526eb 100644 --- a/include/transport/NetworkPluginServer.h +++ b/include/transport/NetworkPluginServer.h @@ -39,6 +39,7 @@ #include "Swiften/Parser/XMPPParser.h" #include "Swiften/Parser/XMPPParserClient.h" #include "Swiften/Serializer/XMPPSerializer.h" +#include "Swiften/SwiftenCompat.h" #include <Swiften/Version.h> #include <Swiften/FileTransfer/FileTransfer.h> #define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000) @@ -68,7 +69,7 @@ class NetworkPluginServer : Swift::XMPPParserClient { int pongReceived; std::list<User *> users; Swift::SafeByteArray data; - boost::shared_ptr<Swift::Connection> connection; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> connection; unsigned long res; unsigned long init_res; unsigned long shared; @@ -104,13 +105,13 @@ class NetworkPluginServer : Swift::XMPPParserClient { bool moveToLongRunBackend(User *user); - void handleMessageReceived(NetworkConversation *conv, boost::shared_ptr<Swift::Message> &message); + void handleMessageReceived(NetworkConversation *conv, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Message> &message); public: - void handleNewClientConnection(boost::shared_ptr<Swift::Connection> c); + void handleNewClientConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> c); void handleSessionFinished(Backend *c); void handlePongReceived(Backend *c); - void handleDataRead(Backend *c, boost::shared_ptr<Swift::SafeByteArray> data); + void handleDataRead(Backend *c, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::SafeByteArray> data); void handleConnectedPayload(const std::string &payload); void handleDisconnectedPayload(const std::string &payload); @@ -148,7 +149,7 @@ class NetworkPluginServer : Swift::XMPPParserClient { void handleBlockToggled(Buddy *buddy); - void handleVCardUpdated(User *user, boost::shared_ptr<Swift::VCard> vcard); + void handleVCardUpdated(User *user, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::VCard> vcard); void handleVCardRequired(User *user, const std::string &name, unsigned int id); void handleFTStateChanged(Swift::FileTransfer::State state, const std::string &userName, const std::string &buddyName, const std::string &fileName, unsigned long size, unsigned long id); @@ -158,7 +159,7 @@ class NetworkPluginServer : Swift::XMPPParserClient { void handlePIDTerminated(unsigned long pid); private: - void send(boost::shared_ptr<Swift::Connection> &, const std::string &data); + void send(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> &, const std::string &data); void pingTimeout(); void sendPing(Backend *c); @@ -166,14 +167,14 @@ class NetworkPluginServer : Swift::XMPPParserClient { Backend *getFreeClient(bool acceptUsers = true, bool longRun = false, bool check = false); void connectWaitingUsers(); void loginDelayFinished(); - void handleRawIQReceived(boost::shared_ptr<Swift::IQ> iq); - void handleRawPresenceReceived(boost::shared_ptr<Swift::Presence> presence); + void handleRawIQReceived(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::IQ> iq); + void handleRawPresenceReceived(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Presence> presence); void handleStreamStart(const Swift::ProtocolHeader&) {} #if HAVE_SWIFTEN_3 - void handleElement(boost::shared_ptr<Swift::ToplevelElement> element); + void handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::ToplevelElement> element); #else - void handleElement(boost::shared_ptr<Swift::Element> element); + void handleElement(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Element> element); #endif void handleStreamEnd() {} @@ -182,7 +183,7 @@ class NetworkPluginServer : Swift::XMPPParserClient { RosterResponder *m_rosterResponder; BlockResponder *m_blockResponder; Config *m_config; - boost::shared_ptr<Swift::ConnectionServer> m_server; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::ConnectionServer> m_server; std::list<Backend *> m_clients; std::vector<unsigned long> m_pids; Swift::Timer::ref m_pingTimer; diff --git a/include/transport/PresenceOracle.h b/include/transport/PresenceOracle.h index 39acc77f..fbad98ed 100644 --- a/include/transport/PresenceOracle.h +++ b/include/transport/PresenceOracle.h @@ -22,12 +22,12 @@ #include <map> +#include <boost/signals.hpp> + #include <string> #include <Swiften/Elements/Presence.h> #include <Swiften/Client/StanzaChannel.h> -#include <Swiften/Base/boost_bsignals.h> - namespace Transport { class Frontend; diff --git a/include/transport/RosterManager.h b/include/transport/RosterManager.h index 6a36d8a8..ba991ea6 100644 --- a/include/transport/RosterManager.h +++ b/include/transport/RosterManager.h @@ -23,6 +23,7 @@ #include <string> #include <algorithm> #include <map> +#include <boost/signal.hpp> #include <boost/pool/pool_alloc.hpp> #include <boost/pool/object_pool.hpp> // #include "rosterstorage.h" diff --git a/include/transport/Transport.h b/include/transport/Transport.h index 385c9f42..25264654 100644 --- a/include/transport/Transport.h +++ b/include/transport/Transport.h @@ -21,6 +21,7 @@ #pragma once #include <vector> +#include <boost/signal.hpp> #include <boost/bind.hpp> #include "Swiften/Network/BoostTimerFactory.h" #include "Swiften/Network/BoostIOServiceThread.h" @@ -28,6 +29,7 @@ #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/Elements/Presence.h" #include "Swiften/Elements/IQ.h" +#include "Swiften/SwiftenCompat.h" namespace Transport { class StorageBackend; @@ -108,7 +110,7 @@ namespace Transport { /// \param presence Presence. boost::signal<void (Swift::Presence::ref presence)> onUserPresenceReceived; - boost::signal<void (boost::shared_ptr<Swift::IQ>)> onRawIQReceived; + boost::signal<void (SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::IQ>)> onRawIQReceived; boost::signal<void ()> onAdminInterfaceSet; @@ -134,7 +136,7 @@ namespace Transport { } private: - void handleDiscoInfoResponse(boost::shared_ptr<Swift::DiscoInfo> info, Swift::ErrorPayload::ref error, const Swift::JID& jid); + void handleDiscoInfoResponse(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DiscoInfo> info, Swift::ErrorPayload::ref error, const Swift::JID& jid); void handleCapsChanged(const Swift::JID& jid); void handleBackendConfigChanged(); diff --git a/include/transport/User.h b/include/transport/User.h index a4eda2a8..0f837ee7 100644 --- a/include/transport/User.h +++ b/include/transport/User.h @@ -20,6 +20,7 @@ #pragma once +#include <boost/signal.hpp> #include <time.h> #include "transport/StorageBackend.h" #include <Swiften/FileTransfer/OutgoingFileTransfer.h> @@ -30,6 +31,7 @@ #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/Network/Timer.h" #include "Swiften/Network/Connection.h" +#include "Swiften/SwiftenCompat.h" namespace Transport { @@ -89,7 +91,7 @@ class User { void handleSubscription(Swift::Presence::ref presence); - void handleDiscoInfo(const Swift::JID& jid, boost::shared_ptr<Swift::DiscoInfo> info); + void handleDiscoInfo(const Swift::JID& jid, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DiscoInfo> info); time_t &getLastActivity() { return m_lastActivity; @@ -169,10 +171,10 @@ class User { bool m_readyForConnect; bool m_ignoreDisconnect; Swift::Timer::ref m_reconnectTimer; - boost::shared_ptr<Swift::Connection> connection; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> connection; time_t m_lastActivity; std::map<Swift::JID, Swift::DiscoInfo::ref> m_legacyCaps; - std::vector<boost::shared_ptr<Swift::OutgoingFileTransfer> > m_filetransfers; + std::vector<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::OutgoingFileTransfer> > m_filetransfers; int m_resources; int m_reconnectCounter; std::list<Swift::Presence::ref> m_joinedRooms; diff --git a/include/transport/UserManager.h b/include/transport/UserManager.h index d722970a..e4923695 100644 --- a/include/transport/UserManager.h +++ b/include/transport/UserManager.h @@ -20,6 +20,7 @@ #pragma once +#include <boost/signal.hpp> #include <string> #include <map> #include "Swiften/Elements/Message.h" @@ -29,6 +30,7 @@ #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/Elements/VCard.h" #include "Swiften/Network/Timer.h" +#include "Swiften/SwiftenCompat.h" namespace Transport { @@ -143,7 +145,7 @@ class UserManager /*: public Swift::EntityCapsProvider*/ { void handleSubscription(Swift::Presence::ref presence); void handleMUCPresence(Swift::Presence::ref presence); void handleRemoveTimeout(const std::string jid, User *user, bool reconnect); - void handleDiscoInfo(const Swift::JID& jid, boost::shared_ptr<Swift::DiscoInfo> info); + void handleDiscoInfo(const Swift::JID& jid, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DiscoInfo> info); void addUser(User *user); long m_onlineBuddies; diff --git a/include/transport/WebSocketClient.h b/include/transport/WebSocketClient.h index 80465aeb..a1efbfe0 100644 --- a/include/transport/WebSocketClient.h +++ b/include/transport/WebSocketClient.h @@ -31,6 +31,7 @@ #include <Swiften/Base/SafeByteArray.h> #include "Swiften/Version.h" #include "Swiften/Network/Timer.h" +#include "Swiften/SwiftenCompat.h" #define HAVE_SWIFTEN_3 (SWIFTEN_VERSION >= 0x030000) @@ -66,7 +67,7 @@ class WebSocketClient { private: void handleDNSResult(const std::vector<Swift::HostAddress>&, boost::optional<Swift::DomainNameResolveError>); - void handleDataRead(boost::shared_ptr<Swift::SafeByteArray> data); + void handleDataRead(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::SafeByteArray> data); void handleConnected(bool error); void handleDisconnected(const boost::optional<Swift::Connection::Error> &error); @@ -74,8 +75,8 @@ class WebSocketClient { private: Component *m_component; - boost::shared_ptr<Swift::DomainNameAddressQuery> m_dnsQuery; - boost::shared_ptr<Swift::Connection> m_conn; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::DomainNameAddressQuery> m_dnsQuery; + SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> m_conn; Swift::TLSConnectionFactory *m_tlsConnectionFactory; Swift::PlatformTLSFactories *m_tlsFactory; std::string m_host; |