| 1 |
adx |
30 |
/* |
| 2 |
michael |
2865 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
adx |
30 |
* |
| 4 |
michael |
7924 |
* Copyright (c) 1997-2017 ircd-hybrid development team |
| 5 |
adx |
30 |
* |
| 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 |
michael |
4565 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
| 19 |
adx |
30 |
* USA |
| 20 |
|
|
*/ |
| 21 |
|
|
|
| 22 |
michael |
2865 |
/*! \file channel_mode.h |
| 23 |
|
|
* \brief Includes channel mode related definitions and structures. |
| 24 |
|
|
* \version $Id$ |
| 25 |
|
|
*/ |
| 26 |
adx |
30 |
|
| 27 |
|
|
#ifndef INCLUDED_channel_mode_h |
| 28 |
|
|
#define INCLUDED_channel_mode_h |
| 29 |
|
|
|
| 30 |
michael |
6904 |
|
| 31 |
|
|
#define CMEMBER_STATUS_FLAGS "@%+" |
| 32 |
|
|
enum { CMEMBER_STATUS_FLAGS_LEN = sizeof(CMEMBER_STATUS_FLAGS) - 1 }; |
| 33 |
|
|
|
| 34 |
michael |
6470 |
enum { MODEBUFLEN = 200 }; |
| 35 |
adx |
30 |
|
| 36 |
|
|
/* Maximum mode changes allowed per client, per server is different */ |
| 37 |
michael |
6470 |
enum { MAXMODEPARAMS = 6 }; |
| 38 |
adx |
30 |
|
| 39 |
michael |
2896 |
enum |
| 40 |
|
|
{ |
| 41 |
michael |
8040 |
MODE_QUERY = 0, |
| 42 |
|
|
MODE_DEL = 1, |
| 43 |
|
|
MODE_ADD = 2 |
| 44 |
michael |
2896 |
}; |
| 45 |
|
|
|
| 46 |
|
|
enum |
| 47 |
|
|
{ |
| 48 |
|
|
CHACCESS_NOTONCHAN = -1, |
| 49 |
|
|
CHACCESS_PEON = 0, |
| 50 |
|
|
CHACCESS_HALFOP = 1, |
| 51 |
michael |
4102 |
CHACCESS_CHANOP = 2, |
| 52 |
|
|
CHACCESS_REMOTE = 3 |
| 53 |
michael |
2896 |
}; |
| 54 |
|
|
|
| 55 |
adx |
30 |
/* can_send results */ |
| 56 |
michael |
2896 |
enum |
| 57 |
|
|
{ |
| 58 |
|
|
CAN_SEND_NO = 0, |
| 59 |
|
|
CAN_SEND_NONOP = -1, |
| 60 |
|
|
CAN_SEND_OPV = -2 |
| 61 |
|
|
}; |
| 62 |
adx |
30 |
|
| 63 |
|
|
/* Channel related flags */ |
| 64 |
michael |
6315 |
enum |
| 65 |
|
|
{ |
| 66 |
|
|
CHFL_CHANOP = 0x00000001U, /* Channel operator */ |
| 67 |
|
|
CHFL_HALFOP = 0x00000002U, /* Channel half op */ |
| 68 |
|
|
CHFL_VOICE = 0x00000004U, /* the power to speak */ |
| 69 |
|
|
CHFL_BAN = 0x00000008U, /* ban channel flag */ |
| 70 |
|
|
CHFL_EXCEPTION = 0x00000010U, /* exception to ban channel flag */ |
| 71 |
|
|
CHFL_INVEX = 0x00000020U, |
| 72 |
|
|
/* Cache flags for silence on ban */ |
| 73 |
|
|
CHFL_BAN_CHECKED = 0x00000040U, |
| 74 |
|
|
CHFL_BAN_SILENCED = 0x00000080U |
| 75 |
|
|
}; |
| 76 |
adx |
30 |
|
| 77 |
|
|
/* channel modes ONLY */ |
| 78 |
michael |
6315 |
enum |
| 79 |
|
|
{ |
| 80 |
|
|
MODE_PRIVATE = 0x00000001U, /**< */ |
| 81 |
|
|
MODE_SECRET = 0x00000002U, /**< Channel does not show up on NAMES or LIST */ |
| 82 |
|
|
MODE_MODERATED = 0x00000004U, /**< Users without +v/+h/+o cannot send text to the channel */ |
| 83 |
|
|
MODE_TOPICLIMIT = 0x00000008U, /**< Only chanops can change the topic */ |
| 84 |
|
|
MODE_INVITEONLY = 0x00000010U, /**< Only invited users may join this channel */ |
| 85 |
|
|
MODE_NOPRIVMSGS = 0x00000020U, /**< Users must be in the channel to send text to it */ |
| 86 |
|
|
MODE_SSLONLY = 0x00000040U, /**< Prevents anyone who isn't connected via SSL/TLS from joining the channel */ |
| 87 |
|
|
MODE_OPERONLY = 0x00000080U, /**< Prevents anyone who hasn't obtained IRC operator status from joining the channel */ |
| 88 |
|
|
MODE_REGISTERED = 0x00000100U, /**< Channel has been registered with ChanServ */ |
| 89 |
|
|
MODE_REGONLY = 0x00000200U, /**< Only registered clients may join a channel with that mode set */ |
| 90 |
|
|
MODE_NOCTRL = 0x00000400U, /**< Prevents users from sending messages containing control codes to the channel */ |
| 91 |
|
|
MODE_MODREG = 0x00000800U, /**< Unregistered/unidentified clients cannot send text to the channel */ |
| 92 |
michael |
6858 |
MODE_NOCTCP = 0x00001000U, /**< Clients cannot send CTCP messages to the channel */ |
| 93 |
michael |
8040 |
MODE_NONOTICE = 0x00002000U, /**< Clients cannot send NOTICE to the channel */ |
| 94 |
michael |
8046 |
MODE_HIDEBMASKS = 0x00004000U, /**< Hides +b/+e/+I lists/changes for non-chanops everywhere */ |
| 95 |
|
|
MODE_EXTLIMIT = 0x00008000U /**< Channel can make use of the extended ban list limit */ |
| 96 |
michael |
6315 |
}; |
| 97 |
adx |
30 |
|
| 98 |
michael |
8044 |
#define HasCMode(x, y) ((x)->mode.mode & (y)) |
| 99 |
|
|
#define AddCMode(x, y) ((x)->mode.mode |= (y)) |
| 100 |
|
|
#define DelCMode(x, y) ((x)->mode.mode &= ~(y)) |
| 101 |
|
|
|
| 102 |
adx |
30 |
/* name invisible */ |
| 103 |
|
|
#define SecretChannel(x) (((x)->mode.mode & MODE_SECRET)) |
| 104 |
michael |
2902 |
#define PubChannel(x) (((x)->mode.mode & (MODE_PRIVATE | MODE_SECRET)) == 0) |
| 105 |
michael |
3707 |
/* knock is forbidden, halfops can't kick/deop other halfops. */ |
| 106 |
adx |
30 |
#define PrivateChannel(x) (((x)->mode.mode & MODE_PRIVATE)) |
| 107 |
|
|
|
| 108 |
michael |
3753 |
struct ChannelMode |
| 109 |
|
|
{ |
| 110 |
|
|
void (*func)(struct Client *, |
| 111 |
|
|
struct Channel *, int, int *, char **, |
| 112 |
|
|
int *, int, int, char, unsigned int); |
| 113 |
|
|
unsigned int d; |
| 114 |
|
|
}; |
| 115 |
|
|
|
| 116 |
adx |
30 |
struct ChModeChange |
| 117 |
|
|
{ |
| 118 |
|
|
char letter; |
| 119 |
|
|
const char *arg; |
| 120 |
|
|
const char *id; |
| 121 |
michael |
8042 |
unsigned int dir; |
| 122 |
michael |
8040 |
unsigned int flags; |
| 123 |
adx |
30 |
}; |
| 124 |
|
|
|
| 125 |
michael |
1175 |
struct mode_letter |
| 126 |
|
|
{ |
| 127 |
|
|
const unsigned int mode; |
| 128 |
|
|
const unsigned char letter; |
| 129 |
|
|
}; |
| 130 |
|
|
|
| 131 |
|
|
extern const struct mode_letter chan_modes[]; |
| 132 |
michael |
3754 |
extern const struct ChannelMode ModeTable[]; |
| 133 |
michael |
2937 |
|
| 134 |
michael |
3044 |
extern int add_id(struct Client *, struct Channel *, char *, unsigned int); |
| 135 |
michael |
3150 |
extern void set_channel_mode(struct Client *, struct Channel *, |
| 136 |
michael |
2937 |
struct Membership *, int, char **); |
| 137 |
michael |
7764 |
extern void clear_ban_cache_list(dlink_list *); |
| 138 |
adx |
30 |
#endif /* INCLUDED_channel_mode_h */ |