}
// Make sure we have a valid interface address
- if (typeof outgoing !== 'string')
+ if (typeof outgoing !== 'string') {
outgoing = '0.0.0.0';
+ }
} else {
// No config was found so use the default
false;
// TLS sockets have already called this
- if (!is_tls)
+ if (!is_tls) {
rawSocketConnect.call(that, this);
+ }
that.connected = true;
this.write_buffer.push(encoded_buffer);
// Only flush if we're not writing already
- if (!this.writing_buffer)
+ if (!this.writing_buffer) {
this.flushWriteBuffer();
+ }
};
* Close the connection to the IRCd after forcing one last line
*/
IrcConnection.prototype.end = function (data, callback) {
- if (!this.socket)
+ if (!this.socket) {
return;
+ }
- if (data)
+ if (data) {
this.write(data, true);
+ }
this.socket.end();
};
var chan;
// Only deal with ourselves joining a channel
- if (event.nick !== this.nick)
+ if (event.nick !== this.nick) {
return;
+ }
// We should only ever get a JOIN command for a channel
// we're not already a member of.. but check we don't
var user;
// Only deal with messages targetted to us
- if (event.channel !== this.nick)
+ if (event.channel !== this.nick) {
return;
+ }
if (!this.irc_users[event.nick]) {
user = new IrcUser(this, event.nick);
var user;
// Only deal with messages targetted to us
- if (event.nick !== this.nick)
+ if (event.nick !== this.nick) {
return;
+ }
this.nick = event.newnick;
}
function onUserParts(event) {
// Only deal with ourselves leaving a channel
- if (event.nick !== this.nick)
+ if (event.nick !== this.nick) {
return;
+ }
if (this.irc_channels[event.channel]) {
this.irc_channels[event.channel].dispose();
function onUserKick(event){
// Only deal with ourselves being kicked from a channel
- if (event.kicked !== this.nick)
+ if (event.kicked !== this.nick) {
return;
+ }
if (this.irc_channels[event.channel]) {
this.irc_channels[event.channel].dispose();
that.write('CAP LS');
- if (that.password)
+ if (that.password) {
that.write('PASS ' + that.password);
+ }
that.write('NICK ' + that.nick);
that.write('USER ' + that.username + ' 0 0 :' + gecos);
var hex = parseInt(i, 10).toString(16);
// Pad out the hex value if it's a single char
- if (hex.length === 1)
+ if (hex.length === 1) {
hex = '0' + hex;
+ }
return hex;
}).join('');
}
// Process our data line by line
- for (i = 0; i < lines.length; i++)
+ for (i = 0; i < lines.length; i++) {
parseIrcLine.call(this, lines[i]);
+ }
}