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 |
/* Channel related flags */ |
60 |
enum |
61 |
{ |
62 |
CHFL_CHANOP = 0x00000001U, /* Channel operator */ |
63 |
CHFL_HALFOP = 0x00000002U, /* Channel half op */ |
64 |
CHFL_VOICE = 0x00000004U, /* the power to speak */ |
65 |
CHFL_BAN = 0x00000008U, /* ban channel flag */ |
66 |
CHFL_EXCEPTION = 0x00000010U, /* exception to ban channel flag */ |
67 |
CHFL_INVEX = 0x00000020U, |
68 |
/* Cache flags for silence on ban */ |
69 |
CHFL_BAN_CHECKED = 0x00000040U, |
70 |
CHFL_BAN_SILENCED = 0x00000080U |
71 |
}; |
72 |
|
73 |
/* channel modes ONLY */ |
74 |
enum |
75 |
{ |
76 |
MODE_PRIVATE = 0x00000001U, /**< */ |
77 |
MODE_SECRET = 0x00000002U, /**< Channel does not show up on NAMES or LIST */ |
78 |
MODE_MODERATED = 0x00000004U, /**< Users without +v/+h/+o cannot send text to the channel */ |
79 |
MODE_TOPICLIMIT = 0x00000008U, /**< Only chanops can change the topic */ |
80 |
MODE_INVITEONLY = 0x00000010U, /**< Only invited users may join this channel */ |
81 |
MODE_NOPRIVMSGS = 0x00000020U, /**< Users must be in the channel to send text to it */ |
82 |
MODE_SSLONLY = 0x00000040U, /**< Prevents anyone who isn't connected via SSL/TLS from joining the channel */ |
83 |
MODE_OPERONLY = 0x00000080U, /**< Prevents anyone who hasn't obtained IRC operator status from joining the channel */ |
84 |
MODE_REGISTERED = 0x00000100U, /**< Channel has been registered with ChanServ */ |
85 |
MODE_REGONLY = 0x00000200U, /**< Only registered clients may join a channel with that mode set */ |
86 |
MODE_NOCTRL = 0x00000400U, /**< Prevents users from sending messages containing control codes to the channel */ |
87 |
MODE_MODREG = 0x00000800U, /**< Unregistered/unidentified clients cannot send text to the channel */ |
88 |
MODE_NOCTCP = 0x00001000U /**< Clients cannot send CTCP messages to the channel */ |
89 |
}; |
90 |
|
91 |
/* name invisible */ |
92 |
#define SecretChannel(x) (((x)->mode.mode & MODE_SECRET)) |
93 |
#define PubChannel(x) (((x)->mode.mode & (MODE_PRIVATE | MODE_SECRET)) == 0) |
94 |
/* knock is forbidden, halfops can't kick/deop other halfops. */ |
95 |
#define PrivateChannel(x) (((x)->mode.mode & MODE_PRIVATE)) |
96 |
|
97 |
struct ChannelMode |
98 |
{ |
99 |
void (*func)(struct Client *, |
100 |
struct Channel *, int, int *, char **, |
101 |
int *, int, int, char, unsigned int); |
102 |
unsigned int d; |
103 |
}; |
104 |
|
105 |
struct ChModeChange |
106 |
{ |
107 |
char letter; |
108 |
const char *arg; |
109 |
const char *id; |
110 |
int dir; |
111 |
}; |
112 |
|
113 |
struct mode_letter |
114 |
{ |
115 |
const unsigned int mode; |
116 |
const unsigned char letter; |
117 |
}; |
118 |
|
119 |
extern const struct mode_letter chan_modes[]; |
120 |
extern const struct ChannelMode ModeTable[]; |
121 |
|
122 |
extern int add_id(struct Client *, struct Channel *, char *, unsigned int); |
123 |
extern void set_channel_mode(struct Client *, struct Channel *, |
124 |
struct Membership *, int, char **); |
125 |
extern void clear_ban_cache_channel(struct Channel *); |
126 |
extern void clear_ban_cache_client(struct Client *); |
127 |
#endif /* INCLUDED_channel_mode_h */ |