summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/irc/irc-commands.c7
-rw-r--r--src/irc/irc-recv.c70
-rw-r--r--src/irc/irc-send.c25
-rw-r--r--src/irc/irc.h1
4 files changed, 94 insertions, 9 deletions
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c
index 0c87fc2bc..b98b038ab 100644
--- a/src/irc/irc-commands.c
+++ b/src/irc/irc-commands.c
@@ -152,8 +152,10 @@ t_irc_command irc_commands[] =
N_("[channel[,channel]]"), N_("channel: channel name"),
0, 1, 1, NULL, irc_cmd_send_names, NULL },
{ "nick", N_("change current nickname"),
- N_("nickname"), N_("nickname: new nickname for current IRC server"),
- 1, 1, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick },
+ N_("[-all] nickname"),
+ N_("-all: set new nickname for all connected servers\n"
+ "nickname: new nickname"),
+ 1, 2, 1, irc_cmd_send_nick, NULL, irc_cmd_recv_nick },
{ "notice", N_("send notice message to user"),
N_("nickname text"), N_("nickname: user to send notice to\ntext: text to send"),
2, MAX_ARGS, 1, NULL, irc_cmd_send_notice, irc_cmd_recv_notice },
@@ -321,6 +323,7 @@ t_irc_command irc_commands[] =
{ "333", N_("infos about topic (nick & date changed)"),
"", "",
0, 0, 1, NULL, NULL, irc_cmd_recv_333 },
+ { "341", N_("inviting"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_341 },
{ "351", N_("server version"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_351 },
{ "352", N_("who"), "", "", 0, 0, 1, NULL, NULL, irc_cmd_recv_352 },
{ "353", N_("list of nicks on channel"),
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index b834188c9..9145e6ccb 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -2892,6 +2892,68 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
/*
+ * irc_cmd_recv_341: '341' command received (inviting)
+ */
+
+int
+irc_cmd_recv_341 (t_irc_server *server, char *host, char *arguments)
+{
+ char *pos, *pos_nick, *pos_channel;
+
+ pos = strchr (host, '!');
+ if (pos)
+ pos[0] = '\0';
+
+ pos_nick = strchr (arguments, ' ');
+ if (pos_nick)
+ {
+ pos_nick[0] = '\0';
+ pos_nick++;
+ while (pos_nick[0] == ' ')
+ pos_nick++;
+
+ pos_channel = strchr (pos_nick, ' ');
+ if (pos_channel)
+ {
+ pos_channel[0] = '\0';
+ pos_channel++;
+ while (pos_channel[0] == ' ')
+ pos_channel++;
+ if (pos_channel[0] == ':')
+ pos_channel++;
+
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
+ "%s ", arguments);
+ gui_printf (server->buffer, _("has invited"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK,
+ " %s ", pos_nick);
+ gui_printf (server->buffer, _("on"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL,
+ " %s\n", pos_channel);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ }
+ else
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot identify channel for \"%s\" command\n"),
+ WEECHAT_ERROR, "341");
+ return -1;
+ }
+ }
+ else
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
+ gui_printf_nolog (server->buffer,
+ _("%s cannot identify nickname for \"%s\" command\n"),
+ WEECHAT_ERROR, "341");
+ return -1;
+ }
+ return 0;
+}
+
+/*
* irc_cmd_recv_351: '351' command received (server version)
*/
@@ -3014,16 +3076,16 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
PREFIX_SERVER);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK,
- "%s", pos_nick);
+ "%s ", pos_nick);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
- _(" on "));
+ _("on"));
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
- "%s ", pos_channel);
+ " %s", pos_channel);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
- "%s %s ",
+ " %s %s ",
pos_attr, pos_hopcount);
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST,
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index a49ef7e4d..f0610d8a6 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -1033,9 +1033,28 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
int
irc_cmd_send_nick (t_irc_server *server, int argc, char **argv)
{
- if (argc != 1)
- return -1;
- server_sendf (server, "NICK %s\r\n", argv[0]);
+ t_irc_server *ptr_server;
+
+ if (argc == 2)
+ {
+ if (strncmp (argv[0], "-all", 4) != 0)
+ return -1;
+
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ if (ptr_server->is_connected)
+ server_sendf (ptr_server, "NICK %s\r\n", argv[1]);
+ }
+ }
+ else
+ {
+ if (argc == 1)
+ server_sendf (server, "NICK %s\r\n", argv[0]);
+ else
+ return -1;
+ }
+
return 0;
}
diff --git a/src/irc/irc.h b/src/irc/irc.h
index a6a7fa2ee..f2bbb4692 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -415,6 +415,7 @@ extern int irc_cmd_recv_329 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_331 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_332 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_333 (t_irc_server *, char *, char *);
+extern int irc_cmd_recv_341 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_351 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_352 (t_irc_server *, char *, char *);
extern int irc_cmd_recv_353 (t_irc_server *, char *, char *);