| 1 |
/* |
| 2 |
* Copyright (c) 2005 William Pitcock, et al. |
| 3 |
* Rights to this code are as documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* Commandlist manipulation routines. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef COMMANDLIST_H |
| 10 |
#define COMMANDLIST_H |
| 11 |
|
| 12 |
typedef struct commandentry_ command_t; |
| 13 |
|
| 14 |
struct commandentry_ { |
| 15 |
const char *name; |
| 16 |
const char *desc; |
| 17 |
const char *access; |
| 18 |
const int maxparc; |
| 19 |
void (*cmd)(sourceinfo_t *, const int parc, char *parv[]); |
| 20 |
struct { |
| 21 |
const char *path; |
| 22 |
void (*func)(sourceinfo_t *, const char *subcmd); |
| 23 |
} help; |
| 24 |
}; |
| 25 |
|
| 26 |
/* commandtree.c */ |
| 27 |
E void command_add(command_t *cmd, mowgli_patricia_t *commandtree); |
| 28 |
E void command_delete(command_t *cmd, mowgli_patricia_t *commandtree); |
| 29 |
E command_t *command_find(mowgli_patricia_t *commandtree, const char *command); |
| 30 |
E void command_exec(service_t *svs, sourceinfo_t *si, command_t *c, int parc, char *parv[]); |
| 31 |
E void command_exec_split(service_t *svs, sourceinfo_t *si, const char *cmd, char *text, mowgli_patricia_t *commandtree); |
| 32 |
E void command_help(sourceinfo_t *si, mowgli_patricia_t *commandtree); |
| 33 |
E void command_help_short(sourceinfo_t *si, mowgli_patricia_t *commandtree, const char *maincmds); |
| 34 |
E bool (*command_authorize)(service_t *svs, sourceinfo_t *si, command_t *c, const char *userlevel); |
| 35 |
|
| 36 |
/* help.c */ |
| 37 |
E void help_display(sourceinfo_t *si, service_t *service, const char *command, mowgli_patricia_t *list); |
| 38 |
E void help_display_as_subcmd(sourceinfo_t *si, service_t *service, const char *subcmd_of, const char *command, mowgli_patricia_t *list); |
| 39 |
|
| 40 |
/* logger.c */ |
| 41 |
E void logaudit_denycmd(sourceinfo_t *si, command_t *cmd, const char *userlevel); |
| 42 |
|
| 43 |
#endif |
| 44 |
|
| 45 |
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs |
| 46 |
* vim:ts=8 |
| 47 |
* vim:sw=8 |
| 48 |
* vim:noexpandtab |
| 49 |
*/ |