/[svn]/vendor/ircservices-5.1.24/commands.h
ViewVC logotype

Contents of /vendor/ircservices-5.1.24/commands.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1171 - (show annotations)
Fri Aug 12 20:00:46 2011 UTC (10 years, 3 months ago) by michael
File MIME type: text/x-csrc
File size: 3944 byte(s)
- Import ircservices-5.1.24. Don't ever think about modifying anything in this
  folder!
  Since Andrew Church has discontinued his services project in April 2011, the
  ircd-hybrid team has been given permissions to officially continue and
  maintain the already mentioned project.
  The name of this project will be changed for the reason being that the current
  name "IRC Services" is way too generic these days.

  Remember: Don't ever modify anything in here. This folder is kept for reference.

1 /* Declarations for command data.
2 *
3 * IRC Services is copyright (c) 1996-2009 Andrew Church.
4 * E-mail: <achurch@achurch.org>
5 * Parts written by Andrew Kempe and others.
6 * This program is free but copyrighted software; see the file GPL.txt for
7 * details.
8 */
9
10 #ifndef COMMANDS_H
11 #define COMMANDS_H
12
13 /* Note that modules.h MUST be included before this file (for the Module
14 * type). */
15
16 /*************************************************************************/
17
18 /* Structure for information about a *Serv command. */
19
20 typedef struct command_ Command;
21 struct command_ {
22 const char *name;
23 void (*routine)(User *u);
24 int (*has_priv)(const User *u); /* Returns 1 if user may use cmd, else 0 */
25 int helpmsg_all; /* Displayed to all users; -1 = no message */
26 int helpmsg_reg; /* Displayed to regular users only */
27 int helpmsg_oper; /* Displayed to IRC operators only */
28 const char *help_param1;
29 const char *help_param2;
30 const char *help_param3;
31 const char *help_param4;
32 Command *next; /* Next command with this name */
33 };
34
35 /*************************************************************************/
36
37 /* Commands must be registered with Services to be usable; an array of
38 * Command structures (terminated with name == NULL) can be registered and
39 * unregistered with the following routines. All routines return 1 on
40 * success, 0 on failure. ("Failure" occurs only when parameters are
41 * invalid.)
42 */
43
44 /* Set up a new command list using the given module pointer as an ID value.
45 * Fails if a command list associated with `id' already exists. */
46 extern int new_commandlist(Module *id);
47
48 /* Register a command array under the given ID. Fails if there is no
49 * command list associated with `id', `array' is NULL, `array' has already
50 * been added to the list, or there are multiple command entries in `array'
51 * with the same name (case-insensitive). If an entry in `array' has the
52 * same name as a previously-registered entry, the entry in `array' will
53 * take precendence, and a pointer to the previous entry will be stored in
54 * the `next' field of the entry. */
55 extern int register_commands(Module *id, Command *array);
56
57 /* Unregister a command array from the given ID. Fails if there is no
58 * command list associated with `id' or `array' was not in the list in the
59 * first place. */
60 extern int unregister_commands(Module *id, Command *array);
61
62 /* Delete the command list associated with the given ID. Fails if there is
63 * no command list associated with `id' or the command list is not empty. */
64 extern int del_commandlist(Module *id);
65
66 /*************************************************************************/
67
68 /* Routines for looking up and doing other things with commands. */
69
70 /* Returns the Command structure associated with the given command for the
71 * given command list (`id'), or NULL if no such command exists. */
72 extern Command *lookup_cmd(Module *id, const char *name);
73
74 /* Runs the routine associated with the given command, sending a help
75 * message if there is no such command or the user does not have privileges
76 * to use the command. Equivalent to
77 * lookup_cmd(id,name)->routine(u)
78 * with privilege and error checking. */
79 extern void run_cmd(const char *service, User *u, Module *id, const char *cmd);
80
81 /* Sends the help message associated with the given command, or a generic
82 * "command not found" message if there is no such command. Multiple
83 * spaces in `cmd' will be compressed to a single space (thus modifying the
84 * string). */
85 extern void help_cmd(const char *service, User *u, Module *id, char *cmd);
86
87 /*************************************************************************/
88
89 #endif /* COMMANDS_H */
90
91 /*
92 * Local variables:
93 * c-file-style: "stroustrup"
94 * c-file-offsets: ((case-label . *) (statement-case-intro . *))
95 * indent-tabs-mode: nil
96 * End:
97 *
98 * vim: expandtab shiftwidth=4:
99 */

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28