Skip to content

Commit

Permalink
fix(webirc): Set sane defaults for WEBIRC options and don't attempt t…
Browse files Browse the repository at this point in the history
…o send the message if they aren't all defined.
  • Loading branch information
jirwin committed Jan 9, 2015
1 parent a0a5b59 commit 4068568
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ function Client(server, nick, opt) {
stripColors: false,
channelPrefixes: '&#',
messageSplit: 512,
encoding: false
encoding: false,
webirc: {
pass: '',
ip: '',
user: ''
}
};

// Features supported by the server
Expand Down Expand Up @@ -679,7 +684,7 @@ Client.prototype.connect = function(retryCount, callback) {
self.conn.authorizationError === 'CERT_HAS_EXPIRED') {
util.log('Connecting to server with expired certificate');
}
if (typeof self.opt.webirc.ip) {
if (self.opt.webirc.ip && self.opt.webirc.pass && self.opt.webirc.host) {
self.send('WEBIRC', self.opt.webirc.pass, self.opt.userName, self.opt.webirc.host, self.opt.webirc.ip);
}
if (self.opt.password) {
Expand Down Expand Up @@ -711,7 +716,7 @@ Client.prototype.connect = function(retryCount, callback) {
// see http://ircv3.atheme.org/extensions/sasl-3.1
self.send('CAP REQ', 'sasl');
}
if (typeof self.opt.webirc.ip) {
if (self.opt.webirc.ip && self.opt.webirc.pass && self.opt.webirc.host) {
self.send('WEBIRC', self.opt.webirc.pass, self.opt.userName, self.opt.webirc.host, self.opt.webirc.ip);
}else if (self.opt.password) {
self.send('PASS', self.opt.password);
Expand Down

1 comment on commit 4068568

@Trinitas
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to delete Webirc at line 46

Please sign in to comment.