-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmds.h
115 lines (91 loc) · 2.1 KB
/
cmds.h
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
/**
* COPYRIGHT 2014 (C) Jason Volk
* COPYRIGHT 2014 (C) Svetlana Tkachenko
*
* DISTRIBUTED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) (see: LICENSE)
*/
struct Cmds
{
// [SEND] Compositions
template<class It> void accept_del(const It &begin, const It &end);
template<class It> void accept_add(const It &begin, const It &end);
template<class It> void monitor_add(const It &begin, const It &end);
template<class It> void monitor_del(const It &begin, const It &end);
void monitor_status() { Quote("MONITOR S"); }
void monitor_clear() { Quote("MONITOR C"); }
void monitor_list() { Quote("MONITOR L"); }
template<class It> void topics(const It &begin, const It &end, const std::string &server = "");
template<class It> void isons(const It &begin, const It &end);
};
template<class It>
void Cmds::isons(const It &begin,
const It &end)
{
Quote ison("ISON");
ison << ":";
std::for_each(begin,end,[&]
(const auto &s)
{
ison << s << " ";
});
}
template<class It>
void Cmds::topics(const It &begin,
const It &end,
const std::string &server)
{
Quote list("LIST");
std::for_each(begin,end,[&]
(const auto &s)
{
list << s << ",";
});
if(!server.empty())
list << " " << server;
}
template<class It>
void Cmds::accept_add(const It &begin,
const It &end)
{
Quote accept("ACCEPT");
std::for_each(begin,end,[&]
(const auto &s)
{
accept << s << ",";
});
}
template<class It>
void Cmds::accept_del(const It &begin,
const It &end)
{
Quote accept("ACCEPT");
std::for_each(begin,end,[&]
(const auto &s)
{
accept << "-" << s << ",";
});
}
template<class It>
void Cmds::monitor_add(const It &begin,
const It &end)
{
Quote monitor("MONITOR");
monitor << "+ ";
std::for_each(begin,end,[&]
(const auto &s)
{
monitor << s << ",";
});
}
template<class It>
void Cmds::monitor_del(const It &begin,
const It &end)
{
Quote monitor("MONITOR");
monitor << "+ ";
std::for_each(begin,end,[&]
(const auto &s)
{
monitor << s << ",";
});
}