]>
Commit | Line | Data |
---|---|---|
189935b1 | 1 | /* |
2 | * IRC - Internet Relay Chat, ircd/channel.h | |
3 | * Copyright (C) 1990 Jarkko Oikarinen | |
4 | * Copyright (C) 1996 - 1997 Carlo Wood | |
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, or (at your option) | |
9 | * 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., 675 Mass Ave, Cambridge, MA 02139, USA. | |
19 | */ | |
20 | /** @file | |
21 | * @brief Channel management and maintenance. | |
052b069e | 22 | * @version $Id: channel.h,v 1.55.2.1 2005/12/23 17:12:06 klmitch Exp $ |
189935b1 | 23 | */ |
24 | #ifndef INCLUDED_channel_h | |
25 | #define INCLUDED_channel_h | |
26 | #ifndef INCLUDED_ircd_defs_h | |
27 | #include "ircd_defs.h" /* NICKLEN */ | |
28 | #endif | |
29 | #ifndef INCLUDED_sys_types_h | |
30 | #include <sys/types.h> | |
31 | #define INCLUDED_sys_types_h | |
32 | #endif | |
33 | #ifndef INCLUDED_res_h | |
34 | #include "res.h" | |
35 | #endif | |
36 | ||
37 | struct SLink; | |
38 | struct Client; | |
39 | ||
40 | /* | |
41 | * General defines | |
42 | */ | |
43 | ||
44 | #define MAXMODEPARAMS 6 /**< Maximum number of mode parameters */ | |
45 | #define MODEBUFLEN 200 /**< Maximum length of a mode */ | |
46 | ||
47 | #define KEYLEN 23 /**< Maximum length of a key */ | |
48 | #define CHANNELLEN 200 /**< Maximum length of a channel */ | |
49 | ||
50 | #define MAXJOINARGS 15 /**< number of slots for join buffer */ | |
51 | #define STARTJOINLEN 10 /**< fuzzy numbers */ | |
52 | #define STARTCREATELEN 20 | |
53 | ||
54 | /* | |
55 | * Macro's | |
56 | */ | |
57 | ||
58 | #define ChannelExists(n) (0 != FindChannel(n)) | |
59 | ||
60 | #define CHFL_CHANOP 0x0001 /**< Channel operator */ | |
61 | #define CHFL_VOICE 0x0002 /**< the power to speak */ | |
62 | #define CHFL_DEOPPED 0x0004 /**< Is de-opped by a server */ | |
63 | #define CHFL_SERVOPOK 0x0008 /**< Server op allowed */ | |
64 | #define CHFL_ZOMBIE 0x0010 /**< Kicked from channel */ | |
65 | #define CHFL_BURST_JOINED 0x0100 /**< Just joined by net.junction */ | |
66 | #define CHFL_BANVALID 0x0800 /**< CHFL_BANNED bit is valid */ | |
67 | #define CHFL_BANNED 0x1000 /**< Channel member is banned */ | |
68 | #define CHFL_SILENCE_IPMASK 0x2000 /**< silence mask is a CIDR */ | |
69 | #define CHFL_BURST_ALREADY_OPPED 0x04000 | |
70 | /**< In oob BURST, but was already | |
71 | * joined and opped | |
72 | */ | |
73 | #define CHFL_BURST_ALREADY_VOICED 0x08000 | |
74 | /**, In oob BURST, but was already | |
75 | * joined and voiced | |
76 | */ | |
77 | #define CHFL_CHANNEL_MANAGER 0x10000 /**< Set when creating channel or using | |
78 | * Apass | |
79 | */ | |
80 | #define CHFL_USER_PARTING 0x20000 /**< User is already parting that | |
81 | * channel | |
82 | */ | |
83 | #define CHFL_DELAYED 0x40000 /**< User's join message is delayed */ | |
84 | ||
85 | #define CHFL_OVERLAP (CHFL_CHANOP | CHFL_VOICE) | |
86 | #define CHFL_BANVALIDMASK (CHFL_BANVALID | CHFL_BANNED) | |
87 | #define CHFL_VOICED_OR_OPPED (CHFL_CHANOP | CHFL_VOICE) | |
88 | ||
89 | /* Channel Visibility macros */ | |
90 | ||
91 | #define MODE_CHANOP CHFL_CHANOP /**< +o Chanop */ | |
92 | #define MODE_VOICE CHFL_VOICE /**< +v Voice */ | |
93 | #define MODE_PRIVATE 0x0004 /**< +p Private */ | |
94 | #define MODE_SECRET 0x0008 /**< +s Secret */ | |
95 | #define MODE_MODERATED 0x0010 /**< +m Moderated */ | |
96 | #define MODE_TOPICLIMIT 0x0020 /**< +t Topic Limited */ | |
97 | #define MODE_INVITEONLY 0x0040 /**< +i Invite only */ | |
98 | #define MODE_NOPRIVMSGS 0x0080 /**< +n No Private Messages */ | |
99 | #define MODE_KEY 0x0100 /**< +k Keyed */ | |
100 | #define MODE_BAN 0x0200 /**< +b Ban */ | |
101 | #define MODE_LIMIT 0x0400 /**< +l Limit */ | |
102 | #define MODE_REGONLY 0x0800 /**< Only +r users may join */ | |
103 | #define MODE_DELJOINS 0x1000 /**< New join messages are delayed */ | |
d8e74551 | 104 | #define MODE_NOCOLOUR 0x2000 /**< No mIRC/ANSI colors/bold */ |
105 | #define MODE_NOCTCP 0x4000 /**< No channel CTCPs */ | |
106 | #define MODE_NONOTICE 0x8000 /**< No channel notices */ | |
189935b1 | 107 | #define MODE_SAVE 0x20000 /**< save this mode-with-arg 'til |
108 | * later */ | |
109 | #define MODE_FREE 0x40000 /**< string needs to be passed to | |
110 | * MyFree() */ | |
111 | #define MODE_BURSTADDED 0x80000 /**< channel was created by a BURST */ | |
112 | #define MODE_UPASS 0x100000 | |
113 | #define MODE_APASS 0x200000 | |
114 | #define MODE_WASDELJOINS 0x400000 /**< Not DELJOINS, but some joins | |
115 | * pending */ | |
d8e74551 | 116 | #define MODE_NOQUITPARTS 0x800000 |
117 | ||
189935b1 | 118 | /** mode flags which take another parameter (With PARAmeterS) |
119 | */ | |
120 | #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS) | |
121 | ||
122 | /** Available Channel modes */ | |
123 | #define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrD" : "biklmnopstvrD" | |
124 | /** Available Channel modes that take parameters */ | |
125 | #define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "AbkloUv" : "bklov" | |
126 | ||
127 | #define HoldChannel(x) (!(x)) | |
128 | /** name invisible */ | |
129 | #define SecretChannel(x) ((x) && ((x)->mode.mode & MODE_SECRET)) | |
130 | /** channel not shown but names are */ | |
131 | #define HiddenChannel(x) ((x) && ((x)->mode.mode & MODE_PRIVATE)) | |
132 | /** channel visible */ | |
133 | #define ShowChannel(v,c) (PubChannel(c) || find_channel_member((v),(c))) | |
134 | #define PubChannel(x) ((!x) || ((x)->mode.mode & \ | |
135 | (MODE_PRIVATE | MODE_SECRET)) == 0) | |
136 | ||
137 | #define IsGlobalChannel(name) (*(name) == '#') | |
138 | #define IsLocalChannel(name) (*(name) == '&') | |
139 | #define IsChannelName(name) (IsGlobalChannel(name) || IsLocalChannel(name)) | |
140 | ||
141 | typedef enum ChannelGetType { | |
142 | CGT_NO_CREATE, | |
143 | CGT_CREATE | |
144 | } ChannelGetType; | |
145 | ||
146 | /* used in SetMode() in channel.c and m_umode() in s_msg.c */ | |
147 | ||
148 | #define MODE_NULL 0 | |
149 | #define MODE_ADD 0x40000000 | |
150 | #define MODE_DEL 0x20000000 | |
151 | ||
152 | /* used in ListingArgs.flags */ | |
153 | ||
154 | #define LISTARG_TOPICLIMITS 0x0001 | |
155 | #define LISTARG_SHOWSECRET 0x0002 | |
156 | #define LISTARG_NEGATEWILDCARD 0x0004 | |
157 | ||
158 | /** | |
159 | * Maximum acceptable lag time in seconds: A channel younger than | |
160 | * this is not protected against hacking admins. | |
161 | * Mainly here to check if the TS clocks really sync (otherwise this | |
162 | * will start causing HACK notices. | |
163 | * This value must be the same on all servers. | |
164 | * | |
165 | * This value has been increased to 1 day in order to distinguish this | |
166 | * "normal" type of HACK wallops / desyncs, from possiblity still | |
167 | * existing bugs. | |
168 | */ | |
169 | #define TS_LAG_TIME 86400 | |
170 | ||
189935b1 | 171 | |
172 | ||
173 | extern const char* const PartFmt1; | |
174 | extern const char* const PartFmt2; | |
175 | extern const char* const PartFmt1serv; | |
176 | extern const char* const PartFmt2serv; | |
177 | ||
178 | ||
179 | /* | |
180 | * Structures | |
181 | */ | |
182 | ||
183 | /** Information about a client on one channel | |
184 | * | |
185 | * This structure forms a sparse matrix with users down the side, and | |
186 | * channels across the top. This matrix holds all the information about | |
187 | * which users are on what channels, and what modes that user has on that | |
188 | * channel (if they are op'd, voice'd and cached information if they are | |
189 | * banned or not) | |
190 | */ | |
191 | struct Membership { | |
192 | struct Client* user; /**< The user */ | |
193 | struct Channel* channel; /**< The channel */ | |
194 | struct Membership* next_member; /**< The next user on this channel */ | |
195 | struct Membership* prev_member; /**< The previous user on this channel*/ | |
196 | struct Membership* next_channel; /**< Next channel this user is on */ | |
197 | struct Membership* prev_channel; /**< Previous channel this user is on*/ | |
198 | unsigned int status; /**< Flags for op'd, voice'd, etc */ | |
199 | unsigned short oplevel; /**< Op level */ | |
200 | }; | |
201 | ||
202 | #define MAXOPLEVELDIGITS 3 | |
203 | #define MAXOPLEVEL 999 | |
204 | ||
205 | #define IsZombie(x) ((x)->status & CHFL_ZOMBIE) /**< see \ref zombie */ | |
206 | #define IsDeopped(x) ((x)->status & CHFL_DEOPPED) | |
207 | #define IsBanned(x) ((x)->status & CHFL_BANNED) | |
208 | #define IsBanValid(x) ((x)->status & CHFL_BANVALID) | |
209 | #define IsChanOp(x) ((x)->status & CHFL_CHANOP) | |
210 | #define OpLevel(x) ((x)->oplevel) | |
211 | #define HasVoice(x) ((x)->status & CHFL_VOICE) | |
212 | #define IsServOpOk(x) ((x)->status & CHFL_SERVOPOK) | |
213 | #define IsBurstJoined(x) ((x)->status & CHFL_BURST_JOINED) | |
214 | #define IsVoicedOrOpped(x) ((x)->status & CHFL_VOICED_OR_OPPED) | |
215 | #define IsChannelManager(x) ((x)->status & CHFL_CHANNEL_MANAGER) | |
216 | #define IsUserParting(x) ((x)->status & CHFL_USER_PARTING) | |
217 | #define IsDelayedJoin(x) ((x)->status & CHFL_DELAYED) | |
218 | ||
219 | #define SetBanned(x) ((x)->status |= CHFL_BANNED) | |
220 | #define SetBanValid(x) ((x)->status |= CHFL_BANVALID) | |
221 | #define SetDeopped(x) ((x)->status |= CHFL_DEOPPED) | |
222 | #define SetServOpOk(x) ((x)->status |= CHFL_SERVOPOK) | |
223 | #define SetBurstJoined(x) ((x)->status |= CHFL_BURST_JOINED) | |
224 | #define SetZombie(x) ((x)->status |= CHFL_ZOMBIE) | |
225 | #define SetChannelManager(x) ((x)->status |= CHFL_CHANNEL_MANAGER) | |
226 | #define SetOpLevel(x, v) (void)((x)->oplevel = (v)) | |
227 | #define SetUserParting(x) ((x)->status |= CHFL_USER_PARTING) | |
228 | #define SetDelayedJoin(x) ((x)->status |= CHFL_DELAYED) | |
229 | ||
230 | #define ClearBanned(x) ((x)->status &= ~CHFL_BANNED) | |
231 | #define ClearBanValid(x) ((x)->status &= ~CHFL_BANVALID) | |
232 | #define ClearDeopped(x) ((x)->status &= ~CHFL_DEOPPED) | |
233 | #define ClearServOpOk(x) ((x)->status &= ~CHFL_SERVOPOK) | |
234 | #define ClearBurstJoined(x) ((x)->status &= ~CHFL_BURST_JOINED) | |
235 | #define ClearDelayedJoin(x) ((x)->status &= ~CHFL_DELAYED) | |
236 | ||
237 | /** Mode information for a channel */ | |
238 | struct Mode { | |
239 | unsigned int mode; | |
240 | unsigned int limit; | |
241 | char key[KEYLEN + 1]; | |
242 | char upass[KEYLEN + 1]; | |
243 | char apass[KEYLEN + 1]; | |
244 | }; | |
245 | ||
246 | #define BAN_IPMASK 0x0001 /**< ban mask is an IP-number mask */ | |
247 | #define BAN_OVERLAPPED 0x0002 /**< ban overlapped, need bounce */ | |
248 | #define BAN_BURSTED 0x0004 /**< Ban part of last BURST */ | |
249 | #define BAN_BURST_WIPEOUT 0x0008 /**< Ban will be wiped at EOB */ | |
250 | #define BAN_EXCEPTION 0x0010 /**< Ban is an exception */ | |
251 | #define BAN_DEL 0x4000 /**< Ban is being removed */ | |
252 | #define BAN_ADD 0x8000 /**< Ban is being added */ | |
253 | ||
254 | /** A single ban for a channel. */ | |
255 | struct Ban { | |
256 | struct Ban* next; /**< next ban in the channel */ | |
257 | struct irc_in_addr address; /**< addres for BAN_IPMASK bans */ | |
258 | time_t when; /**< timestamp when ban was added */ | |
259 | unsigned short flags; /**< modifier flags for the ban */ | |
260 | unsigned char nu_len; /**< length of nick!user part of banstr */ | |
261 | unsigned char addrbits; /**< netmask length for BAN_IPMASK bans */ | |
262 | char who[NICKLEN+1]; /**< name of client that set the ban */ | |
263 | char banstr[NICKLEN+USERLEN+HOSTLEN+3]; /**< hostmask that the ban matches */ | |
264 | }; | |
265 | ||
266 | /** Information about a channel */ | |
267 | struct Channel { | |
268 | struct Channel* next; /**< next channel in the global channel list */ | |
269 | struct Channel* prev; /**< previous channel */ | |
270 | struct Channel* hnext; /**< Next channel in the hash table */ | |
271 | struct DestructEvent* destruct_event; | |
272 | time_t creationtime; /**< Creation time of this channel */ | |
273 | time_t topic_time; /**< Modification time of the topic */ | |
274 | unsigned int users; /**< Number of clients on this channel */ | |
275 | struct Membership* members; /**< Pointer to the clients on this channel*/ | |
276 | struct SLink* invites; /**< List of invites on this channel */ | |
277 | struct Ban* banlist; /**< List of bans on this channel */ | |
278 | struct Mode mode; /**< This channels mode */ | |
279 | char topic[TOPICLEN + 1]; /**< Channels topic */ | |
280 | char topic_nick[NICKLEN + 1]; /**< Nick of the person who set | |
281 | * The topic | |
282 | */ | |
283 | char chname[1]; /**< Dynamically allocated string of the | |
284 | * channel name | |
285 | */ | |
286 | }; | |
287 | ||
288 | /** Information about a /list in progress */ | |
289 | struct ListingArgs { | |
290 | time_t max_time; | |
291 | time_t min_time; | |
292 | unsigned int max_users; | |
293 | unsigned int min_users; | |
294 | unsigned int flags; | |
295 | time_t max_topic_time; | |
296 | time_t min_topic_time; | |
297 | unsigned int bucket; | |
298 | char wildcard[CHANNELLEN]; | |
299 | }; | |
300 | ||
301 | struct ModeBuf { | |
302 | unsigned int mb_add; /**< Modes to add */ | |
303 | unsigned int mb_rem; /**< Modes to remove */ | |
304 | struct Client *mb_source; /**< Source of MODE changes */ | |
305 | struct Client *mb_connect; /**< Connection of MODE changes */ | |
306 | struct Channel *mb_channel; /**< Channel they affect */ | |
307 | unsigned int mb_dest; /**< Destination of MODE changes */ | |
308 | unsigned int mb_count; /**< Number of modes w/args */ | |
309 | struct { | |
310 | unsigned int mbm_type; /**< Type of argument */ | |
311 | union { | |
312 | unsigned int mbma_uint; /**< A limit */ | |
313 | char *mbma_string; /**< A string */ | |
314 | struct Client *mbma_client; /**< A client */ | |
315 | } mbm_arg; /**< The mode argument */ | |
316 | unsigned short mbm_oplevel; /**< Oplevel for a bounce */ | |
317 | } mb_modeargs[MAXMODEPARAMS]; | |
318 | /**< A mode w/args */ | |
319 | }; | |
320 | ||
321 | #define MODEBUF_DEST_CHANNEL 0x00001 /**< Mode is flushed to channel */ | |
322 | #define MODEBUF_DEST_SERVER 0x00002 /**< Mode is flushed to server */ | |
323 | ||
324 | #define MODEBUF_DEST_OPMODE 0x00100 /**< Send server mode as OPMODE */ | |
325 | #define MODEBUF_DEST_DEOP 0x00200 /**< Deop the offender */ | |
326 | #define MODEBUF_DEST_BOUNCE 0x00400 /**< Bounce the modes */ | |
327 | #define MODEBUF_DEST_LOG 0x00800 /**< Log the mode changes to OPATH */ | |
328 | ||
329 | #define MODEBUF_DEST_HACK2 0x02000 /**< Send a HACK(2) notice, reverse */ | |
330 | #define MODEBUF_DEST_HACK3 0x04000 /**< Send a HACK(3) notice, TS == 0 */ | |
331 | #define MODEBUF_DEST_HACK4 0x08000 /**< Send a HACK(4) notice, TS == 0 */ | |
332 | ||
333 | #define MODEBUF_DEST_NOKEY 0x10000 /**< Don't send the real key */ | |
334 | ||
335 | #define MB_TYPE(mb, i) ((mb)->mb_modeargs[(i)].mbm_type) | |
336 | #define MB_UINT(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_uint) | |
337 | #define MB_STRING(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_string) | |
338 | #define MB_CLIENT(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_client) | |
339 | #define MB_OPLEVEL(mb, i) ((mb)->mb_modeargs[(i)].mbm_oplevel) | |
340 | ||
341 | /** A buffer represeting a list of joins to send */ | |
342 | struct JoinBuf { | |
343 | struct Client *jb_source; /**< Source of joins (ie, joiner) */ | |
344 | struct Client *jb_connect; /**< Connection of joiner */ | |
345 | unsigned int jb_type; /**< Type of join (JOIN or CREATE) */ | |
346 | char *jb_comment; /**< part comment */ | |
347 | time_t jb_create; /**< Creation timestamp */ | |
348 | unsigned int jb_count; /**< Number of channels */ | |
349 | unsigned int jb_strlen; /**< length so far */ | |
350 | struct Channel *jb_channels[MAXJOINARGS]; | |
351 | /**< channels joined or whatever */ | |
352 | }; | |
353 | ||
354 | #define JOINBUF_TYPE_JOIN 0 /**< send JOINs */ | |
355 | #define JOINBUF_TYPE_CREATE 1 /**< send CREATEs */ | |
356 | #define JOINBUF_TYPE_PART 2 /**< send PARTs */ | |
357 | #define JOINBUF_TYPE_PARTALL 3 /**< send local PARTs, but not remote */ | |
358 | ||
359 | extern struct Channel* GlobalChannelList; | |
360 | extern int LocalChanOperMode; | |
361 | ||
362 | /* | |
363 | * Proto types | |
364 | */ | |
365 | extern void channel_modes(struct Client *cptr, char *mbuf, char *pbuf, | |
366 | int buflen, struct Channel *chptr, | |
367 | struct Membership *member); | |
368 | extern int set_mode(struct Client* cptr, struct Client* sptr, | |
369 | struct Channel* chptr, int parc, char* parv[], | |
370 | char* mbuf, char* pbuf, char* npbuf, int* badop); | |
371 | extern void send_hack_notice(struct Client *cptr, struct Client *sptr, | |
372 | int parc, char *parv[], int badop, int mtype); | |
373 | extern struct Channel *get_channel(struct Client *cptr, | |
374 | char *chname, ChannelGetType flag); | |
d8e74551 | 375 | extern int SetAutoChanModes(struct Channel *chptr); |
189935b1 | 376 | extern struct Membership* find_member_link(struct Channel * chptr, |
377 | const struct Client* cptr); | |
378 | extern int sub1_from_channel(struct Channel* chptr); | |
379 | extern int destruct_channel(struct Channel* chptr); | |
380 | extern void add_user_to_channel(struct Channel* chptr, struct Client* who, | |
381 | unsigned int flags, int oplevel); | |
382 | extern void make_zombie(struct Membership* member, struct Client* who, | |
383 | struct Client* cptr, struct Client* sptr, | |
384 | struct Channel* chptr); | |
385 | extern struct Client* find_chasing(struct Client* sptr, const char* user, int* chasing); | |
386 | void add_invite(struct Client *cptr, struct Channel *chptr); | |
387 | int number_of_zombies(struct Channel *chptr); | |
388 | ||
389 | extern const char* find_no_nickchange_channel(struct Client* cptr); | |
390 | extern struct Membership* find_channel_member(struct Client* cptr, struct Channel* chptr); | |
391 | extern int member_can_send_to_channel(struct Membership* member, int reveal); | |
392 | extern int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, int reveal); | |
393 | ||
394 | extern void remove_user_from_channel(struct Client *sptr, struct Channel *chptr); | |
395 | extern void remove_user_from_all_channels(struct Client* cptr); | |
396 | ||
397 | extern int is_chan_op(struct Client *cptr, struct Channel *chptr); | |
398 | extern int is_zombie(struct Client *cptr, struct Channel *chptr); | |
399 | extern int has_voice(struct Client *cptr, struct Channel *chptr); | |
400 | /* | |
401 | NOTE: pointer is compared, and not dereferenced, called by | |
402 | add_target with a void*, since targets could be anything, | |
403 | this function can't make any assumptions that it has a channel | |
404 | */ | |
405 | extern int IsInvited(struct Client* cptr, const void* chptr); | |
406 | extern void send_channel_modes(struct Client *cptr, struct Channel *chptr); | |
407 | extern char *pretty_mask(char *mask); | |
408 | extern void del_invite(struct Client *cptr, struct Channel *chptr); | |
409 | extern void list_set_default(void); /* this belongs elsewhere! */ | |
410 | ||
411 | extern void RevealDelayedJoin(struct Membership *member); | |
412 | extern void CheckDelayedJoins(struct Channel *chan); | |
413 | ||
414 | extern void modebuf_init(struct ModeBuf *mbuf, struct Client *source, | |
415 | struct Client *connect, struct Channel *chan, | |
416 | unsigned int dest); | |
417 | extern void modebuf_mode(struct ModeBuf *mbuf, unsigned int mode); | |
418 | extern void modebuf_mode_uint(struct ModeBuf *mbuf, unsigned int mode, | |
419 | unsigned int uint); | |
420 | extern void modebuf_mode_string(struct ModeBuf *mbuf, unsigned int mode, | |
421 | char *string, int free); | |
422 | extern void modebuf_mode_client(struct ModeBuf *mbuf, unsigned int mode, | |
423 | struct Client *client, int oplevel); | |
424 | extern int modebuf_flush(struct ModeBuf *mbuf); | |
425 | extern void modebuf_extract(struct ModeBuf *mbuf, char *buf); | |
426 | ||
427 | extern void mode_ban_invalidate(struct Channel *chan); | |
428 | extern void mode_invite_clear(struct Channel *chan); | |
429 | ||
430 | extern int mode_parse(struct ModeBuf *mbuf, struct Client *cptr, | |
431 | struct Client *sptr, struct Channel *chptr, | |
432 | int parc, char *parv[], unsigned int flags, | |
433 | struct Membership* member); | |
434 | ||
435 | #define MODE_PARSE_SET 0x01 /**< actually set channel modes */ | |
436 | #define MODE_PARSE_STRICT 0x02 /**< +m +n +t style not supported */ | |
437 | #define MODE_PARSE_FORCE 0x04 /**< force the mode to be applied */ | |
438 | #define MODE_PARSE_BOUNCE 0x08 /**< we will be bouncing the modes */ | |
439 | #define MODE_PARSE_NOTOPER 0x10 /**< send "not chanop" to user */ | |
440 | #define MODE_PARSE_NOTMEMBER 0x20 /**< send "not member" to user */ | |
441 | #define MODE_PARSE_WIPEOUT 0x40 /**< wipe out +k and +l during burst */ | |
442 | #define MODE_PARSE_BURST 0x80 /**< be even more strict w/extra args */ | |
443 | ||
444 | extern void joinbuf_init(struct JoinBuf *jbuf, struct Client *source, | |
445 | struct Client *connect, unsigned int type, | |
446 | char *comment, time_t create); | |
447 | extern void joinbuf_join(struct JoinBuf *jbuf, struct Channel *chan, | |
448 | unsigned int flags); | |
449 | extern int joinbuf_flush(struct JoinBuf *jbuf); | |
450 | extern struct Ban *make_ban(const char *banstr); | |
451 | extern struct Ban *find_ban(struct Client *cptr, struct Ban *banlist); | |
452 | extern int apply_ban(struct Ban **banlist, struct Ban *newban, int free); | |
453 | extern void free_ban(struct Ban *ban); | |
454 | ||
455 | #endif /* INCLUDED_channel_h */ |