blob: 5ac1e152e7644d43cc43d96bff44312dc52798a3 (
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
|
/*
* Copyright (c) 2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Base/LogSerializers.h>
#include <Swiften/Elements/Presence.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& 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>()";
}
}
|