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