RPL_LUSERME: '255',
RPL_LOCALUSERS: '265',
RPL_GLOBALUSERS: '266',
+ RPL_AWAY: '301',
RPL_WHOISREGNICK: '307',
RPL_WHOISUSER: '311',
RPL_WHOISSERVER: '312',
msg: command.trailing
});
},
+ 'RPL_AWAY': function (command) {
+ this.irc_connection.emit('user ' + command.params[1] + ' whoisaway', {
+ nick: command.params[1],
+ reason: command.trailing
+ });
+ },
'RPL_WHOISUSER': function (command) {
this.irc_connection.emit('user ' + command.params[1] + ' whoisuser', {
nick: command.params[1],
msg: command.trailing.substr(1, command.trailing.length - 2)
});
} else {
- namespace = (command.params[0] == this.irc_connection.nick) ? 'user' : 'channel';
+ namespace = (command.params[0] == this.irc_connection.nick || command.params[0] == '*') ?
+ 'user' :
+ 'channel';
+
this.irc_connection.emit(namespace + ' ' + command.params[0] + ' notice', {
- nick: command.nick,
+ from_server: command.prefix ? true : false,
+ nick: command.nick || command.prefix || undefined,
ident: command.ident,
hostname: command.hostname,
target: command.params[0],
// i.e. - for disable, ~ for requires ACK, = for sticky
var capabilities = command.trailing.replace(/[\-~=]/, '').split(' ');
var request;
+
+ // Which capabilities we want to enable
var want = ['multi-prefix', 'away-notify'];
-
+
if (this.irc_connection.password) {
want.push('sasl');
}
-
+
switch (command.params[1]) {
case 'LS':
+ // Compute which of the available capabilities we want and request them
request = _.intersection(capabilities, want);
if (request.length > 0) {
this.irc_connection.cap.requested = request;
break;
case 'ACK':
if (capabilities.length > 0) {
+ // Update list of enabled capabilities
this.irc_connection.cap.enabled = capabilities;
+ // Update list of capabilities we would like to have but that aren't enabled
this.irc_connection.cap.requested = _.difference(this.irc_connection.cap.requested, capabilities);
}
- if (this.irc_connection.cap.requested.length > 0) {
+ if (this.irc_connection.cap.enabled.length > 0) {
if (_.contains(this.irc_connection.cap.enabled, 'sasl')) {
this.irc_connection.sasl = true;
this.irc_connection.write('AUTHENTICATE PLAIN');
this.client.sendIrcCommand('notice', {
server: this.con_num,
+ from_server: true,
nick: command.prefix,
ident: '',
hostname: '',