summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/CoreClient.cpp')
-rw-r--r--Swiften/Client/CoreClient.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index 3c7902e..1de1d61 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -363,60 +363,64 @@ void CoreClient::handleNeedCredentials() {
if (options.forgetPassword) {
purgePassword();
}
}
void CoreClient::handleDataRead(const SafeByteArray& data) {
onDataRead(data);
}
void CoreClient::handleDataWritten(const SafeByteArray& data) {
onDataWritten(data);
}
void CoreClient::handleStanzaChannelAvailableChanged(bool available) {
if (available) {
iqRouter_->setJID(session_->getLocalJID());
handleConnected();
onConnected();
}
}
void CoreClient::sendMessage(std::shared_ptr<Message> message) {
stanzaChannel_->sendMessage(message);
}
void CoreClient::sendPresence(std::shared_ptr<Presence> presence) {
stanzaChannel_->sendPresence(presence);
}
void CoreClient::sendData(const std::string& data) {
+ if (!sessionStream_) {
+ SWIFT_LOG(warning) << "Client: Trying to send data while disconnected." << std::endl;
+ return;
+ }
sessionStream_->writeData(data);
}
bool CoreClient::isActive() const {
return (session_ && !session_->isFinished()) || connector_;
}
void CoreClient::setCertificateTrustChecker(CertificateTrustChecker* checker) {
certificateTrustChecker = checker;
}
void CoreClient::handlePresenceReceived(Presence::ref presence) {
onPresenceReceived(presence);
}
void CoreClient::handleMessageReceived(Message::ref message) {
onMessageReceived(message);
}
void CoreClient::handleStanzaAcked(Stanza::ref stanza) {
onStanzaAcked(stanza);
}
bool CoreClient::isAvailable() const {
return stanzaChannel_->isAvailable();
}
bool CoreClient::getStreamManagementEnabled() const {
return stanzaChannel_->getStreamManagementEnabled();