X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/a0626e7ce3593e7084f303cfb08fc276cc1e25a5..b2ee72e4487d9ec90ff64f63d8f8c3974d96bc5c:/include/channel.h diff --git a/include/channel.h b/include/channel.h index 66e5ba99..76a1b178 100644 --- a/include/channel.h +++ b/include/channel.h @@ -20,8 +20,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA - * - * $Id: channel.h 3580 2007-11-07 23:45:14Z jilles $ */ #ifndef INCLUDED_channel_h @@ -33,6 +31,8 @@ #define MAXMODEPARAMS 4 #define MAXMODEPARAMSSERV 10 +#include + struct Client; /* mode structure for channels */ @@ -60,7 +60,7 @@ struct Channel rb_dlink_list members; /* channel members */ rb_dlink_list locmembers; /* local channel members */ -rb_dlink_list invites; + rb_dlink_list invites; rb_dlink_list banlist; rb_dlink_list exceptlist; rb_dlink_list invexlist; @@ -73,9 +73,14 @@ rb_dlink_list invites; unsigned int join_count; /* joins within delta */ unsigned int join_delta; /* last ts of join */ - unsigned long bants; + time_t bants; time_t channelts; char *chname; + + struct Client *last_checked_client; + time_t last_checked_ts; + unsigned int last_checked_type; + int last_checked_result; }; struct membership @@ -88,7 +93,7 @@ struct membership struct Client *client_p; unsigned int flags; - unsigned long bants; + time_t bants; }; #define BANLEN 195 @@ -97,6 +102,7 @@ struct Ban char *banstr; char *who; time_t when; + char *forward; rb_dlink_node node; }; @@ -112,17 +118,7 @@ struct ChModeChange const char *arg; const char *id; int dir; - int caps; - int nocaps; int mems; - struct Client *client; -}; - -struct ChCapCombo -{ - int count; - int cap_yes; - int cap_no; }; typedef void (*ChannelModeFunc)(struct Client *source_p, struct Channel *chptr, @@ -151,6 +147,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p, #define CHFL_BANNED 0x0008 /* cached as banned */ #define CHFL_QUIETED 0x0010 /* cached as being +q victim */ #define ONLY_SERVERS 0x0020 +#define ONLY_OPERS 0x0040 #define ALL_MEMBERS CHFL_PEON #define ONLY_CHANOPS CHFL_CHANOP #define ONLY_CHANOPSVOICED (CHFL_CHANOP|CHFL_VOICE) @@ -168,14 +165,12 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p, #define MODE_INVITEONLY 0x0010 #define MODE_NOPRIVMSGS 0x0020 #define MODE_REGONLY 0x0040 -#define MODE_NOCOLOR 0x0080 #define MODE_EXLIMIT 0x0100 /* exempt from list limits, +b/+e/+I/+q */ #define MODE_PERMANENT 0x0200 /* permanant channel, +P */ #define MODE_OPMODERATE 0x0400 /* send rejected messages to ops */ #define MODE_FREEINVITE 0x0800 /* allow free use of /invite */ #define MODE_FREETARGET 0x1000 /* can be forwarded to without authorization */ #define MODE_DISFORWARD 0x2000 /* disable channel forwarding */ -#define MODE_NOCTCP 0x8000 /* Block CTCPs directed to this channel */ #define CHFL_BAN 0x10000000 /* ban channel flag */ #define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */ @@ -198,7 +193,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p, #define IsMember(who, chan) ((who && who->user && \ find_channel_membership(chan, who)) ? 1 : 0) -#define IsChannelName(name) ((name) && (*(name) == '#' || *(name) == '&')) +#define IsChannelName(name) ((name) && (IsChanPrefix(*(name)))) /* extban function results */ #define EXTBAN_INVALID -1 /* invalid mask, false even if negated */ @@ -210,19 +205,22 @@ void init_channels(void); struct Channel *allocate_channel(const char *chname); void free_channel(struct Channel *chptr); -struct Ban *allocate_ban(const char *, const char *); +struct Ban *allocate_ban(const char *, const char *, const char *); void free_ban(struct Ban *bptr); extern void destroy_channel(struct Channel *); -extern int can_send(struct Channel *chptr, struct Client *who, +extern int can_send(struct Channel *chptr, struct Client *who, struct membership *); +extern bool flood_attack_channel(int p_or_n, struct Client *source_p, + struct Channel *chptr, char *chname); extern int is_banned(struct Channel *chptr, struct Client *who, - struct membership *msptr, const char *, const char *); + struct membership *msptr, const char *, const char *, const char **); extern int is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr, const char *, const char *); -extern int can_join(struct Client *source_p, struct Channel *chptr, char *key); +extern int can_join(struct Client *source_p, struct Channel *chptr, + const char *key, const char **forward); extern struct membership *find_channel_membership(struct Channel *, struct Client *); extern const char *find_channel_status(struct membership *msptr, int combine); @@ -233,7 +231,7 @@ extern void invalidate_bancache_user(struct Client *); extern void free_channel_list(rb_dlink_list *); -extern int check_channel_name(const char *name); +extern bool check_channel_name(const char *name); extern void channel_member_names(struct Channel *chptr, struct Client *, int show_eon); @@ -262,14 +260,15 @@ void resv_chan_forcepart(const char *name, const char *reason, int temp_time); extern void set_channel_mode(struct Client *client_p, struct Client *source_p, struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]); extern void set_channel_mlock(struct Client *client_p, struct Client *source_p, - struct Channel *chptr, const char *newmlock, int propagate); + struct Channel *chptr, const char *newmlock, bool propagate); extern struct ChannelMode chmode_table[256]; -extern int add_id(struct Client *source_p, struct Channel *chptr, const char *banid, - rb_dlink_list * list, long mode_type); +extern bool add_id(struct Client *source_p, struct Channel *chptr, const char *banid, + const char *forward, rb_dlink_list * list, long mode_type); -extern int del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, long mode_type); +extern struct Ban * del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, + long mode_type); extern ExtbanFunc extban_table[256]; @@ -277,6 +276,8 @@ extern int match_extban(const char *banstr, struct Client *client_p, struct Chan extern int valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type); const char * get_extban_string(void); -extern int get_channel_access(struct Client *source_p, struct membership *msptr); +extern int get_channel_access(struct Client *source_p, struct Channel *chptr, struct membership *msptr, int dir, const char *modestr); + +extern void send_channel_join(struct Channel *chptr, struct Client *client_p); #endif /* INCLUDED_channel_h */