]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - include/channel.h
Rework ircd-side MLOCK enforcement: instead of trying to track modes locked on or...
[irc/rqf/shadowircd.git] / include / channel.h
index 9e84dcec0421478737ce2044e8089e6db3bb1dba..d471e6cd0511831609c10f856bdaa1a5fc6bc7e4 100644 (file)
@@ -21,7 +21,6 @@
  *  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
@@ -51,6 +50,7 @@ struct Channel
 {
        rb_dlink_node node;
        struct Mode mode;
+       char *mode_lock;
        char *topic;
        char *topic_info;
        time_t topic_time;
@@ -72,6 +72,8 @@ struct Channel
        unsigned int join_count;  /* joins within delta */
        unsigned int join_delta;  /* last ts of join */
 
+       struct Dictionary *metadata;
+
        unsigned long bants;
        time_t channelts;
        char *chname;
@@ -114,6 +116,7 @@ struct ChModeChange
        int caps;
        int nocaps;
        int mems;
+       int override;
        struct Client *client;
 };
 
@@ -124,14 +127,42 @@ struct ChCapCombo
        int cap_no;
 };
 
+typedef void (*ChannelModeFunc)(struct Client *source_p, struct Channel *chptr,
+               int alevel, int parc, int *parn,
+               const char **parv, int *errors, int dir, char c, long mode_type);
+
 struct ChannelMode
 {
-       void (*set_func) (struct Client * source_p, struct Channel * chptr,
-                     int alevel, int parc, int *parn,
-                     const char **parv, int *errors, int dir, char c, long mode_type);
+       ChannelModeFunc set_func;
        long mode_type;
 };
 
+/* modes added by the module files in modes/ */
+struct module_modes
+{
+       unsigned int MODE_REGONLY; 
+       unsigned int MODE_NOCTCP; /* Block CTCPs directed to this channel */
+       unsigned int MODE_NOCOLOR;
+       unsigned int MODE_EXLIMIT; /* exempt from list limits, +b/+e/+I/+q */
+       unsigned int MODE_PERMANENT; /* permanant channel, +P */
+       unsigned int MODE_OPMODERATE; /* send rejected messages to ops */
+       unsigned int MODE_FREEINVITE; /* allow free use of /invite */
+       unsigned int MODE_FREETARGET; /* can be forwarded to without authorization */
+       unsigned int MODE_DISFORWARD; /* disable channel forwarding */
+       unsigned int MODE_THROTTLE; /* throttle joins */
+       unsigned int MODE_FORWARD;
+       unsigned int MODE_NONOTICE; /* Block notices directed to this channel */
+       unsigned int MODE_NOACTION; /* Block CTCP ACTION directed to this channel */
+       unsigned int MODE_NOKICK; /* Disable /kick on this channel */
+       unsigned int MODE_NONICK; /* Disable /nick for anyone on this channel */
+       unsigned int MODE_NOCAPS; /* Block messages in all capital letters */
+       unsigned int MODE_NOREJOIN; /* Block rejoin immediately after kick */
+       unsigned int MODE_NOREPEAT; /* Block repeat messages */
+       unsigned int MODE_NOOPERKICK; /* disallow kicking opers */
+
+       unsigned int CHFL_QUIET;
+};
+
 typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
                struct Channel *chptr, long mode_type);
 
@@ -147,13 +178,17 @@ 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 CHFL_HALFOP            0x0040
+#define CHFL_ADMIN             0x0080
+#define        ONLY_OPERS              0x0100
 #define ALL_MEMBERS            CHFL_PEON
-#define ONLY_CHANOPS           CHFL_CHANOP
-#define ONLY_CHANOPSVOICED     (CHFL_CHANOP|CHFL_VOICE)
+#define ONLY_CHANOPS           (CHFL_ADMIN|CHFL_CHANOP|CHFL_HALFOP)
+#define ONLY_CHANOPSVOICED     (CHFL_ADMIN|CHFL_CHANOP|CHFL_HALFOP|CHFL_VOICE)
 
+#define is_chmode_h(x) ((x) && (x)->flags & CHFL_HALFOP) /* does not check if halfop is enabled, should typically not be used */
+#define is_chmode_a(x) ((x) && (x)->flags & CHFL_ADMIN) /* does not check if admin is enabled, should typically not be used */
 #define is_chanop(x)   ((x) && (x)->flags & CHFL_CHANOP)
 #define is_voiced(x)   ((x) && (x)->flags & CHFL_VOICE)
-#define is_chanop_voiced(x) ((x) && (x)->flags & (CHFL_CHANOP|CHFL_VOICE))
 #define can_send_banned(x) ((x) && (x)->flags & (CHFL_BANNED|CHFL_QUIETED))
 
 /* channel modes ONLY */
@@ -163,26 +198,10 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
 #define MODE_TOPICLIMIT 0x0008
 #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 MODE_NONOTICE  0x16000 /* Block notices directed to this channel */
-#define MODE_NOACTION  0x32000 /* Block CTCP ACTION directed to this channel */
-#define MODE_NOKICK    0x64000 /* Disable /kick on this channel */
-#define MODE_NONICK    0x128000 /* Disable /nick for anyone on this channel */
-#define MODE_NOCAPS    0x256000 /* Block messages in all capital letters */
-#define MODE_NOREJOIN  0x512000 /* Block rejoin immediately after kick */
 
 #define CHFL_BAN        0x10000000     /* ban channel flag */
 #define CHFL_EXCEPTION  0x20000000     /* exception to ban channel flag */
 #define CHFL_INVEX      0x40000000
-#define CHFL_QUIET      0x80000000
 
 /* mode flags for direction indication */
 #define MODE_QUERY     0
@@ -209,6 +228,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
 
 extern rb_dlink_list global_channel_list;
 void init_channels(void);
+void init_module_modes(void);
 
 struct Channel *allocate_channel(const char *chname);
 void free_channel(struct Channel *chptr);
@@ -228,6 +248,11 @@ extern int can_join(struct Client *source_p, struct Channel *chptr, char *key);
 
 extern struct membership *find_channel_membership(struct Channel *, struct Client *);
 extern const char *find_channel_status(struct membership *msptr, int combine);
+extern int is_halfop(struct membership *msptr);
+extern int is_admin(struct membership *msptr);
+extern int is_any_op(struct membership *msptr);
+extern int is_chanop_voiced(struct membership *msptr);
+extern int can_kick_deop(struct membership *source, struct membership *target);
 extern void add_user_to_channel(struct Channel *, struct Client *, int flags);
 extern void remove_user_from_channel(struct membership *);
 extern void remove_user_from_channels(struct Client *);
@@ -263,8 +288,12 @@ extern void unset_chcap_usage_counts(struct Client *serv_p);
 extern void send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
                                  struct Channel *chptr, struct ChModeChange foo[], int);
 
+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);
 
 extern struct ChannelMode chmode_table[256];
 
@@ -284,4 +313,11 @@ extern void user_join(struct Client * client_p, struct Client * source_p, const
 extern void do_join_0(struct Client *client_p, struct Client *source_p);
 extern int check_channel_name_loc(struct Client *source_p, const char *name);
 
+extern struct Metadata *channel_metadata_add(struct Channel *target, const char *name, const char *value, int propegate);
+extern struct Metadata *channel_metadata_time_add(struct Channel *target, const char *name, time_t timevalue, const char *value);
+extern void channel_metadata_delete(struct Channel *target, const char *name, int propegate);
+extern struct Metadata *channel_metadata_find(struct Channel *target, const char *name);
+extern void channel_metadata_clear(struct Channel *target);
+
+
 #endif /* INCLUDED_channel_h */