summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Limber/Server/ServerFromClientSession.cpp4
-rw-r--r--Limber/Server/ServerFromClientSession.h6
-rw-r--r--Limber/main.cpp4
-rw-r--r--Slimber/Server.cpp10
-rw-r--r--Slimber/Server.h6
-rw-r--r--Swiften/Client/ClientSession.cpp4
-rw-r--r--Swiften/Client/ClientSession.h6
-rw-r--r--Swiften/Client/UnitTest/ClientSessionTest.cpp8
-rw-r--r--Swiften/Component/ComponentSession.cpp4
-rw-r--r--Swiften/Component/ComponentSession.h6
-rw-r--r--Swiften/Component/UnitTest/ComponentSessionTest.cpp8
-rw-r--r--Swiften/Elements/AuthChallenge.h6
-rw-r--r--Swiften/Elements/AuthFailure.h6
-rw-r--r--Swiften/Elements/AuthRequest.h6
-rw-r--r--Swiften/Elements/AuthResponse.h6
-rw-r--r--Swiften/Elements/AuthSuccess.h6
-rw-r--r--Swiften/Elements/ComponentHandshake.h6
-rw-r--r--Swiften/Elements/CompressFailure.h6
-rw-r--r--Swiften/Elements/CompressRequest.h6
-rw-r--r--Swiften/Elements/Compressed.h6
-rw-r--r--Swiften/Elements/EnableStreamManagement.h6
-rw-r--r--Swiften/Elements/Payload.h3
-rw-r--r--Swiften/Elements/Stanza.h6
-rw-r--r--Swiften/Elements/StanzaAck.h6
-rw-r--r--Swiften/Elements/StanzaAckRequest.h6
-rw-r--r--Swiften/Elements/StartTLSFailure.h6
-rw-r--r--Swiften/Elements/StartTLSRequest.h6
-rw-r--r--Swiften/Elements/StreamError.h6
-rw-r--r--Swiften/Elements/StreamFeatures.h6
-rw-r--r--Swiften/Elements/StreamManagementEnabled.h6
-rw-r--r--Swiften/Elements/StreamManagementFailed.h6
-rw-r--r--Swiften/Elements/StreamResume.h6
-rw-r--r--Swiften/Elements/StreamResumed.h6
-rw-r--r--Swiften/Elements/TLSProceed.h6
-rw-r--r--Swiften/Elements/ToplevelElement.cpp (renamed from Swiften/Elements/Element.cpp)6
-rw-r--r--Swiften/Elements/ToplevelElement.h (renamed from Swiften/Elements/Element.h)8
-rw-r--r--Swiften/Elements/UnknownElement.h6
-rw-r--r--Swiften/Examples/ParserTester/ParserTester.cpp4
-rw-r--r--Swiften/LinkLocal/IncomingLinkLocalSession.cpp4
-rw-r--r--Swiften/LinkLocal/IncomingLinkLocalSession.h6
-rw-r--r--Swiften/LinkLocal/LinkLocalConnector.cpp4
-rw-r--r--Swiften/LinkLocal/LinkLocalConnector.h10
-rw-r--r--Swiften/LinkLocal/OutgoingLinkLocalSession.cpp8
-rw-r--r--Swiften/LinkLocal/OutgoingLinkLocalSession.h10
-rw-r--r--Swiften/Parser/ElementParser.h6
-rw-r--r--Swiften/Parser/GenericElementParser.h4
-rw-r--r--Swiften/Parser/GenericStanzaParser.h4
-rw-r--r--Swiften/Parser/StanzaParser.h4
-rw-r--r--Swiften/Parser/UnitTest/StanzaParserTest.cpp4
-rw-r--r--Swiften/Parser/UnitTest/XMPPParserTest.cpp8
-rw-r--r--Swiften/Parser/XMPPParserClient.h6
-rw-r--r--Swiften/SConscript2
-rw-r--r--Swiften/Serializer/AuthChallengeSerializer.cpp4
-rw-r--r--Swiften/Serializer/AuthChallengeSerializer.h4
-rw-r--r--Swiften/Serializer/AuthFailureSerializer.h4
-rw-r--r--Swiften/Serializer/AuthRequestSerializer.cpp4
-rw-r--r--Swiften/Serializer/AuthRequestSerializer.h4
-rw-r--r--Swiften/Serializer/AuthResponseSerializer.cpp4
-rw-r--r--Swiften/Serializer/AuthResponseSerializer.h4
-rw-r--r--Swiften/Serializer/AuthSuccessSerializer.cpp4
-rw-r--r--Swiften/Serializer/AuthSuccessSerializer.h4
-rw-r--r--Swiften/Serializer/ComponentHandshakeSerializer.cpp4
-rw-r--r--Swiften/Serializer/ComponentHandshakeSerializer.h4
-rw-r--r--Swiften/Serializer/CompressFailureSerializer.h4
-rw-r--r--Swiften/Serializer/CompressRequestSerializer.cpp6
-rw-r--r--Swiften/Serializer/CompressRequestSerializer.h6
-rw-r--r--Swiften/Serializer/ElementSerializer.h8
-rw-r--r--Swiften/Serializer/EnableStreamManagementSerializer.h4
-rw-r--r--Swiften/Serializer/GenericElementSerializer.h4
-rw-r--r--Swiften/Serializer/GenericStanzaSerializer.h6
-rw-r--r--Swiften/Serializer/StanzaAckRequestSerializer.h4
-rw-r--r--Swiften/Serializer/StanzaAckSerializer.h4
-rw-r--r--Swiften/Serializer/StanzaSerializer.cpp4
-rw-r--r--Swiften/Serializer/StanzaSerializer.h6
-rw-r--r--Swiften/Serializer/StartTLSFailureSerializer.h4
-rw-r--r--Swiften/Serializer/StartTLSRequestSerializer.h4
-rw-r--r--Swiften/Serializer/StreamErrorSerializer.cpp4
-rw-r--r--Swiften/Serializer/StreamErrorSerializer.h4
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.cpp4
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.h4
-rw-r--r--Swiften/Serializer/StreamManagementEnabledSerializer.cpp4
-rw-r--r--Swiften/Serializer/StreamManagementEnabledSerializer.h4
-rw-r--r--Swiften/Serializer/StreamManagementFailedSerializer.h4
-rw-r--r--Swiften/Serializer/StreamResumeSerializer.cpp4
-rw-r--r--Swiften/Serializer/StreamResumeSerializer.h4
-rw-r--r--Swiften/Serializer/StreamResumedSerializer.cpp4
-rw-r--r--Swiften/Serializer/StreamResumedSerializer.h4
-rw-r--r--Swiften/Serializer/TLSProceedSerializer.h4
-rw-r--r--Swiften/Serializer/XMPPSerializer.cpp4
-rw-r--r--Swiften/Serializer/XMPPSerializer.h6
-rw-r--r--Swiften/Session/BOSHSessionStream.cpp6
-rw-r--r--Swiften/Session/BOSHSessionStream.h6
-rw-r--r--Swiften/Session/BasicSessionStream.cpp6
-rw-r--r--Swiften/Session/BasicSessionStream.h6
-rw-r--r--Swiften/Session/Session.cpp4
-rw-r--r--Swiften/Session/Session.h10
-rw-r--r--Swiften/Session/SessionStream.h8
-rw-r--r--Swiften/StreamStack/UnitTest/StreamStackTest.cpp4
-rw-r--r--Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp6
-rw-r--r--Swiften/StreamStack/XMPPLayer.cpp6
-rw-r--r--Swiften/StreamStack/XMPPLayer.h10
101 files changed, 272 insertions, 271 deletions
diff --git a/Limber/Server/ServerFromClientSession.cpp b/Limber/Server/ServerFromClientSession.cpp
index 71a8fef..9b1d2cf 100644
--- a/Limber/Server/ServerFromClientSession.cpp
+++ b/Limber/Server/ServerFromClientSession.cpp
@@ -1,11 +1,11 @@
/*
- * 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 "Limber/Server/ServerFromClientSession.h"
#include <boost/smart_ptr/make_shared.hpp>
#include <boost/bind.hpp>
@@ -34,19 +34,19 @@ ServerFromClientSession::ServerFromClientSession(
Session(connection, payloadParserFactories, payloadSerializers, xmlParserFactory),
id_(id),
userRegistry_(userRegistry),
authenticated_(false),
initialized(false),
allowSASLEXTERNAL(false) {
}
-void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) {
+void ServerFromClientSession::handleElement(boost::shared_ptr<ToplevelElement> element) {
if (isInitialized()) {
onElementReceived(element);
}
else {
if (AuthRequest* authRequest = dynamic_cast<AuthRequest*>(element.get())) {
if (authRequest->getMechanism() == "PLAIN" || (allowSASLEXTERNAL && authRequest->getMechanism() == "EXTERNAL")) {
if (authRequest->getMechanism() == "EXTERNAL") {
getXMPPLayer()->writeElement(boost::make_shared<AuthSuccess>());
authenticated_ = true;
diff --git a/Limber/Server/ServerFromClientSession.h b/Limber/Server/ServerFromClientSession.h
index e2754b9..00dfd79 100644
--- a/Limber/Server/ServerFromClientSession.h
+++ b/Limber/Server/ServerFromClientSession.h
@@ -1,30 +1,30 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <string>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Session/Session.h>
#include <Swiften/JID/JID.h>
#include <Swiften/Network/Connection.h>
#include <Swiften/Base/ByteArray.h>
namespace Swift {
class ProtocolHeader;
- class Element;
+ class ToplevelElement;
class Stanza;
class PayloadParserFactoryCollection;
class PayloadSerializerCollection;
class StreamStack;
class UserRegistry;
class XMPPLayer;
class ConnectionLayer;
class Connection;
class XMLParserFactory;
@@ -37,19 +37,19 @@ namespace Swift {
PayloadParserFactoryCollection* payloadParserFactories,
PayloadSerializerCollection* payloadSerializers,
XMLParserFactory* xmlParserFactory,
UserRegistry* userRegistry);
boost::signal<void ()> onSessionStarted;
void setAllowSASLEXTERNAL();
private:
- void handleElement(boost::shared_ptr<Element>);
+ void handleElement(boost::shared_ptr<ToplevelElement>);
void handleStreamStart(const ProtocolHeader& header);
void setInitialized();
bool isInitialized() const {
return initialized;
}
private:
std::string id_;
diff --git a/Limber/main.cpp b/Limber/main.cpp
index 3809729..3e095d5 100644
--- a/Limber/main.cpp
+++ b/Limber/main.cpp
@@ -1,11 +1,11 @@
/*
- * 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 <string>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include "Swiften/Elements/IQ.h"
@@ -43,19 +43,19 @@ class Server {
session->onElementReceived.connect(boost::bind(&Server::handleElementReceived, this, _1, session));
session->onSessionFinished.connect(boost::bind(&Server::handleSessionFinished, this, session));
session->startSession();
}
void handleSessionFinished(boost::shared_ptr<ServerFromClientSession> session) {
serverFromClientSessions_.erase(std::remove(serverFromClientSessions_.begin(), serverFromClientSessions_.end(), session), serverFromClientSessions_.end());
}
- void handleElementReceived(boost::shared_ptr<Element> element, boost::shared_ptr<ServerFromClientSession> session) {
+ void handleElementReceived(boost::shared_ptr<ToplevelElement> element, boost::shared_ptr<ServerFromClientSession> session) {
boost::shared_ptr<Stanza> stanza(boost::dynamic_pointer_cast<Stanza>(element));
if (!stanza) {
return;
}
stanza->setFrom(session->getRemoteJID());
if (!stanza->getTo().isValid()) {
stanza->setTo(JID(session->getLocalJID()));
}
if (!stanza->getTo().isValid() || stanza->getTo() == session->getLocalJID() || stanza->getTo() == session->getRemoteJID().toBare()) {
diff --git a/Slimber/Server.cpp b/Slimber/Server.cpp
index b63ca67..41b90c4 100644
--- a/Slimber/Server.cpp
+++ b/Slimber/Server.cpp
@@ -1,26 +1,26 @@
/*
- * 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 "Slimber/Server.h"
#include <string>
#include <boost/bind.hpp>
#include <iostream>
#include "Swiften/Base/String.h"
#include "Swiften/LinkLocal/LinkLocalConnector.h"
#include "Swiften/Network/Connection.h"
#include "Swiften/Session/SessionTracer.h"
-#include "Swiften/Elements/Element.h"
+#include "Swiften/Elements/ToplevelElement.h"
#include "Swiften/Elements/Presence.h"
#include "Swiften/Elements/RosterPayload.h"
#include "Swiften/Network/BoostConnection.h"
#include "Swiften/Network/BoostConnectionServer.h"
#include "Swiften/Session/SessionTracer.h"
#include "Swiften/Elements/IQ.h"
#include "Swiften/Elements/VCard.h"
#include "Limber/Server/UserRegistry.h"
#include "Swiften/Session/Session.h"
@@ -176,19 +176,19 @@ void Server::handleSessionFinished(boost::shared_ptr<ServerFromClientSession>) {
}
void Server::unregisterService() {
if (linkLocalServiceRegistered) {
linkLocalServiceRegistered = false;
linkLocalServiceBrowser->unregisterService();
}
}
-void Server::handleElementReceived(boost::shared_ptr<Element> element, boost::shared_ptr<ServerFromClientSession> session) {
+void Server::handleElementReceived(boost::shared_ptr<ToplevelElement> element, boost::shared_ptr<ServerFromClientSession> session) {
boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element);
if (!stanza) {
return;
}
stanza->setFrom(session->getRemoteJID());
if (!stanza->getTo().isValid()) {
stanza->setTo(session->getLocalJID());
}
@@ -286,19 +286,19 @@ void Server::handleNewLinkLocalConnection(boost::shared_ptr<Connection> connecti
}
void Server::handleLinkLocalSessionFinished(boost::shared_ptr<Session> session) {
//std::cout << "Link local session from " << session->getRemoteJID() << " ended" << std::endl;
linkLocalSessions.erase(
std::remove(linkLocalSessions.begin(), linkLocalSessions.end(), session),
linkLocalSessions.end());
}
-void Server::handleLinkLocalElementReceived(boost::shared_ptr<Element> element, boost::shared_ptr<Session> session) {
+void Server::handleLinkLocalElementReceived(boost::shared_ptr<ToplevelElement> element, boost::shared_ptr<Session> session) {
if (boost::shared_ptr<Stanza> stanza = boost::dynamic_pointer_cast<Stanza>(element)) {
JID fromJID = session->getRemoteJID();
if (!presenceManager->getServiceForJID(fromJID.toBare())) {
return; // TODO: Send error back
}
stanza->setFrom(fromJID);
serverFromClientSession->sendElement(stanza);
}
}
@@ -307,19 +307,19 @@ void Server::handleConnectFinished(boost::shared_ptr<LinkLocalConnector> connect
if (error) {
std::cerr << "Error connecting" << std::endl;
// TODO: Send back queued stanzas
}
else {
boost::shared_ptr<OutgoingLinkLocalSession> outgoingSession(
new OutgoingLinkLocalSession(
selfJID, connector->getService().getJID(), connector->getConnection(),
&payloadParserFactories, &payloadSerializers, &xmlParserFactory));
- foreach(const boost::shared_ptr<Element> element, connector->getQueuedElements()) {
+ foreach(const boost::shared_ptr<ToplevelElement> element, connector->getQueuedElements()) {
outgoingSession->queueElement(element);
}
registerLinkLocalSession(outgoingSession);
}
connectors.erase(std::remove(connectors.begin(), connectors.end(), connector), connectors.end());
}
void Server::registerLinkLocalSession(boost::shared_ptr<Session> session) {
session->onSessionFinished.connect(
diff --git a/Slimber/Server.h b/Slimber/Server.h
index 96401d9..2d520d6 100644
--- a/Slimber/Server.h
+++ b/Slimber/Server.h
@@ -1,11 +1,11 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <vector>
@@ -59,25 +59,25 @@ namespace Swift {
boost::signal<void (bool)> onSelfConnected;
boost::signal<void (boost::optional<ServerError>)> onStopped;
private:
void stop(boost::optional<ServerError>);
void handleNewClientConnection(boost::shared_ptr<Connection> c);
void handleSessionStarted();
void handleSessionFinished(boost::shared_ptr<ServerFromClientSession>);
- void handleElementReceived(boost::shared_ptr<Element> element, boost::shared_ptr<ServerFromClientSession> session);
+ void handleElementReceived(boost::shared_ptr<ToplevelElement> element, boost::shared_ptr<ServerFromClientSession> session);
void handleRosterChanged(boost::shared_ptr<RosterPayload> roster);
void handlePresenceChanged(boost::shared_ptr<Presence> presence);
void handleServiceRegistered(const DNSSDServiceID& service);
void handleNewLinkLocalConnection(boost::shared_ptr<Connection> connection);
void handleLinkLocalSessionFinished(boost::shared_ptr<Session> session);
- void handleLinkLocalElementReceived(boost::shared_ptr<Element> element, boost::shared_ptr<Session> session);
+ void handleLinkLocalElementReceived(boost::shared_ptr<ToplevelElement> element, boost::shared_ptr<Session> session);
void handleConnectFinished(boost::shared_ptr<LinkLocalConnector> connector, bool error);
void handleClientConnectionServerStopped(
boost::optional<BoostConnectionServer::Error>);
void handleLinkLocalConnectionServerStopped(
boost::optional<BoostConnectionServer::Error>);
boost::shared_ptr<Session> getLinkLocalSessionForJID(const JID& jid);
boost::shared_ptr<LinkLocalConnector> getLinkLocalConnectorForJID(const JID& jid);
void registerLinkLocalSession(boost::shared_ptr<Session> session);
void unregisterService();
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,11 +1,11 @@
/*
- * 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/Client/ClientSession.h>
#include <boost/bind.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
@@ -108,19 +108,19 @@ void ClientSession::sendStanza(boost::shared_ptr<Stanza> stanza) {
stanzaAckRequester_->handleStanzaSent(stanza);
}
}
void ClientSession::handleStreamStart(const ProtocolHeader&) {
CHECK_STATE_OR_RETURN(WaitingForStreamStart);
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();
}
if (getState() == Initialized) {
onStanzaReceived(stanza);
}
else if (boost::shared_ptr<IQ> iq = boost::dynamic_pointer_cast<IQ>(element)) {
if (state == BindingResource) {
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,27 +1,27 @@
/*
- * 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/Base/boost_bsignals.h>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Base/Error.h>
#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>
namespace Swift {
class ClientAuthenticator;
class CertificateTrustChecker;
class IDNConverter;
class CryptoProvider;
@@ -142,19 +142,19 @@ namespace Swift {
void finishSession(Error::Type error);
void finishSession(boost::shared_ptr<Swift::Error> error);
JID getRemoteJID() const {
return JID("", localJID.getDomain());
}
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>);
void handleTLSEncrypted();
bool checkState(State);
void continueSessionInitialization();
void requestAck();
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,11 +1,11 @@
/*
- * 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 <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <deque>
#include <boost/bind.hpp>
#include <boost/optional.hpp>
@@ -375,23 +375,23 @@ class ClientSessionTest : public CppUnit::TestFixture {
}
void handleSessionNeedCredentials() {
needCredentials = true;
}
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;
};
MockSessionStream() : available(true), canTLSEncrypt(true), tlsEncrypted(false), compressed(false), whitespacePingEnabled(false), resetCount(0) {
}
virtual void close() {
onClosed(boost::shared_ptr<Error>());
@@ -403,19 +403,19 @@ class ClientSessionTest : public CppUnit::TestFixture {
virtual void writeHeader(const ProtocolHeader& header) {
receivedEvents.push_back(Event(header));
}
virtual void writeFooter() {
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));
}
virtual void writeData(const std::string&) {
}
virtual bool supportsTLSEncryption() {
return canTLSEncrypt;
}
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,11 +1,11 @@
/*
- * 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.
*/
#include <Swiften/Component/ComponentSession.h>
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
@@ -43,19 +43,19 @@ void ComponentSession::sendStanza(boost::shared_ptr<Stanza> stanza) {
stream->writeElement(stanza);
}
void ComponentSession::handleStreamStart(const ProtocolHeader& header) {
checkState(WaitingForStreamStart);
state = Authenticating;
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);
}
else {
finishSession(Error::UnexpectedElementError);
}
}
else if (boost::dynamic_pointer_cast<ComponentHandshake>(element)) {
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,26 +1,26 @@
/*
- * 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.
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/JID/JID.h>
#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>
namespace Swift {
class ComponentAuthenticator;
class CryptoProvider;
class SWIFTEN_API ComponentSession : public boost::enable_shared_from_this<ComponentSession> {
public:
@@ -63,19 +63,19 @@ namespace Swift {
private:
ComponentSession(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream>, CryptoProvider*);
void finishSession(Error::Type error);
void finishSession(boost::shared_ptr<Swift::Error> error);
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>);
bool checkState(State);
private:
JID jid;
std::string secret;
boost::shared_ptr<SessionStream> stream;
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,11 +1,11 @@
/*
- * 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.
*/
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <deque>
#include <boost/bind.hpp>
#include <boost/optional.hpp>
@@ -80,23 +80,23 @@ class ComponentSessionTest : public CppUnit::TestFixture {
void handleSessionFinished(boost::shared_ptr<Error> error) {
sessionFinishedReceived = true;
sessionFinishedError = error;
}
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;
};
MockSessionStream() : available(true), whitespacePingEnabled(false), resetCount(0) {
}
virtual void close() {
onClosed(boost::shared_ptr<Error>());
@@ -108,19 +108,19 @@ class ComponentSessionTest : public CppUnit::TestFixture {
virtual void writeHeader(const ProtocolHeader& header) {
receivedEvents.push_back(Event(header));
}
virtual void writeFooter() {
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));
}
virtual void writeData(const std::string&) {
}
virtual bool supportsTLSEncryption() {
return false;
}
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,24 +1,24 @@
/*
- * 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 <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() {
}
AuthChallenge(const std::vector<unsigned char>& value) : value(value) {
}
const boost::optional< std::vector<unsigned char> >& getValue() const {
return value;
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,20 +1,20 @@
/*
- * 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 <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;
AuthFailure() {}
};
}
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,26 +1,26 @@
/*
- * 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 <vector>
#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) {
}
AuthRequest(const std::string& mechanism, const SafeByteArray& message) :
mechanism_(mechanism), message_(message) {
}
AuthRequest(const std::string& mechanism, const boost::optional<SafeByteArray>& message) :
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,25 +1,25 @@
/*
- * 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 <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() {
}
AuthResponse(const SafeByteArray& value) : value(value) {
}
AuthResponse(const boost::optional<SafeByteArray>& value) : value(value) {
}
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,24 +1,24 @@
/*
- * 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 <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() {}
const boost::optional<std::vector<unsigned char> >& getValue() const {
return value;
}
void setValue(const std::vector<unsigned char>& value) {
this->value = boost::optional<std::vector<unsigned char> >(value);
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,24 +1,24 @@
/*
- * 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 <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;
ComponentHandshake(const std::string& data = "") : data(data) {
}
void setData(const std::string& d) {
data = d;
}
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,17 +1,17 @@
/*
- * 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 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,21 +1,21 @@
/*
- * 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) {}
const std::string& getMethod() const {
return method_;
}
void setMethod(const std::string& 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,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 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,17 +1,17 @@
/*
- * 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
@@ -3,21 +3,22 @@
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#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:
Payload() {}
SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Payload)
virtual ~Payload();
SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Payload)
};
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,31 +1,31 @@
/*
- * 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 <vector>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/optional/optional_fwd.hpp>
#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;
protected:
Stanza();
public:
virtual ~Stanza();
SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Stanza)
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,23 +1,23 @@
/*
- * 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.
*/
#pragma once
#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;
StanzaAck() : valid(false), handledStanzasCount(0) {}
StanzaAck(unsigned int handledStanzasCount) : valid(true), handledStanzasCount(handledStanzasCount) {}
virtual ~StanzaAck();
unsigned int getHandledStanzasCount() const {
return handledStanzasCount;
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,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 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,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 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,24 +1,24 @@
/*
- * 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 <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;
enum Type {
BadFormat,
BadNamespacePrefix,
Conflict,
ConnectionTimeout,
HostGone,
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,26 +1,26 @@
/*
- * 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 <vector>
#include <string>
#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;
StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false), hasRosterVersioning_(false) {}
void setHasStartTLS() {
hasStartTLS_ = true;
}
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,24 +1,24 @@
/*
- * 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.
*/
#pragma once
#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();
void setResumeSupported() {
resumeSupported = true;
}
bool getResumeSupported() const {
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,17 +1,17 @@
/*
- * 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,24 +1,24 @@
/*
- * 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.
*/
#pragma once
#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();
void setResumeID(const std::string& id) {
resumeID = id;
}
const std::string& getResumeID() const {
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,24 +1,24 @@
/*
- * 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.
*/
#pragma once
#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();
void setResumeID(const std::string& id) {
resumeID = id;
}
const std::string& getResumeID() const {
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,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 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
@@ -3,16 +3,16 @@
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#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,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 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,11 +1,11 @@
/*
- * 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 <iostream>
#include <fstream>
#include <typeinfo>
#include <Swiften/Parser/UnitTest/ParserTester.h>
@@ -15,19 +15,19 @@
#include <Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h>
using namespace Swift;
class MyXMPPParserClient : public XMPPParserClient {
public:
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() {
std::cout << "-> Stream end" << std::endl;
}
};
int main(int argc, char* argv[]) {
if (argc != 2) {
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,11 +1,11 @@
/*
- * 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/LinkLocal/IncomingLinkLocalSession.h>
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
@@ -43,19 +43,19 @@ void IncomingLinkLocalSession::handleStreamStart(const ProtocolHeader& incomingH
if (incomingHeader.getVersion() == "1.0") {
getXMPPLayer()->writeElement(boost::make_shared<StreamFeatures>());
}
else {
setInitialized();
}
}
-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
if (stanza && !isInitialized()) {
setInitialized();
}
onElementReceived(element);
}
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,44 +1,44 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Session/Session.h>
#include <Swiften/JID/JID.h>
#include <Swiften/Network/Connection.h>
namespace Swift {
class ProtocolHeader;
class XMLParserFactory;
- class Element;
+ class ToplevelElement;
class PayloadParserFactoryCollection;
class PayloadSerializerCollection;
class IncomingLinkLocalSession : public Session {
public:
IncomingLinkLocalSession(
const JID& localJID,
boost::shared_ptr<Connection> connection,
PayloadParserFactoryCollection* payloadParserFactories,
PayloadSerializerCollection* payloadSerializers,
XMLParserFactory* xmlParserFactory);
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 {
return initialized;
}
bool initialized;
};
}
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,11 +1,11 @@
/*
- * 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/LinkLocal/LinkLocalConnector.h>
#include <boost/bind.hpp>
#include <Swiften/Network/Connection.h>
@@ -65,15 +65,15 @@ void LinkLocalConnector::handleHostnameResolved(const boost::optional<HostAddres
}
}
void LinkLocalConnector::handleConnected(bool error) {
onConnectFinished(error);
assert(connectionConnectFinishedConnection.connected());
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,30 +1,30 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <boost/enable_shared_from_this.hpp>
#include <vector>
#include <Swiften/Base/API.h>
#include <Swiften/Network/Connection.h>
#include <Swiften/LinkLocal/LinkLocalService.h>
namespace Swift {
class ConnectionFactory;
class HostAddress;
- class Element;
+ class ToplevelElement;
class PayloadParserFactoryCollection;
class PayloadSerializerCollection;
class DNSSDQuerier;
class DNSSDResolveHostnameQuery;
class SWIFTEN_API LinkLocalConnector : public boost::enable_shared_from_this<LinkLocalConnector> {
public:
LinkLocalConnector(
const LinkLocalService& service,
@@ -32,21 +32,21 @@ namespace Swift {
boost::shared_ptr<Connection> connection);
~LinkLocalConnector();
const LinkLocalService& getService() const {
return service;
}
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;
}
boost::shared_ptr<Connection> getConnection() const {
return connection;
}
boost::signal<void (bool)> onConnectFinished;
@@ -55,12 +55,12 @@ namespace Swift {
void handleConnected(bool error);
private:
LinkLocalService service;
boost::shared_ptr<DNSSDQuerier> querier;
boost::shared_ptr<DNSSDResolveHostnameQuery> resolveQuery;
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,11 +1,11 @@
/*
- * 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/LinkLocal/OutgoingLinkLocalSession.h>
#include <boost/bind.hpp>
#include <Swiften/Base/foreach.h>
@@ -29,25 +29,25 @@ OutgoingLinkLocalSession::OutgoingLinkLocalSession(
}
void OutgoingLinkLocalSession::handleSessionStarted() {
ProtocolHeader header;
header.setFrom(getLocalJID());
getXMPPLayer()->writeHeader(header);
}
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,44 +1,44 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <boost/enable_shared_from_this.hpp>
#include <vector>
#include <Swiften/Session/Session.h>
#include <Swiften/JID/JID.h>
namespace Swift {
class ConnectionFactory;
class XMLParserFactory;
- class Element;
+ class ToplevelElement;
class PayloadParserFactoryCollection;
class PayloadSerializerCollection;
class OutgoingLinkLocalSession : public Session {
public:
OutgoingLinkLocalSession(
const JID& localJID,
const JID& remoteJID,
boost::shared_ptr<Connection> connection,
PayloadParserFactoryCollection* payloadParserFactories,
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,27 +1,27 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <string>
#include <Swiften/Base/API.h>
-#include <Swiften/Elements/Element.h>
+#include <Swiften/Elements/ToplevelElement.h>
#include <Swiften/Parser/AttributeMap.h>
namespace Swift {
class SWIFTEN_API ElementParser {
public:
virtual ~ElementParser();
virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0;
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,11 +1,11 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
@@ -16,19 +16,19 @@ namespace Swift {
class PayloadParserFactoryCollection;
template<typename ElementType>
class GenericElementParser : public ElementParser {
public:
GenericElementParser() {
stanza_ = boost::make_shared<ElementType>();
}
- virtual boost::shared_ptr<Element> getElement() const {
+ virtual boost::shared_ptr<ToplevelElement> getElement() const {
return stanza_;
}
virtual boost::shared_ptr<ElementType> getElementGeneric() const {
return stanza_;
}
private:
virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
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,11 +1,11 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared.hpp>
@@ -17,19 +17,19 @@ namespace Swift {
template<typename STANZA_TYPE>
class GenericStanzaParser : public StanzaParser {
public:
GenericStanzaParser(PayloadParserFactoryCollection* collection) :
StanzaParser(collection) {
stanza_ = boost::make_shared<STANZA_TYPE>();
}
- virtual boost::shared_ptr<Element> getElement() const {
+ virtual boost::shared_ptr<ToplevelElement> getElement() const {
return stanza_;
}
virtual boost::shared_ptr<STANZA_TYPE> getStanzaGeneric() const {
return stanza_;
}
private:
boost::shared_ptr<STANZA_TYPE> 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,11 +1,11 @@
/*
- * 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 <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
@@ -22,19 +22,19 @@ namespace Swift {
class SWIFTEN_API StanzaParser : public ElementParser, public boost::noncopyable {
public:
StanzaParser(PayloadParserFactoryCollection* factories);
~StanzaParser();
void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes);
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 {
return boost::dynamic_pointer_cast<Stanza>(getElement());
}
private:
bool inPayload() const {
return currentDepth_ > 1;
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,11 +1,11 @@
/*
- * 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 <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <Swiften/Parser/StanzaParser.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -190,19 +190,19 @@ class StanzaParserTest : public CppUnit::TestFixture {
class MyStanzaParser : public StanzaParser
{
public:
MyStanzaParser(PayloadParserFactoryCollection* collection) : StanzaParser(collection)
{
stanza_ = boost::make_shared<MyStanza>();
}
- virtual boost::shared_ptr<Element> getElement() const {
+ virtual boost::shared_ptr<ToplevelElement> getElement() const {
return stanza_;
}
private:
boost::shared_ptr<MyStanza> stanza_;
};
MyPayload1ParserFactory factory1_;
MyPayload2ParserFactory factory2_;
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,11 +1,11 @@
/*
- * 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 <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <vector>
#include <Swiften/Elements/ProtocolHeader.h>
@@ -156,36 +156,36 @@ class XMPPParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(!testling.parse("<tream/>"));
}
private:
class Client : public XMPPParserClient {
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) {}
Event(Type type) : type(type) {}
Type type;
boost::optional<ProtocolHeader> header;
- boost::shared_ptr<Element> element;
+ boost::shared_ptr<ToplevelElement> element;
};
Client() {}
void handleStreamStart(const ProtocolHeader& header) {
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));
}
void handleStreamEnd() {
events.push_back(Event(StreamEnd));
}
std::vector<Event> events;
} client_;
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,26 +1,26 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
-#include <Swiften/Elements/Element.h>
+#include <Swiften/Elements/ToplevelElement.h>
namespace Swift {
class ProtocolHeader;
class SWIFTEN_API XMPPParserClient {
public:
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
@@ -116,19 +116,19 @@ if env["SCONS_STAGE"] == "build" :
"Client/XMLBeautifier.cpp",
"Compress/ZLibCodecompressor.cpp",
"Compress/ZLibDecompressor.cpp",
"Compress/ZLibCompressor.cpp",
"Elements/DiscoInfo.cpp",
"Elements/Presence.cpp",
"Elements/Form.cpp",
"Elements/FormField.cpp",
"Elements/StreamFeatures.cpp",
- "Elements/Element.cpp",
+ "Elements/ToplevelElement.cpp",
"Elements/IQ.cpp",
"Elements/Payload.cpp",
"Elements/PubSubPayload.cpp",
"Elements/PubSubOwnerPayload.cpp",
"Elements/PubSubEventPayload.cpp",
"Elements/RosterItemExchangePayload.cpp",
"Elements/RosterPayload.cpp",
"Elements/SecurityLabel.cpp",
"Elements/Stanza.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,27 +1,27 @@
/*
- * 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/Serializer/AuthChallengeSerializer.h>
#include <Swiften/Elements/AuthChallenge.h>
#include <Swiften/StringCodecs/Base64.h>
#include <Swiften/Base/ByteArray.h>
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();
if (message) {
if ((*message).empty()) {
value = "=";
}
else {
value = Base64::encode(ByteArray(*message));
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,22 +1,22 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/AuthChallenge.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class SWIFTEN_API AuthChallengeSerializer : public GenericElementSerializer<AuthChallenge> {
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/AuthFailure.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class AuthFailureSerializer : public GenericElementSerializer<AuthFailure> {
public:
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,28 +1,28 @@
/*
- * 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/Serializer/AuthRequestSerializer.h>
#include <Swiften/Elements/AuthRequest.h>
#include <Swiften/StringCodecs/Base64.h>
#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/Base/Concat.h>
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();
if (message) {
if ((*message).empty()) {
value = createSafeByteArray("=");
}
else {
value = Base64::encode(*message);
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,22 +1,22 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/AuthRequest.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class SWIFTEN_API AuthRequestSerializer : public GenericElementSerializer<AuthRequest> {
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,28 +1,28 @@
/*
- * 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/Serializer/AuthResponseSerializer.h>
#include <Swiften/Elements/AuthResponse.h>
#include <Swiften/StringCodecs/Base64.h>
#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/Base/Concat.h>
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();
if (message) {
if ((*message).empty()) {
value = createSafeByteArray("=");
}
else {
value = Base64::encode(*message);
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,22 +1,22 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/AuthResponse.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class SWIFTEN_API AuthResponseSerializer : public GenericElementSerializer<AuthResponse> {
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,27 +1,27 @@
/*
- * 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/Serializer/AuthSuccessSerializer.h>
#include <Swiften/Elements/AuthSuccess.h>
#include <Swiften/StringCodecs/Base64.h>
#include <Swiften/Base/ByteArray.h>
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();
if (message) {
if ((*message).empty()) {
value = "=";
}
else {
value = Base64::encode(ByteArray(*message));
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,22 +1,22 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/AuthSuccess.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class SWIFTEN_API AuthSuccessSerializer : public GenericElementSerializer<AuthSuccess> {
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,21 +1,21 @@
/*
- * 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/Serializer/ComponentHandshakeSerializer.h>
#include <Swiften/Elements/ComponentHandshake.h>
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,21 +1,21 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/ComponentHandshake.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class ComponentHandshakeSerializer : public GenericElementSerializer<ComponentHandshake> {
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/CompressFailure.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class CompressFailureSerializer : public GenericElementSerializer<CompressFailure> {
public:
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,25 +1,25 @@
/*
- * 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/Serializer/CompressRequestSerializer.h>
#include <Swiften/Elements/CompressRequest.h>
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,21 +1,21 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Serializer/ElementSerializer.h>
namespace Swift {
class CompressRequestSerializer : public ElementSerializer {
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,22 +1,22 @@
/*
- * 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 <boost/shared_ptr.hpp>
-#include <Swiften/Elements/Element.h>
+#include <Swiften/Elements/ToplevelElement.h>
#include <Swiften/Base/SafeByteArray.h>
namespace Swift {
class ElementSerializer {
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/EnableStreamManagement.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class EnableStreamManagementSerializer : public GenericElementSerializer<EnableStreamManagement> {
public:
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
@@ -8,16 +8,16 @@
#include <boost/shared_ptr.hpp>
#include <Swiften/Serializer/ElementSerializer.h>
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,31 +1,31 @@
/*
- * 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/Serializer/StanzaSerializer.h>
namespace Swift {
template<typename STANZA_TYPE>
class GenericStanzaSerializer : public StanzaSerializer {
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);
}
virtual void setStanzaSpecificAttributesGeneric(
boost::shared_ptr<STANZA_TYPE>,
XMLElement&) const = 0;
};
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/StanzaAckRequest.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StanzaAckRequestSerializer : public GenericElementSerializer<StanzaAckRequest> {
public:
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,11 +1,11 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
@@ -13,18 +13,18 @@
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StanzaAckSerializer : public GenericElementSerializer<StanzaAck> {
public:
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");
result.setAttribute("h", std::string(boost::lexical_cast<std::string>(stanzaAck->getHandledStanzasCount())));
return createSafeByteArray(result.serialize());
}
};
}
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
@@ -16,23 +16,23 @@
#include <Swiften/Serializer/PayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Elements/Stanza.h>
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);
if (stanza->getFrom().isValid()) {
stanzaElement.setAttribute("from", stanza->getFrom());
}
if (stanza->getTo().isValid()) {
stanzaElement.setAttribute("to", stanza->getTo());
}
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
@@ -12,18 +12,18 @@
namespace Swift {
class PayloadSerializerCollection;
class XMLElement;
class StanzaSerializer : public ElementSerializer {
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_;
PayloadSerializerCollection* payloadSerializers_;
};
}
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/StartTLSFailure.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StartTLSFailureSerializer : public GenericElementSerializer<StartTLSFailure> {
public:
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/StartTLSRequest.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StartTLSRequestSerializer : public GenericElementSerializer<StartTLSRequest> {
public:
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,27 +1,27 @@
/*
- * 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/Serializer/StreamErrorSerializer.h>
#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/XML/XMLElement.h>
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");
std::string typeTag;
switch (error->getType()) {
case StreamError::BadFormat: typeTag = "bad-format"; break;
case StreamError::BadNamespacePrefix: typeTag = "bad-namespace-prefix"; break;
case StreamError::Conflict: typeTag = "conflict"; break;
case StreamError::ConnectionTimeout: typeTag = "connection-timeout"; break;
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,19 +1,19 @@
/*
- * 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/Serializer/GenericElementSerializer.h>
#include <Swiften/Elements/StreamError.h>
namespace Swift {
class StreamErrorSerializer : public GenericElementSerializer<StreamError> {
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,29 +1,29 @@
/*
- * 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/Serializer/StreamFeaturesSerializer.h>
#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLTextNode.h>
#include <Swiften/Base/foreach.h>
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");
if (streamFeatures->hasStartTLS()) {
streamFeaturesElement.addNode(boost::make_shared<XMLElement>("starttls", "urn:ietf:params:xml:ns:xmpp-tls"));
}
if (!streamFeatures->getCompressionMethods().empty()) {
boost::shared_ptr<XMLElement> compressionElement(new XMLElement("compression", "http://jabber.org/features/compress"));
foreach(const std::string& method, streamFeatures->getCompressionMethods()) {
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,22 +1,22 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/StreamFeatures.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class SWIFTEN_API StreamFeaturesSerializer : public GenericElementSerializer<StreamFeatures> {
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,28 +1,28 @@
/*
- * 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/Serializer/StreamManagementEnabledSerializer.h>
#include <boost/shared_ptr.hpp>
#include <Swiften/Elements/StreamManagementEnabled.h>
#include <Swiften/Serializer/XML/XMLElement.h>
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()) {
element.setAttribute("id", e->getResumeID());
}
if (e->getResumeSupported()) {
element.setAttribute("resume", "true");
}
return createSafeByteArray(element.serialize());
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,21 +1,21 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/StreamManagementEnabled.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class StreamManagementEnabledSerializer : public GenericElementSerializer<StreamManagementEnabled> {
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/StreamManagementFailed.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StreamManagementFailedSerializer : public GenericElementSerializer<StreamManagementFailed> {
public:
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,28 +1,28 @@
/*
- * 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.
*/
#include <Swiften/Serializer/StreamResumeSerializer.h>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
#include <Swiften/Elements/StreamResume.h>
#include <Swiften/Serializer/XML/XMLElement.h>
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());
if (e->getHandledStanzasCount()) {
element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount()));
}
return createSafeByteArray(element.serialize());
}
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,21 +1,21 @@
/*
- * 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.
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <Swiften/Elements/StreamResume.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class StreamResumeSerializer : public GenericElementSerializer<StreamResume> {
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,28 +1,28 @@
/*
- * 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.
*/
#include <Swiften/Serializer/StreamResumedSerializer.h>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
#include <Swiften/Elements/StreamResumed.h>
#include <Swiften/Serializer/XML/XMLElement.h>
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());
if (e->getHandledStanzasCount()) {
element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount()));
}
return createSafeByteArray(element.serialize());
}
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,21 +1,21 @@
/*
- * 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.
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <Swiften/Elements/StreamResumed.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class StreamResumedSerializer : public GenericElementSerializer<StreamResumed> {
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Elements/TLSProceed.h>
#include <Swiften/Serializer/GenericElementSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class TLSProceedSerializer : public GenericElementSerializer<TLSProceed> {
public:
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,11 +1,11 @@
/*
- * 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/Serializer/XMPPSerializer.h>
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <iostream>
@@ -77,19 +77,19 @@ std::string XMPPSerializer::serializeHeader(const ProtocolHeader& header) const
result += " id=\"" + header.getID() + "\"";
}
if (!header.getVersion().empty()) {
result += " version=\"" + header.getVersion() + "\"";
}
result += ">";
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);
}
else {
std::cerr << "Could not find serializer for " << typeid(*(element.get())).name() << std::endl;
return createSafeByteArray("");
}
}
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,37 +1,37 @@
/*
- * 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 <boost/shared_ptr.hpp>
#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>
namespace Swift {
class PayloadSerializerCollection;
class CompressRequestSerializer;
class ProtocolHeader;
class SWIFTEN_API XMPPSerializer {
public:
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:
std::string getDefaultNamespace() const;
private:
StreamType type_;
std::vector< boost::shared_ptr<ElementSerializer> > serializers_;
};
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,11 +1,11 @@
/*
- * 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.
*/
#include <Swiften/Session/BOSHSessionStream.h>
#include <boost/bind.hpp>
#include <boost/random/mersenne_twister.hpp>
@@ -80,19 +80,19 @@ BOSHSessionStream::~BOSHSessionStream() {
xmppLayer->onWriteData.disconnect(boost::bind(&BOSHSessionStream::handleXMPPLayerDataWritten, this, _1));
delete xmppLayer;
xmppLayer = NULL;
}
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);
}
void BOSHSessionStream::writeFooter() {
connectionPool->writeFooter();
}
void BOSHSessionStream::writeData(const std::string& data) {
@@ -150,19 +150,19 @@ void BOSHSessionStream::setWhitespacePingEnabled(bool /*enabled*/) {
void BOSHSessionStream::resetXMPPParser() {
xmppLayer->resetParser();
}
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);
}
void BOSHSessionStream::handleXMPPError() {
available = false;
onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ParseError));
}
void BOSHSessionStream::handlePoolSessionStarted() {
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,11 +1,11 @@
/*
- * 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.
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <Swiften/Base/SafeString.h>
@@ -44,19 +44,19 @@ namespace Swift {
const SafeString& boshHTTPConnectProxyAuthID,
const SafeString& boshHTTPConnectProxyAuthPassword
);
~BOSHSessionStream();
virtual void close();
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);
virtual bool supportsZLibCompression();
virtual void addZLibCompression();
virtual bool supportsTLSEncryption();
virtual void addTLSEncryption();
virtual bool isTLSEncrypted();
@@ -66,19 +66,19 @@ namespace Swift {
virtual ByteArray getTLSFinishMessage() const;
virtual void setWhitespacePingEnabled(bool);
virtual void resetXMPPParser();
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();
void handlePoolBOSHDataRead(const SafeByteArray& data);
void handlePoolBOSHDataWritten(const SafeByteArray& data);
void handlePoolSessionTerminated(BOSHError::ref condition);
private:
void fakeStreamHeaderReceipt();
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,11 +1,11 @@
/*
- * 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/Session/BasicSessionStream.h>
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
@@ -71,19 +71,19 @@ BasicSessionStream::~BasicSessionStream() {
xmppLayer->onWriteData.disconnect(boost::bind(&BasicSessionStream::handleDataWritten, this, _1));
delete xmppLayer;
}
void BasicSessionStream::writeHeader(const ProtocolHeader& header) {
assert(available);
xmppLayer->writeHeader(header);
}
-void BasicSessionStream::writeElement(boost::shared_ptr<Element> element) {
+void BasicSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) {
assert(available);
xmppLayer->writeElement(element);
}
void BasicSessionStream::writeFooter() {
assert(available);
xmppLayer->writeFooter();
}
@@ -162,19 +162,19 @@ void BasicSessionStream::setWhitespacePingEnabled(bool enabled) {
void BasicSessionStream::resetXMPPParser() {
xmppLayer->resetParser();
}
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);
}
void BasicSessionStream::handleXMPPError() {
available = false;
onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ParseError));
}
void BasicSessionStream::handleTLSConnected() {
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,11 +1,11 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/SafeByteArray.h>
@@ -38,19 +38,19 @@ namespace Swift {
TimerFactory* whitespacePingLayerFactory,
XMLParserFactory* xmlParserFactory
);
~BasicSessionStream();
virtual void close();
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);
virtual bool supportsZLibCompression();
virtual void addZLibCompression();
virtual bool supportsTLSEncryption();
virtual void addTLSEncryption();
virtual bool isTLSEncrypted();
@@ -64,19 +64,19 @@ namespace Swift {
virtual void resetXMPPParser();
private:
void handleConnectionFinished(const boost::optional<Connection::Error>& error);
void handleXMPPError();
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);
private:
bool available;
boost::shared_ptr<Connection> connection;
TLSContextFactory* tlsContextFactory;
TimerFactory* timerFactory;
XMPPLayer* xmppLayer;
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,11 +1,11 @@
/*
- * 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/Session/Session.h>
#include <boost/bind.hpp>
#include <Swiften/StreamStack/XMPPLayer.h>
@@ -70,19 +70,19 @@ void Session::initializeStreamStack() {
boost::bind(&Session::finishSession, this, XMLError));
xmppLayer->onDataRead.connect(boost::bind(boost::ref(onDataRead), _1));
xmppLayer->onWriteData.connect(boost::bind(boost::ref(onDataWritten), _1));
connection->onDisconnected.connect(
boost::bind(&Session::handleDisconnected, this, _1));
connectionLayer = new ConnectionLayer(connection);
streamStack = new StreamStack(xmppLayer, connectionLayer);
}
-void Session::sendElement(boost::shared_ptr<Element> stanza) {
+void Session::sendElement(boost::shared_ptr<ToplevelElement> stanza) {
xmppLayer->writeElement(stanza);
}
void Session::handleDisconnected(const boost::optional<Connection::Error>& connectionError) {
connection->onDisconnected.disconnect(
boost::bind(&Session::handleDisconnected, this, _1));
if (connectionError) {
switch (*connectionError) {
case Connection::ReadError:
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <boost/optional.hpp>
#include <boost/enable_shared_from_this.hpp>
#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>
namespace Swift {
class ProtocolHeader;
class StreamStack;
class JID;
class Element;
@@ -48,47 +48,47 @@ namespace Swift {
boost::shared_ptr<Connection> connection,
PayloadParserFactoryCollection* payloadParserFactories,
PayloadSerializerCollection* payloadSerializers,
XMLParserFactory* xmlParserFactory);
virtual ~Session();
void startSession();
void finishSession();
- void sendElement(boost::shared_ptr<Element>);
+ void sendElement(boost::shared_ptr<ToplevelElement>);
const JID& getLocalJID() const {
return localJID;
}
const JID& getRemoteJID() const {
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;
protected:
void setRemoteJID(const JID& j) {
remoteJID = j;
}
void setLocalJID(const JID& j) {
localJID = j;
}
void finishSession(const SessionError&);
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();
XMPPLayer* getXMPPLayer() const {
return xmppLayer;
}
StreamStack* getStreamStack() const {
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,24 +1,24 @@
/*
- * 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.
*/
#pragma once
#include <Swiften/Base/boost_bsignals.h>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#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>
#include <Swiften/TLS/Certificate.h>
#include <Swiften/TLS/CertificateVerificationError.h>
namespace Swift {
class SWIFTEN_API SessionStream {
public:
@@ -40,19 +40,19 @@ namespace Swift {
SessionStream(): certificate() {}
virtual ~SessionStream();
virtual void close() = 0;
virtual bool isOpen() = 0;
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;
virtual void addZLibCompression() = 0;
virtual bool supportsTLSEncryption() = 0;
virtual void addTLSEncryption() = 0;
virtual bool isTLSEncrypted() = 0;
virtual void setWhitespacePingEnabled(bool enabled) = 0;
@@ -68,19 +68,19 @@ namespace Swift {
}
virtual Certificate::ref getPeerCertificate() const = 0;
virtual std::vector<Certificate::ref> getPeerCertificateChain() const = 0;
virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const = 0;
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;
boost::signal<void (const SafeByteArray&)> onDataWritten;
protected:
CertificateWithKey::ref getTLSCertificate() const {
return certificate;
}
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,11 +1,11 @@
/*
- * 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/Base/ByteArray.h>
#include <QA/Checker/IO.h>
#include <vector>
#include <boost/bind.hpp>
@@ -120,19 +120,19 @@ class StreamStackTest : public CppUnit::TestFixture {
xmppStream_->onWriteData.connect(boost::bind(&StreamStackTest::handleWriteData, this, _1));
boost::shared_ptr<MyStreamLayer> xStream(new MyStreamLayer("X"));
testling.addLayer(xStream.get());
xmppStream_->writeData("foo");
CPPUNIT_ASSERT_EQUAL(1, dataWriteReceived_);
}
- void handleElement(boost::shared_ptr<Element>) {
+ void handleElement(boost::shared_ptr<ToplevelElement>) {
++elementsReceived_;
}
void handleWriteData(const SafeByteArray&) {
++dataWriteReceived_;
}
private:
class MyStreamLayer : public StreamLayer {
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,11 +1,11 @@
/*
- * 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 <vector>
#include <boost/bind.hpp>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -88,23 +88,23 @@ class XMPPLayerTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("<presence/>"), lowLayer_->writtenData);
}
void testWriteFooter() {
testling_->writeFooter();
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();
}
void handleError() {
++errorReceived_;
}
private:
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,11 +1,11 @@
/*
- * 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/StreamStack/XMPPLayer.h>
#include <Swiften/Parser/XMPPParser.h>
#include <Swiften/Serializer/XMPPSerializer.h>
#include <Swiften/Elements/ProtocolHeader.h>
@@ -32,19 +32,19 @@ XMPPLayer::~XMPPLayer() {
void XMPPLayer::writeHeader(const ProtocolHeader& header) {
writeDataInternal(createSafeByteArray(xmppSerializer_->serializeHeader(header)));
}
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));
}
void XMPPLayer::writeData(const std::string& data) {
writeDataInternal(createSafeByteArray(data));
}
void XMPPLayer::writeDataInternal(const SafeByteArray& data) {
onWriteData(data);
@@ -72,19 +72,19 @@ void XMPPLayer::doResetParser() {
delete xmppParser_;
xmppParser_ = new XMPPParser(this, payloadParserFactories_, xmlParserFactory_);
resetParserAfterParse_ = false;
}
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);
}
void XMPPLayer::handleStreamEnd() {
}
void XMPPLayer::resetParser() {
if (inParser_) {
resetParserAfterParse_ = true;
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,25 +1,25 @@
/*
- * 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 <boost/shared_ptr.hpp>
#include <Swiften/Base/boost_bsignals.h>
#include <boost/noncopyable.hpp>
#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>
namespace Swift {
class ProtocolHeader;
class XMPPParser;
class PayloadParserFactoryCollection;
class XMPPSerializer;
class PayloadSerializerCollection;
@@ -32,37 +32,37 @@ namespace Swift {
XMPPLayer(
PayloadParserFactoryCollection* payloadParserFactories,
PayloadSerializerCollection* payloadSerializers,
XMLParserFactory* xmlParserFactory,
StreamType streamType);
~XMPPLayer();
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();
protected:
void handleDataRead(const SafeByteArray& data);
void writeDataInternal(const SafeByteArray& data);
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();
private:
PayloadParserFactoryCollection* payloadParserFactories_;
XMPPParser* xmppParser_;
PayloadSerializerCollection* payloadSerializers_;
XMLParserFactory* xmlParserFactory_;