File: admin.h

package info (click to toggle)
ctrlproxy 3.0.7-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,668 kB
  • ctags: 2,045
  • sloc: ansic: 15,358; sh: 2,805; xml: 1,078; python: 346; makefile: 302; perl: 18
file content (55 lines) | stat: -rw-r--r-- 1,156 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef __CTRLPROXY_ADMIN_H__
#define __CTRLPROXY_ADMIN_H__

/**
 * @file
 * @brief Administration interface
 */

struct admin_handle;

typedef struct admin_handle *admin_handle;

typedef void (*admin_command_handler) (admin_handle, char **, void *userdata);

/**
 * Handle used in the administration subsystem.
 */
struct admin_handle
{
	struct global *global;
	struct irc_client *client;
	struct irc_network *network;
	void *user_data;
	void (*send_fn) (struct admin_handle *, const char *data);
};

/**
 * Administration command
 */
struct admin_command {
	char *name;
	admin_command_handler handler;
	void *userdata;
};

/**
 * Register a new administration command
 */
G_MODULE_EXPORT void register_admin_command(const struct admin_command *cmd);

/**
 * Reply to an administration command.
 *
 * @param h admin handle
 * @param fmt printf-style string to send
 */
G_MODULE_EXPORT void admin_out(admin_handle h, const char *fmt, ...);

G_MODULE_EXPORT struct irc_client *admin_get_client(admin_handle h);

G_MODULE_EXPORT struct irc_network *admin_get_network(admin_handle h);

G_MODULE_EXPORT struct global *admin_get_global(admin_handle h);

#endif