Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / include / channel.h
index 131e11d84dc5c0b52f302ebdb1af2369c8ac2c87..96c878aeeceb78092ce1a380135eccbb949f6fd8 100644 (file)
@@ -69,6 +69,7 @@ struct Client;
 #define CHFL_SILENCE_IPMASK     0x2000  /* silence mask is an IP-number mask */
 #define CHFL_BURST_ALREADY_OPPED       0x04000  /* In oob BURST, but was already joined and opped */
 #define CHFL_BURST_ALREADY_VOICED      0x08000  /* In oob BURST, but was already joined and voiced */
+#define CHFL_CHANNEL_MANAGER   0x10000 /* Set when creating channel or using Apass */
 
 #define CHFL_OVERLAP         (CHFL_CHANOP | CHFL_VOICE)
 #define CHFL_BANVALIDMASK    (CHFL_BANVALID | CHFL_BANNED)
@@ -105,15 +106,15 @@ 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)))
+#define ShowChannel(v,c)        (PubChannel(c) || find_channel_member((v),(c)) || \
+                                 (IsAnOper(v) && HasPriv(v, PRIV_LIST_CHAN)))
 #define PubChannel(x)           ((!x) || ((x)->mode.mode & \
                                     (MODE_PRIVATE | MODE_SECRET)) == 0)
 #define is_listed(x)            ((x)->mode.mode & MODE_LISTED)
 
 #define IsLocalChannel(name)    (*(name) == '&')
-#define IsModelessChannel(name) (*(name) == '+')
 #define IsChannelName(name)     (*(name) == '#' || \
-                                IsModelessChannel(name) || IsLocalChannel(name))
+                                IsLocalChannel(name))
 
 typedef enum ChannelGetType {
   CGT_NO_CREATE,
@@ -186,6 +187,7 @@ struct Membership {
 #define IsServOpOk(x)       ((x)->status & CHFL_SERVOPOK)
 #define IsBurstJoined(x)    ((x)->status & CHFL_BURST_JOINED)
 #define IsVoicedOrOpped(x)  ((x)->status & CHFL_VOICED_OR_OPPED)
+#define IsChannelManager(x) ((x)->status & CHFL_CHANNEL_MANAGER)
 
 #define SetBanned(x)        ((x)->status |= CHFL_BANNED)
 #define SetBanValid(x)      ((x)->status |= CHFL_BANVALID)
@@ -193,6 +195,7 @@ struct Membership {
 #define SetServOpOk(x)      ((x)->status |= CHFL_SERVOPOK)
 #define SetBurstJoined(x)   ((x)->status |= CHFL_BURST_JOINED)
 #define SetZombie(x)        ((x)->status |= CHFL_ZOMBIE)
+#define SetChannelManager(x) ((x)->status |= CHFL_CHANNEL_MANAGER)
 #define SetOpLevel(x, v)    (void)((x)->oplevel = (v))
 
 #define ClearBanned(x)      ((x)->status &= ~CHFL_BANNED)
@@ -257,17 +260,19 @@ struct ModeBuf {
                                        /* A mode w/args */
 };
 
-#define MODEBUF_DEST_CHANNEL   0x000 /* Mode is flushed to channel */
-#define MODEBUF_DEST_SERVER    0x000 /* Mode is flushed to server */
+#define MODEBUF_DEST_CHANNEL   0x00001 /* Mode is flushed to channel */
+#define MODEBUF_DEST_SERVER    0x00002 /* Mode is flushed to server */
 
-#define MODEBUF_DEST_OPMODE    0x0100  /* Send server mode as OPMODE */
-#define MODEBUF_DEST_DEOP      0x0200  /* Deop the offender */
-#define MODEBUF_DEST_BOUNCE    0x0400  /* Bounce the modes */
-#define MODEBUF_DEST_LOG       0x0800  /* Log the mode changes to OPATH */
+#define MODEBUF_DEST_OPMODE    0x00100 /* Send server mode as OPMODE */
+#define MODEBUF_DEST_DEOP      0x00200 /* Deop the offender */
+#define MODEBUF_DEST_BOUNCE    0x00400 /* Bounce the modes */
+#define MODEBUF_DEST_LOG       0x00800 /* Log the mode changes to OPATH */
 
-#define MODEBUF_DEST_HACK2     0x2000  /* Send a HACK(2) notice, reverse */
-#define MODEBUF_DEST_HACK3     0x4000  /* Send a HACK(3) notice, TS == 0 */
-#define MODEBUF_DEST_HACK4     0x8000  /* Send a HACK(4) notice, TS == 0 */
+#define MODEBUF_DEST_HACK2     0x02000 /* Send a HACK(2) notice, reverse */
+#define MODEBUF_DEST_HACK3     0x04000 /* Send a HACK(3) notice, TS == 0 */
+#define MODEBUF_DEST_HACK4     0x08000 /* Send a HACK(4) notice, TS == 0 */
+
+#define MODEBUF_DEST_NOKEY     0x10000 /* Don't send the real key */
 
 #define MB_TYPE(mb, i)         ((mb)->mb_modeargs[(i)].mbm_type)
 #define MB_UINT(mb, i)         ((mb)->mb_modeargs[(i)].mbm_arg.mbma_uint)
@@ -299,7 +304,8 @@ extern int             LocalChanOperMode;
  */
 extern void clean_channelname(char* name);
 extern void channel_modes(struct Client *cptr, char *mbuf, char *pbuf,
-                          int buflen, struct Channel *chptr);
+                          int buflen, struct Channel *chptr,
+                         struct Membership *member);
 extern int set_mode(struct Client* cptr, struct Client* sptr,
                     struct Channel* chptr, int parc, char* parv[],
                     char* mbuf, char* pbuf, char* npbuf, int* badop);
@@ -342,6 +348,7 @@ extern void remove_user_from_all_channels(struct Client* cptr);
 extern int is_chan_op(struct Client *cptr, struct Channel *chptr);
 extern int is_zombie(struct Client *cptr, struct Channel *chptr);
 extern int has_voice(struct Client *cptr, struct Channel *chptr);
+extern int IsInvited(struct Client* cptr, struct Channel* 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);