summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc-commands.c1
-rw-r--r--src/irc/irc-recv.c48
-rw-r--r--src/irc/irc-server.c4
-rw-r--r--src/irc/irc.h1
4 files changed, 48 insertions, 6 deletions
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c
index c9fafd06b..c272bec74 100644
--- a/src/irc/irc-commands.c
+++ b/src/irc/irc-commands.c
@@ -302,6 +302,7 @@ t_irc_command irc_commands[] =
{ "020", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "212", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "219", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
+ { "221", N_("user mode string"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_221 },
{ "250", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "251", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
{ "252", N_("a server message"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_server_msg },
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 9e8afed89..6f1e82e51 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -170,10 +170,7 @@ irc_recv_command (t_irc_server *server, char *entire_line,
if (irc_commands[i].recv_function != NULL)
{
command_ignored = ignore_check (host, irc_commands[i].command_name, NULL, server->name);
- if (host)
- pos = strchr (host, '!');
- else
- pos = NULL;
+ pos = (host) ? strchr (host, '!') : NULL;
if (pos)
pos[0] = '\0';
nick = (host) ? strdup (host) : NULL;
@@ -2322,6 +2319,49 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *nick, char *arguments)
}
/*
+ * irc_cmd_recv_221: '221' command (user mode string)
+ */
+
+int
+irc_cmd_recv_221 (t_irc_server *server, char *host, char *nick, char *arguments)
+{
+ char *pos_mode;
+
+ /* make gcc happy */
+ (void) server;
+ (void) host;
+ (void) nick;
+
+ pos_mode = strchr (arguments, ' ');
+ if (pos_mode)
+ {
+ pos_mode[0] = '\0';
+ pos_mode++;
+ while (pos_mode[0] == ' ')
+ pos_mode++;
+
+ if (!command_ignored)
+ {
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("User mode"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, " [");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "/");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, pos_mode);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "]\n");
+ }
+ }
+ else
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot parse \"%s\" command\n"),
+ WEECHAT_ERROR, "221");
+ return -1;
+ }
+}
+
+/*
* irc_cmd_recv_301: '301' command (away message)
*/
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 5f0fe45bd..62d1c91ac 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -663,8 +663,8 @@ server_msgq_flush ()
case -3:
irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
- _("%s Unknown command: cmd=%s, args=%s\n"),
- WEECHAT_WARNING, command, args);
+ _("%s Unknown command: cmd=%s, host=%s, args=%s\n"),
+ WEECHAT_WARNING, command, host, args);
break;
}
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 2fb0255f1..a8f37f7c9 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -459,6 +459,7 @@ extern int irc_cmd_recv_server_reply (t_irc_server *, char *, char *, char *);
extern int irc_cmd_recv_topic (t_irc_server *, char *, char *, char *);
extern int irc_cmd_recv_001 (t_irc_server *, char *, char *, char *);
extern int irc_cmd_recv_004 (t_irc_server *, char *, char *, char *);
+extern int irc_cmd_recv_221 (t_irc_server *, char *, char *, char *);
extern int irc_cmd_recv_301 (t_irc_server *, char *, char *, char *);
extern int irc_cmd_recv_302 (t_irc_server *, char *, char *, char *);
extern int irc_cmd_recv_303 (t_irc_server *, char *, char *, char *);