]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/builtinmodes.h
Fix module loading in PURE_STATIC builds
[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 ModeHandler
90 {
91  private:
92  public:
93         ModeChannelOp();
94         ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
95         unsigned int GetPrefixRank();
96 };
97
98 /** Channel mode +p
99  */
100 class ModeChannelPrivate : public SimpleChannelModeHandler
101 {
102  public:
103         ModeChannelPrivate() : SimpleChannelModeHandler(NULL, "private", 'p')
104         {
105         }
106 };
107
108 /** Channel mode +s
109  */
110 class ModeChannelSecret : public SimpleChannelModeHandler
111 {
112  public:
113         ModeChannelSecret() : SimpleChannelModeHandler(NULL, "secret", 's')
114         {
115         }
116 };
117
118 /** Channel mode +t
119  */
120 class ModeChannelTopicOps : public SimpleChannelModeHandler
121 {
122  public:
123         ModeChannelTopicOps() : SimpleChannelModeHandler(NULL, "topiclock", 't')
124         {
125         }
126 };
127
128 /** Channel mode +v
129  */
130 class ModeChannelVoice : public ModeHandler
131 {
132  private:
133  public:
134         ModeChannelVoice();
135         ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
136         unsigned int GetPrefixRank();
137 };
138
139 /** User mode +i
140  */
141 class ModeUserInvisible : public SimpleUserModeHandler
142 {
143  public:
144         ModeUserInvisible() : SimpleUserModeHandler(NULL, "invisible", 'i')
145         {
146         }
147 };
148
149 /** User mode +s
150  */
151 class ModeUserServerNoticeMask : public ModeHandler
152 {
153         /** Process a snomask modifier string, e.g. +abc-de
154          * @param user The target user
155          * @param input A sequence of notice mask characters
156          * @return The cleaned mode sequence which can be output,
157          * e.g. in the above example if masks c and e are not
158          * valid, this function will return +ab-d
159          */
160         std::string ProcessNoticeMasks(User* user, const std::string& input);
161
162  public:
163         ModeUserServerNoticeMask();
164         ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
165         void OnParameterMissing(User* user, User* dest, Channel* channel);
166
167         /** Create a displayable mode string of the snomasks set on a given user
168          * @param user The user whose notice masks to format
169          * @return The notice mask character sequence
170          */
171         std::string GetUserParameter(User* user);
172 };
173
174 /** User mode +o
175  */
176 class ModeUserOperator : public ModeHandler
177 {
178  public:
179         ModeUserOperator();
180         ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding);
181 };
182
183 /** User mode +w
184  */
185 class ModeUserWallops : public SimpleUserModeHandler
186 {
187  public:
188         ModeUserWallops() : SimpleUserModeHandler(NULL, "wallops", 'w')
189         {
190         }
191 };