]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/builtinmodes.h
Merge insp20
[user/henk/code/inspircd.git] / include / builtinmodes.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
5  *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
6  *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
7  *
8  * This file is part of InspIRCd.  InspIRCd is free software: you can
9  * redistribute it and/or modify it under the terms of the GNU General Public
10  * License as published by the Free Software Foundation, version 2.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #pragma once
22
23 #include "mode.h"
24 #include "channels.h"
25 #include "listmode.h"
26
27 /** Channel mode +b
28  */
29 class ModeChannelBan : public ListModeBase
30 {
31  public:
32         ModeChannelBan()
33                 : ListModeBase(NULL, "ban", 'b', "End of channel ban list", 367, 368, true, "maxbans")
34         {
35         }
36 };
37
38 /** Channel mode +i
39  */
40 class ModeChannelInviteOnly : public SimpleChannelModeHandler
41 {
42  public:
43         ModeChannelInviteOnly() : SimpleChannelModeHandler(NULL, "inviteonly", 'i')
44         {
45         }
46 };
47
48 /** Channel mode +k
49  */
50 class ModeChannelKey : public ModeHandler
51 {
52  public:
53         ModeChannelKey();
54         ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
55 };
56
57 /** Channel mode +l
58  */
59 class ModeChannelLimit : public ParamChannelModeHandler
60 {
61  public:
62         ModeChannelLimit();
63         bool ParamValidate(std::string& parameter);
64         bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel* channel);
65 };
66
67 /** Channel mode +m
68  */
69 class ModeChannelModerated : public SimpleChannelModeHandler
70 {
71  public:
72         ModeChannelModerated() : SimpleChannelModeHandler(NULL, "moderated", 'm')
73         {
74         }
75 };
76
77 /** Channel mode +n
78  */
79 class ModeChannelNoExternal : public SimpleChannelModeHandler
80 {
81  public:
82         ModeChannelNoExternal() : SimpleChannelModeHandler(NULL, "noextmsg", 'n')
83         {
84         }
85 };
86
87 /** Channel mode +o
88  */
89 class ModeChannelOp : public PrefixMode
90 {
91  public:
92         ModeChannelOp();
93 };
94
95 /** Channel mode +p
96  */
97 class ModeChannelPrivate : public SimpleChannelModeHandler
98 {
99  public:
100         ModeChannelPrivate() : SimpleChannelModeHandler(NULL, "private", 'p')
101         {
102         }
103 };
104
105 /** Channel mode +s
106  */
107 class ModeChannelSecret : public SimpleChannelModeHandler
108 {
109  public:
110         ModeChannelSecret() : SimpleChannelModeHandler(NULL, "secret", 's')
111         {
112         }
113 };
114
115 /** Channel mode +t
116  */
117 class ModeChannelTopicOps : public SimpleChannelModeHandler
118 {
119  public:
120         ModeChannelTopicOps() : SimpleChannelModeHandler(NULL, "topiclock", 't')
121         {
122         }
123 };
124
125 /** Channel mode +v
126  */
127 class ModeChannelVoice : public PrefixMode
128 {
129  public:
130         ModeChannelVoice();
131 };
132
133 /** User mode +i
134  */
135 class ModeUserInvisible : public SimpleUserModeHandler
136 {
137  public:
138         ModeUserInvisible() : SimpleUserModeHandler(NULL, "invisible", 'i')
139         {
140         }
141 };
142
143 /** User mode +s
144  */
145 class ModeUserServerNoticeMask : public ModeHandler
146 {
147         /** Process a snomask modifier string, e.g. +abc-de
148          * @param user The target user
149          * @param input A sequence of notice mask characters
150          * @return The cleaned mode sequence which can be output,
151          * e.g. in the above example if masks c and e are not
152          * valid, this function will return +ab-d
153          */
154         std::string ProcessNoticeMasks(User* user, const std::string& input);
155
156  public:
157         ModeUserServerNoticeMask();
158         ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
159         void OnParameterMissing(User* user, User* dest, Channel* channel);
160
161         /** Create a displayable mode string of the snomasks set on a given user
162          * @param user The user whose notice masks to format
163          * @return The notice mask character sequence
164          */
165         std::string GetUserParameter(User* user);
166 };
167
168 /** User mode +o
169  */
170 class ModeUserOperator : public ModeHandler
171 {
172  public:
173         ModeUserOperator();
174         ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
175 };
176
177 /** User mode +w
178  */
179 class ModeUserWallops : public SimpleUserModeHandler
180 {
181  public:
182         ModeUserWallops() : SimpleUserModeHandler(NULL, "wallops", 'w')
183         {
184         }
185 };