X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Firssi%2Fsrc%2Fcore%2Fcommands.h;h=1733c589e4debbfacaea7f3881474934e928f924;hb=9601176a506c8a545a954891e5e25552e9609159;hp=e3bf4374346d94e32242878ee8bce9efff304f90;hpb=8efe5c6b18756ea335788ebf0afdf294764f4c26;p=crypto.git diff --git a/apps/irssi/src/core/commands.h b/apps/irssi/src/core/commands.h index e3bf4374..1733c589 100644 --- a/apps/irssi/src/core/commands.h +++ b/apps/irssi/src/core/commands.h @@ -3,11 +3,16 @@ #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 */