diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-02 01:05:14 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-02 01:05:14 +0000 |
commit | f354fe54c71485516b76fdd149891191993f60b5 (patch) | |
tree | 1231e8f5e1126c4fa9544a9ce40ce54ace6e05d1 /src/irc/core/modes.c | |
parent | 95b94ed83c1372fae4eb14bf8109847bdc65a8d2 (diff) | |
download | irssi-f354fe54c71485516b76fdd149891191993f60b5.zip |
Moved some stuff from irc to core. Added command_bind_proto() function to
bind protocol-specific commands. Added #define command_bind_irc() for easier
access. CMD_IRC_SERVER(server) check should be done at the beginning of each
command requiring IRC server as active server, it handles it correctly the
cases when it is not. Did some other cleanups as well.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1955 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/core/modes.c')
-rw-r--r-- | src/irc/core/modes.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index 8c102e9a..25b212c2 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -20,10 +20,11 @@ #include "module.h" #include "signals.h" -#include "commands.h" #include "settings.h" -#include "irc.h" +#include "irc-commands.h" +#include "irc-servers.h" +#include "irc-channels.h" #include "modes.h" #include "mode-lists.h" #include "nicklist.h" @@ -590,8 +591,7 @@ static void cmd_op(const char *data, IRC_SERVER_REC *server, { char *nicks; - if (!IS_IRC_CHANNEL(channel)) - return; + CMD_IRC_SERVER(server); nicks = get_nicks(channel, data, 0, -1); if (nicks != NULL && *nicks != '\0') @@ -605,8 +605,7 @@ static void cmd_deop(const char *data, IRC_SERVER_REC *server, { char *nicks; - if (!IS_IRC_CHANNEL(channel)) - return; + CMD_IRC_SERVER(server); nicks = get_nicks(channel, data, 1, -1); if (nicks != NULL && *nicks != '\0') @@ -620,8 +619,7 @@ static void cmd_voice(const char *data, IRC_SERVER_REC *server, { char *nicks; - if (!IS_IRC_CHANNEL(channel)) - return; + CMD_IRC_SERVER(server); nicks = get_nicks(channel, data, 0, 0); if (nicks != NULL && *nicks != '\0') @@ -635,8 +633,7 @@ static void cmd_devoice(const char *data, IRC_SERVER_REC *server, { char *nicks; - if (!IS_IRC_CHANNEL(channel)) - return; + CMD_IRC_SERVER(server); nicks = get_nicks(channel, data, -1, 1); if (nicks != NULL && *nicks != '\0') @@ -651,9 +648,7 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server, char *target, *mode; void *free_arg; - g_return_if_fail(data != NULL); - if (server == NULL || !server->connected || !IS_IRC_SERVER(server)) - cmd_return_error(CMDERR_NOT_CONNECTED); + CMD_IRC_SERVER(server); if (*data == '+' || *data == '-') { target = "*"; @@ -692,11 +687,11 @@ void modes_init(void) signal_add("event 381", (SIGNAL_FUNC) event_oper); signal_add("event mode", (SIGNAL_FUNC) event_mode); - command_bind("op", NULL, (SIGNAL_FUNC) cmd_op); - command_bind("deop", NULL, (SIGNAL_FUNC) cmd_deop); - command_bind("voice", NULL, (SIGNAL_FUNC) cmd_voice); - command_bind("devoice", NULL, (SIGNAL_FUNC) cmd_devoice); - command_bind("mode", NULL, (SIGNAL_FUNC) cmd_mode); + command_bind_irc("op", NULL, (SIGNAL_FUNC) cmd_op); + command_bind_irc("deop", NULL, (SIGNAL_FUNC) cmd_deop); + command_bind_irc("voice", NULL, (SIGNAL_FUNC) cmd_voice); + command_bind_irc("devoice", NULL, (SIGNAL_FUNC) cmd_devoice); + command_bind_irc("mode", NULL, (SIGNAL_FUNC) cmd_mode); } void modes_deinit(void) |