1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

irc: fix format of message "USER" (according to RFC 2812) (bug #36825)

Old format was:  USER username username address :real name
New format is :  USER username 0 * :real name

And now spaces are automatically replaced by underscores in username
(since no space is allowed here).
This commit is contained in:
Sebastien Helleu
2012-07-15 09:53:36 +02:00
parent a4dac092d2
commit aa971baa15
2 changed files with 10 additions and 6 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.9-dev, 2012-07-14
v0.3.9-dev, 2012-07-15
Version 0.3.9 (under dev!)
@@ -34,6 +34,7 @@ Version 0.3.9 (under dev!)
internal WeeChat charset)
* guile: fix crash when unloading a script without pointer to interpreter
* guile: fix path of guile include dirs in cmake build (patch #7790)
* irc: fix format of message "USER" (according to RFC 2812) (bug #36825)
* irc: add bar item "buffer_modes", remove option irc.look.item_channel_modes
(task #12022)
* irc: fix parsing of user modes (ignore everything after first space)
+8 -5
View File
@@ -2793,6 +2793,7 @@ void
irc_server_login (struct t_irc_server *server)
{
const char *password, *username, *realname, *capabilities;
char *username2;
password = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD);
username = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME);
@@ -2817,14 +2818,16 @@ irc_server_login (struct t_irc_server *server)
irc_server_sendf (server, 0, NULL, "CAP LS");
}
username2 = (username && username[0]) ?
weechat_string_replace (username, " ", "_") : strdup ("weechat");
irc_server_sendf (server, 0, NULL,
"NICK %s\n"
"USER %s %s %s :%s",
"USER %s 0 * :%s",
server->nick,
(username && username[0]) ? username : "weechat",
(username && username[0]) ? username : "weechat",
server->current_address,
(realname && realname[0]) ? realname : ((username && username[0]) ? username : "weechat"));
(username2) ? username2 : "weechat",
(realname && realname[0]) ? realname : ((username2) ? username2 : "weechat"));
if (username2)
free (username2);
if (server->hook_timer_connection)
weechat_unhook (server->hook_timer_connection);