X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=include%2Fchannel.h;h=57ed5dc4a91bc37424653c0970de12f06230891c;hb=fa78a87f4d4bf4411effdb4e3ba1072625294a9a;hp=e0dc9021e496801b4f4fcab54cb2cf7fe25be947;hpb=5246a6127cca4385da318f2e75271b4f5907947b;p=ircu2.10.12-pk.git diff --git a/include/channel.h b/include/channel.h index e0dc902..57ed5dc 100644 --- a/include/channel.h +++ b/include/channel.h @@ -30,6 +30,9 @@ #include #define INCLUDED_sys_types_h #endif +#ifndef INCLUDED_res_h +#include "res.h" +#endif struct SLink; struct Client; @@ -42,7 +45,6 @@ struct Client; #define MODEBUFLEN 200 /**< Maximum length of a mode */ #define KEYLEN 23 /**< Maximum length of a key */ -#define PASSLEN 23 /**< Maximum length of a password */ #define CHANNELLEN 200 /**< Maximum length of a channel */ #define MAXJOINARGS 15 /**< number of slots for join buffer */ @@ -60,12 +62,7 @@ struct Client; #define CHFL_DEOPPED 0x0004 /**< Is de-opped by a server */ #define CHFL_SERVOPOK 0x0008 /**< Server op allowed */ #define CHFL_ZOMBIE 0x0010 /**< Kicked from channel */ -#define CHFL_BAN 0x0020 /**< ban channel flag */ -#define CHFL_BAN_IPMASK 0x0040 /**< ban mask is an IP-number mask */ -#define CHFL_BAN_OVERLAPPED 0x0080 /**< ban overlapped, need bounce */ #define CHFL_BURST_JOINED 0x0100 /**< Just joined by net.junction */ -#define CHFL_BURST_BAN 0x0200 /**< Ban part of last BURST */ -#define CHFL_BURST_BAN_WIPEOUT 0x0400 /**< Ban will be wiped at EOB */ #define CHFL_BANVALID 0x0800 /**< CHFL_BANNED bit is valid */ #define CHFL_BANNED 0x1000 /**< Channel member is banned */ #define CHFL_SILENCE_IPMASK 0x2000 /**< silence mask is a CIDR */ @@ -104,7 +101,8 @@ struct Client; #define MODE_LIMIT 0x0400 /**< +l Limit */ #define MODE_REGONLY 0x0800 /**< Only +r users may join */ #define MODE_DELJOINS 0x1000 /**< New join messages are delayed */ -#define MODE_LISTED 0x10000 +#define MODE_REGISTERED 0x2000 /**< Channel marked as registered + * (for future semantic expansion) */ #define MODE_SAVE 0x20000 /**< save this mode-with-arg 'til * later */ #define MODE_FREE 0x40000 /**< string needs to be passed to @@ -119,7 +117,7 @@ struct Client; #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS) /** Available Channel modes */ -#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrD" : "biklmnopstvrD" +#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDdR" : "biklmnopstvrDdR" /** Available Channel modes that take parameters */ #define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "AbkloUv" : "bklov" @@ -129,11 +127,9 @@ struct Client; /** channel not shown but names are */ #define HiddenChannel(x) ((x) && ((x)->mode.mode & MODE_PRIVATE)) /** channel visible */ -#define ShowChannel(v,c) (PubChannel(c) || find_channel_member((v),(c)) || \ - (IsAnOper(v) && HasPriv(v, PRIV_LIST_CHAN))) +#define ShowChannel(v,c) (PubChannel(c) || find_channel_member((v),(c))) #define PubChannel(x) ((!x) || ((x)->mode.mode & \ (MODE_PRIVATE | MODE_SECRET)) == 0) -#define is_listed(x) ((x)->mode.mode & MODE_LISTED) #define IsGlobalChannel(name) (*(name) == '#') #define IsLocalChannel(name) (*(name) == '&') @@ -154,6 +150,8 @@ typedef enum ChannelGetType { #define LISTARG_TOPICLIMITS 0x0001 #define LISTARG_SHOWSECRET 0x0002 +#define LISTARG_NEGATEWILDCARD 0x0004 +#define LISTARG_SHOWMODES 0x0008 /** * Maximum acceptable lag time in seconds: A channel younger than @@ -168,19 +166,6 @@ typedef enum ChannelGetType { */ #define TS_LAG_TIME 86400 -/** - * A Magic TS that is used for channels that are created by JOIN, - * a channel with this TS accepts all TS without complaining that - * it might receive later via MODE or CREATE. - * - * Part of the P9 compatibility, shouldn't occur on a P10 network. - */ -#define MAGIC_REMOTE_JOIN_TS 1270080000 - -/** - * used in can_join to determine if an oper forced a join on a channel - */ -#define MAGIC_OPER_OVERRIDE 1000 extern const char* const PartFmt1; @@ -252,8 +237,28 @@ struct Mode { unsigned int mode; unsigned int limit; char key[KEYLEN + 1]; - char upass[PASSLEN + 1]; - char apass[PASSLEN + 1]; + char upass[KEYLEN + 1]; + char apass[KEYLEN + 1]; +}; + +#define BAN_IPMASK 0x0001 /**< ban mask is an IP-number mask */ +#define BAN_OVERLAPPED 0x0002 /**< ban overlapped, need bounce */ +#define BAN_BURSTED 0x0004 /**< Ban part of last BURST */ +#define BAN_BURST_WIPEOUT 0x0008 /**< Ban will be wiped at EOB */ +#define BAN_EXCEPTION 0x0010 /**< Ban is an exception */ +#define BAN_DEL 0x4000 /**< Ban is being removed */ +#define BAN_ADD 0x8000 /**< Ban is being added */ + +/** A single ban for a channel. */ +struct Ban { + struct Ban* next; /**< next ban in the channel */ + struct irc_in_addr address; /**< address for BAN_IPMASK bans */ + time_t when; /**< timestamp when ban was added */ + unsigned short flags; /**< modifier flags for the ban */ + unsigned char nu_len; /**< length of nick!user part of banstr */ + unsigned char addrbits; /**< netmask length for BAN_IPMASK bans */ + char who[NICKLEN+1]; /**< name of client that set the ban */ + char banstr[NICKLEN+USERLEN+HOSTLEN+3]; /**< hostmask that the ban matches */ }; /** Information about a channel */ @@ -267,7 +272,7 @@ struct Channel { unsigned int users; /**< Number of clients on this channel */ struct Membership* members; /**< Pointer to the clients on this channel*/ struct SLink* invites; /**< List of invites on this channel */ - struct SLink* banlist; /**< List of bans on this channel */ + struct Ban* banlist; /**< List of bans on this channel */ struct Mode mode; /**< This channels mode */ char topic[TOPICLEN + 1]; /**< Channels topic */ char topic_nick[NICKLEN + 1]; /**< Nick of the person who set @@ -287,7 +292,8 @@ struct ListingArgs { unsigned int flags; time_t max_topic_time; time_t min_topic_time; - struct Channel *chptr; + unsigned int bucket; + char wildcard[CHANNELLEN]; }; struct ModeBuf { @@ -305,6 +311,7 @@ struct ModeBuf { char *mbma_string; /**< A string */ struct Client *mbma_client; /**< A client */ } mbm_arg; /**< The mode argument */ + unsigned short mbm_oplevel; /**< Oplevel for a bounce */ } mb_modeargs[MAXMODEPARAMS]; /**< A mode w/args */ }; @@ -327,6 +334,7 @@ struct ModeBuf { #define MB_UINT(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_uint) #define MB_STRING(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_string) #define MB_CLIENT(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_client) +#define MB_OPLEVEL(mb, i) ((mb)->mb_modeargs[(i)].mbm_oplevel) /** A buffer represeting a list of joins to send */ struct JoinBuf { @@ -352,7 +360,6 @@ extern int LocalChanOperMode; /* * Proto types */ -extern void clean_channelname(char* name); extern void channel_modes(struct Client *cptr, char *mbuf, char *pbuf, int buflen, struct Channel *chptr, struct Membership *member); @@ -367,18 +374,8 @@ extern struct Membership* find_member_link(struct Channel * chptr, const struct Client* cptr); extern int sub1_from_channel(struct Channel* chptr); extern int destruct_channel(struct Channel* chptr); -extern int can_join(struct Client *sptr, struct Channel *chptr, char *key); extern void add_user_to_channel(struct Channel* chptr, struct Client* who, unsigned int flags, int oplevel); -extern void cancel_mode(struct Client *sptr, struct Channel *chptr, char m, - const char *param, int *count); -extern void add_token_to_sendbuf(char *token, size_t *sblenp, int *firstp, - int *send_itp, char is_a_ban, int mode); -extern int add_banid(struct Client *cptr, struct Channel *chptr, char *banid, - int change, int firsttime); -extern struct SLink *next_removed_overlapped_ban(void); -extern void cancel_mode(struct Client *sptr, struct Channel *chptr, char m, - const char *param, int *count); extern void make_zombie(struct Membership* member, struct Client* who, struct Client* cptr, struct Client* sptr, struct Channel* chptr); @@ -387,7 +384,6 @@ void add_invite(struct Client *cptr, struct Channel *chptr); int number_of_zombies(struct Channel *chptr); extern const char* find_no_nickchange_channel(struct Client* cptr); -extern struct Membership* IsMember(struct Client *cptr, struct Channel *chptr); extern struct Membership* find_channel_member(struct Client* cptr, struct Channel* chptr); extern int member_can_send_to_channel(struct Membership* member, int reveal); extern int client_can_send_to_channel(struct Client *cptr, struct Channel *chptr, int reveal); @@ -407,9 +403,9 @@ extern int IsInvited(struct Client* cptr, const void* chptr); extern void send_channel_modes(struct Client *cptr, struct Channel *chptr); extern char *pretty_mask(char *mask); extern void del_invite(struct Client *cptr, struct Channel *chptr); -extern void list_next_channels(struct Client *cptr, int nr); extern void list_set_default(void); /* this belongs elsewhere! */ +extern void RevealDelayedJoinIfNeeded(struct Client *sptr, struct Channel *chptr); extern void RevealDelayedJoin(struct Membership *member); extern void CheckDelayedJoins(struct Channel *chan); @@ -422,7 +418,7 @@ extern void modebuf_mode_uint(struct ModeBuf *mbuf, unsigned int mode, extern void modebuf_mode_string(struct ModeBuf *mbuf, unsigned int mode, char *string, int free); extern void modebuf_mode_client(struct ModeBuf *mbuf, unsigned int mode, - struct Client *client); + struct Client *client, int oplevel); extern int modebuf_flush(struct ModeBuf *mbuf); extern void modebuf_extract(struct ModeBuf *mbuf, char *buf); @@ -449,5 +445,9 @@ extern void joinbuf_init(struct JoinBuf *jbuf, struct Client *source, extern void joinbuf_join(struct JoinBuf *jbuf, struct Channel *chan, unsigned int flags); extern int joinbuf_flush(struct JoinBuf *jbuf); +extern struct Ban *make_ban(const char *banstr); +extern struct Ban *find_ban(struct Client *cptr, struct Ban *banlist); +extern int apply_ban(struct Ban **banlist, struct Ban *newban, int free); +extern void free_ban(struct Ban *ban); #endif /* INCLUDED_channel_h */