From cb234b7e31e7eaa6f4fbefc17d5494a65fb4c44f Mon Sep 17 00:00:00 2001 From: Darren Date: Sat, 28 Sep 2013 15:59:22 +0100 Subject: [PATCH] Replace %n with the nick for a custom real name #247 --- config.example.js | 1 + server/irc/connection.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.example.js b/config.example.js index e3cfcde..a86fdb1 100644 --- a/config.example.js +++ b/config.example.js @@ -74,6 +74,7 @@ conf.default_encoding = 'utf8'; /* * Default GECOS (real name) for IRC connections +* %n will be replaced with the users nick */ //conf.default_gecos = 'Web IRC Client'; diff --git a/server/irc/connection.js b/server/irc/connection.js index 5278ad1..f7f8e82 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -564,6 +564,10 @@ var socketConnectHandler = function () { global.modules.emit('irc authorize', connect_data).done(function ircAuthorizeCb() { var gecos = '[www.kiwiirc.com] ' + that.nick; + if (global.config.default_gecos) { + gecos = global.config.default_gecos.toString().replace('%n', that.nick); + } + // Send any initial data for webirc/etc if (connect_data.prepend_data) { _.each(connect_data.prepend_data, function(data) { @@ -577,7 +581,7 @@ var socketConnectHandler = function () { that.write('PASS ' + that.password); that.write('NICK ' + that.nick); - that.write('USER ' + that.username + ' 0 0 :' + (global.config.default_gecos || gecos)); + that.write('USER ' + that.username + ' 0 0 :' + gecos); that.emit('connected'); }); -- 2.25.1