summaryrefslogtreecommitdiff
path: root/include/modules/protocol/rfc1459.h
blob: 8780892e0f9ee91e570d026a03b229f1d3eea632 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
/*
 * Anope IRC Services
 *
 * Copyright (C) 2016 Anope Team <team@anope.org>
 *
 * This file is part of Anope. Anope is free software; you can
 * redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software
 * Foundation, version 2.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see see <http://www.gnu.org/licenses/>.
 */

#pragma once

namespace rfc1459
{

namespace senders
{

class GlobalNotice : public messages::GlobalNotice
{
 public:
	using messages::GlobalNotice::GlobalNotice;

	void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
};

class GlobalPrivmsg : public messages::GlobalPrivmsg
{
 public:
	using messages::GlobalPrivmsg::GlobalPrivmsg;

	void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
};

class Invite : public messages::Invite
{
 public:
	using messages::Invite::Invite;

	void Send(const MessageSource &source, Channel *chan, User *user) override;
};

class Join : public messages::Join
{
 public:
	using messages::Join::Join;

	void Send(User *u, Channel *c, const ChannelStatus *status) override;
};

class Kick : public messages::Kick
{
 public:
	using messages::Kick::Kick;

	void Send(const MessageSource &source, Channel *chan, User *user, const Anope::string &reason) override;
};

class Kill : public messages::Kill
{
 public:
	using messages::Kill::Kill;

	void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override;

	void Send(const MessageSource &source, User *user, const Anope::string &reason) override;
};

class ModeChannel : public messages::ModeChannel
{
 public:
	using messages::ModeChannel::ModeChannel;

	void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override;
};

class ModeUser : public messages::ModeUser
{
 public:
	using messages::ModeUser::ModeUser;

	void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
};

class NickChange : public messages::NickChange
{
 public:
	using messages::NickChange::NickChange;

	void Send(User *u, const Anope::string &newnick, time_t ts) override;
};

class Notice : public messages::Notice
{
 public:
	using messages::Notice::Notice;

	void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override;
};

class Part : public messages::Part
{
 public:
	using messages::Part::Part;

	void Send(User *, Channel *chan, const Anope::string &reason) override;
};

class Ping : public messages::Ping
{
 public:
	using messages::Ping::Ping;

	void Send(const Anope::string &servname, const Anope::string &who) override;
};

class Pong : public messages::Pong
{
 public:
	using messages::Pong::Pong;

	void Send(const Anope::string &servname, const Anope::string &who) override;
};

class Privmsg : public messages::Privmsg
{
 public:
	using messages::Privmsg::Privmsg;

	void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override;
};

class Quit : public messages::Quit
{
 public:
	using messages::Quit::Quit;

	void Send(User *user, const Anope::string &reason) override;
};

class MessageServer : public messages::MessageServer
{
 public:
	using messages::MessageServer::MessageServer;

	void Send(Server *server) override;
};

class SQuit : public messages::SQuit
{
 public:
	using messages::SQuit::SQuit;

	void Send(Server *s, const Anope::string &message) override;
};

class Topic : public messages::Topic
{
 public:
	using messages::Topic::Topic;

	void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
};

class Wallops : public messages::Wallops
{
 public:
	using messages::Wallops::Wallops;

	void Send(const MessageSource &, const Anope::string &msg) override;
};

} // namespace senders

class Away : public IRCDMessage
{
 public:
	Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Capab : public IRCDMessage
{
 public:
	Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Error : public IRCDMessage
{
 public:
	Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Invite : public IRCDMessage
{
 public:
	Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Join : public IRCDMessage
{
 public:
	Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;

	typedef std::pair<ChannelStatus, User *> SJoinUser;

	/** Handle a SJOIN.
	 * @param source The source of the SJOIN
	 * @param chan The channel the users are joining to
	 * @param ts The TS for the channel
	 * @param modes The modes sent with the SJOIN, if any
	 * @param users The users and their status, if any
	 */
	static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users);
};

class Kick : public IRCDMessage
{
 public:
	Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Kill : public IRCDMessage
{
 public:
	Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Mode : public IRCDMessage
{
 public:
	Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class MOTD : public IRCDMessage
{
 public:
	MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Notice : public IRCDMessage
{
 public:
	Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Part : public IRCDMessage
{
 public:
	Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Ping : public IRCDMessage
{
 public:
	Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Pong : public IRCDMessage
{
 public:
	Pong(Module *creator, const Anope::string &mname = "PONG") : IRCDMessage(creator, mname) { }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Privmsg : public IRCDMessage
{
 public:
	Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Quit : public IRCDMessage
{
 public:
	Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class SQuit : public IRCDMessage
{
 public:
	SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Stats : public IRCDMessage
{
 public:
	Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Time : public IRCDMessage
{
 public:
	Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Topic : public IRCDMessage
{
 public:
	Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Version : public IRCDMessage
{
 public:
	Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

class Whois : public IRCDMessage
{
 public:
	Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }

	void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};

} // namespace rfc1459