summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Base/LogSerializers.cpp54
-rw-r--r--Swiften/Base/LogSerializers.h5
-rw-r--r--Swiften/Network/BOSHConnection.h4
3 files changed, 59 insertions, 4 deletions
diff --git a/Swiften/Base/LogSerializers.cpp b/Swiften/Base/LogSerializers.cpp
index 5ac1e15..3f8e9ce 100644
--- a/Swiften/Base/LogSerializers.cpp
+++ b/Swiften/Base/LogSerializers.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 Isode Limited.
+ * Copyright (c) 2016-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -7,6 +7,7 @@
#include <Swiften/Base/LogSerializers.h>
#include <Swiften/Elements/Presence.h>
+#include <Swiften/Network/BOSHConnection.h>
namespace Swift {
@@ -65,6 +66,57 @@ std::ostream& operator<<(std::ostream& stream, const Presence& presence) {
return stream;
}
+std::ostream& operator<<(std::ostream& stream, const BOSHError& boshError) {
+ std::string errorString;
+ switch (boshError.getType()) {
+ case BOSHError::BadRequest:
+ errorString = "BadRequest";
+ break;
+ case BOSHError::HostGone:
+ errorString = "HostGone";
+ break;
+ case BOSHError::HostUnknown:
+ errorString = "HostUnknown";
+ break;
+ case BOSHError::ImproperAddressing:
+ errorString = "ImproperAddressing";
+ break;
+ case BOSHError::InternalServerError:
+ errorString = "InternalServerError";
+ break;
+ case BOSHError::ItemNotFound:
+ errorString = "ItemNotFound";
+ break;
+ case BOSHError::OtherRequest:
+ errorString = "OtherRequest";
+ break;
+ case BOSHError::PolicyViolation:
+ errorString = "PolicyViolation";
+ break;
+ case BOSHError::RemoteConnectionFailed:
+ errorString = "RemoteConnectionFailed";
+ break;
+ case BOSHError::RemoteStreamError:
+ errorString = "RemoteStreamError";
+ break;
+ case BOSHError::SeeOtherURI:
+ errorString = "SeeOtherURI";
+ break;
+ case BOSHError::SystemShutdown:
+ errorString = "SystemShutdown";
+ break;
+ case BOSHError::UndefinedCondition:
+ errorString = "UndefinedCondition";
+ break;
+ case BOSHError::NoError:
+ errorString = "NoError";
+ break;
+ }
+
+ stream << "BOSHError( " << errorString << " )";
+ return stream;
+}
+
};
::std::ostream& operator<<(::std::ostream& os, const boost::optional<std::string>& optStr) {
diff --git a/Swiften/Base/LogSerializers.h b/Swiften/Base/LogSerializers.h
index be992bb..b804808 100644
--- a/Swiften/Base/LogSerializers.h
+++ b/Swiften/Base/LogSerializers.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 Isode Limited.
+ * Copyright (c) 2016-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,6 +16,7 @@
namespace Swift {
class Presence;
+class BOSHError;
template <typename T>
std::ostream& operator<<(std::ostream& stream, const std::shared_ptr<T>& ptr) {
@@ -46,6 +47,8 @@ std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vec) {
std::ostream& operator<<(std::ostream& stream, const Presence& presence);
+std::ostream& operator<<(std::ostream& stream, const BOSHError& boshError);
+
};
::std::ostream& operator<<(::std::ostream& os, const boost::optional<std::string>& optStr);
diff --git a/Swiften/Network/BOSHConnection.h b/Swiften/Network/BOSHConnection.h
index b75e51f..1409ae6 100644
--- a/Swiften/Network/BOSHConnection.h
+++ b/Swiften/Network/BOSHConnection.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2011-2016 Isode Limited.
+ * Copyright (c) 2011-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -50,7 +50,7 @@ namespace Swift {
NoError};
BOSHError(Type type) : SessionStream::SessionStreamError(SessionStream::SessionStreamError::ConnectionReadError), type(type) {}
- Type getType() {return type;}
+ Type getType() const {return type;}
typedef std::shared_ptr<BOSHError> ref;
private: