summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/ClientSession.cpp')
-rw-r--r--Swiften/Client/ClientSession.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index f7fc073..a95c058 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -171,54 +171,55 @@ void ClientSession::handleElement(boost::shared_ptr<Element> element) {
// FIXME Not correct?
state = Initialized;
onInitialized();
}
}
void ClientSession::sendSessionStart() {
state = StartingSession;
stream->writeElement(IQ::createRequest(IQ::Set, JID(), "session-start", boost::shared_ptr<StartSession>(new StartSession())));
}
bool ClientSession::checkState(State state) {
if (state != state) {
finishSession(Error::UnexpectedElementError);
return false;
}
return true;
}
void ClientSession::sendCredentials(const String& password) {
assert(WaitingForCredentials);
state = Authenticating;
stream->writeElement(boost::shared_ptr<Element>(new AuthRequest("PLAIN", PLAINMessage(localJID.getNode(), password).getValue())));
}
void ClientSession::handleTLSEncrypted() {
checkState(WaitingForEncrypt);
state = WaitingForStreamStart;
stream->resetXMPPParser();
sendStreamHeader();
}
void ClientSession::handleStreamError(boost::shared_ptr<Swift::Error> error) {
finishSession(error);
}
void ClientSession::finish() {
if (stream->isAvailable()) {
stream->writeFooter();
}
finishSession(boost::shared_ptr<Error>());
}
void ClientSession::finishSession(Error::Type error) {
finishSession(boost::shared_ptr<Swift::ClientSession::Error>(new Swift::ClientSession::Error(error)));
}
void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) {
+ state = Finished;
stream->setWhitespacePingEnabled(false);
onFinished(error);
}
}