summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/ClientSession.h')
-rw-r--r--Swiften/Client/ClientSession.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h
index 795a09e..f980a9e 100644
--- a/Swiften/Client/ClientSession.h
+++ b/Swiften/Client/ClientSession.h
@@ -39,27 +39,37 @@ namespace Swift {
TLSClientCertificateError,
TLSError,
} type;
Error(Type type) : type(type) {}
};
- ClientSession(
- const JID& jid,
- boost::shared_ptr<SessionStream>);
+ static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream) {
+ return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream));
+ }
State getState() const {
return state;
}
void start();
void finish();
void sendCredentials(const String& password);
void sendElement(boost::shared_ptr<Element> element);
+ public:
+ boost::signal<void ()> onNeedCredentials;
+ boost::signal<void ()> onInitialized;
+ boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished;
+ boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;
+
private:
+ ClientSession(
+ const JID& jid,
+ boost::shared_ptr<SessionStream>);
+
void finishSession(Error::Type error);
void finishSession(boost::shared_ptr<Swift::Error> error);
JID getRemoteJID() const {
return JID("", localJID.getDomain());
}
@@ -72,18 +82,12 @@ namespace Swift {
void handleStreamError(boost::shared_ptr<Swift::Error>);
void handleTLSEncrypted();
bool checkState(State);
- public:
- boost::signal<void ()> onNeedCredentials;
- boost::signal<void ()> onInitialized;
- boost::signal<void (boost::shared_ptr<Swift::Error>)> onFinished;
- boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;
-
private:
JID localJID;
State state;
boost::shared_ptr<SessionStream> stream;
bool needSessionStart;
};