2 * IRC - Internet Relay Chat, ircd/channel.h
3 * Copyright (C) 1990 Jarkko Oikarinen
4 * Copyright (C) 1996 - 1997 Carlo Wood
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, or (at your option)
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /*=============================================================================
30 #define MAXMODEPARAMS 6
31 #define MODEBUFLEN 200
35 #define CHANNELLEN 200
37 #define MAXBANLENGTH 1024
39 /*=============================================================================
43 #define ChannelExists(n) (FindChannel(n) != NullChn)
44 #define NullChn ((aChannel *)0)
45 #define CREATE 1 /* whether a channel should be
46 * created or just tested for existance */
48 #define CHFL_CHANOP 0x0001 /* Channel operator */
49 #define CHFL_VOICE 0x0002 /* the power to speak */
50 #define CHFL_DEOPPED 0x0004 /* Is de-opped by a server */
51 #define CHFL_SERVOPOK 0x0008 /* Server op allowed */
52 #define CHFL_ZOMBIE 0x0010 /* Kicked from channel */
53 #define CHFL_BAN 0x0020 /* ban channel flag */
54 #define CHFL_BAN_IPMASK 0x0040 /* ban mask is an IP-number mask */
55 #define CHFL_BAN_OVERLAPPED 0x0080 /* ban overlapped, need bounce */
56 #define CHFL_OVERLAP (CHFL_CHANOP|CHFL_VOICE)
57 #define CHFL_BURST_JOINED 0x0100 /* Just joined by net.junction */
58 #define CHFL_BURST_BAN 0x0200 /* Ban part of last BURST */
59 #define CHFL_BURST_BAN_WIPEOUT 0x0400 /* Ban will be wiped at end of BURST */
60 #define CHFL_BANVALID 0x0800 /* CHFL_BANNED bit is valid */
61 #define CHFL_BANNED 0x1000 /* Channel member is banned */
62 #define CHFL_SILENCE_IPMASK 0x2000 /* silence mask is an IP-number mask */
64 /* Channel Visibility macros */
66 #define MODE_CHANOP CHFL_CHANOP
67 #define MODE_VOICE CHFL_VOICE
68 #define MODE_PRIVATE 0x0004
69 #define MODE_SECRET 0x0008
70 #define MODE_MODERATED 0x0010
71 #define MODE_TOPICLIMIT 0x0020
72 #define MODE_INVITEONLY 0x0040
73 #define MODE_NOPRIVMSGS 0x0080
74 #define MODE_KEY 0x0100
75 #define MODE_BAN 0x0200
76 #define MODE_LIMIT 0x0400
77 #define MODE_SENDTS 0x0800 /* TS was 0 during a local user /join; send
78 * temporary TS; can be removed when all 2.10 */
79 #define MODE_LISTED 0x10000
82 * mode flags which take another parameter (With PARAmeterS)
84 #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT)
86 #define HoldChannel(x) (!(x))
88 #define SecretChannel(x) ((x) && ((x)->mode.mode & MODE_SECRET))
89 /* channel not shown but names are */
90 #define HiddenChannel(x) ((x) && ((x)->mode.mode & MODE_PRIVATE))
92 #define ShowChannel(v,c) (PubChannel(c) || IsMember((v),(c)))
93 #define PubChannel(x) ((!x) || ((x)->mode.mode & \
94 (MODE_PRIVATE | MODE_SECRET)) == 0)
95 #define is_listed(x) ((x)->mode.mode & MODE_LISTED)
97 #define IsLocalChannel(name) (*(name) == '&')
98 #define IsModelessChannel(name) (*(name) == '+')
99 #define IsChannelName(name) (*(name) == '#' || \
100 IsModelessChannel(name) || IsLocalChannel(name))
102 /* Check if a sptr is an oper, and chptr is a local channel. */
104 #define IsOperOnLocalChannel(sptr,chname) ((IsAnOper(sptr)) \
105 && (IsLocalChannel(chname)))
108 #ifdef OPER_WALK_THROUGH_LMODES
109 /* used in can_join to determine if an oper forced a join on a channel */
110 #define MAGIC_OPER_OVERRIDE 1000
115 /* used in SetMode() in channel.c and m_umode() in s_msg.c */
118 #define MODE_ADD 0x40000000
119 #define MODE_DEL 0x20000000
121 /*=============================================================================
128 char key[KEYLEN + 1];
132 struct Channel *nextch, *prevch, *hnextch;
135 char topic[TOPICLEN + 1];
136 char topic_nick[NICKLEN + 1];
139 struct SLink *members;
140 struct SLink *invites;
141 struct SLink *banlist;
148 unsigned int max_users;
149 unsigned int min_users;
150 unsigned int topic_limits;
151 time_t max_topic_time;
152 time_t min_topic_time;
153 struct Channel *chptr;
156 /*=============================================================================
160 extern int m_names(aClient *cptr, aClient *sptr, int parc, char *parv[]);
161 extern Link *IsMember(aClient *cptr, aChannel *chptr);
162 extern void remove_user_from_channel(aClient *sptr, aChannel *chptr);
163 extern int is_chan_op(aClient *cptr, aChannel *chptr);
164 extern int is_zombie(aClient *cptr, aChannel *chptr);
165 extern int has_voice(aClient *cptr, aChannel *chptr);
166 extern int can_send(aClient *cptr, aChannel *chptr);
167 extern void send_channel_modes(aClient *cptr, aChannel *chptr);
168 extern int m_mode(aClient *cptr, aClient *sptr, int parc, char *parv[]);
169 extern char *pretty_mask(char *mask);
170 extern void del_invite(aClient *cptr, aChannel *chptr);
171 extern void list_next_channels(aClient *cptr, int nr);
172 extern int m_join(aClient *cptr, aClient *sptr, int parc, char *parv[]);
173 extern int m_create(aClient *cptr, aClient *sptr, int parc, char *parv[]);
174 extern int m_destruct(aClient *cptr, aClient *sptr, int parc, char *parv[]);
175 extern int m_burst(aClient *cptr, aClient *sptr, int parc, char *parv[]);
176 extern int m_part(aClient *cptr, aClient *sptr, int parc, char *parv[]);
177 extern int m_kick(aClient *cptr, aClient *sptr, int parc, char *parv[]);
178 extern int m_topic(aClient *cptr, aClient *sptr, int parc, char *parv[]);
179 extern int m_invite(aClient *cptr, aClient *sptr, int parc, char *parv[]);
180 extern int m_list(aClient *cptr, aClient *sptr, int parc, char *parv[]);
181 extern void send_user_joins(aClient *cptr, aClient *user);
183 extern aChannel *channel;
185 #endif /* CHANNEL_H */