1 |
/* |
2 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
* |
4 |
* Copyright (c) 1997-2015 ircd-hybrid development team |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
19 |
* USA |
20 |
*/ |
21 |
|
22 |
/*! \file channel_mode.h |
23 |
* \brief Includes channel mode related definitions and structures. |
24 |
* \version $Id$ |
25 |
*/ |
26 |
|
27 |
#ifndef INCLUDED_channel_mode_h |
28 |
#define INCLUDED_channel_mode_h |
29 |
|
30 |
#define MODEBUFLEN 200 |
31 |
|
32 |
/* Maximum mode changes allowed per client, per server is different */ |
33 |
#define MAXMODEPARAMS 6 |
34 |
|
35 |
enum |
36 |
{ |
37 |
MODE_QUERY = 0, |
38 |
MODE_ADD = 1, |
39 |
MODE_DEL = -1 |
40 |
}; |
41 |
|
42 |
enum |
43 |
{ |
44 |
CHACCESS_NOTONCHAN = -1, |
45 |
CHACCESS_PEON = 0, |
46 |
CHACCESS_HALFOP = 1, |
47 |
CHACCESS_CHANOP = 2, |
48 |
CHACCESS_REMOTE = 3 |
49 |
}; |
50 |
|
51 |
/* can_send results */ |
52 |
enum |
53 |
{ |
54 |
CAN_SEND_NO = 0, |
55 |
CAN_SEND_NONOP = -1, |
56 |
CAN_SEND_OPV = -2 |
57 |
}; |
58 |
|
59 |
|
60 |
/* Channel related flags */ |
61 |
#define CHFL_CHANOP 0x0001U /* Channel operator */ |
62 |
#define CHFL_HALFOP 0x0002U /* Channel half op */ |
63 |
#define CHFL_VOICE 0x0004U /* the power to speak */ |
64 |
#define CHFL_BAN 0x0008U /* ban channel flag */ |
65 |
#define CHFL_EXCEPTION 0x0010U /* exception to ban channel flag */ |
66 |
#define CHFL_INVEX 0x0020U |
67 |
|
68 |
/* channel modes ONLY */ |
69 |
#define MODE_PRIVATE 0x0001U /**< */ |
70 |
#define MODE_SECRET 0x0002U /**< Channel does not show up on NAMES or LIST */ |
71 |
#define MODE_MODERATED 0x0004U /**< Users without +v/h/o cannot send text to the channel */ |
72 |
#define MODE_TOPICLIMIT 0x0008U /**< Only chanops can change the topic */ |
73 |
#define MODE_INVITEONLY 0x0010U /**< Only invited usersmay join this channel */ |
74 |
#define MODE_NOPRIVMSGS 0x0020U /**< Users must be in the channel to send text to it */ |
75 |
#define MODE_SSLONLY 0x0040U /**< Prevents anyone who isn't connected via SSL/TLS from joining the channel */ |
76 |
#define MODE_OPERONLY 0x0080U /**< Prevents anyone who hasn't obtained IRC operator status from joining the channel */ |
77 |
#define MODE_REGISTERED 0x0100U /**< Channel has been registered with ChanServ */ |
78 |
#define MODE_REGONLY 0x0200U /**< Only registered clients may join a channel with that mode set */ |
79 |
#define MODE_NOCTRL 0x0400U /**< Prevents users from sending messages containing control codes to the channel */ |
80 |
#define MODE_MODREG 0x0800U /**< Unregistered/unidentified clients cannot send text to the channel */ |
81 |
#define MODE_NOCTCP 0x1000U |
82 |
|
83 |
/* cache flags for silence on ban */ |
84 |
#define CHFL_BAN_CHECKED 0x0080U |
85 |
#define CHFL_BAN_SILENCED 0x0100U |
86 |
|
87 |
/* name invisible */ |
88 |
#define SecretChannel(x) (((x)->mode.mode & MODE_SECRET)) |
89 |
#define PubChannel(x) (((x)->mode.mode & (MODE_PRIVATE | MODE_SECRET)) == 0) |
90 |
/* knock is forbidden, halfops can't kick/deop other halfops. */ |
91 |
#define PrivateChannel(x) (((x)->mode.mode & MODE_PRIVATE)) |
92 |
|
93 |
struct ChannelMode |
94 |
{ |
95 |
void (*func)(struct Client *, |
96 |
struct Channel *, int, int *, char **, |
97 |
int *, int, int, char, unsigned int); |
98 |
unsigned int d; |
99 |
}; |
100 |
|
101 |
struct ChModeChange |
102 |
{ |
103 |
char letter; |
104 |
const char *arg; |
105 |
const char *id; |
106 |
int dir; |
107 |
}; |
108 |
|
109 |
struct mode_letter |
110 |
{ |
111 |
const unsigned int mode; |
112 |
const unsigned char letter; |
113 |
}; |
114 |
|
115 |
extern const struct mode_letter chan_modes[]; |
116 |
extern const struct ChannelMode ModeTable[]; |
117 |
|
118 |
extern int add_id(struct Client *, struct Channel *, char *, unsigned int); |
119 |
extern void set_channel_mode(struct Client *, struct Channel *, |
120 |
struct Membership *, int, char **); |
121 |
extern void clear_ban_cache_channel(struct Channel *); |
122 |
extern void clear_ban_cache_client(struct Client *); |
123 |
#endif /* INCLUDED_channel_mode_h */ |