From: Darren Date: Sat, 28 Sep 2013 14:59:22 +0000 (+0100) Subject: Replace %n with the nick for a custom real name #247 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cb234b7e31e7eaa6f4fbefc17d5494a65fb4c44f;p=KiwiIRC.git Replace %n with the nick for a custom real name #247 --- 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'); });