ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/channel_mode.h
Revision: 8468
Committed: Tue Apr 3 11:23:28 2018 UTC (7 years, 4 months ago) by michael
Content type: text/x-chdr
File size: 4951 byte(s)
Log Message:
- Implemented channel mode 'N' which prevents users from changing their nick while in a channel with that mode set

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2018 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
31 #define CMEMBER_STATUS_FLAGS "@%+"
32 enum { CMEMBER_STATUS_FLAGS_LEN = sizeof(CMEMBER_STATUS_FLAGS) - 1 };
33
34 enum { MODEBUFLEN = 200 };
35
36 /* Maximum mode changes allowed per client, per server is different */
37 enum { MAXMODEPARAMS = 6 };
38
39 enum
40 {
41 MODE_QUERY = 0,
42 MODE_DEL = 1,
43 MODE_ADD = 2
44 };
45
46 enum
47 {
48 CHACCESS_NOTONCHAN = -1,
49 CHACCESS_PEON = 0,
50 CHACCESS_HALFOP = 1,
51 CHACCESS_CHANOP = 2,
52 CHACCESS_REMOTE = 3
53 };
54
55 /* can_send results */
56 enum
57 {
58 CAN_SEND_NO = 0,
59 CAN_SEND_NONOP = -1,
60 CAN_SEND_OPV = -2
61 };
62
63 /* Channel related flags */
64 enum
65 {
66 CHFL_CHANOP = 1 << 0, /* Channel operator */
67 CHFL_HALFOP = 1 << 1, /* Channel half op */
68 CHFL_VOICE = 1 << 2, /* the power to speak */
69 CHFL_BAN = 1 << 3, /* ban channel flag */
70 CHFL_EXCEPTION = 1 << 4, /* exception to ban channel flag */
71 CHFL_INVEX = 1 << 5,
72 /* Cache flags for silence on ban */
73 CHFL_BAN_CHECKED = 1 << 6,
74 CHFL_BAN_SILENCED = 1 << 7
75 };
76
77 /* channel modes ONLY */
78 enum
79 {
80 MODE_PRIVATE = 1 << 0, /**< */
81 MODE_SECRET = 1 << 1, /**< Channel does not show up on NAMES or LIST */
82 MODE_MODERATED = 1 << 2, /**< Users without +v/+h/+o cannot send text to the channel */
83 MODE_TOPICLIMIT = 1 << 3, /**< Only chanops can change the topic */
84 MODE_INVITEONLY = 1 << 4, /**< Only invited users may join this channel */
85 MODE_NOPRIVMSGS = 1 << 5, /**< Users must be in the channel to send text to it */
86 MODE_SSLONLY = 1 << 6, /**< Prevents anyone who isn't connected via SSL/TLS from joining the channel */
87 MODE_OPERONLY = 1 << 7, /**< Prevents anyone who hasn't obtained IRC operator status from joining the channel */
88 MODE_REGISTERED = 1 << 8, /**< Channel has been registered with ChanServ */
89 MODE_REGONLY = 1 << 9, /**< Only registered clients may join a channel with that mode set */
90 MODE_NOCTRL = 1 << 10, /**< Prevents users from sending messages containing control codes to the channel */
91 MODE_MODREG = 1 << 11, /**< Unregistered/unidentified clients cannot send text to the channel */
92 MODE_NOCTCP = 1 << 12, /**< Clients cannot send CTCP messages to the channel */
93 MODE_NONOTICE = 1 << 13, /**< Clients cannot send NOTICE to the channel */
94 MODE_HIDEBMASKS = 1 << 14, /**< Hides +b/+e/+I lists/changes for non-chanops everywhere */
95 MODE_EXTLIMIT = 1 << 15, /**< Channel can make use of the extended ban list limit */
96 MODE_NONICKCHANGE = 1 << 16 /**< User is prevented from changing their nick when in this channel */
97 };
98
99 #define HasCMode(x, y) ((x)->mode.mode & (y))
100 #define AddCMode(x, y) ((x)->mode.mode |= (y))
101 #define DelCMode(x, y) ((x)->mode.mode &= ~(y))
102
103 /* name invisible */
104 #define SecretChannel(x) (((x)->mode.mode & MODE_SECRET))
105 #define PubChannel(x) (((x)->mode.mode & (MODE_PRIVATE | MODE_SECRET)) == 0)
106 /* knock is forbidden, halfops can't kick/deop other halfops. */
107 #define PrivateChannel(x) (((x)->mode.mode & MODE_PRIVATE))
108
109 struct ChModeChange
110 {
111 char letter;
112 const char *arg;
113 const char *id;
114 unsigned int dir;
115 unsigned int flags;
116 };
117
118 struct chan_mode
119 {
120 const unsigned char letter;
121 const unsigned int mode;
122 const unsigned int only_opers;
123 const unsigned int only_servers;
124 void (*func)(struct Client *,
125 struct Channel *, int, int *, char **, int *,
126 int, int, const char, const struct chan_mode *);
127 };
128
129 extern const struct chan_mode *cmode_map[];
130 extern const struct chan_mode cmode_tab[];
131
132 extern void channel_mode_init(void);
133 extern int add_id(struct Client *, struct Channel *, char *, unsigned int);
134 extern void channel_mode_set(struct Client *, struct Channel *,
135 struct Membership *, int, char **);
136 extern void clear_ban_cache_list(dlink_list *);
137 #endif /* INCLUDED_channel_mode_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id