added some code & compiler information to cmd_netinfo
[NeonServV5.git] / modcmd.h
1 #ifndef _modcmd_h
2 #define _modcmd_h
3 #include "main.h"
4
5 #define CMDFLAG_REQUIRE_CHAN 0x01
6 #define CMDFLAG_REQUIRE_AUTH 0x02
7 #define CMDFLAG_REQUIRE_GOD  0x04
8 #define CMDFLAG_CHECK_AUTH   0x08
9 #define CMDFLAG_REGISTERED_CHAN 0x10
10 #define CMDFLAG_OVERRIDE_GLOBAL_ACCESS 0x20
11 #define CMDFLAG_OVERRIDE_CHANNEL_ACCESS 0x40
12
13 struct ClientSocket;
14 struct UserNode;
15 struct ChanNode;
16
17 #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))
18 typedef void cmd_bind_t(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, char **argv, char argc);
19 typedef void trigger_callback_t(struct ChanNode *chan, char *trigger);
20
21 struct cmd_function {
22     char *name;
23     int botid;
24     cmd_bind_t *func;
25     unsigned int flags;
26     int paramcount;
27     int global_access;
28     char *channel_access;
29     
30     struct cmd_function *next;
31 };
32
33 struct cmd_binding {
34     char *cmd;
35     int botid;
36     struct cmd_function *func;
37     unsigned int flags;
38     char *parameters;
39     int global_access;
40     char *channel_access;
41     
42     struct cmd_binding *next;
43 };
44
45 struct trigger_cache {
46     int botid;
47     char *trigger;
48     
49     struct trigger_cache *next;
50 };
51
52 void init_modcmd();
53 void free_modcmd();
54 struct ClientSocket* get_prefered_bot(int botid);
55 int register_command(int botid, char *name, cmd_bind_t *func, int paramcount, unsigned int flags, char *channel_access, int global_access);
56 int set_trigger_callback(int botid, trigger_callback_t *func);
57 int changeChannelTrigger(int botid, struct ChanNode *chan, char *new_trigger);
58 int bind_cmd_to_function(int botid, char *cmd, struct cmd_function *func);
59 int bind_cmd_to_command(int botid, char *cmd, char *func);
60 int unbind_cmd(int botid, char *cmd);
61 struct ClientSocket *getTextBot();
62 void bind_set_parameters(int botid, char *cmd, char *parameters);
63 void bind_set_global_access(int botid, char *cmd, int gaccess);
64 void bind_set_channel_access(int botid, char *cmd, char *chanaccess);
65
66 #endif