| 1 |
/* |
| 2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
* channel_mode.h: The ircd channel mode header. |
| 4 |
* |
| 5 |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 20 |
* USA |
| 21 |
* |
| 22 |
* $Id$ |
| 23 |
*/ |
| 24 |
|
| 25 |
|
| 26 |
#ifndef INCLUDED_channel_mode_h |
| 27 |
#define INCLUDED_channel_mode_h |
| 28 |
|
| 29 |
#include "ircd_defs.h" /* buffer sizes */ |
| 30 |
|
| 31 |
#define MODEBUFLEN 200 |
| 32 |
|
| 33 |
/* Maximum mode changes allowed per client, per server is different */ |
| 34 |
#define MAXMODEPARAMS 4 |
| 35 |
|
| 36 |
/* can_send results */ |
| 37 |
#define CAN_SEND_NO 0 |
| 38 |
#define CAN_SEND_NONOP -1 |
| 39 |
#define CAN_SEND_OPV -2 |
| 40 |
|
| 41 |
|
| 42 |
/* Channel related flags */ |
| 43 |
#define CHFL_CHANOP 0x0001 /* Channel operator */ |
| 44 |
#define CHFL_HALFOP 0x0002 /* Channel half op */ |
| 45 |
#define CHFL_VOICE 0x0004 /* the power to speak */ |
| 46 |
#define CHFL_DEOPPED 0x0008 /* deopped by us, modes need to be bounced */ |
| 47 |
#define CHFL_BAN 0x0010 /* ban channel flag */ |
| 48 |
#define CHFL_EXCEPTION 0x0020 /* exception to ban channel flag */ |
| 49 |
#define CHFL_INVEX 0x0040 |
| 50 |
|
| 51 |
/* channel modes ONLY */ |
| 52 |
#define MODE_PRIVATE 0x0001 |
| 53 |
#define MODE_SECRET 0x0002 |
| 54 |
#define MODE_MODERATED 0x0004 |
| 55 |
#define MODE_TOPICLIMIT 0x0008 |
| 56 |
#define MODE_INVITEONLY 0x0010 |
| 57 |
#define MODE_NOPRIVMSGS 0x0020 |
| 58 |
#define MODE_SSLONLY 0x0040 |
| 59 |
#define MODE_OPERONLY 0x0080 |
| 60 |
#define MODE_REGISTERED 0x0100 /* Channel has been registered with ChanServ */ |
| 61 |
#define MODE_REGONLY 0x0200 |
| 62 |
#define MODE_NOCTRL 0x0400 |
| 63 |
#define MODE_MODREG 0x0800 |
| 64 |
|
| 65 |
/* cache flags for silence on ban */ |
| 66 |
#define CHFL_BAN_CHECKED 0x0080 |
| 67 |
#define CHFL_BAN_SILENCED 0x0100 |
| 68 |
|
| 69 |
#define MODE_QUERY 0 |
| 70 |
#define MODE_ADD 1 |
| 71 |
#define MODE_DEL -1 |
| 72 |
|
| 73 |
#define CHACCESS_NOTONCHAN -1 |
| 74 |
#define CHACCESS_PEON 0 |
| 75 |
#define CHACCESS_HALFOP 1 |
| 76 |
#define CHACCESS_CHANOP 2 |
| 77 |
|
| 78 |
/* name invisible */ |
| 79 |
#define SecretChannel(x) (((x)->mode.mode & MODE_SECRET)) |
| 80 |
#define PubChannel(x) (!SecretChannel(x)) |
| 81 |
/* knock is forbidden, halfops can't kick/deop other halfops. |
| 82 |
* +pi means paranoid and will generate notices on each invite */ |
| 83 |
#define PrivateChannel(x) (((x)->mode.mode & MODE_PRIVATE)) |
| 84 |
|
| 85 |
struct ChModeChange |
| 86 |
{ |
| 87 |
char letter; |
| 88 |
const char *arg; |
| 89 |
const char *id; |
| 90 |
int dir; |
| 91 |
unsigned int caps; |
| 92 |
unsigned int nocaps; |
| 93 |
int mems; |
| 94 |
struct Client *client; |
| 95 |
}; |
| 96 |
|
| 97 |
struct ChCapCombo |
| 98 |
{ |
| 99 |
int count; |
| 100 |
unsigned int cap_yes; |
| 101 |
unsigned int cap_no; |
| 102 |
}; |
| 103 |
|
| 104 |
struct mode_letter |
| 105 |
{ |
| 106 |
const unsigned int mode; |
| 107 |
const unsigned char letter; |
| 108 |
}; |
| 109 |
|
| 110 |
extern const struct mode_letter chan_modes[]; |
| 111 |
extern int add_id(struct Client *, struct Channel *, char *, int); |
| 112 |
extern void set_channel_mode(struct Client *, struct Client *, struct Channel *, |
| 113 |
struct Membership *, int, char **, char *); |
| 114 |
extern void clear_ban_cache(struct Channel *); |
| 115 |
extern void clear_ban_cache_client(struct Client *); |
| 116 |
extern void init_chcap_usage_counts(void); |
| 117 |
extern void set_chcap_usage_counts(struct Client *); |
| 118 |
extern void unset_chcap_usage_counts(struct Client *); |
| 119 |
#endif /* INCLUDED_channel_mode_h */ |