diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-28 08:36:39 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-28 15:23:59 (GMT) |
commit | be642f17bfa2df7cb88ddb5fb4aa37438d9e2110 (patch) | |
tree | c11e239dfcfcab2b38b64e6a19ffb48e8c30c44d /Swiften | |
parent | 64511948b075e650cacfcc78e40371abee1d2716 (diff) | |
download | swift-be642f17bfa2df7cb88ddb5fb4aa37438d9e2110.zip swift-be642f17bfa2df7cb88ddb5fb4aa37438d9e2110.tar.bz2 |
Create ToplevelElement to replace Element.
Change-Id: I3460f6f4a2ffa9b795080664f49d9138440de72d
Diffstat (limited to 'Swiften')
96 files changed, 257 insertions, 256 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index b29f63d..441189e 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -114,7 +114,7 @@ void ClientSession::handleStreamStart(const ProtocolHeader&) { state = Negotiating; } -void ClientSession::handleElement(boost::shared_ptr<Element> element) { +void ClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) { if (boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element)) { if (stanzaAckResponder_) { stanzaAckResponder_->handleStanzaReceived(); diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index 4b944fc..8a3deb4 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -15,7 +15,7 @@ #include <Swiften/Session/SessionStream.h> #include <string> #include <Swiften/JID/JID.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/StreamManagement/StanzaAckRequester.h> #include <Swiften/StreamManagement/StanzaAckResponder.h> @@ -148,7 +148,7 @@ namespace Swift { void sendStreamHeader(); - void handleElement(boost::shared_ptr<Element>); + void handleElement(boost::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); void handleStreamClosed(boost::shared_ptr<Swift::Error>); diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp index 4ef6727..4e1fc31 100644 --- a/Swiften/Client/UnitTest/ClientSessionTest.cpp +++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -381,11 +381,11 @@ class ClientSessionTest : public CppUnit::TestFixture { class MockSessionStream : public SessionStream { public: struct Event { - Event(boost::shared_ptr<Element> element) : element(element), footer(false) {} + Event(boost::shared_ptr<ToplevelElement> element) : element(element), footer(false) {} Event(const ProtocolHeader& header) : header(header), footer(false) {} Event() : footer(true) {} - boost::shared_ptr<Element> element; + boost::shared_ptr<ToplevelElement> element; boost::optional<ProtocolHeader> header; bool footer; }; @@ -409,7 +409,7 @@ class ClientSessionTest : public CppUnit::TestFixture { receivedEvents.push_back(Event()); } - virtual void writeElement(boost::shared_ptr<Element> element) { + virtual void writeElement(boost::shared_ptr<ToplevelElement> element) { receivedEvents.push_back(Event(element)); } diff --git a/Swiften/Component/ComponentSession.cpp b/Swiften/Component/ComponentSession.cpp index 7925b23..826451d 100644 --- a/Swiften/Component/ComponentSession.cpp +++ b/Swiften/Component/ComponentSession.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -49,7 +49,7 @@ void ComponentSession::handleStreamStart(const ProtocolHeader& header) { stream->writeElement(ComponentHandshake::ref(new ComponentHandshake(ComponentHandshakeGenerator::getHandshake(header.getID(), secret, crypto)))); } -void ComponentSession::handleElement(boost::shared_ptr<Element> element) { +void ComponentSession::handleElement(boost::shared_ptr<ToplevelElement> element) { if (boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element)) { if (getState() == Initialized) { onStanzaReceived(stanza); diff --git a/Swiften/Component/ComponentSession.h b/Swiften/Component/ComponentSession.h index 3103335..1fa7b5c 100644 --- a/Swiften/Component/ComponentSession.h +++ b/Swiften/Component/ComponentSession.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -14,7 +14,7 @@ #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Base/Error.h> #include <string> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Elements/Stanza.h> #include <Swiften/Session/SessionStream.h> @@ -69,7 +69,7 @@ namespace Swift { void sendStreamHeader(); - void handleElement(boost::shared_ptr<Element>); + void handleElement(boost::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); void handleStreamClosed(boost::shared_ptr<Swift::Error>); diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp index 0533645..79d9ab3 100644 --- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp +++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -86,11 +86,11 @@ class ComponentSessionTest : public CppUnit::TestFixture { class MockSessionStream : public SessionStream { public: struct Event { - Event(boost::shared_ptr<Element> element) : element(element), footer(false) {} + Event(boost::shared_ptr<ToplevelElement> element) : element(element), footer(false) {} Event(const ProtocolHeader& header) : header(header), footer(false) {} Event() : footer(true) {} - boost::shared_ptr<Element> element; + boost::shared_ptr<ToplevelElement> element; boost::optional<ProtocolHeader> header; bool footer; }; @@ -114,7 +114,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { receivedEvents.push_back(Event()); } - virtual void writeElement(boost::shared_ptr<Element> element) { + virtual void writeElement(boost::shared_ptr<ToplevelElement> element) { receivedEvents.push_back(Event(element)); } diff --git a/Swiften/Elements/AuthChallenge.h b/Swiften/Elements/AuthChallenge.h index f7f2796..6332d69 100644 --- a/Swiften/Elements/AuthChallenge.h +++ b/Swiften/Elements/AuthChallenge.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,10 +9,10 @@ #include <boost/optional.hpp> #include <vector> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class AuthChallenge : public Element { + class AuthChallenge : public ToplevelElement { public: AuthChallenge() { } diff --git a/Swiften/Elements/AuthFailure.h b/Swiften/Elements/AuthFailure.h index ac40956..5088dcf 100644 --- a/Swiften/Elements/AuthFailure.h +++ b/Swiften/Elements/AuthFailure.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -8,10 +8,10 @@ #include <boost/shared_ptr.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class AuthFailure : public Element { + class AuthFailure : public ToplevelElement { public: typedef boost::shared_ptr<AuthFailure> ref; diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h index bfc86c2..bc88b9b 100644 --- a/Swiften/Elements/AuthRequest.h +++ b/Swiften/Elements/AuthRequest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -10,11 +10,11 @@ #include <string> #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/SafeByteArray.h> namespace Swift { - class AuthRequest : public Element { + class AuthRequest : public ToplevelElement { public: AuthRequest(const std::string& mechanism = "") : mechanism_(mechanism) { } diff --git a/Swiften/Elements/AuthResponse.h b/Swiften/Elements/AuthResponse.h index db2dcea..f8a075c 100644 --- a/Swiften/Elements/AuthResponse.h +++ b/Swiften/Elements/AuthResponse.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,11 +9,11 @@ #include <vector> #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/SafeByteArray.h> namespace Swift { - class AuthResponse : public Element { + class AuthResponse : public ToplevelElement { public: AuthResponse() { } diff --git a/Swiften/Elements/AuthSuccess.h b/Swiften/Elements/AuthSuccess.h index 3c0f329..8e4591c 100644 --- a/Swiften/Elements/AuthSuccess.h +++ b/Swiften/Elements/AuthSuccess.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,10 +9,10 @@ #include <vector> #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class AuthSuccess : public Element { + class AuthSuccess : public ToplevelElement { public: AuthSuccess() {} diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h index 5992b8c..b2f9b21 100644 --- a/Swiften/Elements/ComponentHandshake.h +++ b/Swiften/Elements/ComponentHandshake.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,10 +9,10 @@ #include <boost/shared_ptr.hpp> #include <string> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class ComponentHandshake : public Element { + class ComponentHandshake : public ToplevelElement { public: typedef boost::shared_ptr<ComponentHandshake> ref; diff --git a/Swiften/Elements/CompressFailure.h b/Swiften/Elements/CompressFailure.h index 7dd8867..75e1d1d 100644 --- a/Swiften/Elements/CompressFailure.h +++ b/Swiften/Elements/CompressFailure.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -7,10 +7,10 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class CompressFailure : public Element { + class CompressFailure : public ToplevelElement { public: CompressFailure() {} }; diff --git a/Swiften/Elements/CompressRequest.h b/Swiften/Elements/CompressRequest.h index b6fcc64..9e2e267 100644 --- a/Swiften/Elements/CompressRequest.h +++ b/Swiften/Elements/CompressRequest.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class CompressRequest : public Element + class CompressRequest : public ToplevelElement { public: CompressRequest(const std::string& method = "") : method_(method) {} diff --git a/Swiften/Elements/Compressed.h b/Swiften/Elements/Compressed.h index 2affec5..f593412 100644 --- a/Swiften/Elements/Compressed.h +++ b/Swiften/Elements/Compressed.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class Compressed : public Element { + class Compressed : public ToplevelElement { public: Compressed() {} }; diff --git a/Swiften/Elements/EnableStreamManagement.h b/Swiften/Elements/EnableStreamManagement.h index 15a091e..732b225 100644 --- a/Swiften/Elements/EnableStreamManagement.h +++ b/Swiften/Elements/EnableStreamManagement.h @@ -1,16 +1,16 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class EnableStreamManagement : public Element { + class EnableStreamManagement : public ToplevelElement { public: EnableStreamManagement() {} }; diff --git a/Swiften/Elements/Payload.h b/Swiften/Elements/Payload.h index 1459837..7d6789c 100644 --- a/Swiften/Elements/Payload.h +++ b/Swiften/Elements/Payload.h @@ -9,9 +9,10 @@ #include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API Payload { + class SWIFTEN_API Payload : public ToplevelElement { public: typedef boost::shared_ptr<Payload> ref; public: diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h index e83f522..648c4df 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -13,13 +13,13 @@ #include <boost/date_time/posix_time/ptime.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/JID/JID.h> namespace Swift { class Payload; - class SWIFTEN_API Stanza : public Element { + class SWIFTEN_API Stanza : public ToplevelElement { public: typedef boost::shared_ptr<Stanza> ref; diff --git a/Swiften/Elements/StanzaAck.h b/Swiften/Elements/StanzaAck.h index 8fe64e0..0d99c5b 100644 --- a/Swiften/Elements/StanzaAck.h +++ b/Swiften/Elements/StanzaAck.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -8,10 +8,10 @@ #include <boost/shared_ptr.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StanzaAck : public Element { + class StanzaAck : public ToplevelElement { public: typedef boost::shared_ptr<StanzaAck> ref; diff --git a/Swiften/Elements/StanzaAckRequest.h b/Swiften/Elements/StanzaAckRequest.h index 81b3871..0ae11ad 100644 --- a/Swiften/Elements/StanzaAckRequest.h +++ b/Swiften/Elements/StanzaAckRequest.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StanzaAckRequest : public Element { + class StanzaAckRequest : public ToplevelElement { }; } diff --git a/Swiften/Elements/StartTLSFailure.h b/Swiften/Elements/StartTLSFailure.h index 5e233fb..ce13fd6 100644 --- a/Swiften/Elements/StartTLSFailure.h +++ b/Swiften/Elements/StartTLSFailure.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StartTLSFailure : public Element { + class StartTLSFailure : public ToplevelElement { public: StartTLSFailure() {} }; diff --git a/Swiften/Elements/StartTLSRequest.h b/Swiften/Elements/StartTLSRequest.h index e284f75..4b4f1f1 100644 --- a/Swiften/Elements/StartTLSRequest.h +++ b/Swiften/Elements/StartTLSRequest.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StartTLSRequest : public Element { + class StartTLSRequest : public ToplevelElement { public: StartTLSRequest() {} }; diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h index a58d3ae..300f1c7 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -8,11 +8,11 @@ #include <boost/shared_ptr.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <string> namespace Swift { - class StreamError : public Element { + class StreamError : public ToplevelElement { public: typedef boost::shared_ptr<StreamError> ref; diff --git a/Swiften/Elements/StreamFeatures.h b/Swiften/Elements/StreamFeatures.h index 5e7b6c9..ed40544 100644 --- a/Swiften/Elements/StreamFeatures.h +++ b/Swiften/Elements/StreamFeatures.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -11,10 +11,10 @@ #include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamFeatures : public Element { + class SWIFTEN_API StreamFeatures : public ToplevelElement { public: typedef boost::shared_ptr<StreamFeatures> ref; diff --git a/Swiften/Elements/StreamManagementEnabled.h b/Swiften/Elements/StreamManagementEnabled.h index 0985574..bb1f858 100644 --- a/Swiften/Elements/StreamManagementEnabled.h +++ b/Swiften/Elements/StreamManagementEnabled.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2011 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,10 +9,10 @@ #include <string> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class SWIFTEN_API StreamManagementEnabled : public Element { + class SWIFTEN_API StreamManagementEnabled : public ToplevelElement { public: StreamManagementEnabled(); ~StreamManagementEnabled(); diff --git a/Swiften/Elements/StreamManagementFailed.h b/Swiften/Elements/StreamManagementFailed.h index 7c6d1b7..a90bddd 100644 --- a/Swiften/Elements/StreamManagementFailed.h +++ b/Swiften/Elements/StreamManagementFailed.h @@ -1,16 +1,16 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamManagementFailed : public Element { + class StreamManagementFailed : public ToplevelElement { public: StreamManagementFailed() {} }; diff --git a/Swiften/Elements/StreamResume.h b/Swiften/Elements/StreamResume.h index aec0909..e87dabb 100644 --- a/Swiften/Elements/StreamResume.h +++ b/Swiften/Elements/StreamResume.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,10 +9,10 @@ #include <string> #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamResume : public Element { + class StreamResume : public ToplevelElement { public: StreamResume(); ~StreamResume(); diff --git a/Swiften/Elements/StreamResumed.h b/Swiften/Elements/StreamResumed.h index cf9a755..7890901 100644 --- a/Swiften/Elements/StreamResumed.h +++ b/Swiften/Elements/StreamResumed.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,10 +9,10 @@ #include <string> #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamResumed : public Element { + class StreamResumed : public ToplevelElement { public: StreamResumed(); ~StreamResumed(); diff --git a/Swiften/Elements/TLSProceed.h b/Swiften/Elements/TLSProceed.h index 4bd790a..27faf26 100644 --- a/Swiften/Elements/TLSProceed.h +++ b/Swiften/Elements/TLSProceed.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class TLSProceed : public Element { + class TLSProceed : public ToplevelElement { public: TLSProceed() {} }; diff --git a/Swiften/Elements/Element.cpp b/Swiften/Elements/ToplevelElement.cpp index 94829ba..c58a914 100644 --- a/Swiften/Elements/Element.cpp +++ b/Swiften/Elements/ToplevelElement.cpp @@ -1,14 +1,14 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { -Element::~Element() { +ToplevelElement::~ToplevelElement() { } } diff --git a/Swiften/Elements/Element.h b/Swiften/Elements/ToplevelElement.h index 14539c1..b3f60c7 100644 --- a/Swiften/Elements/Element.h +++ b/Swiften/Elements/ToplevelElement.h @@ -9,10 +9,10 @@ #include <Swiften/Base/API.h> namespace Swift { - class SWIFTEN_API Element { + class SWIFTEN_API ToplevelElement { public: - Element() {} - SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Element) - virtual ~Element(); + ToplevelElement() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(ToplevelElement) + virtual ~ToplevelElement(); }; } diff --git a/Swiften/Elements/UnknownElement.h b/Swiften/Elements/UnknownElement.h index 100ba92..48072ef 100644 --- a/Swiften/Elements/UnknownElement.h +++ b/Swiften/Elements/UnknownElement.h @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class UnknownElement : public Element { + class UnknownElement : public ToplevelElement { public: UnknownElement() {} }; diff --git a/Swiften/Examples/ParserTester/ParserTester.cpp b/Swiften/Examples/ParserTester/ParserTester.cpp index 009eef4..5ce44ef 100644 --- a/Swiften/Examples/ParserTester/ParserTester.cpp +++ b/Swiften/Examples/ParserTester/ParserTester.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -21,7 +21,7 @@ class MyXMPPParserClient : public XMPPParserClient { virtual void handleStreamStart(const ProtocolHeader&) { std::cout << "-> Stream start" << std::endl; } - virtual void handleElement(boost::shared_ptr<Element> element) { + virtual void handleElement(boost::shared_ptr<ToplevelElement> element) { std::cout << "-> Element " << typeid(*element.get()).name() << std::endl; } virtual void handleStreamEnd() { diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp index 610b28b..63f3ca1 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -49,7 +49,7 @@ void IncomingLinkLocalSession::handleStreamStart(const ProtocolHeader& incomingH } } -void IncomingLinkLocalSession::handleElement(boost::shared_ptr<Element> element) { +void IncomingLinkLocalSession::handleElement(boost::shared_ptr<ToplevelElement> element) { boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element); // If we get our first stanza before streamfeatures, our session is implicitly // initialized diff --git a/Swiften/LinkLocal/IncomingLinkLocalSession.h b/Swiften/LinkLocal/IncomingLinkLocalSession.h index f00c166..e10cd0a 100644 --- a/Swiften/LinkLocal/IncomingLinkLocalSession.h +++ b/Swiften/LinkLocal/IncomingLinkLocalSession.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,7 +16,7 @@ namespace Swift { class ProtocolHeader; class XMLParserFactory; - class Element; + class ToplevelElement; class PayloadParserFactoryCollection; class PayloadSerializerCollection; @@ -32,7 +32,7 @@ namespace Swift { boost::signal<void ()> onSessionStarted; private: - void handleElement(boost::shared_ptr<Element>); + void handleElement(boost::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); void setInitialized(); bool isInitialized() const { diff --git a/Swiften/LinkLocal/LinkLocalConnector.cpp b/Swiften/LinkLocal/LinkLocalConnector.cpp index af96e65..6471ca7 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.cpp +++ b/Swiften/LinkLocal/LinkLocalConnector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -71,7 +71,7 @@ void LinkLocalConnector::handleConnected(bool error) { connectionConnectFinishedConnection.disconnect(); } -void LinkLocalConnector::queueElement(boost::shared_ptr<Element> element) { +void LinkLocalConnector::queueElement(boost::shared_ptr<ToplevelElement> element) { queuedElements.push_back(element); } diff --git a/Swiften/LinkLocal/LinkLocalConnector.h b/Swiften/LinkLocal/LinkLocalConnector.h index 52692ef..367e972 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.h +++ b/Swiften/LinkLocal/LinkLocalConnector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { class ConnectionFactory; class HostAddress; - class Element; + class ToplevelElement; class PayloadParserFactoryCollection; class PayloadSerializerCollection; class DNSSDQuerier; @@ -38,9 +38,9 @@ namespace Swift { void connect(); void cancel(); - void queueElement(boost::shared_ptr<Element> element); + void queueElement(boost::shared_ptr<ToplevelElement> element); - const std::vector<boost::shared_ptr<Element> >& getQueuedElements() const { + const std::vector<boost::shared_ptr<ToplevelElement> >& getQueuedElements() const { return queuedElements; } @@ -61,6 +61,6 @@ namespace Swift { boost::bsignals::connection resolveQueryHostNameResolvedConnection; boost::shared_ptr<Connection> connection; boost::bsignals::connection connectionConnectFinishedConnection; - std::vector<boost::shared_ptr<Element> > queuedElements; + std::vector<boost::shared_ptr<ToplevelElement> > queuedElements; }; } diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp index 7a59715..1d280ef 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -35,17 +35,17 @@ void OutgoingLinkLocalSession::handleSessionStarted() { } void OutgoingLinkLocalSession::handleStreamStart(const ProtocolHeader&) { - foreach(const boost::shared_ptr<Element>& stanza, queuedElements_) { + foreach(const boost::shared_ptr<ToplevelElement>& stanza, queuedElements_) { sendElement(stanza); } queuedElements_.clear(); } -void OutgoingLinkLocalSession::handleElement(boost::shared_ptr<Element> element) { +void OutgoingLinkLocalSession::handleElement(boost::shared_ptr<ToplevelElement> element) { onElementReceived(element); } -void OutgoingLinkLocalSession::queueElement(boost::shared_ptr<Element> element) { +void OutgoingLinkLocalSession::queueElement(boost::shared_ptr<ToplevelElement> element) { queuedElements_.push_back(element); } diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.h b/Swiften/LinkLocal/OutgoingLinkLocalSession.h index b97f2bf..4550ae4 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.h +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,7 +17,7 @@ namespace Swift { class ConnectionFactory; class XMLParserFactory; - class Element; + class ToplevelElement; class PayloadParserFactoryCollection; class PayloadSerializerCollection; @@ -31,14 +31,14 @@ namespace Swift { PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory); - void queueElement(boost::shared_ptr<Element> element); + void queueElement(boost::shared_ptr<ToplevelElement> element); private: void handleSessionStarted(); - void handleElement(boost::shared_ptr<Element>); + void handleElement(boost::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); private: - std::vector<boost::shared_ptr<Element> > queuedElements_; + std::vector<boost::shared_ptr<ToplevelElement> > queuedElements_; }; } diff --git a/Swiften/Parser/ElementParser.h b/Swiften/Parser/ElementParser.h index 1815240..256e2dc 100644 --- a/Swiften/Parser/ElementParser.h +++ b/Swiften/Parser/ElementParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -10,7 +10,7 @@ #include <string> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Parser/AttributeMap.h> namespace Swift { @@ -22,6 +22,6 @@ namespace Swift { virtual void handleEndElement(const std::string& element, const std::string& ns) = 0; virtual void handleCharacterData(const std::string& data) = 0; - virtual boost::shared_ptr<Element> getElement() const = 0; + virtual boost::shared_ptr<ToplevelElement> getElement() const = 0; }; } diff --git a/Swiften/Parser/GenericElementParser.h b/Swiften/Parser/GenericElementParser.h index 224c59e..4395622 100644 --- a/Swiften/Parser/GenericElementParser.h +++ b/Swiften/Parser/GenericElementParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -22,7 +22,7 @@ namespace Swift { stanza_ = boost::make_shared<ElementType>(); } - virtual boost::shared_ptr<Element> getElement() const { + virtual boost::shared_ptr<ToplevelElement> getElement() const { return stanza_; } diff --git a/Swiften/Parser/GenericStanzaParser.h b/Swiften/Parser/GenericStanzaParser.h index c756c9a..2aff4d5 100644 --- a/Swiften/Parser/GenericStanzaParser.h +++ b/Swiften/Parser/GenericStanzaParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -23,7 +23,7 @@ namespace Swift { stanza_ = boost::make_shared<STANZA_TYPE>(); } - virtual boost::shared_ptr<Element> getElement() const { + virtual boost::shared_ptr<ToplevelElement> getElement() const { return stanza_; } diff --git a/Swiften/Parser/StanzaParser.h b/Swiften/Parser/StanzaParser.h index 0af6b43..fc60b47 100644 --- a/Swiften/Parser/StanzaParser.h +++ b/Swiften/Parser/StanzaParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -28,7 +28,7 @@ namespace Swift { void handleEndElement(const std::string& element, const std::string& ns); void handleCharacterData(const std::string& data); - virtual boost::shared_ptr<Element> getElement() const = 0; + virtual boost::shared_ptr<ToplevelElement> getElement() const = 0; virtual void handleStanzaAttributes(const AttributeMap&) {} virtual boost::shared_ptr<Stanza> getStanza() const { diff --git a/Swiften/Parser/UnitTest/StanzaParserTest.cpp b/Swiften/Parser/UnitTest/StanzaParserTest.cpp index 88e6dec..020f0ca 100644 --- a/Swiften/Parser/UnitTest/StanzaParserTest.cpp +++ b/Swiften/Parser/UnitTest/StanzaParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -196,7 +196,7 @@ class StanzaParserTest : public CppUnit::TestFixture { stanza_ = boost::make_shared<MyStanza>(); } - virtual boost::shared_ptr<Element> getElement() const { + virtual boost::shared_ptr<ToplevelElement> getElement() const { return stanza_; } diff --git a/Swiften/Parser/UnitTest/XMPPParserTest.cpp b/Swiften/Parser/UnitTest/XMPPParserTest.cpp index f8d60f2..7d2d3fa 100644 --- a/Swiften/Parser/UnitTest/XMPPParserTest.cpp +++ b/Swiften/Parser/UnitTest/XMPPParserTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -162,7 +162,7 @@ class XMPPParserTest : public CppUnit::TestFixture { public: enum Type { StreamStart, ElementEvent, StreamEnd }; struct Event { - Event(Type type, boost::shared_ptr<Element> element) + Event(Type type, boost::shared_ptr<ToplevelElement> element) : type(type), element(element) {} Event(Type type, const ProtocolHeader& header) : type(type), header(header) {} @@ -170,7 +170,7 @@ class XMPPParserTest : public CppUnit::TestFixture { Type type; boost::optional<ProtocolHeader> header; - boost::shared_ptr<Element> element; + boost::shared_ptr<ToplevelElement> element; }; Client() {} @@ -179,7 +179,7 @@ class XMPPParserTest : public CppUnit::TestFixture { events.push_back(Event(StreamStart, header)); } - void handleElement(boost::shared_ptr<Element> element) { + void handleElement(boost::shared_ptr<ToplevelElement> element) { events.push_back(Event(ElementEvent, element)); } diff --git a/Swiften/Parser/XMPPParserClient.h b/Swiften/Parser/XMPPParserClient.h index 85e0f86..7d35968 100644 --- a/Swiften/Parser/XMPPParserClient.h +++ b/Swiften/Parser/XMPPParserClient.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -9,7 +9,7 @@ #include <boost/shared_ptr.hpp> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { @@ -20,7 +20,7 @@ namespace Swift { virtual ~XMPPParserClient(); virtual void handleStreamStart(const ProtocolHeader&) = 0; - virtual void handleElement(boost::shared_ptr<Element>) = 0; + virtual void handleElement(boost::shared_ptr<ToplevelElement>) = 0; virtual void handleStreamEnd() = 0; }; } diff --git a/Swiften/SConscript b/Swiften/SConscript index 574b7d8..d898bfa 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -122,7 +122,7 @@ if env["SCONS_STAGE"] == "build" : "Elements/Form.cpp", "Elements/FormField.cpp", "Elements/StreamFeatures.cpp", - "Elements/Element.cpp", + "Elements/ToplevelElement.cpp", "Elements/IQ.cpp", "Elements/Payload.cpp", "Elements/PubSubPayload.cpp", diff --git a/Swiften/Serializer/AuthChallengeSerializer.cpp b/Swiften/Serializer/AuthChallengeSerializer.cpp index 1ddc165..57a79e0 100644 --- a/Swiften/Serializer/AuthChallengeSerializer.cpp +++ b/Swiften/Serializer/AuthChallengeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -15,7 +15,7 @@ namespace Swift { AuthChallengeSerializer::AuthChallengeSerializer() { } -SafeByteArray AuthChallengeSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray AuthChallengeSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { boost::shared_ptr<AuthChallenge> authChallenge(boost::dynamic_pointer_cast<AuthChallenge>(element)); std::string value; boost::optional<std::vector<unsigned char> > message = authChallenge->getValue(); diff --git a/Swiften/Serializer/AuthChallengeSerializer.h b/Swiften/Serializer/AuthChallengeSerializer.h index 7d0b1b8..af77a5e 100644 --- a/Swiften/Serializer/AuthChallengeSerializer.h +++ b/Swiften/Serializer/AuthChallengeSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,6 +17,6 @@ namespace Swift { public: AuthChallengeSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/AuthFailureSerializer.h b/Swiften/Serializer/AuthFailureSerializer.h index 090f0c4..f7e48f0 100644 --- a/Swiften/Serializer/AuthFailureSerializer.h +++ b/Swiften/Serializer/AuthFailureSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { AuthFailureSerializer() : GenericElementSerializer<AuthFailure>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failure", "urn:ietf:params:xml:ns:xmpp-sasl").serialize()); } }; diff --git a/Swiften/Serializer/AuthRequestSerializer.cpp b/Swiften/Serializer/AuthRequestSerializer.cpp index 7f25c93..5c78e48 100644 --- a/Swiften/Serializer/AuthRequestSerializer.cpp +++ b/Swiften/Serializer/AuthRequestSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,7 +16,7 @@ namespace Swift { AuthRequestSerializer::AuthRequestSerializer() { } -SafeByteArray AuthRequestSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray AuthRequestSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { boost::shared_ptr<AuthRequest> authRequest(boost::dynamic_pointer_cast<AuthRequest>(element)); SafeByteArray value; boost::optional<SafeByteArray> message = authRequest->getMessage(); diff --git a/Swiften/Serializer/AuthRequestSerializer.h b/Swiften/Serializer/AuthRequestSerializer.h index 0b49384..45c2ff8 100644 --- a/Swiften/Serializer/AuthRequestSerializer.h +++ b/Swiften/Serializer/AuthRequestSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,6 +17,6 @@ namespace Swift { public: AuthRequestSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/AuthResponseSerializer.cpp b/Swiften/Serializer/AuthResponseSerializer.cpp index 86b7fbe..c04fed0 100644 --- a/Swiften/Serializer/AuthResponseSerializer.cpp +++ b/Swiften/Serializer/AuthResponseSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,7 +16,7 @@ namespace Swift { AuthResponseSerializer::AuthResponseSerializer() { } -SafeByteArray AuthResponseSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray AuthResponseSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { boost::shared_ptr<AuthResponse> authResponse(boost::dynamic_pointer_cast<AuthResponse>(element)); SafeByteArray value; boost::optional<SafeByteArray> message = authResponse->getValue(); diff --git a/Swiften/Serializer/AuthResponseSerializer.h b/Swiften/Serializer/AuthResponseSerializer.h index af71f59..9c9ae74 100644 --- a/Swiften/Serializer/AuthResponseSerializer.h +++ b/Swiften/Serializer/AuthResponseSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,6 +17,6 @@ namespace Swift { public: AuthResponseSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/AuthSuccessSerializer.cpp b/Swiften/Serializer/AuthSuccessSerializer.cpp index 26b58c3..0f4ef6e 100644 --- a/Swiften/Serializer/AuthSuccessSerializer.cpp +++ b/Swiften/Serializer/AuthSuccessSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -15,7 +15,7 @@ namespace Swift { AuthSuccessSerializer::AuthSuccessSerializer() { } -SafeByteArray AuthSuccessSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray AuthSuccessSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { boost::shared_ptr<AuthSuccess> authSuccess(boost::dynamic_pointer_cast<AuthSuccess>(element)); std::string value; boost::optional<std::vector<unsigned char> > message = authSuccess->getValue(); diff --git a/Swiften/Serializer/AuthSuccessSerializer.h b/Swiften/Serializer/AuthSuccessSerializer.h index 370afaa..7aa934e 100644 --- a/Swiften/Serializer/AuthSuccessSerializer.h +++ b/Swiften/Serializer/AuthSuccessSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,6 +17,6 @@ namespace Swift { public: AuthSuccessSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/ComponentHandshakeSerializer.cpp b/Swiften/Serializer/ComponentHandshakeSerializer.cpp index e7837d3..123798c 100644 --- a/Swiften/Serializer/ComponentHandshakeSerializer.cpp +++ b/Swiften/Serializer/ComponentHandshakeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -13,7 +13,7 @@ namespace Swift { ComponentHandshakeSerializer::ComponentHandshakeSerializer() { } -SafeByteArray ComponentHandshakeSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray ComponentHandshakeSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { boost::shared_ptr<ComponentHandshake> handshake(boost::dynamic_pointer_cast<ComponentHandshake>(element)); return createSafeByteArray("<handshake>" + handshake->getData() + "</handshake>"); } diff --git a/Swiften/Serializer/ComponentHandshakeSerializer.h b/Swiften/Serializer/ComponentHandshakeSerializer.h index 1145ed9..54cd7c8 100644 --- a/Swiften/Serializer/ComponentHandshakeSerializer.h +++ b/Swiften/Serializer/ComponentHandshakeSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,6 +16,6 @@ namespace Swift { public: ComponentHandshakeSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/CompressFailureSerializer.h b/Swiften/Serializer/CompressFailureSerializer.h index 27a638f..2545608 100644 --- a/Swiften/Serializer/CompressFailureSerializer.h +++ b/Swiften/Serializer/CompressFailureSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { CompressFailureSerializer() : GenericElementSerializer<CompressFailure>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failure", "http://jabber.org/protocol/compress").serialize()); } }; diff --git a/Swiften/Serializer/CompressRequestSerializer.cpp b/Swiften/Serializer/CompressRequestSerializer.cpp index af7f7db..38f5b71 100644 --- a/Swiften/Serializer/CompressRequestSerializer.cpp +++ b/Swiften/Serializer/CompressRequestSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -13,12 +13,12 @@ namespace Swift { CompressRequestSerializer::CompressRequestSerializer() { } -SafeByteArray CompressRequestSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray CompressRequestSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { boost::shared_ptr<CompressRequest> compressRequest(boost::dynamic_pointer_cast<CompressRequest>(element)); return createSafeByteArray("<compress xmlns='http://jabber.org/protocol/compress'><method>" + compressRequest->getMethod() + "</method></compress>"); } -bool CompressRequestSerializer::canSerialize(boost::shared_ptr<Element> element) const { +bool CompressRequestSerializer::canSerialize(boost::shared_ptr<ToplevelElement> element) const { return boost::dynamic_pointer_cast<CompressRequest>(element) != 0; } diff --git a/Swiften/Serializer/CompressRequestSerializer.h b/Swiften/Serializer/CompressRequestSerializer.h index 4d68c98..a8610d1 100644 --- a/Swiften/Serializer/CompressRequestSerializer.h +++ b/Swiften/Serializer/CompressRequestSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -15,7 +15,7 @@ namespace Swift { public: CompressRequestSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; - virtual bool canSerialize(boost::shared_ptr<Element> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/ElementSerializer.h b/Swiften/Serializer/ElementSerializer.h index ba59106..76c7d20 100644 --- a/Swiften/Serializer/ElementSerializer.h +++ b/Swiften/Serializer/ElementSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -8,7 +8,7 @@ #include <boost/shared_ptr.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/SafeByteArray.h> namespace Swift { @@ -16,7 +16,7 @@ namespace Swift { public: virtual ~ElementSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const = 0; - virtual bool canSerialize(boost::shared_ptr<Element> element) const = 0; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const = 0; + virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const = 0; }; } diff --git a/Swiften/Serializer/EnableStreamManagementSerializer.h b/Swiften/Serializer/EnableStreamManagementSerializer.h index 384753b..a41df81 100644 --- a/Swiften/Serializer/EnableStreamManagementSerializer.h +++ b/Swiften/Serializer/EnableStreamManagementSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { EnableStreamManagementSerializer() : GenericElementSerializer<EnableStreamManagement>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("enable", "urn:xmpp:sm:2").serialize()); } }; diff --git a/Swiften/Serializer/GenericElementSerializer.h b/Swiften/Serializer/GenericElementSerializer.h index 92f7737..620ae7b 100644 --- a/Swiften/Serializer/GenericElementSerializer.h +++ b/Swiften/Serializer/GenericElementSerializer.h @@ -14,9 +14,9 @@ namespace Swift { template<typename T> class GenericElementSerializer : public ElementSerializer { public: - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const = 0; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const = 0; - virtual bool canSerialize(boost::shared_ptr<Element> element) const { + virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const { return !!boost::dynamic_pointer_cast<T>(element); } }; diff --git a/Swiften/Serializer/GenericStanzaSerializer.h b/Swiften/Serializer/GenericStanzaSerializer.h index 4129ca8..a85d3ba 100644 --- a/Swiften/Serializer/GenericStanzaSerializer.h +++ b/Swiften/Serializer/GenericStanzaSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -14,12 +14,12 @@ namespace Swift { public: GenericStanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers) : StanzaSerializer(tag, payloadSerializers) {} - virtual bool canSerialize(boost::shared_ptr<Element> element) const { + virtual bool canSerialize(boost::shared_ptr<ToplevelElement> element) const { return dynamic_cast<STANZA_TYPE*>(element.get()) != 0; } virtual void setStanzaSpecificAttributes( - boost::shared_ptr<Element> stanza, + boost::shared_ptr<ToplevelElement> stanza, XMLElement& element) const { setStanzaSpecificAttributesGeneric( boost::dynamic_pointer_cast<STANZA_TYPE>(stanza), element); diff --git a/Swiften/Serializer/StanzaAckRequestSerializer.h b/Swiften/Serializer/StanzaAckRequestSerializer.h index fff2a83..9766308 100644 --- a/Swiften/Serializer/StanzaAckRequestSerializer.h +++ b/Swiften/Serializer/StanzaAckRequestSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { StanzaAckRequestSerializer() : GenericElementSerializer<StanzaAckRequest>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("r", "urn:xmpp:sm:2").serialize()); } }; diff --git a/Swiften/Serializer/StanzaAckSerializer.h b/Swiften/Serializer/StanzaAckSerializer.h index ea1e8ad..ad2add6 100644 --- a/Swiften/Serializer/StanzaAckSerializer.h +++ b/Swiften/Serializer/StanzaAckSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -19,7 +19,7 @@ namespace Swift { StanzaAckSerializer() : GenericElementSerializer<StanzaAck>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const { StanzaAck::ref stanzaAck(boost::dynamic_pointer_cast<StanzaAck>(element)); assert(stanzaAck->isValid()); XMLElement result("a", "urn:xmpp:sm:2"); diff --git a/Swiften/Serializer/StanzaSerializer.cpp b/Swiften/Serializer/StanzaSerializer.cpp index b5f0b22..358e4b8 100644 --- a/Swiften/Serializer/StanzaSerializer.cpp +++ b/Swiften/Serializer/StanzaSerializer.cpp @@ -22,11 +22,11 @@ namespace Swift { StanzaSerializer::StanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers) : tag_(tag), payloadSerializers_(payloadSerializers) { } -SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { return serialize(element, ""); } -SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<Element> element, const std::string& xmlns) const { +SafeByteArray StanzaSerializer::serialize(boost::shared_ptr<ToplevelElement> element, const std::string& xmlns) const { boost::shared_ptr<Stanza> stanza(boost::dynamic_pointer_cast<Stanza>(element)); XMLElement stanzaElement(tag_, xmlns); diff --git a/Swiften/Serializer/StanzaSerializer.h b/Swiften/Serializer/StanzaSerializer.h index d569d82..6b46670 100644 --- a/Swiften/Serializer/StanzaSerializer.h +++ b/Swiften/Serializer/StanzaSerializer.h @@ -18,9 +18,9 @@ namespace Swift { public: StanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; - virtual SafeByteArray serialize(boost::shared_ptr<Element> element, const std::string& xmlns) const; - virtual void setStanzaSpecificAttributes(boost::shared_ptr<Element>, XMLElement&) const = 0; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element, const std::string& xmlns) const; + virtual void setStanzaSpecificAttributes(boost::shared_ptr<ToplevelElement>, XMLElement&) const = 0; private: std::string tag_; diff --git a/Swiften/Serializer/StartTLSFailureSerializer.h b/Swiften/Serializer/StartTLSFailureSerializer.h index 779be92..f924545 100644 --- a/Swiften/Serializer/StartTLSFailureSerializer.h +++ b/Swiften/Serializer/StartTLSFailureSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { StartTLSFailureSerializer() : GenericElementSerializer<StartTLSFailure>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failure", "urn:ietf:params:xml:ns:xmpp-tls").serialize()); } }; diff --git a/Swiften/Serializer/StartTLSRequestSerializer.h b/Swiften/Serializer/StartTLSRequestSerializer.h index df914ce..80745e3 100644 --- a/Swiften/Serializer/StartTLSRequestSerializer.h +++ b/Swiften/Serializer/StartTLSRequestSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { StartTLSRequestSerializer() : GenericElementSerializer<StartTLSRequest>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("starttls", "urn:ietf:params:xml:ns:xmpp-tls").serialize()); } }; diff --git a/Swiften/Serializer/StreamErrorSerializer.cpp b/Swiften/Serializer/StreamErrorSerializer.cpp index b3d62a0..37ac3ca 100644 --- a/Swiften/Serializer/StreamErrorSerializer.cpp +++ b/Swiften/Serializer/StreamErrorSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -15,7 +15,7 @@ namespace Swift { StreamErrorSerializer::StreamErrorSerializer() : GenericElementSerializer<StreamError>() { } -SafeByteArray StreamErrorSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray StreamErrorSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { StreamError::ref error = boost::dynamic_pointer_cast<StreamError>(element); XMLElement errorElement("error", "http://etherx.jabber.org/streams"); diff --git a/Swiften/Serializer/StreamErrorSerializer.h b/Swiften/Serializer/StreamErrorSerializer.h index bdaa831..d82cd02 100644 --- a/Swiften/Serializer/StreamErrorSerializer.h +++ b/Swiften/Serializer/StreamErrorSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -14,6 +14,6 @@ namespace Swift { public: StreamErrorSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> error) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> error) const; }; } diff --git a/Swiften/Serializer/StreamFeaturesSerializer.cpp b/Swiften/Serializer/StreamFeaturesSerializer.cpp index 2344349..a93247a 100644 --- a/Swiften/Serializer/StreamFeaturesSerializer.cpp +++ b/Swiften/Serializer/StreamFeaturesSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,7 +17,7 @@ namespace Swift { StreamFeaturesSerializer::StreamFeaturesSerializer() { } -SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr<Element> element) const { +SafeByteArray StreamFeaturesSerializer::serialize(boost::shared_ptr<ToplevelElement> element) const { boost::shared_ptr<StreamFeatures> streamFeatures(boost::dynamic_pointer_cast<StreamFeatures>(element)); XMLElement streamFeaturesElement("stream:features"); diff --git a/Swiften/Serializer/StreamFeaturesSerializer.h b/Swiften/Serializer/StreamFeaturesSerializer.h index 1bd1136..b69a218 100644 --- a/Swiften/Serializer/StreamFeaturesSerializer.h +++ b/Swiften/Serializer/StreamFeaturesSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,6 +17,6 @@ namespace Swift { public: StreamFeaturesSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element> element) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement> element) const; }; } diff --git a/Swiften/Serializer/StreamManagementEnabledSerializer.cpp b/Swiften/Serializer/StreamManagementEnabledSerializer.cpp index b559721..9d4ee94 100644 --- a/Swiften/Serializer/StreamManagementEnabledSerializer.cpp +++ b/Swiften/Serializer/StreamManagementEnabledSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,7 +16,7 @@ using namespace Swift; StreamManagementEnabledSerializer::StreamManagementEnabledSerializer() : GenericElementSerializer<StreamManagementEnabled>() { } -SafeByteArray StreamManagementEnabledSerializer::serialize(boost::shared_ptr<Element> el) const { +SafeByteArray StreamManagementEnabledSerializer::serialize(boost::shared_ptr<ToplevelElement> el) const { boost::shared_ptr<StreamManagementEnabled> e(boost::dynamic_pointer_cast<StreamManagementEnabled>(el)); XMLElement element("enabled", "urn:xmpp:sm:2"); if (!e->getResumeID().empty()) { diff --git a/Swiften/Serializer/StreamManagementEnabledSerializer.h b/Swiften/Serializer/StreamManagementEnabledSerializer.h index 5f28a2b..ee2a980 100644 --- a/Swiften/Serializer/StreamManagementEnabledSerializer.h +++ b/Swiften/Serializer/StreamManagementEnabledSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,6 +16,6 @@ namespace Swift { public: StreamManagementEnabledSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const; }; } diff --git a/Swiften/Serializer/StreamManagementFailedSerializer.h b/Swiften/Serializer/StreamManagementFailedSerializer.h index f3dcce0..f6e7b0e 100644 --- a/Swiften/Serializer/StreamManagementFailedSerializer.h +++ b/Swiften/Serializer/StreamManagementFailedSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { StreamManagementFailedSerializer() : GenericElementSerializer<StreamManagementFailed>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("failed", "urn:xmpp:sm:2").serialize()); } }; diff --git a/Swiften/Serializer/StreamResumeSerializer.cpp b/Swiften/Serializer/StreamResumeSerializer.cpp index e9e520d..902ab21 100644 --- a/Swiften/Serializer/StreamResumeSerializer.cpp +++ b/Swiften/Serializer/StreamResumeSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,7 +17,7 @@ using namespace Swift; StreamResumeSerializer::StreamResumeSerializer() : GenericElementSerializer<StreamResume>() { } -SafeByteArray StreamResumeSerializer::serialize(boost::shared_ptr<Element> el) const { +SafeByteArray StreamResumeSerializer::serialize(boost::shared_ptr<ToplevelElement> el) const { boost::shared_ptr<StreamResume> e(boost::dynamic_pointer_cast<StreamResume>(el)); XMLElement element("resume", "urn:xmpp:sm:2"); element.setAttribute("previd", e->getResumeID()); diff --git a/Swiften/Serializer/StreamResumeSerializer.h b/Swiften/Serializer/StreamResumeSerializer.h index 501d8b6..17baa44 100644 --- a/Swiften/Serializer/StreamResumeSerializer.h +++ b/Swiften/Serializer/StreamResumeSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,6 +16,6 @@ namespace Swift { public: StreamResumeSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const; }; } diff --git a/Swiften/Serializer/StreamResumedSerializer.cpp b/Swiften/Serializer/StreamResumedSerializer.cpp index 7ae82d1..6477af9 100644 --- a/Swiften/Serializer/StreamResumedSerializer.cpp +++ b/Swiften/Serializer/StreamResumedSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -17,7 +17,7 @@ using namespace Swift; StreamResumedSerializer::StreamResumedSerializer() : GenericElementSerializer<StreamResumed>() { } -SafeByteArray StreamResumedSerializer::serialize(boost::shared_ptr<Element> el) const { +SafeByteArray StreamResumedSerializer::serialize(boost::shared_ptr<ToplevelElement> el) const { boost::shared_ptr<StreamResumed> e(boost::dynamic_pointer_cast<StreamResumed>(el)); XMLElement element("resumed", "urn:xmpp:sm:2"); element.setAttribute("previd", e->getResumeID()); diff --git a/Swiften/Serializer/StreamResumedSerializer.h b/Swiften/Serializer/StreamResumedSerializer.h index 7828694..bdca891 100644 --- a/Swiften/Serializer/StreamResumedSerializer.h +++ b/Swiften/Serializer/StreamResumedSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -16,6 +16,6 @@ namespace Swift { public: StreamResumedSerializer(); - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const; + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const; }; } diff --git a/Swiften/Serializer/TLSProceedSerializer.h b/Swiften/Serializer/TLSProceedSerializer.h index 21a8420..15db3dc 100644 --- a/Swiften/Serializer/TLSProceedSerializer.h +++ b/Swiften/Serializer/TLSProceedSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -18,7 +18,7 @@ namespace Swift { TLSProceedSerializer() : GenericElementSerializer<TLSProceed>() { } - virtual SafeByteArray serialize(boost::shared_ptr<Element>) const { + virtual SafeByteArray serialize(boost::shared_ptr<ToplevelElement>) const { return createSafeByteArray(XMLElement("proceed", "urn:ietf:params:xml:ns:xmpp-tls").serialize()); } }; diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp index 389f7cc..e3f43cd 100644 --- a/Swiften/Serializer/XMPPSerializer.cpp +++ b/Swiften/Serializer/XMPPSerializer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -83,7 +83,7 @@ std::string XMPPSerializer::serializeHeader(const ProtocolHeader& header) const return result; } -SafeByteArray XMPPSerializer::serializeElement(boost::shared_ptr<Element> element) const { +SafeByteArray XMPPSerializer::serializeElement(boost::shared_ptr<ToplevelElement> element) const { std::vector< boost::shared_ptr<ElementSerializer> >::const_iterator i = std::find_if(serializers_.begin(), serializers_.end(), boost::bind(&ElementSerializer::canSerialize, _1, element)); if (i != serializers_.end()) { return (*i)->serialize(element); diff --git a/Swiften/Serializer/XMPPSerializer.h b/Swiften/Serializer/XMPPSerializer.h index 5b5c9d6..cbcdccb 100644 --- a/Swiften/Serializer/XMPPSerializer.h +++ b/Swiften/Serializer/XMPPSerializer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -10,7 +10,7 @@ #include <vector> #include <Swiften/Base/API.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Elements/StreamType.h> #include <string> #include <Swiften/Serializer/ElementSerializer.h> @@ -25,7 +25,7 @@ namespace Swift { XMPPSerializer(PayloadSerializerCollection*, StreamType type); std::string serializeHeader(const ProtocolHeader&) const; - SafeByteArray serializeElement(boost::shared_ptr<Element> stanza) const; + SafeByteArray serializeElement(boost::shared_ptr<ToplevelElement> stanza) const; std::string serializeFooter() const; private: diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp index 62261d0..8cdbdb0 100644 --- a/Swiften/Session/BOSHSessionStream.cpp +++ b/Swiften/Session/BOSHSessionStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Kevin Smith + * Copyright (c) 2011-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -86,7 +86,7 @@ void BOSHSessionStream::handlePoolXMPPDataRead(const SafeByteArray& data) { xmppLayer->handleDataRead(data); } -void BOSHSessionStream::writeElement(boost::shared_ptr<Element> element) { +void BOSHSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) { assert(available); xmppLayer->writeElement(element); } @@ -156,7 +156,7 @@ void BOSHSessionStream::handleStreamStartReceived(const ProtocolHeader& header) onStreamStartReceived(header); } -void BOSHSessionStream::handleElementReceived(boost::shared_ptr<Element> element) { +void BOSHSessionStream::handleElementReceived(boost::shared_ptr<ToplevelElement> element) { onElementReceived(element); } diff --git a/Swiften/Session/BOSHSessionStream.h b/Swiften/Session/BOSHSessionStream.h index 290a4c5..e74d534 100644 --- a/Swiften/Session/BOSHSessionStream.h +++ b/Swiften/Session/BOSHSessionStream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Kevin Smith + * Copyright (c) 2011-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -50,7 +50,7 @@ namespace Swift { virtual bool isOpen(); virtual void writeHeader(const ProtocolHeader& header); - virtual void writeElement(boost::shared_ptr<Element>); + virtual void writeElement(boost::shared_ptr<ToplevelElement>); virtual void writeFooter(); virtual void writeData(const std::string& data); @@ -72,7 +72,7 @@ namespace Swift { private: void handleXMPPError(); void handleStreamStartReceived(const ProtocolHeader&); - void handleElementReceived(boost::shared_ptr<Element>); + void handleElementReceived(boost::shared_ptr<ToplevelElement>); void handlePoolXMPPDataRead(const SafeByteArray& data); void handleXMPPLayerDataWritten(const SafeByteArray& data); void handlePoolSessionStarted(); diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp index 2bd8d66..7aaa5c2 100644 --- a/Swiften/Session/BasicSessionStream.cpp +++ b/Swiften/Session/BasicSessionStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -77,7 +77,7 @@ void BasicSessionStream::writeHeader(const ProtocolHeader& header) { xmppLayer->writeHeader(header); } -void BasicSessionStream::writeElement(boost::shared_ptr<Element> element) { +void BasicSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) { assert(available); xmppLayer->writeElement(element); } @@ -168,7 +168,7 @@ void BasicSessionStream::handleStreamStartReceived(const ProtocolHeader& header) onStreamStartReceived(header); } -void BasicSessionStream::handleElementReceived(boost::shared_ptr<Element> element) { +void BasicSessionStream::handleElementReceived(boost::shared_ptr<ToplevelElement> element) { onElementReceived(element); } diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h index 389ecbe..e5f8004 100644 --- a/Swiften/Session/BasicSessionStream.h +++ b/Swiften/Session/BasicSessionStream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -44,7 +44,7 @@ namespace Swift { virtual bool isOpen(); virtual void writeHeader(const ProtocolHeader& header); - virtual void writeElement(boost::shared_ptr<Element>); + virtual void writeElement(boost::shared_ptr<ToplevelElement>); virtual void writeFooter(); virtual void writeData(const std::string& data); @@ -70,7 +70,7 @@ namespace Swift { void handleTLSConnected(); void handleTLSError(boost::shared_ptr<TLSError>); void handleStreamStartReceived(const ProtocolHeader&); - void handleElementReceived(boost::shared_ptr<Element>); + void handleElementReceived(boost::shared_ptr<ToplevelElement>); void handleDataRead(const SafeByteArray& data); void handleDataWritten(const SafeByteArray& data); diff --git a/Swiften/Session/Session.cpp b/Swiften/Session/Session.cpp index acc73f1..de54c5f 100644 --- a/Swiften/Session/Session.cpp +++ b/Swiften/Session/Session.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -76,7 +76,7 @@ void Session::initializeStreamStack() { streamStack = new StreamStack(xmppLayer, connectionLayer); } -void Session::sendElement(boost::shared_ptr<Element> stanza) { +void Session::sendElement(boost::shared_ptr<ToplevelElement> stanza) { xmppLayer->writeElement(stanza); } diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h index 4becebf..63a6a02 100644 --- a/Swiften/Session/Session.h +++ b/Swiften/Session/Session.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -13,7 +13,7 @@ #include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Network/Connection.h> #include <Swiften/StreamStack/ConnectionLayer.h> #include <Swiften/Base/SafeByteArray.h> @@ -54,7 +54,7 @@ namespace Swift { void startSession(); void finishSession(); - void sendElement(boost::shared_ptr<Element>); + void sendElement(boost::shared_ptr<ToplevelElement>); const JID& getLocalJID() const { return localJID; @@ -64,7 +64,7 @@ namespace Swift { return remoteJID; } - boost::signal<void (boost::shared_ptr<Element>)> onElementReceived; + boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElementReceived; boost::signal<void (const boost::optional<SessionError>&)> onSessionFinished; boost::signal<void (const SafeByteArray&)> onDataWritten; boost::signal<void (const SafeByteArray&)> onDataRead; @@ -82,7 +82,7 @@ namespace Swift { virtual void handleSessionStarted() {} virtual void handleSessionFinished(const boost::optional<SessionError>&) {} - virtual void handleElement(boost::shared_ptr<Element>) = 0; + virtual void handleElement(boost::shared_ptr<ToplevelElement>) = 0; virtual void handleStreamStart(const ProtocolHeader&) = 0; void initializeStreamStack(); diff --git a/Swiften/Session/SessionStream.h b/Swiften/Session/SessionStream.h index 501f588..2394295 100644 --- a/Swiften/Session/SessionStream.h +++ b/Swiften/Session/SessionStream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -12,7 +12,7 @@ #include <Swiften/Base/API.h> #include <Swiften/Elements/ProtocolHeader.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/Error.h> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/TLS/CertificateWithKey.h> @@ -46,7 +46,7 @@ namespace Swift { virtual void writeHeader(const ProtocolHeader& header) = 0; virtual void writeFooter() = 0; - virtual void writeElement(boost::shared_ptr<Element>) = 0; + virtual void writeElement(boost::shared_ptr<ToplevelElement>) = 0; virtual void writeData(const std::string& data) = 0; virtual bool supportsZLibCompression() = 0; @@ -74,7 +74,7 @@ namespace Swift { virtual ByteArray getTLSFinishMessage() const = 0; boost::signal<void (const ProtocolHeader&)> onStreamStartReceived; - boost::signal<void (boost::shared_ptr<Element>)> onElementReceived; + boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElementReceived; boost::signal<void (boost::shared_ptr<Error>)> onClosed; boost::signal<void ()> onTLSEncrypted; boost::signal<void (const SafeByteArray&)> onDataRead; diff --git a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp index 213948a..35146d6 100644 --- a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp +++ b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -126,7 +126,7 @@ class StreamStackTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, dataWriteReceived_); } - void handleElement(boost::shared_ptr<Element>) { + void handleElement(boost::shared_ptr<ToplevelElement>) { ++elementsReceived_; } diff --git a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp index a6098f1..ced9ec3 100644 --- a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp +++ b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -94,11 +94,11 @@ class XMPPLayerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("</stream:stream>"), lowLayer_->writtenData); } - void handleElement(boost::shared_ptr<Element>) { + void handleElement(boost::shared_ptr<ToplevelElement>) { ++elementsReceived_; } - void handleElementAndReset(boost::shared_ptr<Element>) { + void handleElementAndReset(boost::shared_ptr<ToplevelElement>) { ++elementsReceived_; testling_->resetParser(); } diff --git a/Swiften/StreamStack/XMPPLayer.cpp b/Swiften/StreamStack/XMPPLayer.cpp index 94afcf9..59418a2 100644 --- a/Swiften/StreamStack/XMPPLayer.cpp +++ b/Swiften/StreamStack/XMPPLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -38,7 +38,7 @@ void XMPPLayer::writeFooter() { writeDataInternal(createSafeByteArray(xmppSerializer_->serializeFooter())); } -void XMPPLayer::writeElement(boost::shared_ptr<Element> element) { +void XMPPLayer::writeElement(boost::shared_ptr<ToplevelElement> element) { writeDataInternal(xmppSerializer_->serializeElement(element)); } @@ -78,7 +78,7 @@ void XMPPLayer::handleStreamStart(const ProtocolHeader& header) { onStreamStart(header); } -void XMPPLayer::handleElement(boost::shared_ptr<Element> stanza) { +void XMPPLayer::handleElement(boost::shared_ptr<ToplevelElement> stanza) { onElement(stanza); } diff --git a/Swiften/StreamStack/XMPPLayer.h b/Swiften/StreamStack/XMPPLayer.h index f0e88aa..bb0e498 100644 --- a/Swiften/StreamStack/XMPPLayer.h +++ b/Swiften/StreamStack/XMPPLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -13,7 +13,7 @@ #include <Swiften/Base/API.h> #include <Swiften/StreamStack/HighLayer.h> #include <Swiften/Base/SafeByteArray.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Elements/StreamType.h> #include <Swiften/Parser/XMPPParserClient.h> @@ -38,7 +38,7 @@ namespace Swift { void writeHeader(const ProtocolHeader& header); void writeFooter(); - void writeElement(boost::shared_ptr<Element>); + void writeElement(boost::shared_ptr<ToplevelElement>); void writeData(const std::string& data); void resetParser(); @@ -49,14 +49,14 @@ namespace Swift { public: boost::signal<void (const ProtocolHeader&)> onStreamStart; - boost::signal<void (boost::shared_ptr<Element>)> onElement; + boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElement; boost::signal<void (const SafeByteArray&)> onWriteData; boost::signal<void (const SafeByteArray&)> onDataRead; boost::signal<void ()> onError; private: void handleStreamStart(const ProtocolHeader&); - void handleElement(boost::shared_ptr<Element>); + void handleElement(boost::shared_ptr<ToplevelElement>); void handleStreamEnd(); void doResetParser(); |