Merge branch 'development'
[NeonServV5.git] / src / modcmd.h
index 9bb799cc1a3194158da7a5f7fceff811a32c7ca8..214a096f2b030a3ae746bb57e5f848ca11d2a053 100644 (file)
@@ -1,5 +1,5 @@
-/* modcmd.h - NeonServ v5.3
- * Copyright (C) 2011  Philipp Kreil (pk910)
+/* modcmd.h - NeonServ v5.6
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 #define MAXPARAMETERS 50
 
-#define CMDFLAG_REQUIRE_CHAN            0x0001
-#define CMDFLAG_REQUIRE_AUTH            0x0002
-#define CMDFLAG_REQUIRE_GOD             0x0004
-#define CMDFLAG_CHECK_AUTH              0x0008
-#define CMDFLAG_REGISTERED_CHAN         0x0010
-#define CMDFLAG_OVERRIDE_GLOBAL_ACCESS  0x0020
-#define CMDFLAG_OVERRIDE_CHANNEL_ACCESS 0x0040
-#define CMDFLAG_CHAN_PARAM              0x0080
-#define CMDFLAG_LOG                     0x0100
-#define CMDFLAG_OPLOG                   0x0200
-#define CMDFLAG_EMPTY_ARGS              0x0400
-#define CMDFLAG_REQUIRED                0x0800
-#define CMDFLAG_TEMPONARY_BIND          0x1000
-#define CMDFLAG_FUNCMD                  0x2000
-#define CMDFLAG_ESCAPE_ARGS             0x4000
+#define CMDFLAG_REQUIRE_CHAN            0x00001
+#define CMDFLAG_REQUIRE_AUTH            0x00002
+#define CMDFLAG_REQUIRE_GOD             0x00004
+#define CMDFLAG_CHECK_AUTH              0x00008
+#define CMDFLAG_REGISTERED_CHAN         0x00010
+#define CMDFLAG_OVERRIDE_GLOBAL_ACCESS  0x00020
+#define CMDFLAG_OVERRIDE_CHANNEL_ACCESS 0x00040
+#define CMDFLAG_CHAN_PARAM              0x00080
+#define CMDFLAG_LOG                     0x00100
+#define CMDFLAG_OPLOG                   0x00200
+#define CMDFLAG_EMPTY_ARGS              0x00400
+#define CMDFLAG_REQUIRED                0x00800
+#define CMDFLAG_TEMPONARY_BIND          0x01000
+#define CMDFLAG_FUNCMD                  0x02000
+#define CMDFLAG_ESCAPE_ARGS             0x04000
+#define CMDFLAG_NO_CROSSCHAN            0x08000
+#define CMDFLAG_SUB_LINKER              0x10000
 
 struct ClientSocket;
 struct UserNode;
 struct ChanNode;
 struct Event;
 
-#define CMD_BIND(NAME) void NAME(UNUSED_ARG(struct ClientSocket *client), UNUSED_ARG(struct UserNode *user), UNUSED_ARG(struct ChanNode *chan), UNUSED_ARG(char **argv), UNUSED_ARG(char argc), UNUSED_ARG(struct Event *event))
-typedef void cmd_bind_t(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, char **argv, char argc, struct Event *event);
+#define CMD_BIND(NAME) void NAME(UNUSED_ARG(struct ClientSocket *client), UNUSED_ARG(struct ClientSocket *textclient), UNUSED_ARG(struct UserNode *user), UNUSED_ARG(struct ChanNode *chan), UNUSED_ARG(char **argv), UNUSED_ARG(char argc), UNUSED_ARG(struct Event *event))
+typedef void cmd_bind_t(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char **argv, char argc, struct Event *event);
 typedef void trigger_callback_t(int clientid, struct ChanNode *chan, char *trigger);
 
 struct cmd_function {
     char *name;
     int botid;
+    int module_id;
     cmd_bind_t *func;
     unsigned int flags;
     int paramcount;
@@ -82,54 +85,48 @@ struct trigger_cache {
     struct trigger_cache *next;
 };
 
-extern int statistics_commands;
-
-void init_modcmd();
-void free_modcmd();
-
 #define get_prefered_bot(BOTID) get_botwise_prefered_bot(BOTID, 0)
-struct ClientSocket* get_botwise_prefered_bot(int botid, int clientid);
-
-int register_command(int botid, char *name, cmd_bind_t *func, int paramcount, char *channel_access, int global_access, unsigned int flags);
-int set_trigger_callback(int botid, trigger_callback_t *func);
-
-int flush_trigger_cache(int botid, int clientid);
-
 #define changeChannelTrigger(BOTID,CHAN,NEW) changeBotwiseChannelTrigger(BOTID, 0, CHAN, NEW)
-int changeBotwiseChannelTrigger(int botid, int clientid, struct ChanNode *chan, char *new_trigger);
-
 #define bind_cmd_to_function(BOTID,CMD,FUNC) bind_botwise_cmd_to_function(BOTID, 0, CMD, FUNC)
-int bind_botwise_cmd_to_function(int botid, int clientid, char *cmd, struct cmd_function *func);
-
 #define bind_cmd_to_command(BOTID,CMD,FUNC) bind_botwise_cmd_to_command(BOTID, 0, CMD, FUNC)
-int bind_botwise_cmd_to_command(int botid, int clientid, char *cmd, char *func);
-
 #define unbind_cmd(BOTID,CMD) unbind_botwise_cmd(BOTID, 0, CMD)
-int unbind_botwise_cmd(int botid, int clientid, char *cmd);
-
-int unbind_botwise_allcmd(int clientid);
-
+#define unbind_allcmd(BOTID) unbind_botwise_allcmd(BOTID, 0)
 #define bind_set_parameters(BOTID,CMD,PARAMETERS) bind_botwise_set_parameters(BOTID, 0, CMD, PARAMETERS)
-void bind_botwise_set_parameters(int botid, int clientid, char *cmd, char *parameters);
-
 #define bind_set_global_access(BOTID,CMD,GACCESS) bind_botwise_set_global_access(BOTID, 0, CMD, GACCESS)
-void bind_botwise_set_global_access(int botid, int clientid, char *cmd, int gaccess);
-
 #define bind_set_channel_access(BOTID,CMD,CACCESS) bind_botwise_set_channel_access(BOTID, 0, CMD, CACCESS)
-void bind_botwise_set_channel_access(int botid, int clientid, char *cmd, char *chanaccess);
-
 #define bind_set_bind_flags(BOTID,CMD,FLAGS) bind_botwise_set_bind_flags(BOTID, 0, CMD, FLAGS)
-void bind_botwise_set_bind_flags(int botid, int clientid, char *cmd, unsigned int flags);
-
 #define find_cmd_binding(BOTID,CMD) find_botwise_cmd_binding(BOTID, 0, CMD)
-struct cmd_binding *find_botwise_cmd_binding(int botid, int clientid, char *cmd);
-
 #define bind_unbound_required_functions(BOTID) bind_botwise_unbound_required_functions(BOTID, 0)
-void bind_botwise_unbound_required_functions(int botid, int clientid);
 
-struct cmd_function *find_cmd_function(int botid, char *name);
-struct ClientSocket *getTextBot();
-void register_command_alias(int botid, char *alias);
-struct cmd_binding *getAllBinds(struct cmd_binding *last);
 
-#endif
\ No newline at end of file
+#ifndef DND_FUNCTIONS
+extern int statistics_commands;
+
+void init_modcmd();
+void free_modcmd();
+
+/* MODULAR ACCESSIBLE */ struct ClientSocket* get_botwise_prefered_bot(int botid, int clientid);
+
+/* MODULAR ACCESSIBLE */ int register_command(int botid, char *name, int module_id, cmd_bind_t *func, int paramcount, char *channel_access, int global_access, unsigned int flags);
+/* MODULAR ACCESSIBLE */ int set_trigger_callback(int botid, int module_id, trigger_callback_t *func);
+
+/* MODULAR ACCESSIBLE */ int flush_trigger_cache(int botid, int clientid);
+/* MODULAR ACCESSIBLE */ int changeBotwiseChannelTrigger(int botid, int clientid, struct ChanNode *chan, char *new_trigger);
+/* MODULAR ACCESSIBLE */ int bind_botwise_cmd_to_function(int botid, int clientid, char *cmd, struct cmd_function *func);
+/* MODULAR ACCESSIBLE */ int bind_botwise_cmd_to_command(int botid, int clientid, char *cmd, char *func);
+/* MODULAR ACCESSIBLE */ int unbind_botwise_cmd(int botid, int clientid, char *cmd);
+/* MODULAR ACCESSIBLE */ int unbind_botwise_allcmd(int botid, int clientid);
+/* MODULAR ACCESSIBLE */ void bind_botwise_set_parameters(int botid, int clientid, char *cmd, char *parameters);
+/* MODULAR ACCESSIBLE */ void bind_botwise_set_global_access(int botid, int clientid, char *cmd, int gaccess);
+/* MODULAR ACCESSIBLE */ void bind_botwise_set_channel_access(int botid, int clientid, char *cmd, char *chanaccess);
+/* MODULAR ACCESSIBLE */ void bind_botwise_set_bind_flags(int botid, int clientid, char *cmd, unsigned int flags);
+/* MODULAR ACCESSIBLE */ struct cmd_binding *find_botwise_cmd_binding(int botid, int clientid, char *cmd);
+/* MODULAR ACCESSIBLE */ void bind_botwise_unbound_required_functions(int botid, int clientid);
+/* MODULAR ACCESSIBLE */ struct cmd_function *find_cmd_function(int botid, char *name);
+/* MODULAR ACCESSIBLE */ void register_command_alias(int botid, char *alias);
+/* MODULAR ACCESSIBLE */ struct cmd_binding *getAllBinds(struct cmd_binding *last);
+
+void unregister_module_commands(int module_id);
+
+#endif
+#endif