Fix more IAuth bugs and add IAUTH log target.
[ircu2.10.12-pk.git] / include / channel.h
index 0895b7fa0b08f23015fe3abea665be98621ba571..db347976c6343021ef6dd64ff7ed229541208427 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)
 
@@ -254,6 +251,26 @@ 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 */
+  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;          /**< name of client that set the ban */
+  char *banstr;       /**< hostmask that the ban matches */
+};
+
 /** Information about a channel */
 struct Channel {
   struct Channel*    next;     /**< next channel in the global channel list */
@@ -265,7 +282,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
@@ -368,15 +385,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 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);
@@ -385,7 +393,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);
@@ -446,5 +453,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 */