a78b3d49e76e6d08b1da5079c0b3740c3afdeeb7
1 var _
= require('underscore');
7 RPL_WHOISREGNICK
: '307',
9 RPL_WHOISSERVER
: '312',
10 RPL_WHOISOPERATOR
: '313',
12 RPL_ENDOFWHOIS
: '318',
13 RPL_WHOISCHANNELS
: '319',
19 RPL_TOPICWHOTIME
: '333',
21 RPL_ENDOFNAMES
: '366',
23 RPL_ENDOFBANLIST
: '368',
27 RPL_WHOISMODES
: '379',
28 ERR_NOSUCHNICK
: '401',
29 ERR_CANNOTSENDTOCHAN
: '404',
30 ERR_TOOMANYCHANNELS
: '405',
31 ERR_NICKNAMEINUSE
: '433',
32 ERR_USERNOTINCHANNEL
: '441',
33 ERR_NOTONCHANNEL
: '442',
34 ERR_NOTREGISTERED
: '451',
35 ERR_LINKCHANNEL
: '470',
36 ERR_CHANNELISFULL
: '471',
37 ERR_INVITEONLYCHAN
: '473',
38 ERR_BANNEDFROMCHAN
: '474',
39 ERR_BADCHANNELKEY
: '475',
40 ERR_CHANOPRIVSNEEDED
: '482',
45 var IrcCommands = function (irc_connection
, con_num
, client
) {
46 this.irc_connection
= irc_connection
;
47 this.con_num
= con_num
;
50 module
.exports
= IrcCommands
;
52 IrcCommands
.prototype.bindEvents = function () {
55 _
.each(listeners
, function (listener
, command
) {
56 var s
= command
.substr(0, 4);
57 if ((s
=== 'RPL_') || (s
=== 'ERR_')) {
58 command
= irc_numerics
[command
];
60 that
.irc_connection
.on('irc_' + command
, function () {
61 listener
.apply(that
, arguments
);
69 'RPL_WELCOME': function (command
) {
70 var nick
= command
.params
[0];
71 this.irc_connection
.registered
= true;
72 this.client
.sendIrcCommand('connect', {server
: this.con_num
, nick
: nick
});
74 'RPL_ISUPPORT': function (command
) {
75 var options
, i
, option
, matches
, j
;
76 options
= command
.params
;
77 for (i
= 1; i
< options
.length
; i
++) {
78 option
= options
[i
].split("=", 2);
79 option
[0] = option
[0].toUpperCase();
80 this.irc_connection
.options
[option
[0]] = (typeof option
[1] !== 'undefined') ? option
[1] : true;
81 if (_
.include(['NETWORK', 'PREFIX', 'CHANTYPES', 'CHANMODES', 'NAMESX'], option
[0])) {
82 if (option
[0] === 'PREFIX') {
83 matches
= /\(([^)]*)\)(.*)/.exec(option
[1]);
84 if ((matches
) && (matches
.length
=== 3)) {
85 this.irc_connection
.options
.PREFIX
= [];
86 for (j
= 0; j
< matches
[2].length
; j
++) {
87 this.irc_connection
.options
.PREFIX
.push({symbol
: matches
[2].charAt(j
), mode
: matches
[1].charAt(j
)});
90 } else if (option
[0] === 'CHANTYPES') {
91 this.irc_connection
.options
.CHANTYPES
= this.irc_connection
.options
.CHANTYPES
.split('');
92 } else if (option
[0] === 'CHANMODES') {
93 this.irc_connection
.options
.CHANMODES
= option
[1].split(',');
94 } else if (option
[0] === 'NAMESX') {
95 this.irc_connection
.write('PROTOCTL NAMESX');
99 //this.client.sendIrcCommand({server: this.con_num, command: 'RPL_ISUPPORT', options: this.irc_connection.options});
100 //websocket.sendClientEvent('options', {server: '', "options": irc_connection.IRC.options});
101 this.client
.sendIrcCommand('options', {server
: this.con_num
, options
: this.irc_connection
.options
});
103 'RPL_ENDOFWHOIS': function (command
) {
104 /*command.server = this.con_num;
105 command.command = 'RPL_ENDOFWHOIS';
106 this.client.sendIrcCommand(command);*/
107 //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: true});
108 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], msg
: command
.trailing
, end
: true});
110 'RPL_WHOISUSER': function (command
) {
111 /*command.server = this.con_num;
112 command.command = 'RPL_WHOISUSER';
113 this.client.sendIrcCommand(command);*/
114 //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
115 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});
117 'RPL_WHOISSERVER': function (command
) {
118 /*command.server = this.con_num;
119 command.command = 'RPL_WHOISSERVER';
120 this.client.sendIrcCommand(command);*/
121 //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
122 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], server
: command
.params
[2], end
: false});
124 'RPL_WHOISOPERATOR': function (command
) {
125 /*command.server = this.con_num;
126 command.command = 'RPL_WHOISOPERATOR';
127 this.client.sendIrcCommand(command);*/
128 //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
129 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], msg
: command
.trailing
, end
: false});
131 'RPL_WHOISCHANNELS': function (command
) {
132 /*command.server = this.con_num;
133 command.command = 'RPL_WHOISCHANNELS';
134 this.client.sendIrcCommand(command);*/
135 //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
136 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], chans
: command
.trailing
, end
: false});
138 'RPL_WHOISMODES': function (command
) {
139 /*command.server = this.con_num;
140 command.command = 'RPL_WHOISMODES';
141 this.client.sendIrcCommand(command);*/
142 //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
143 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], msg
: command
.trailing
, end
: false});
145 'RPL_WHOISIDLE': function (command
) {
146 /*command.server = this.con_num;
147 command.command = 'RPL_WHOISIDLE';
148 this.client.sendIrcCommand(command);*/
149 //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false});
150 if (command
.params
[3]) {
151 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], idle
: command
.params
[2], logon
: command
.params
[3], end
: false});
153 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], idle
: command
.params
[2], end
: false});
156 'RPL_WHOISREGNICK': function (command
) {
157 this.client
.sendIrcCommand('whois', {server
: this.con_num
, nick
: command
.params
[1], msg
: command
.trailing
, end
: false});
159 'RPL_LISTSTART': function (command
) {
160 /*command.server = this.con_num;
161 command.command = 'RPL_LISTSTART';
162 this.client.sendIrcCommand(command);*/
163 this.client
.sendIrcCommand('list_start', {server
: this.con_num
});
164 this.client
.buffer
.list
= [];
166 'RPL_LISTEND': function (command
) {
167 /*command.server = this.con_num;
168 command.command = 'RPL_LISTEND';
169 this.client.sendIrcCommand(command);*/
170 if (this.client
.buffer
.list
.length
> 0) {
171 this.client
.buffer
.list
= _
.sortBy(this.client
.buffer
.list
, function (channel
) {
172 return channel
.num_users
;
174 this.client
.sendIrcCommand('list_channel', {server
: this.con_num
, chans
: this.client
.buffer
.list
});
175 this.client
.buffer
.list
= [];
177 this.client
.sendIrcCommand('list_end', {server
: this.con_num
});
179 'RPL_LIST': function (command
) {
180 /*command.server = this.con_num;
181 command.command = 'RPL_LIST';
182 this.client.sendIrcCommand(command);*/
183 this.client
.buffer
.list
.push({server
: this.con_num
, channel
: command
.params
[1], num_users
: parseInt(command
.params
[2], 10), topic
: command
.trailing
});
184 if (this.client
.buffer
.list
.length
> 200){
185 this.client
.buffer
.list
= _
.sortBy(this.client
.buffer
.list
, function (channel
) {
186 return channel
.num_users
;
188 this.client
.sendIrcCommand('list_channel', {server
: this.con_num
, chans
: this.client
.buffer
.list
});
189 this.client
.buffer
.list
= [];
192 'RPL_MOTD': function (command
) {
193 /*command.server = this.con_num;
194 command.command = 'RPL_MOTD';
195 this.client.sendIrcCommand(command);*/
196 this.client
.buffer
.motd
+= command
.trailing
+ '\n';
198 'RPL_MOTDSTART': function (command
) {
199 /*command.server = this.con_num;
200 command.command = 'RPL_MOTDSTART';
201 this.client.sendIrcCommand(command);*/
202 this.client
.buffer
.motd
= '';
204 'RPL_ENDOFMOTD': function (command
) {
205 /*command.server = this.con_num;
206 command.command = 'RPL_ENDOFMOTD';
207 this.client.sendIrcCommand(command);*/
208 //websocket.sendClientEvent('motd', {server: '', 'msg': websocket.kiwi.buffer.motd});
209 this.client
.sendIrcCommand('motd', {server
: this.con_num
, msg
: this.client
.buffer
.motd
});
211 'RPL_NAMEREPLY': function (command
) {
212 /*command.server = this.con_num;
213 command.command = 'RPL_NAMEREPLY';
214 this.client.sendIrcCommand(command);*/
215 var members
= command
.trailing
.split(' ');
216 var member_list
= [];
219 _
.each(members
, function (member
) {
220 var j
, k
, modes
= [];
221 for (j
= 0; j
< member
.length
; j
++) {
222 for (k
= 0; k
< that
.irc_connection
.options
.PREFIX
.length
; k
++) {
223 if (member
.charAt(j
) === that
.irc_connection
.options
.PREFIX
[k
].symbol
) {
224 modes
.push(that
.irc_connection
.options
.PREFIX
[k
].mode
);
229 member_list
.push({nick
: member
, modes
: modes
});
231 that
.client
.sendIrcCommand('userlist', {server
: that
.con_num
, users
: member_list
, channel
: command
.params
[2]});
237 this.client
.sendIrcCommand('userlist', {server
: this.con_num
, users
: member_list
, channel
: command
.params
[2]});
240 'RPL_ENDOFNAMES': function (command
) {
241 /*command.server = this.con_num;
242 command.command = 'RPL_ENDOFNAMES';
243 this.client.sendIrcCommand(command);*/
244 //websocket.sendClientEvent('userlist_end', {server: '', channel: msg.params.split(" ")[1]});
245 this.client
.sendIrcCommand('userlist_end', {server
: this.con_num
, channel
: command
.params
[1]});
247 'RPL_BANLIST': function (command
) {
248 /*command.server = this.con_num;
249 command.command = 'RPL_BANLIST';
250 this.client.sendIrcCommand(command);*/
251 //websocket.sendClientEvent('banlist', {server: '', channel: params[1], banned: params[2], banned_by: params[3], banned_at: params[4]});
252 this.client
.sendIrcCommand('banlist', {server
: this.con_num
, channel
: command
.params
[1], banned
: command
.params
[2], banned_by
: command
.params
[3], banned_at
: command
.params
[4]});
254 'RPL_ENDOFBANLIST': function (command
) {
255 /*command.server = this.con_num;
256 command.command = 'RPL_ENDOFBANLIST';
257 this.client.sendIrcCommand(command);*/
258 //websocket.sendClientEvent('banlist_end', {server: '', channel: msg.params.split(" ")[1]});
259 this.client
.sendIrcCommand('banlist_end', {server
: this.con_num
, channel
: command
.params
[1]});
261 'RPL_TOPIC': function (command
) {
262 /*command.server = this.con_num;
263 command.command = 'RPL_TOPIC';
264 this.client.sendIrcCommand(command);*/
265 //{nick: '', channel: msg.params.split(" ")[1], topic: msg.trailing};
266 this.client
.sendIrcCommand('topic', {server
: this.con_num
, nick
: '', channel
: command
.params
[1], topic
: command
.trailing
});
268 'RPL_NOTOPIC': function (command
) {
269 /*command.server = this.con_num;
270 command.command = 'RPL_NOTOPIC';
271 this.client.sendIrcCommand(command);*/
272 this.client
.sendIrcCommand('topic', {server
: this.con_num
, nick
: '', channel
: command
.params
[1], topic
: ''});
274 'RPL_TOPICWHOTIME': function (command
) {
275 /*command.server = this.con_num;
276 command.command = 'RPL_TOPICWHOTIME';
277 this.client.sendIrcCommand(command);*/
278 //{nick: nick, channel: channel, when: when};
279 this.client
.sendIrcCommand('topicsetby', {server
: this.con_num
, nick
: command
.params
[2], channel
: command
.params
[1], when
: command
.params
[3]});
281 'PING': function (command
) {
282 this.irc_connection
.write('PONG ' + command
.trailing
);
284 'JOIN': function (command
) {
286 if (typeof command
.trailing
=== 'string' && command
.trailing
!== '') {
287 channel
= command
.trailing
;
288 } else if (typeof command
.params
[0] === 'string' && command
.params
[0] !== '') {
289 channel
= command
.params
[0];
291 /*command.server = this.con_num;
292 command.command = 'JOIN';
293 command.params = [channel];
294 this.client.sendIrcCommand(command);*/
295 //websocket.sendClientEvent('join', {nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: channel});
296 this.client
.sendIrcCommand('join', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, channel
: channel
});
298 if (command
.nick
=== this.nick
) {
299 this.irc_connection
.write('NAMES ' + channel
);
302 'PART': function (command
) {
303 /*command.server = this.con_num;
304 command.command = 'PART';
305 this.client.sendIrcCommand(command);*/
306 //websocket.sendClientEvent('part', {nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: msg.params.trim(), message: msg.trailing});
307 this.client
.sendIrcCommand('part', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, channel
: command
.params
[0], message
: command
.trailing
});
309 'KICK': function (command
) {
310 /*command.server = this.con_num;
311 command.command = 'KICK';
312 this.client.sendIrcCommand(command);*/
313 //websocket.sendClientEvent('kick', {kicked: params[1], nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: params[0].trim(), message: msg.trailing});
314 this.client
.sendIrcCommand('kick', {server
: this.con_num
, kicked
: command
.params
[1], nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, channel
: command
.params
[0], message
: command
.trailing
});
316 'QUIT': function (command
) {
317 /*command.server = this.con_num;
318 command.command = 'QUIT';
319 this.client.sendIrcCommand(command);*/
320 //websocket.sendClientEvent('quit', {nick: msg.nick, ident: msg.ident, hostname: msg.hostname, message: msg.trailing});
321 this.client
.sendIrcCommand('quit', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, message
: command
.trailing
});
323 'NOTICE': function (command
) {
324 /*command.server = this.con_num;
325 command.command = 'NOTICE';
326 this.client.sendIrcCommand(command);*/
327 if ((command
.trailing
.charAt(0) === String
.fromCharCode(1)) && (command
.trailing
.charAt(command
.trailing
.length
- 1) === String
.fromCharCode(1))) {
328 // It's a CTCP response
329 //websocket.sendClientEvent('ctcp_response', {nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: msg.params.trim(), msg: msg.trailing.substr(1, msg.trailing.length - 2)});
330 this.client
.sendIrcCommand('ctcp_response', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, channel
: command
.params
[0], msg
: command
.trailing
.substr(1, command
.trailing
.length
- 2)});
332 //websocket.sendClientEvent('notice', {nick: msg.nick, ident: msg.ident, hostname: msg.hostname, target: msg.params.trim(), msg: msg.trailing});
333 this.client
.sendIrcCommand('notice', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, target
: command
.params
[0], msg
: command
.trailing
});
336 'NICK': function (command
) {
337 /*command.server = this.con_num;
338 command.command = 'NICK';
339 this.client.sendIrcCommand(command);*/
340 //websocket.sendClientEvent('nick', {nick: msg.nick, ident: msg.ident, hostname: msg.hostname, newnick: msg.trailing});
341 this.client
.sendIrcCommand('nick', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, newnick
: command
.trailing
});
343 'TOPIC': function (command
) {
344 /*command.server = this.con_num;
345 command.command = 'TOPIC';
346 this.client.sendIrcCommand(command);*/
347 //{nick: msg.nick, channel: msg.params, topic: msg.trailing};
348 this.client
.sendIrcCommand('topic', {server
: this.con_num
, nick
: command
.nick
, channel
: command
.params
[0], topic
: command
.trailing
});
350 'MODE': function (command
) {
351 var chanmodes
= this.irc_connection
.options
.CHANMODES
,
352 prefixes
= this.irc_connection
.options
.PREFIX
,
353 always_param
= chanmodes
[0].concat(chanmodes
[1]),
355 has_param
, i
, j
, add
;
357 prefixes
= _
.reduce(prefixes
, function (list
, prefix
) {
358 list
.push(prefix
.mode
);
361 always_param
= always_param
.split('').concat(prefixes
);
363 has_param = function (mode
, add
) {
364 if (_
.find(always_param
, function (m
) {
368 } else if (add
&& _
.find(chanmodes
[2].split(''), function (m
) {
377 if (!command
.params
[1]) {
378 command
.params
[1] = command
.trailing
;
381 for (i
= 0; i
< command
.params
[1].length
; i
++) {
382 switch (command
.params
[1][i
]) {
390 if (has_param(command
.params
[1][i
], add
)) {
391 modes
.push({mode
: (add
? '+' : '-') + command
.params
[1][i
], param
: command
.params
[2 + j
]});
394 modes
.push({mode
: (add
? '+' : '-') + command
.params
[1][i
], param
: null});
399 this.client
.sendIrcCommand('mode', {
400 server
: this.con_num
,
401 target
: command
.params
[0],
402 nick
: command
.nick
|| command
.prefix
|| '',
406 'PRIVMSG': function (command
) {
407 /*command.server = this.con_num;
408 command.command = 'PRIVMSG';
409 this.client.sendIrcCommand(command);*/
411 if ((command
.trailing
.charAt(0) === String
.fromCharCode(1)) && (command
.trailing
.charAt(command
.trailing
.length
- 1) === String
.fromCharCode(1))) {
413 if (command
.trailing
.substr(1, 6) === 'ACTION') {
414 this.client
.sendIrcCommand('action', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, channel
: command
.params
[0], msg
: command
.trailing
.substr(7, command
.trailing
.length
- 2)});
415 } else if (command
.trailing
.substr(1, 4) === 'KIWI') {
416 tmp
= command
.trailing
.substr(6, command
.trailing
.length
- 2);
417 namespace = tmp
.split(' ', 1)[0];
418 this.client
.sendIrcCommand('kiwi', {server
: this.con_num
, namespace: namespace, data
: tmp
.substr(namespace.length
+ 1)});
419 } else if (command
.trailing
.substr(1, 7) === 'VERSION') {
420 this.irc_connection
.write('NOTICE ' + command
.nick
+ ' :' + String
.fromCharCode(1) + 'VERSION KiwiIRC' + String
.fromCharCode(1));
422 this.client
.sendIrcCommand('ctcp_request', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, channel
: command
.params
[0], msg
: command
.trailing
.substr(1, command
.trailing
.length
- 2)});
425 //{nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: msg.params.trim(), msg: msg.trailing}
426 this.client
.sendIrcCommand('msg', {server
: this.con_num
, nick
: command
.nick
, ident
: command
.ident
, hostname
: command
.hostname
, channel
: command
.params
[0], msg
: command
.trailing
});
429 'ERROR': function (command
) {
430 /*command.server = this.con_num;
431 command.command = 'ERROR';
432 this.client.sendIrcCommand(command);*/
433 //websocket.sendClientEvent('irc_error', {error: 'error', reason: msg.trailing});
434 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'error', reason
: command
.trailing
});
436 ERR_LINKCHANNEL: function (command
) {
437 /*command.server = this.con_num;
438 command.command = 'ERR_LINKCHANNEL';
439 this.client.sendIrcCommand(command);*/
440 //websocket.sendClientEvent('channel_redirect', {from: params[1], to: params[2]});
441 this.client
.sendIrcCommand('channel_redirect', {server
: this.con_num
, from: command
.params
[1], to
: command
.params
[2]});
443 ERR_NOSUCHNICK: function (command
) {
444 /*command.server = this.con_num;
445 command.command = 'ERR_NOSUCHNICK';
446 this.client.sendIrcCommand(command);*/
447 //websocket.sendClientEvent('irc_error', {error: 'no_such_nick', nick: msg.params.split(" ")[1], reason: msg.trailing});
448 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'no_such_nick', nick
: command
.params
[1], reason
: command
.trailing
});
450 ERR_CANNOTSENDTOCHAN: function (command
) {
451 /*command.server = this.con_num;
452 command.command = 'ERR_CANNOTSENDTOCHAN';
453 this.client.sendIrcCommand(command);*/
454 //websocket.sendClientEvent('irc_error', {error: 'cannot_send_to_chan', channel: msg.params.split(" ")[1], reason: msg.trailing});
455 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'cannot_send_to_chan', channel
: command
.params
[1], reason
: command
.trailing
});
457 ERR_TOOMANYCHANNELS: function (command
) {
458 /*command.server = this.con_num;
459 command.command = 'ERR_TOOMANYCHANNELS';
460 this.client.sendIrcCommand(command);*/
461 //websocket.sendClientEvent('irc_error', {error: 'too_many_channels', channel: msg.params.split(" ")[1], reason: msg.trailing});
462 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'too_many_channels', channel
: command
.params
[1], reason
: command
.trailing
});
464 ERR_USERNOTINCHANNEL: function (command
) {
465 /*command.server = this.con_num;
466 command.command = 'ERR_USERNOTINCHANNEL';
467 this.client.sendIrcCommand(command);*/
468 //websocket.sendClientEvent('irc_error', {error: 'user_not_in_channel', nick: params[0], channel: params[1], reason: msg.trainling});
469 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'user_not_in_channel', nick
: command
.params
[0], channel
: command
.params
[1], reason
: command
.trailing
});
471 ERR_NOTONCHANNEL: function (command
) {
472 /*command.server = this.con_num;
473 command.command = 'ERR_NOTONCHANNEL';
474 this.client.sendIrcCommand(command);*/
475 //websocket.sendClientEvent('irc_error', {error: 'not_on_channel', channel: msg.params.split(" ")[1], reason: msg.trailing});
476 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'not_on_channel', channel
: command
.params
[1], reason
: command
.trailing
});
478 ERR_CHANNELISFULL: function (command
) {
479 /*command.server = this.con_num;
480 command.command = 'ERR_CHANNELISFULL';
481 this.client.sendIrcCommand(command);*/
482 //websocket.sendClientEvent('irc_error', {error: 'channel_is_full', channel: msg.params.split(" ")[1], reason: msg.trailing});
483 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'channel_is_full', channel
: command
.params
[1], reason
: command
.trailing
});
485 ERR_INVITEONLYCHAN: function (command
) {
486 /*command.server = this.con_num;
487 command.command = 'ERR_INVITEONLYCHAN';
488 this.client.sendIrcCommand(command);*/
489 //websocket.sendClientEvent('irc_error', {error: 'invite_only_channel', channel: msg.params.split(" ")[1], reason: msg.trailing});
490 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'invite_only_channel', channel
: command
.params
[1], reason
: command
.trailing
});
492 ERR_BANNEDFROMCHAN: function (command
) {
493 /*command.server = this.con_num;
494 command.command = 'ERR_BANNEDFROMCHAN';
495 this.client.sendIrcCommand(command);*/
496 //websocket.sendClientEvent('irc_error', {error: 'banned_from_channel', channel: msg.params.split(" ")[1], reason: msg.trailing});
497 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'banned_from_channel', channel
: command
.params
[1], reason
: command
.trailing
});
499 ERR_BADCHANNELKEY: function (command
) {
500 /*command.server = this.con_num;
501 command.command = 'ERR_BADCHANNELKEY';
502 this.client.sendIrcCommand(command);*/
503 //websocket.sendClientEvent('irc_error', {error: 'bad_channel_key', channel: msg.params.split(" ")[1], reason: msg.trailing});
504 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'bad_channel_key', channel
: command
.params
[1], reason
: command
.trailing
});
506 ERR_CHANOPRIVSNEEDED: function (command
) {
507 /*command.server = this.con_num;
508 command.command = 'ERR_CHANOPRIVSNEEDED';
509 this.client.sendIrcCommand(command);*/
510 //websocket.sendClientEvent('irc_error', {error: 'chanop_privs_needed', channel: msg.params.split(" ")[1], reason: msg.trailing});
511 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'chanop_privs_needed', channel
: command
.params
[1], reason
: command
.trailing
});
513 ERR_NICKNAMEINUSE: function (command
) {
514 /*command.server = this.con_num;
515 command.command = 'ERR_NICKNAMEINUSE';
516 this.client.sendIrcCommand(command);*/
517 //websocket.sendClientEvent('irc_error', {error: 'nickname_in_use', nick: _.last(msg.params.split(" ")), reason: msg.trailing});
518 this.client
.sendIrcCommand('irc_error', {server
: this.con_num
, error
: 'nickname_in_use', nick
: command
.params
[1], reason
: command
.trailing
});
520 ERR_NOTREGISTERED: function (command
) {
521 /*command.server = this.con_num;
522 command.command = 'ERR_NOTREGISTERED';
523 this.client.sendIrcCommand(command);*/