diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-07-15 09:53:36 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-07-15 09:53:36 +0200 |
commit | aa971baa15678c0d1e20af74c9cf82e2b46e8db4 (patch) | |
tree | 0185445faabd6eb0a7d6ba34141f106b6eea4b3f /src | |
parent | a4dac092d2cfcd86aec1a4a9aad8616a9e00cb7a (diff) | |
download | weechat-aa971baa15678c0d1e20af74c9cf82e2b46e8db4.zip |
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).
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-server.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 1cf0cc56a..f6972142d 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -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); |