blob: 3f8e9ceb370390afc7d7dffb695eb7214a147c47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/*
* Copyright (c) 2016-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Base/LogSerializers.h>
#include <Swiften/Elements/Presence.h>
#include <Swiften/Network/BOSHConnection.h>
namespace Swift {
std::ostream& operator<<(std::ostream& stream, const Presence& presence) {
std::string typeString;
switch (presence.getType()) {
case Presence::Available:
typeString = "Available";
break;
case Presence::Error:
typeString = "Error";
break;
case Presence::Probe:
typeString = "Probe";
break;
case Presence::Subscribe:
typeString = "Subscribe";
break;
case Presence::Subscribed:
typeString = "Subscribed";
break;
case Presence::Unavailable:
typeString = "Unavailable";
break;
case Presence::Unsubscribe:
typeString = "Unsubscribe";
break;
case Presence::Unsubscribed:
typeString = "Unsubscribed";
break;
}
std::string showTypeString;
switch (presence.getShow()) {
case StatusShow::Online:
showTypeString = "Online";
break;
case StatusShow::Away:
showTypeString = "Away";
break;
case StatusShow::FFC:
showTypeString = "FFC";
break;
case StatusShow::DND:
showTypeString = "DND";
break;
case StatusShow::XA:
showTypeString = "XA";
break;
case StatusShow::None:
showTypeString = "None";
break;
}
stream << "Presence(" << "from: " << presence.getFrom() << ", to: " << presence.getTo() << ", type: " << typeString << ", status: " << showTypeString << ", priority: " << presence.getPriority() << ", '" << presence.getStatus() << "'" << " )";
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) {
if (optStr.is_initialized()) {
return os << "boost::optional<std::string>(\"" << optStr.get() << "\")";
}
else {
return os << "boost::optional<std::string>()";
}
}
|