Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webirc): Set sane defaults for WEBIRC options. #283

Merged
1 commit merged into from
Jan 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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