diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-25 18:44:36 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-25 18:45:36 (GMT) |
commit | f77eeb87104a4ea0fd8e43399da14dc5f1cd97c3 (patch) | |
tree | 484a1755ccb69421de3ed9b7b9c731870f2de56a /Swiften | |
parent | bd80c3b9054d91b3cbc309400f4db195c708115d (diff) | |
download | swift-contrib-f77eeb87104a4ea0fd8e43399da14dc5f1cd97c3.zip swift-contrib-f77eeb87104a4ea0fd8e43399da14dc5f1cd97c3.tar.bz2 |
Remove the use of Shared<>.
Diffstat (limited to 'Swiften')
40 files changed, 135 insertions, 80 deletions
diff --git a/Swiften/Client/Client.h b/Swiften/Client/Client.h index c2c9c60..eb3fc09 100644 --- a/Swiften/Client/Client.h +++ b/Swiften/Client/Client.h @@ -110,7 +110,7 @@ namespace Swift { /** * This signal is emitted when a JID changes presence. */ - boost::signal<void (boost::shared_ptr<Presence>)> onPresenceChange; + boost::signal<void (Presence::ref)> onPresenceChange; /** * This signal is emitted when a presence subscription request is received. diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index 02d98b6..24f44fc 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -21,7 +21,7 @@ #include "Swiften/Client/StanzaChannel.h" #include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h" #include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" -#include "Swiften/Base/Shared.h" + #include "Swiften/Client/ClientSessionStanzaChannel.h" namespace Swift { @@ -53,8 +53,8 @@ namespace Swift { void connect(const String& host); void disconnect(); - void sendMessage(boost::shared_ptr<Message>); - void sendPresence(boost::shared_ptr<Presence>); + void sendMessage(Message::ref); + void sendPresence(Presence::ref); IQRouter* getIQRouter() const { return iqRouter_; @@ -87,9 +87,9 @@ namespace Swift { boost::signal<void (const String&)> onDataRead; boost::signal<void (const String&)> onDataWritten; - boost::signal<void (boost::shared_ptr<Message>)> onMessageReceived; - boost::signal<void (boost::shared_ptr<Presence>) > onPresenceReceived; - boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaAcked; + boost::signal<void (Message::ref)> onMessageReceived; + boost::signal<void (Presence::ref) > onPresenceReceived; + boost::signal<void (Stanza::ref)> onStanzaAcked; private: void handleConnectorFinished(boost::shared_ptr<Connection>); diff --git a/Swiften/Component/ComponentSession.cpp b/Swiften/Component/ComponentSession.cpp index 75ee467..d15d51c 100644 --- a/Swiften/Component/ComponentSession.cpp +++ b/Swiften/Component/ComponentSession.cpp @@ -56,7 +56,7 @@ void ComponentSession::handleElement(boost::shared_ptr<Element> element) { finishSession(Error::UnexpectedElementError); } } - else if (ComponentHandshake::cast(element)) { + else if (boost::dynamic_pointer_cast<ComponentHandshake>(element)) { if (!checkState(Authenticating)) { return; } diff --git a/Swiften/Component/CoreComponent.h b/Swiften/Component/CoreComponent.h index 21f339e..67f87ee 100644 --- a/Swiften/Component/CoreComponent.h +++ b/Swiften/Component/CoreComponent.h @@ -20,7 +20,7 @@ #include "Swiften/Base/String.h" #include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h" #include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" -#include "Swiften/Base/Shared.h" + #include "Swiften/Component/ComponentSessionStanzaChannel.h" namespace Swift { diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp index 1722ad4..d35a664 100644 --- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp +++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp @@ -162,7 +162,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { void receiveHandshake() { Event event = popEvent(); CPPUNIT_ASSERT(event.element); - ComponentHandshake::ref handshake(ComponentHandshake::cast(event.element)); + ComponentHandshake::ref handshake(boost::dynamic_pointer_cast<ComponentHandshake>(event.element)); CPPUNIT_ASSERT(handshake); CPPUNIT_ASSERT_EQUAL(String("4c4f8a41141722c8bbfbdd92d827f7b2fc0a542b"), handshake->getData()); } diff --git a/Swiften/Disco/CapsFileStorage.cpp b/Swiften/Disco/CapsFileStorage.cpp index c5326a7..107cf28 100644 --- a/Swiften/Disco/CapsFileStorage.cpp +++ b/Swiften/Disco/CapsFileStorage.cpp @@ -30,7 +30,7 @@ DiscoInfo::ref CapsFileStorage::getDiscoInfo(const String& hash) const { DiscoInfoParser parser; PayloadParserTester tester(&parser); tester.parse(String(data.getData(), data.getSize())); - return DiscoInfo::cast(parser.getPayload()); + return boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); } else { return DiscoInfo::ref(); diff --git a/Swiften/Disco/GetDiscoInfoRequest.h b/Swiften/Disco/GetDiscoInfoRequest.h index d1ed279..2298b5c 100644 --- a/Swiften/Disco/GetDiscoInfoRequest.h +++ b/Swiften/Disco/GetDiscoInfoRequest.h @@ -10,8 +10,10 @@ #include "Swiften/Elements/DiscoInfo.h" namespace Swift { - class GetDiscoInfoRequest : public GenericRequest<DiscoInfo>, public Shared<GetDiscoInfoRequest> { + class GetDiscoInfoRequest : public GenericRequest<DiscoInfo> { public: + typedef boost::shared_ptr<GetDiscoInfoRequest> ref; + static ref create(const JID& jid, IQRouter* router) { return ref(new GetDiscoInfoRequest(jid, router)); } diff --git a/Swiften/Disco/GetDiscoItemsRequest.h b/Swiften/Disco/GetDiscoItemsRequest.h index ed565ac..0a94402 100644 --- a/Swiften/Disco/GetDiscoItemsRequest.h +++ b/Swiften/Disco/GetDiscoItemsRequest.h @@ -10,8 +10,10 @@ #include "Swiften/Elements/DiscoItems.h" namespace Swift { - class GetDiscoItemsRequest : public GenericRequest<DiscoItems>, public Shared<GetDiscoItemsRequest> { + class GetDiscoItemsRequest : public GenericRequest<DiscoItems> { public: + typedef boost::shared_ptr<GetDiscoItemsRequest> ref; + static ref create(const JID& jid, IQRouter* router) { return ref(new GetDiscoItemsRequest(jid, router)); } diff --git a/Swiften/Elements/AuthFailure.h b/Swiften/Elements/AuthFailure.h index 348a19b..7ffc762 100644 --- a/Swiften/Elements/AuthFailure.h +++ b/Swiften/Elements/AuthFailure.h @@ -6,12 +6,15 @@ #pragma once +#include <boost/shared_ptr.hpp> + #include "Swiften/Elements/Element.h" -#include "Swiften/Base/Shared.h" namespace Swift { - class AuthFailure : public Element, public Shared<AuthFailure> { + class AuthFailure : public Element { public: + typedef boost::shared_ptr<AuthFailure> ref; + AuthFailure() {} }; } diff --git a/Swiften/Elements/Bytestreams.h b/Swiften/Elements/Bytestreams.h index 323167c..9d45c8a 100644 --- a/Swiften/Elements/Bytestreams.h +++ b/Swiften/Elements/Bytestreams.h @@ -8,15 +8,17 @@ #include <vector> #include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> #include "Swiften/JID/JID.h" #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Elements/Payload.h" namespace Swift { - class Bytestreams : public Payload, public Shared<Bytestreams> { + class Bytestreams : public Payload { public: + typedef boost::shared_ptr<Bytestreams> ref; + struct StreamHost { StreamHost(const String& host = "", const JID& jid = JID(), int port = -1) : host(host), jid(jid), port(port) {} diff --git a/Swiften/Elements/CapsInfo.h b/Swiften/Elements/CapsInfo.h index 0fce90c..1968a29 100644 --- a/Swiften/Elements/CapsInfo.h +++ b/Swiften/Elements/CapsInfo.h @@ -7,11 +7,11 @@ #pragma once #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" + #include "Swiften/Elements/Payload.h" namespace Swift { - class CapsInfo : public Payload, public Shared<CapsInfo> { + class CapsInfo : public Payload { public: CapsInfo(const String& node = "", const String& version = "", const String& hash = "sha-1") : node_(node), version_(version), hash_(hash) {} diff --git a/Swiften/Elements/Command.h b/Swiften/Elements/Command.h index 91ca915..73d359f 100644 --- a/Swiften/Elements/Command.h +++ b/Swiften/Elements/Command.h @@ -6,8 +6,9 @@ #pragma once +#include <boost/shared_ptr.hpp> + #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/Form.h" @@ -15,8 +16,10 @@ namespace Swift { /** * Ad-Hoc Command (XEP-0050). */ - class Command : public Payload, public Shared<Command> { + class Command : public Payload { public: + typedef boost::shared_ptr<Command> ref; + enum Status {Executing, Completed, Canceled, NoStatus}; enum Action {Cancel, Execute, Complete, Prev, Next, NoAction}; diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h index d9088e0..ca18e73 100644 --- a/Swiften/Elements/ComponentHandshake.h +++ b/Swiften/Elements/ComponentHandshake.h @@ -6,13 +6,16 @@ #pragma once +#include <boost/shared_ptr.hpp> + #include "Swiften/Elements/Element.h" #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" namespace Swift { - class ComponentHandshake : public Element, public Shared<ComponentHandshake> { + class ComponentHandshake : public Element { public: + typedef boost::shared_ptr<ComponentHandshake> ref; + ComponentHandshake(const String& data = "") : data(data) { } diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h index 2cc914a..249f9ac 100644 --- a/Swiften/Elements/DiscoInfo.h +++ b/Swiften/Elements/DiscoInfo.h @@ -11,12 +11,14 @@ #include "Swiften/Elements/Payload.h" #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" + #include "Swiften/Elements/Form.h" namespace Swift { - class DiscoInfo : public Payload, public Shared<DiscoInfo> { + class DiscoInfo : public Payload { public: + typedef boost::shared_ptr<DiscoInfo> ref; + const static std::string SecurityLabels; class Identity { public: diff --git a/Swiften/Elements/EnableStreamManagement.h b/Swiften/Elements/EnableStreamManagement.h index 3383e77..807db84 100644 --- a/Swiften/Elements/EnableStreamManagement.h +++ b/Swiften/Elements/EnableStreamManagement.h @@ -7,10 +7,10 @@ #pragma once #include "Swiften/Elements/Element.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class EnableStreamManagement : public Element, public Shared<EnableStreamManagement> { + class EnableStreamManagement : public Element { public: EnableStreamManagement() {} }; diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h index 0eb6ef0..5e8f994 100644 --- a/Swiften/Elements/Form.h +++ b/Swiften/Elements/Form.h @@ -11,7 +11,7 @@ #include "Swiften/Elements/Payload.h" #include "Swiften/Elements/FormField.h" #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" + #include "Swiften/JID/JID.h" namespace Swift { @@ -20,8 +20,10 @@ namespace Swift { * For the relevant Fields, the parsers and serialisers protect the API user against * the strange multi-value instead of newline thing by transforming them. */ - class Form : public Payload, public Shared<Form> { + class Form : public Payload { public: + typedef boost::shared_ptr<Form> ref; + enum Type { FormType, SubmitType, CancelType, ResultType }; public: diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h index da9c18a..727755f 100644 --- a/Swiften/Elements/IBB.h +++ b/Swiften/Elements/IBB.h @@ -6,14 +6,17 @@ #pragma once +#include <boost/shared_ptr.hpp> + #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Base/ByteArray.h" #include "Swiften/Elements/Payload.h" namespace Swift { - class IBB : public Payload, public Shared<IBB> { + class IBB : public Payload { public: + typedef boost::shared_ptr<IBB> ref; + enum Action { Open, Close, diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h index 2bb55e1..e15de24 100644 --- a/Swiften/Elements/IQ.h +++ b/Swiften/Elements/IQ.h @@ -6,15 +6,16 @@ #pragma once +#include <boost/shared_ptr.hpp> + #include "Swiften/Elements/Stanza.h" #include "Swiften/Elements/ErrorPayload.h" -#include "Swiften/Base/Shared.h" -namespace Swift -{ - class IQ : public Stanza, public Shared<IQ> - { - public: +namespace Swift { + class IQ : public Stanza { + public: + typedef boost::shared_ptr<IQ> ref; + enum Type { Get, Set, Result, Error }; IQ(Type type = Get) : type_(type) { } diff --git a/Swiften/Elements/MUCUserPayload.h b/Swiften/Elements/MUCUserPayload.h index 8635176..f55c779 100644 --- a/Swiften/Elements/MUCUserPayload.h +++ b/Swiften/Elements/MUCUserPayload.h @@ -7,16 +7,18 @@ #pragma once #include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> #include "Swiften/JID/JID.h" #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Elements/Payload.h" #include "Swiften/MUC/MUCOccupant.h" namespace Swift { - class MUCUserPayload : public Payload, public Shared<MUCUserPayload> { + class MUCUserPayload : public Payload { public: + typedef boost::shared_ptr<MUCUserPayload> ref; + struct Item { Item() : affiliation(MUCOccupant::NoAffiliation), role(MUCOccupant::NoRole) {} boost::optional<JID> realJID; diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index e5e00ab..ea03299 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -7,18 +7,19 @@ #pragma once #include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Elements/Body.h" #include "Swiften/Elements/Subject.h" #include "Swiften/Elements/ErrorPayload.h" #include "Swiften/Elements/Stanza.h" -namespace Swift -{ - class Message : public Stanza, public Shared<Message> { +namespace Swift { + class Message : public Stanza { public: + typedef boost::shared_ptr<Message> ref; + enum Type { Normal, Chat, Error, Groupchat, Headline }; Message() : type_(Chat) { } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 45638b9..642262c 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -6,15 +6,17 @@ #pragma once -#include "Swiften/Base/Shared.h" + #include "Swiften/Elements/Stanza.h" #include "Swiften/Elements/Status.h" #include "Swiften/Elements/StatusShow.h" #include "Swiften/Elements/Priority.h" namespace Swift { - class Presence : public Stanza, public Shared<Presence> { + class Presence : public Stanza { public: + typedef boost::shared_ptr<Presence> ref; + enum Type { Available, Error, Probe, Subscribe, Subscribed, Unavailable, Unsubscribe, Unsubscribed }; Presence() : type_(Available) /*, showType_(Online)*/ {} diff --git a/Swiften/Elements/RosterPayload.h b/Swiften/Elements/RosterPayload.h index 0c987c4..b46b384 100644 --- a/Swiften/Elements/RosterPayload.h +++ b/Swiften/Elements/RosterPayload.h @@ -8,14 +8,16 @@ #include <vector> #include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> #include "Swiften/Elements/RosterItemPayload.h" #include "Swiften/Elements/Payload.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class RosterPayload : public Payload, public Shared<RosterPayload> { + class RosterPayload : public Payload { public: + typedef boost::shared_ptr<RosterPayload> ref; typedef std::vector<RosterItemPayload> RosterItemPayloads; public: diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h index 5d8fd6c..0f07223 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -14,13 +14,14 @@ #include "Swiften/Elements/Element.h" #include "Swiften/Elements/Payload.h" #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Base/foreach.h" #include "Swiften/JID/JID.h" namespace Swift { class Stanza : public Element { public: + typedef boost::shared_ptr<Stanza> ref; + virtual ~Stanza(); template<typename T> diff --git a/Swiften/Elements/StanzaAck.h b/Swiften/Elements/StanzaAck.h index 53b62b4..8a57442 100644 --- a/Swiften/Elements/StanzaAck.h +++ b/Swiften/Elements/StanzaAck.h @@ -7,11 +7,13 @@ #pragma once #include "Swiften/Elements/Element.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class StanzaAck : public Element, public Shared<StanzaAck> { + class StanzaAck : public Element { public: + typedef boost::shared_ptr<StanzaAck> ref; + StanzaAck() : valid(false), handledStanzasCount(0) {} StanzaAck(unsigned int handledStanzasCount) : valid(true), handledStanzasCount(handledStanzasCount) {} diff --git a/Swiften/Elements/StanzaAckRequest.h b/Swiften/Elements/StanzaAckRequest.h index ab4f354..024ebc9 100644 --- a/Swiften/Elements/StanzaAckRequest.h +++ b/Swiften/Elements/StanzaAckRequest.h @@ -7,9 +7,9 @@ #pragma once #include "Swiften/Elements/Element.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class StanzaAckRequest : public Element, public Shared<StanzaAckRequest> { + class StanzaAckRequest : public Element { }; } diff --git a/Swiften/Elements/StreamInitiation.h b/Swiften/Elements/StreamInitiation.h index fdf2399..55b6b87 100644 --- a/Swiften/Elements/StreamInitiation.h +++ b/Swiften/Elements/StreamInitiation.h @@ -8,14 +8,16 @@ #include <vector> #include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Elements/Payload.h" namespace Swift { - class StreamInitiation : public Payload, public Shared<StreamInitiation> { + class StreamInitiation : public Payload { public: + typedef boost::shared_ptr<StreamInitiation> ref; + struct FileInfo { FileInfo(const String& name = "", const String& description = "", int size = -1) : name(name), description(description), size(size) {} diff --git a/Swiften/Elements/StreamManagementEnabled.h b/Swiften/Elements/StreamManagementEnabled.h index 12cff51..0c72b84 100644 --- a/Swiften/Elements/StreamManagementEnabled.h +++ b/Swiften/Elements/StreamManagementEnabled.h @@ -7,10 +7,10 @@ #pragma once #include "Swiften/Elements/Element.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class StreamManagementEnabled : public Element, public Shared<StreamManagementEnabled> { + class StreamManagementEnabled : public Element { public: StreamManagementEnabled() {} }; diff --git a/Swiften/Elements/StreamManagementFailed.h b/Swiften/Elements/StreamManagementFailed.h index e95d767..8302c94 100644 --- a/Swiften/Elements/StreamManagementFailed.h +++ b/Swiften/Elements/StreamManagementFailed.h @@ -7,10 +7,10 @@ #pragma once #include "Swiften/Elements/Element.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class StreamManagementFailed : public Element, public Shared<StreamManagementFailed> { + class StreamManagementFailed : public Element { public: StreamManagementFailed() {} }; diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h index 15173f1..e1f6f88 100644 --- a/Swiften/Elements/VCard.h +++ b/Swiften/Elements/VCard.h @@ -6,14 +6,17 @@ #pragma once +#include <boost/shared_ptr.hpp> + #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" #include "Swiften/Base/ByteArray.h" #include "Swiften/Elements/Payload.h" namespace Swift { - class VCard : public Payload, public Shared<VCard> { + class VCard : public Payload { public: + typedef boost::shared_ptr<VCard> ref; + struct EMailAddress { EMailAddress() : isHome(false), isWork(false), isInternet(false), isPreferred(false), isX400(false) { } diff --git a/Swiften/FileTransfer/BytestreamsRequest.h b/Swiften/FileTransfer/BytestreamsRequest.h index 71b93ec..9757bfa 100644 --- a/Swiften/FileTransfer/BytestreamsRequest.h +++ b/Swiften/FileTransfer/BytestreamsRequest.h @@ -6,13 +6,16 @@ #pragma once +#include <boost/shared_ptr.hpp> + #include "Swiften/Queries/GenericRequest.h" #include "Swiften/Elements/Bytestreams.h" -#include "Swiften/Base/Shared.h" namespace Swift { - class BytestreamsRequest : public GenericRequest<Bytestreams>, public Shared<BytestreamsRequest> { + class BytestreamsRequest : public GenericRequest<Bytestreams> { public: + typedef boost::shared_ptr<BytestreamsRequest> ref; + static ref create(const JID& jid, boost::shared_ptr<Bytestreams> payload, IQRouter* router) { return ref(new BytestreamsRequest(jid, payload, router)); } diff --git a/Swiften/FileTransfer/IBBRequest.h b/Swiften/FileTransfer/IBBRequest.h index 7269362..f104277 100644 --- a/Swiften/FileTransfer/IBBRequest.h +++ b/Swiften/FileTransfer/IBBRequest.h @@ -8,11 +8,13 @@ #include "Swiften/Queries/GenericRequest.h" #include "Swiften/Elements/IBB.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class IBBRequest : public GenericRequest<IBB>, public Shared<IBBRequest> { + class IBBRequest : public GenericRequest<IBB> { public: + typedef boost::shared_ptr<IBBRequest> ref; + static ref create(const JID& jid, boost::shared_ptr<IBB> payload, IQRouter* router) { return ref(new IBBRequest(jid, payload, router)); } diff --git a/Swiften/FileTransfer/StreamInitiationRequest.h b/Swiften/FileTransfer/StreamInitiationRequest.h index 64f51f2..f516d4b 100644 --- a/Swiften/FileTransfer/StreamInitiationRequest.h +++ b/Swiften/FileTransfer/StreamInitiationRequest.h @@ -8,11 +8,13 @@ #include "Swiften/Queries/GenericRequest.h" #include "Swiften/Elements/StreamInitiation.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class StreamInitiationRequest : public GenericRequest<StreamInitiation>, public Shared<StreamInitiationRequest> { + class StreamInitiationRequest : public GenericRequest<StreamInitiation> { public: + typedef boost::shared_ptr<StreamInitiationRequest> ref; + static ref create(const JID& jid, boost::shared_ptr<StreamInitiation> payload, IQRouter* router) { return ref(new StreamInitiationRequest(jid, payload, router)); } diff --git a/Swiften/Parser/PayloadParsers/CommandParser.cpp b/Swiften/Parser/PayloadParsers/CommandParser.cpp index 4e80829..b07b806 100644 --- a/Swiften/Parser/PayloadParsers/CommandParser.cpp +++ b/Swiften/Parser/PayloadParsers/CommandParser.cpp @@ -86,7 +86,7 @@ void CommandParser::handleEndElement(const String& element, const String& ns) { if (level_ == FormOrNoteOrActionsLevel) { if (formParser_) { - Form::ref form = Form::cast(formParser_->getPayload()); + Form::ref form(boost::dynamic_pointer_cast<Form>(formParser_->getPayload())); assert(form); getPayloadInternal()->setForm(form); delete formParser_; diff --git a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h index ec04f80..51794da 100644 --- a/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h +++ b/Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h @@ -8,11 +8,13 @@ #include "Swiften/Queries/GenericRequest.h" #include "Swiften/Elements/SecurityLabelsCatalog.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class GetSecurityLabelsCatalogRequest : public GenericRequest<SecurityLabelsCatalog>, public Shared<GetSecurityLabelsCatalogRequest> { + class GetSecurityLabelsCatalogRequest : public GenericRequest<SecurityLabelsCatalog> { public: + typedef boost::shared_ptr<GetSecurityLabelsCatalogRequest> ref; + static ref create(const JID& recipient, IQRouter* router) { return ref(new GetSecurityLabelsCatalogRequest(recipient, router)); } diff --git a/Swiften/Roster/GetRosterRequest.h b/Swiften/Roster/GetRosterRequest.h index 271b2fb..00cf77f 100644 --- a/Swiften/Roster/GetRosterRequest.h +++ b/Swiften/Roster/GetRosterRequest.h @@ -8,11 +8,13 @@ #include "Swiften/Queries/GenericRequest.h" #include "Swiften/Elements/RosterPayload.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class GetRosterRequest : public GenericRequest<RosterPayload>, public Shared<GetRosterRequest> { + class GetRosterRequest : public GenericRequest<RosterPayload> { public: + typedef boost::shared_ptr<GetRosterRequest> ref; + static ref create(IQRouter* router) { return ref(new GetRosterRequest(router)); } diff --git a/Swiften/Roster/SetRosterRequest.h b/Swiften/Roster/SetRosterRequest.h index 7b1bf8c..b1ecd1f 100644 --- a/Swiften/Roster/SetRosterRequest.h +++ b/Swiften/Roster/SetRosterRequest.h @@ -11,11 +11,13 @@ #include "Swiften/Queries/Request.h" #include "Swiften/Elements/RosterPayload.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class SetRosterRequest : public Request, public Shared<SetRosterRequest> { + class SetRosterRequest : public Request { public: + typedef boost::shared_ptr<SetRosterRequest> ref; + static ref create(RosterPayload::ref payload, IQRouter* router) { return ref(new SetRosterRequest(payload, router)); } diff --git a/Swiften/Serializer/StanzaAckSerializer.h b/Swiften/Serializer/StanzaAckSerializer.h index eb957b9..d29fbde 100644 --- a/Swiften/Serializer/StanzaAckSerializer.h +++ b/Swiften/Serializer/StanzaAckSerializer.h @@ -20,7 +20,7 @@ namespace Swift { } virtual String serialize(boost::shared_ptr<Element> element) const { - StanzaAck::ref stanzaAck = StanzaAck::cast(element); + StanzaAck::ref stanzaAck(boost::dynamic_pointer_cast<StanzaAck>(element)); assert(stanzaAck->isValid()); XMLElement result("a", "urn:xmpp:sm:2"); result.setAttribute("h", String(boost::lexical_cast<std::string>(stanzaAck->getHandledStanzasCount()))); diff --git a/Swiften/Serializer/XML/XMLElement.h b/Swiften/Serializer/XML/XMLElement.h index 8447ab1..cac29f1 100644 --- a/Swiften/Serializer/XML/XMLElement.h +++ b/Swiften/Serializer/XML/XMLElement.h @@ -11,12 +11,14 @@ #include <map> #include "Swiften/Base/String.h" -#include "Swiften/Base/Shared.h" + #include "Swiften/Serializer/XML/XMLNode.h" namespace Swift { - class XMLElement : public XMLNode, public Shared<XMLElement> { + class XMLElement : public XMLNode { public: + typedef boost::shared_ptr<XMLElement> ref; + XMLElement(const String& tag, const String& xmlns = ""); void setAttribute(const String& attribute, const String& value); diff --git a/Swiften/Serializer/XML/XMLTextNode.h b/Swiften/Serializer/XML/XMLTextNode.h index e158916..dae4d58 100644 --- a/Swiften/Serializer/XML/XMLTextNode.h +++ b/Swiften/Serializer/XML/XMLTextNode.h @@ -7,10 +7,10 @@ #pragma once #include "Swiften/Serializer/XML/XMLNode.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class XMLTextNode : public XMLNode, public Shared<XMLTextNode> { + class XMLTextNode : public XMLNode { public: typedef boost::shared_ptr<XMLTextNode> ref; diff --git a/Swiften/VCards/GetVCardRequest.h b/Swiften/VCards/GetVCardRequest.h index 2c40cd1..93e4871 100644 --- a/Swiften/VCards/GetVCardRequest.h +++ b/Swiften/VCards/GetVCardRequest.h @@ -8,11 +8,13 @@ #include "Swiften/Queries/GenericRequest.h" #include "Swiften/Elements/VCard.h" -#include "Swiften/Base/Shared.h" + namespace Swift { - class GetVCardRequest : public GenericRequest<VCard>, public Shared<GetVCardRequest> { + class GetVCardRequest : public GenericRequest<VCard> { public: + typedef boost::shared_ptr<GetVCardRequest> ref; + static ref create(const JID& jid, IQRouter* router) { return ref(new GetVCardRequest(jid, router)); } |