diff options
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/irc-commands.c | 2 | ||||
-rw-r--r-- | src/irc/irc-recv.c | 70 | ||||
-rw-r--r-- | src/irc/irc.h | 1 |
3 files changed, 72 insertions, 1 deletions
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c index 904a54e98..a43e2900d 100644 --- a/src/irc/irc-commands.c +++ b/src/irc/irc-commands.c @@ -97,7 +97,7 @@ t_irc_command irc_commands[] = { "kill", N_("close client-server connection"), N_("nickname comment"), N_("nickname: nickname\ncomment: comment for kill"), - 2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, NULL }, + 2, MAX_ARGS, 1, NULL, irc_cmd_send_kill, irc_cmd_recv_kill }, { "links", N_("list all servernames which are known by the server answering the query"), N_("[[server] server_mask]"), N_("server: this server should answer the query\n" diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c index add452e24..c3b3a3e54 100644 --- a/src/irc/irc-recv.c +++ b/src/irc/irc-recv.c @@ -346,6 +346,76 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments) } /* + * irc_cmd_recv_kill: 'kill' message received + */ + +int +irc_cmd_recv_kill (t_irc_server *server, char *host, char *arguments) +{ + char *pos, *pos_host2, *pos_comment; + t_irc_channel *ptr_channel; + + pos = strchr (host, '!'); + if (pos) + pos[0] = '\0'; + + pos_host2 = strchr (arguments, ' '); + if (pos_host2) + { + pos_host2[0] = '\0'; + pos_host2++; + while (pos_host2[0] == ' ') + pos_host2++; + + pos_comment = strchr (pos_host2, ' '); + if (pos_comment) + { + pos_comment[0] = '\0'; + pos_comment++; + while (pos_comment[0] == ' ') + pos_comment++; + if (pos_comment[0] == ':') + pos_comment++; + } + + for (ptr_channel = server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) + { + irc_display_prefix (ptr_channel->buffer, PREFIX_PART); + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK, + "%s", host); + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, + _(" has killed ")); + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK, + "%s", arguments); + if (pos_comment) + { + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, + _(" from server")); + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, + " ("); + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, + "%s", pos_comment); + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, + ")\n"); + } + else + gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, + _(" from server\n")); + } + } + else + { + irc_display_prefix (server->buffer, PREFIX_ERROR); + gui_printf_nolog (server->buffer, + _("%s host \"%s\" not found for \"%s\" command\n"), + WEECHAT_ERROR, "", "kill"); + return -1; + } + return 0; +} + +/* * irc_get_channel_modes: get channel modes */ diff --git a/src/irc/irc.h b/src/irc/irc.h index f0a920f5f..f0d5dc19a 100644 --- a/src/irc/irc.h +++ b/src/irc/irc.h @@ -390,6 +390,7 @@ extern int irc_cmd_recv_error (t_irc_server *, char *, char *); extern int irc_cmd_recv_invite (t_irc_server *, char *, char *); extern int irc_cmd_recv_join (t_irc_server *, char *, char *); extern int irc_cmd_recv_kick (t_irc_server *, char *, char *); +extern int irc_cmd_recv_kill (t_irc_server *, char *, char *); extern int irc_cmd_recv_mode (t_irc_server *, char *, char *); extern int irc_cmd_recv_nick (t_irc_server *, char *, char *); extern int irc_cmd_recv_notice (t_irc_server *, char *, char *); |