Skip to content

Commit

Permalink
Merge pull request #283 from martynsmith/jirwin/set-sane-webirc-defau…
Browse files Browse the repository at this point in the history
…lt-opts

fix(webirc): Set sane defaults for WEBIRC options.
  • Loading branch information
Chris Nehren committed Jan 9, 2015
2 parents a0a5b59 + 4068568 commit e4064db
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

0 comments on commit e4064db

Please sign in to comment.