summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-06-20 14:04:17 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-06-20 14:04:17 +0000
commitabe7e081478f3c22a0407d08b5a4d059dd7e44f3 (patch)
tree22a7b93ee71b9629aa60ce951dbae77faab737fd
parent4e9193a943a0ba3c38b11f0380fd224ef552ce32 (diff)
downloadweechat-abe7e081478f3c22a0407d08b5a4d059dd7e44f3.zip
kill command now received and displayed
-rw-r--r--ChangeLog3
-rw-r--r--src/irc/irc-commands.c2
-rw-r--r--src/irc/irc-recv.c70
-rw-r--r--src/irc/irc.h1
-rw-r--r--weechat/ChangeLog3
-rw-r--r--weechat/src/irc/irc-commands.c2
-rw-r--r--weechat/src/irc/irc-recv.c70
-rw-r--r--weechat/src/irc/irc.h1
8 files changed, 148 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5386892c6..96f841364 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2005-06-19
+ChangeLog - 2005-06-20
Version 0.1.3 (under dev!):
+ * kill command now received and displayed
* SSL support (currently in development, NOT WORKING!)
* channel notify levels are saved in config file (new option
"server_notify_levels" for server sections)
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 *);
diff --git a/weechat/ChangeLog b/weechat/ChangeLog
index 5386892c6..96f841364 100644
--- a/weechat/ChangeLog
+++ b/weechat/ChangeLog
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2005-06-19
+ChangeLog - 2005-06-20
Version 0.1.3 (under dev!):
+ * kill command now received and displayed
* SSL support (currently in development, NOT WORKING!)
* channel notify levels are saved in config file (new option
"server_notify_levels" for server sections)
diff --git a/weechat/src/irc/irc-commands.c b/weechat/src/irc/irc-commands.c
index 904a54e98..a43e2900d 100644
--- a/weechat/src/irc/irc-commands.c
+++ b/weechat/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/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c
index add452e24..c3b3a3e54 100644
--- a/weechat/src/irc/irc-recv.c
+++ b/weechat/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/weechat/src/irc/irc.h b/weechat/src/irc/irc.h
index f0a920f5f..f0d5dc19a 100644
--- a/weechat/src/irc/irc.h
+++ b/weechat/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 *);