summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-04-28 08:36:39 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-04-28 15:23:59 (GMT)
commitbe642f17bfa2df7cb88ddb5fb4aa37438d9e2110 (patch)
treec11e239dfcfcab2b38b64e6a19ffb48e8c30c44d /Swiften/Component/ComponentSession.h
parent64511948b075e650cacfcc78e40371abee1d2716 (diff)
downloadswift-contrib-be642f17bfa2df7cb88ddb5fb4aa37438d9e2110.zip
swift-contrib-be642f17bfa2df7cb88ddb5fb4aa37438d9e2110.tar.bz2
Create ToplevelElement to replace Element.
Change-Id: I3460f6f4a2ffa9b795080664f49d9138440de72d
Diffstat (limited to 'Swiften/Component/ComponentSession.h')
-rw-r--r--Swiften/Component/ComponentSession.h6
1 files changed, 3 insertions, 3 deletions
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,86 +1,86 @@
/*
- * 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:
enum State {
Initial,
WaitingForStreamStart,
Authenticating,
Initialized,
Finishing,
Finished
};
struct Error : public Swift::Error {
enum Type {
AuthenticationFailedError,
UnexpectedElementError
} type;
Error(Type type) : type(type) {}
};
~ComponentSession();
static boost::shared_ptr<ComponentSession> create(const JID& jid, const std::string& secret, boost::shared_ptr<SessionStream> stream, CryptoProvider* crypto) {
return boost::shared_ptr<ComponentSession>(new ComponentSession(jid, secret, stream, crypto));
}
State getState() const {
return state;
}
void start();
void finish();
void sendStanza(boost::shared_ptr<Stanza>);
public:
boost::signal<void ()> onInitialized;
boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished;
boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived;
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;
CryptoProvider* crypto;
boost::shared_ptr<Swift::Error> error;
State state;
};
}