this.cap_negotiation = true;
this.nick = nick;
this.user = user;
+ this.username = this.nick.replace(/[^0-9a-zA-Z\-_.]/, ''),
this.irc_host = {hostname: hostname, port: port};
this.ssl = !(!ssl);
this.options = Object.create(null);
user: this.user,
nick: this.nick,
realname: '[www.kiwiirc.com] ' + this.nick,
- username: this.nick.replace(/[^0-9a-zA-Z\-_.]/, ''),
+ username: this.username,
irc_host: this.irc_host
};
this.write('PASS ' + this.password);
}
this.write('NICK ' + this.nick);
- this.write('USER ' + this.user + ' 0 0 :' + '[www.kiwiirc.com] ' + this.nick);
+ this.write('USER ' + this.username + ' 0 0 :' + '[www.kiwiirc.com] ' + this.nick);
if (this.cap_negotation) {
this.write('CAP END');
}
// Check if we need to pass the users IP as its username/ident
if (ip_as_username && ip_as_username.indexOf(connect_data.irc_host.hostname) > -1) {
// Get a hex value of the clients IP
- this.user = connect_data.user.address.split('.').map(function(i, idx){
+ this.username = connect_data.user.address.split('.').map(function(i, idx){
return parseInt(i, 10).toString(16);
}).join('');