RPL_WELCOME: '001',
RPL_MYINFO: '004',
RPL_ISUPPORT: '005',
+ RPL_WHOISREGNICK: '307',
RPL_WHOISUSER: '311',
RPL_WHOISSERVER: '312',
RPL_WHOISOPERATOR: '313',
command.command = 'RPL_ENDOFWHOIS';
this.client.sendIRCCommand(command);*/
//websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: true});
- this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: true});
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], msg: command.trailing, end: true});
},
'RPL_WHOISUSER': function (command) {
/*command.server = this.con_num;
command.command = 'RPL_WHOISUSER';
this.client.sendIRCCommand(command);*/
//websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
- this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false});
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], ident: command.params[2], host: command.params[3], msg: command.trailing, end: false});
},
'RPL_WHOISSERVER': function (command) {
/*command.server = this.con_num;
command.command = 'RPL_WHOISSERVER';
this.client.sendIRCCommand(command);*/
//websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
- this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false});
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], server: command.params[2], end: false});
},
'RPL_WHOISOPERATOR': function (command) {
/*command.server = this.con_num;
command.command = 'RPL_WHOISOPERATOR';
this.client.sendIRCCommand(command);*/
//websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
- this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false});
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], msg: command.trailing, end: false});
},
'RPL_WHOISCHANNELS': function (command) {
/*command.server = this.con_num;
command.command = 'RPL_WHOISCHANNELS';
this.client.sendIRCCommand(command);*/
//websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
- this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false});
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], chans: command.trailing, end: false});
},
'RPL_WHOISMODES': function (command) {
/*command.server = this.con_num;
command.command = 'RPL_WHOISMODES';
this.client.sendIRCCommand(command);*/
//websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
- this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false});
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], msg: command.trailing, end: false});
},
'RPL_WHOISIDLE': function (command) {
/*command.server = this.con_num;
command.command = 'RPL_WHOISIDLE';
this.client.sendIRCCommand(command);*/
//websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
- this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false});
+ if (command.params[3]) {
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], idle: command.params[2], logon: command.params[3], end: false});
+ } else {
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], idle: command.params[2], end: false});
+ }
+ },
+ 'RPL_WHOISREGNICK': function (command) {
+ this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], msg: command.trailing, end: false});
},
'RPL_LISTSTART': function (command) {
/*command.server = this.con_num;
//{nick: msg.nick, channel: msg.params, topic: msg.trailing};
this.client.sendIRCCommand('topic', {server: this.con_num, nick: command.nick, channel: command.params[0], topic: command.trailing});
},
- 'MODE': function (command) {
- /*command.server = this.con_num;
- command.command = 'MODE';
- this.client.sendIRCCommand(command);*/
- var ret = { server: this.con_num, nick: command.nick };
- switch (command.params.length) {
- case 1:
- ret.affected_nick = command.params[0];
- ret.mode = command.trailing;
- break;
- case 2:
- ret.channel = command.params[0];
- ret.mode = command.params[1];
- break;
- default:
- ret.channel = command.params[0];
- ret.mode = command.params[1];
- ret.affected_nick = command.params[2];
- break;
+ 'MODE': function (command) {
+ var chanmodes = this.irc_connection.options.CHANMODES,
+ prefixes = this.irc_connection.options.PREFIX,
+ always_param = chanmodes[0].concat(chanmodes[1]),
+ modes = [],
+ has_param, i, j, add;
+
+ prefixes = _.reduce(prefixes, function (list, prefix) {
+ list.push(prefix.mode);
+ return list;
+ }, []);
+ always_param = always_param.split('').concat(prefixes);
+
+ has_param = function (mode, add) {
+ if (_.find(always_param, function (m) {
+ return m === mode;
+ })) {
+ return true;
+ } else if (add && _.find(chanmodes[2].split(''), function (m) {
+ return m === mode;
+ })) {
+ return true;
+ } else {
+ return false;
+ }
+ };
+
+ if (!command.params[1]) {
+ command.params[1] = command.trailing;
+ }
+ j = 0;
+ for (i = 0; i < command.params[1].length; i++) {
+ switch (command.params[1][i]) {
+ case '+':
+ add = true;
+ break;
+ case '-':
+ add = false;
+ break;
+ default:
+ if (has_param(command.params[1][i], add)) {
+ modes.push({mode: (add ? '+' : '-') + command.params[1][i], param: command.params[2 + j]});
+ j++;
+ } else {
+ modes.push({mode: (add ? '+' : '-') + command.params[1][i], param: null});
+ }
+ }
}
- this.client.sendIRCCommand('mode', ret);
+
+ this.client.sendIRCCommand('mode', {
+ server: this.con_num,
+ target: command.params[0],
+ nick: command.nick || command.prefix || '',
+ modes: modes
+ });
},
'PRIVMSG': function (command) {
/*command.server = this.con_num;