diff options
author | Timo Sirainen <cras@irssi.org> | 2002-04-16 18:11:06 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-04-16 18:11:06 +0000 |
commit | c7320514aaf0e97b4a628fec301fd9c4d1fe2a7d (patch) | |
tree | e4f1ce9ef5c73ada83ddf414e4ceaf35c1dd4d93 /src/core/commands.h | |
parent | c5b852ed57a8a54b5981c04492f6823c98304e74 (diff) | |
download | irssi-c7320514aaf0e97b4a628fec301fd9c4d1fe2a7d.zip |
fixes for new signaling code.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2691 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/commands.h')
-rw-r--r-- | src/core/commands.h | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/core/commands.h b/src/core/commands.h index e3bf4374..1733c589 100644 --- a/src/core/commands.h +++ b/src/core/commands.h @@ -4,10 +4,15 @@ #include "signals.h" typedef struct { + SIGNAL_FUNC func; + void *user_data; +} COMMAND_CALLBACK_REC; + +typedef struct { char *name; char *options; int protocol; /* chat protocol required for this command */ - GSList *signals; + GSList *callbacks; } COMMAND_MODULE_REC; typedef struct { @@ -57,17 +62,23 @@ extern GSList *commands; extern char *current_command; /* the command we're right now. */ /* Bind command to specified function. */ -void command_bind_to(const char *module, int pos, const char *cmd, - int protocol, const char *category, SIGNAL_FUNC func); -#define command_bind(a, b, c) command_bind_to(MODULE_NAME, 1, a, -1, b, c) -#define command_bind_first(a, b, c) command_bind_to(MODULE_NAME, 0, a, -1, b, c) -#define command_bind_last(a, b, c) command_bind_to(MODULE_NAME, 2, a, -1, b, c) - -#define command_bind_proto(a, b, c, d) command_bind_to(MODULE_NAME, 1, a, b, c, d) -#define command_bind_proto_first(a, b, c, d) command_bind_to(MODULE_NAME, 0, a, b, c, d) -#define command_bind_proto_last(a, b, c, d) command_bind_to(MODULE_NAME, 2, a, b, c, d) - -void command_unbind(const char *cmd, SIGNAL_FUNC func); +void command_bind_full(const char *module, int priority, const char *cmd, + int protocol, const char *category, SIGNAL_FUNC func, + void *user_data); +#define command_bind(a, b, c) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, a, -1, b, c, NULL) +#define command_bind_first(a, b, c) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, a, -1, b, c, NULL) +#define command_bind_last(a, b, c) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, a, -1, b, c, NULL) + +#define command_bind_data(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, a, -1, b, c, d) +#define command_bind_data_first(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, a, -1, b, c, d) +#define command_bind_data_last(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, a, -1, b, c, d) + +#define command_bind_proto(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_DEFAULT, a, b, c, d, NULL) +#define command_bind_proto_first(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, a, b, c, d, NULL) +#define command_bind_proto_last(a, b, c, d) command_bind_full(MODULE_NAME, SIGNAL_PRIORITY_LOW, a, b, c, d, NULL) + +void command_unbind_full(const char *cmd, SIGNAL_FUNC func, void *user_data); +#define command_unbind(cmd, func) command_unbind_full(cmd, func, NULL) /* Run subcommand, `cmd' contains the base command, first word in `data' contains the subcommand */ |