summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-10 21:39:38 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-10 21:39:38 (GMT)
commit80a67051508b7a2f59e0ded9d1dd4df490d44ec2 (patch)
tree1ff1415ad56f9d88c5ec6ee16160e775e8b5b238 /Swiften
parent54781ce12f7654f8136e645d4ebc5934d90c6bea (diff)
downloadswift-contrib-80a67051508b7a2f59e0ded9d1dd4df490d44ec2.zip
swift-contrib-80a67051508b7a2f59e0ded9d1dd4df490d44ec2.tar.bz2
Fixed error handling.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/ClientError.h9
-rw-r--r--Swiften/Session/BasicSessionStream.cpp10
2 files changed, 8 insertions, 11 deletions
diff --git a/Swiften/Client/ClientError.h b/Swiften/Client/ClientError.h
index d81cc0e..d4f280c 100644
--- a/Swiften/Client/ClientError.h
+++ b/Swiften/Client/ClientError.h
@@ -1,11 +1,10 @@
-#ifndef SWIFTEN_ClientError_H
-#define SWIFTEN_ClientError_H
+#pragma once
namespace Swift {
class ClientError {
public:
enum Type {
- NoError,
+ UnknownError,
DomainNameResolveError,
ConnectionError,
ConnectionReadError,
@@ -21,7 +20,7 @@ namespace Swift {
ClientCertificateError
};
- ClientError(Type type = NoError) : type_(type) {}
+ ClientError(Type type = UnknownError) : type_(type) {}
Type getType() const { return type_; }
@@ -29,5 +28,3 @@ namespace Swift {
Type type_;
};
}
-
-#endif
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 8b14367..807470e 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -75,14 +75,14 @@ void BasicSessionStream::addTLSEncryption() {
}
void BasicSessionStream::setWhitespacePingEnabled(bool enabled) {
- if (enabled && !whitespacePingLayer) {
- whitespacePingLayer = boost::shared_ptr<WhitespacePingLayer>(new WhitespacePingLayer());
- streamStack->addLayer(whitespacePingLayer);
- }
if (enabled) {
+ if (!whitespacePingLayer) {
+ whitespacePingLayer = boost::shared_ptr<WhitespacePingLayer>(new WhitespacePingLayer());
+ streamStack->addLayer(whitespacePingLayer);
+ }
whitespacePingLayer->setActive();
}
- else {
+ else if (whitespacePingLayer) {
whitespacePingLayer->setInactive();
}
}