Implement tracker item #1031606(relating to wildcards in /list).
[ircu2.10.12-pk.git] / include / channel.h
index 3358742485b9555126b2223ee438eedc2c5e3b8a..e0aca8dac01daf76f34f82b787378c5ec35e36f8 100644 (file)
@@ -30,6 +30,9 @@
 #include <sys/types.h>
 #define INCLUDED_sys_types_h
 #endif
+#ifndef INCLUDED_res_h
+#include "res.h"
+#endif
 
 struct SLink;
 struct Client;
@@ -60,12 +63,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 */
@@ -128,8 +126,7 @@ 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)
 
@@ -152,6 +149,7 @@ typedef enum ChannelGetType {
 
 #define LISTARG_TOPICLIMITS     0x0001
 #define LISTARG_SHOWSECRET      0x0002
+#define LISTARG_NEGATEWILDCARD  0x0004
 
 /**
  * Maximum acceptable lag time in seconds: A channel younger than
@@ -254,16 +252,24 @@ struct Mode {
   char apass[PASSLEN + 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 */
-  time_t when;        /**< timestamp when ban was added */
-  unsigned int flags; /**< modifier flags for the ban
-                       * Zero or more of CHFL_BURST_BAN_WIPEOUT,
-                       * CHFL_BAN_OVERLAPPED
-                       */
-  char *who;          /**< name of client that set the ban */
-  char *banstr;       /**< hostmask that the ban matches */
+  struct Ban* next;           /**< next ban in the channel */
+  struct irc_in_addr address; /**< addres 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 */
@@ -298,6 +304,7 @@ struct ListingArgs {
   time_t max_topic_time;
   time_t min_topic_time;
   unsigned int bucket;
+  char wildcard[CHANNELLEN];
 };
 
 struct ModeBuf {
@@ -380,15 +387,6 @@ 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 Ban *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);
@@ -397,7 +395,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);
@@ -459,6 +456,8 @@ 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 */