summaryrefslogtreecommitdiff
path: root/src/irc/irc-recv.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-09-07 14:17:10 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-09-07 14:17:10 +0000
commit76263dc7cf7e13ff00fc1a7365733dbae3db53e8 (patch)
treea65e112d1a9ff9f201f402c228424b94e515cbff /src/irc/irc-recv.c
parent554fa728ae94d733d7cebd7ccc666ab479113e8b (diff)
downloadweechat-76263dc7cf7e13ff00fc1a7365733dbae3db53e8.zip
Added IRC command "221"
Diffstat (limited to 'src/irc/irc-recv.c')
-rw-r--r--src/irc/irc-recv.c48
1 files changed, 44 insertions, 4 deletions
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)
*/