]> jfr.im git - irc/quakenet/newserv.git/blobdiff - control/control.h
Merge chanserv-live into default.
[irc/quakenet/newserv.git] / control / control.h
index e9560aec95db9200584807f1f861885af078a89f..1b3e9c9c3c8070d5990ad2459b0bb1ba064c600c 100644 (file)
@@ -2,28 +2,17 @@
 #ifndef __CONTROL_H
 #define __CONTROL_H
 
+#include "control_db.h"
+#include "../lib/flags.h"
 #include "../parser/parser.h"
 #include "../nick/nick.h"
 #include "../channel/channel.h"
 
-void registercontrolhelpcmd(const char *name, int level, int maxparams, CommandHandler handler, char *help);
-int deregistercontrolcmd(const char *name, CommandHandler handler);
-void controlmessage(nick *target, char *message, ... );
-void controlchanmsg(channel *cp, char *message, ...);
-void controlnotice(nick *target, char *message, ...);
-int controlshowcommands(void *sender, int cargc, char **cargv);
-int controlrmmod(void *sender, int cargc, char **cargv);
-void controlspecialrmmod(void *arg);
-void controlspecialreloadmod(void *arg);
-void controlhelp(nick *np, Command *cmd);
-
 #define registercontrolcmd(a, b, c, d) registercontrolhelpcmd(a, b, c, d, NULL)
 
-typedef void (*ControlMsg)(nick *, char *, ... );
-typedef void (*ControlWall)(flag_t, flag_t, char *, ...);
-
-extern ControlMsg controlreply;
-extern ControlWall controlwall;
+void controlreply(nick *, char *, ...);
+void controlwall(flag_t, flag_t, char *, ...);
+int controlpermitted(flag_t, nick *);
 
 extern nick *mynick;
 
@@ -32,7 +21,27 @@ extern CommandTree *controlcmds;
 struct specialsched {
   sstring *modulename;
   void *schedule;
-} specialsched;
+};
+
+typedef void (*CommandHelp)(nick *, Command *);
+typedef struct cmdhelp {
+  char *helpstr;
+  CommandHelp helpcmd;
+} cmdhelp;
+
+void registercontrolhelpcmd(const char *name, int level, int maxparams, CommandHandler handler, char *help);
+void registercontrolhelpfunccmd(const char *name, int level, int maxparams, CommandHandler handler, CommandHelp helpcmd);
+int deregistercontrolcmd(const char *name, CommandHandler handler);
+void controlmessage(nick *target, char *message, ... ) __attribute__ ((format (printf, 2, 3)));
+void controlchanmsg(channel *cp, char *message, ...) __attribute__ ((format (printf, 2, 3)));
+void controlnotice(nick *target, char *message, ...) __attribute__ ((format (printf, 2, 3)));
+int controlshowcommands(void *sender, int cargc, char **cargv);
+int controlrmmod(void *sender, int cargc, char **cargv);
+void controlspecialrmmod(void *arg);
+void controlspecialreloadmod(void *arg);
+void controlhelp(nick *np, Command *cmd);
+void controlnswall(int noticelevel, char *format, ...) __attribute__ ((format (printf, 2, 3)));
+char *controlid(nick *);
 
 /* NEVER USE THE FOLLOWING IN COMMANDS, you'll end up missing bits off and users'll end up being able to gline people */
 #define __NO_ANYONE      0x000
@@ -45,6 +54,7 @@ struct specialsched {
 #define __NO_OPER        0x040 /* +O */
 #define __NO_SEC         0x080 /* +w */
 #define __NO_DEVELOPER   0x100 /* +d */
+#define __NO_RELAY       0x200 /* +Y */
 
 /* These are dangerous, they don't include requiring /OPER or STAFF status, be careful */
 #define NOD_ACCOUNT   __NO_ACCOUNT | NO_AUTHED /* must contain authed else account won't be checked */
@@ -53,6 +63,7 @@ struct specialsched {
 #define NOD_OPER      __NO_OPER | NOD_ACCOUNT
 #define NOD_SEC       __NO_SEC | NOD_ACCOUNT
 #define NOD_DEVELOPER __NO_DEVELOPER | NOD_ACCOUNT
+#define NOD_RELAY     __NO_RELAY | NOD_ACCOUNT
 
 /* These ones are safe to use */
 #define NO_ANYONE       __NO_ANYONE                /* don't have to be authed to Q, or us, or opered or anything */
@@ -66,8 +77,9 @@ struct specialsched {
 #define NO_TRUST_OPER   NO_OPER | NOD_TRUST        /* must be authed to Q, /opered, and have trust and oper levels on bot */
 #define NO_SEC_STAFF    NO_STAFF | NOD_SEC         /* must be authed to Q, and have staff and sec level on bot */
 #define NO_SEC_OPER     NO_OPER | NOD_SEC          /* must be authed to Q, /opered, and have sec and oper levels on bot */
+#define NO_RELAY        NO_OPERED | NOD_RELAY      /* must be authed to Q, /opered, and have the relay level on bot */
 
-#define NO_ALL_FLAGS    __NO_STAFF | __NO_TRUST | __NO_OPER | __NO_SEC | __NO_DEVELOPER
+#define NO_ALL_FLAGS    __NO_STAFF | __NO_TRUST | __NO_OPER | __NO_SEC | __NO_DEVELOPER | __NO_RELAY
 #define NO_OPER_FLAGS   __NO_STAFF
 #define NO_DEV_FLAGS    NO_ALL_FLAGS
 
@@ -85,5 +97,21 @@ struct specialsched {
 #define NL_OPERING         0x0800  /* when someone opers */
 #define NL_NOTICES         0x1000  /* turn off to receive privmsgs instead of notices */
 #define NL_ALL_COMMANDS    0x2000  /* every single command sent */
+#define NL_GLINES_AUTO     0x4000  /* automated gline messages */
+#define NL_CLEANUP         0x8000  /* automated cleanup notices */
+
+extern int noperserv_ext;
+
+extern const flag no_userflags[];
+extern const flag no_noticeflags[];
+extern const flag no_commandflags[];
+
+#define NO_NICKS_PER_WHOIS_LINE 3
+
+#define NOGetAuthedUser(user)  (no_autheduser *)(user->auth ? user->auth->exts[noperserv_ext] : NULL)
+#define NOGetAuthLevel(user)   user->authlevel
+#define NOGetNoticeLevel(user) user->noticelevel
+#define NOMax(a, b) (a>b?a:b)
+#define NOMin(a, b) (a<b?b:a)
 
 #endif