3 _kiwi
.model
.Network
= Backbone
.Model
.extend({
7 * The name of the network
13 * The address (URL) of the network
19 * The port for the network
25 * If this network uses SSL
31 * The password to connect to this network
37 * The current nickname
43 * The channel prefix for this network
49 * The user prefixes for channel owner/admin/op/voice etc. on this network
53 {symbol
: '~', mode
: 'q'},
54 {symbol
: '&', mode
: 'a'},
55 {symbol
: '@', mode
: 'o'},
56 {symbol
: '%', mode
: 'h'},
57 {symbol
: '+', mode
: 'v'}
61 * List of nicks we are ignoring
68 initialize: function () {
69 // If we already have a connection, bind our events
70 if (typeof this.get('connection_id') !== 'undefined') {
71 this.gateway
= _kiwi
.global
.components
.Network(this.get('connection_id'));
72 this.bindGatewayEvents();
75 // Create our panel list (tabs)
76 this.panels
= new _kiwi
.model
.PanelList([], this);
77 //this.panels.network = this;
79 // Automatically create a server tab
80 var server_panel
= new _kiwi
.model
.Server({name
: 'Server'});
81 this.panels
.add(server_panel
);
82 this.panels
.server
= this.panels
.active
= server_panel
;
86 reconnect: function(callback_fn
) {
89 nick
: this.get('nick'),
90 host
: this.get('address'),
91 port
: this.get('port'),
93 password
: this.get('password')
96 _kiwi
.gateway
.makeIrcConnection(server_info
, function(err
, connection_id
) {
98 that
.gateway
.dispose();
100 that
.set('connection_id', connection_id
);
101 that
.gateway
= _kiwi
.global
.components
.Network(that
.get('connection_id'));
102 that
.bindGatewayEvents();
104 callback_fn
&& callback_fn(err
);
107 console
.log("_kiwi.gateway.socket.on('error')", {reason
: err
});
108 callback_fn
&& callback_fn(err
);
114 bindGatewayEvents: function () {
115 //this.gateway.on('all', function() {console.log('ALL', this.get('connection_id'), arguments);});
117 this.gateway
.on('connect', onConnect
, this);
118 this.gateway
.on('disconnect', onDisconnect
, this);
120 this.gateway
.on('nick', function(event
) {
121 if (event
.nick
=== this.get('nick')) {
122 this.set('nick', event
.newnick
);
126 this.gateway
.on('options', onOptions
, this);
127 this.gateway
.on('motd', onMotd
, this);
128 this.gateway
.on('join', onJoin
, this);
129 this.gateway
.on('part', onPart
, this);
130 this.gateway
.on('quit', onQuit
, this);
131 this.gateway
.on('kick', onKick
, this);
132 this.gateway
.on('msg', onMsg
, this);
133 this.gateway
.on('nick', onNick
, this);
134 this.gateway
.on('ctcp_request', onCtcpRequest
, this);
135 this.gateway
.on('ctcp_response', onCtcpResponse
, this);
136 this.gateway
.on('notice', onNotice
, this);
137 this.gateway
.on('action', onAction
, this);
138 this.gateway
.on('topic', onTopic
, this);
139 this.gateway
.on('topicsetby', onTopicSetBy
, this);
140 this.gateway
.on('userlist', onUserlist
, this);
141 this.gateway
.on('userlist_end', onUserlistEnd
, this);
142 this.gateway
.on('banlist', onBanlist
, this);
143 this.gateway
.on('mode', onMode
, this);
144 this.gateway
.on('whois', onWhois
, this);
145 this.gateway
.on('whowas', onWhowas
, this);
146 this.gateway
.on('away', onAway
, this);
147 this.gateway
.on('list_start', onListStart
, this);
148 this.gateway
.on('irc_error', onIrcError
, this);
149 this.gateway
.on('unknown_command', onUnknownCommand
, this);
150 this.gateway
.on('channel_info', onChannelInfo
, this);
155 * Create panels and join the channel
156 * This will not wait for the join event to create a panel. This
157 * increases responsiveness in case of network lag
159 createAndJoinChannels: function (channels
) {
163 // Multiple channels may come as comma-delimited
164 if (typeof channels
=== 'string') {
165 channels
= channels
.split(',');
168 $.each(channels
, function (index
, channel_name_key
) {
169 // We may have a channel key so split it off
170 var spli
= channel_name_key
.trim().split(' '),
171 channel_name
= spli
[0],
172 channel_key
= spli
[1] || '';
174 // Trim any whitespace off the name
175 channel_name
= channel_name
.trim();
177 // Add channel_prefix in front of the first channel if missing
178 if (that
.get('channel_prefix').indexOf(channel_name
[0]) === -1) {
179 // Could be many prefixes but '#' is highly likely the required one
180 channel_name
= '#' + channel_name
;
183 // Check if we have the panel already. If not, create it
184 channel
= that
.panels
.getByName(channel_name
);
186 channel
= new _kiwi
.model
.Channel({name
: channel_name
, network
: that
});
187 that
.panels
.add(channel
);
190 panels
.push(channel
);
192 that
.gateway
.join(channel_name
, channel_key
);
201 * Join all the open channels we have open
202 * Reconnecting to a network would typically call this.
204 rejoinAllChannels: function() {
207 this.panels
.forEach(function(panel
) {
208 if (!panel
.isChannel())
211 that
.gateway
.join(panel
.get('name'));
215 isChannelName: function (channel_name
) {
216 var channel_prefix
= this.get('channel_prefix');
218 if (!channel_name
|| !channel_name
.length
) return false;
219 return (channel_prefix
.indexOf(channel_name
[0]) > -1);
222 // Check a nick alongside our ignore list
223 isNickIgnored: function (nick
) {
224 var idx
, list
= this.get('ignore_list');
227 for (idx
= 0; idx
< list
.length
; idx
++) {
228 pattern
= list
[idx
].replace(/([.+^$[\]\\(){}|-])/g, "\\$1")
232 regex
= new RegExp(pattern
, 'i');
233 if (regex
.test(nick
)) return true;
242 function onDisconnect(event
) {
243 $.each(this.panels
.models
, function (index
, panel
) {
244 panel
.addMsg('', styleText('client_models_network_disconnected', {'%T': translateText('client_models_network_disconnected', [])}), 'action quit');
250 function onConnect(event
) {
251 var panels
, channel_names
;
253 // Update our nick with what the network gave us
254 this.set('nick', event
.nick
);
256 // If this is a re-connection then we may have some channels to re-join
257 this.rejoinAllChannels();
259 // Auto joining channels
260 if (this.auto_join
&& this.auto_join
.channel
) {
261 panels
= this.createAndJoinChannels(this.auto_join
.channel
+ ' ' + (this.auto_join
.key
|| ''));
263 // Show the last channel if we have one
265 panels
[panels
.length
- 1].view
.show();
267 delete this.auto_join
;
273 function onOptions(event
) {
276 $.each(event
.options
, function (name
, value
) {
279 that
.set('channel_prefix', value
.join(''));
282 that
.set('name', value
);
285 that
.set('user_prefixes', value
);
290 this.set('cap', event
.cap
);
295 function onMotd(event
) {
296 this.panels
.server
.addMsg(this.get('name'), styleText('motd', {'%T': event
.msg
}), 'motd');
301 function onJoin(event
) {
302 var c
, members
, user
;
303 c
= this.panels
.getByName(event
.channel
);
305 c
= new _kiwi
.model
.Channel({name
: event
.channel
, network
: this});
309 members
= c
.get('members');
310 if (!members
) return;
312 user
= new _kiwi
.model
.Member({
315 hostname
: event
.hostname
,
316 user_prefixes
: this.get('user_prefixes')
318 members
.add(user
, {kiwi
: event
});
323 function onPart(event
) {
324 var channel
, members
, user
,
327 part_options
.type
= 'part';
328 part_options
.message
= event
.message
|| '';
329 part_options
.time
= event
.time
;
331 channel
= this.panels
.getByName(event
.channel
);
332 if (!channel
) return;
334 // If this is us, close the panel
335 if (event
.nick
=== this.get('nick')) {
340 members
= channel
.get('members');
341 if (!members
) return;
343 user
= members
.getByNick(event
.nick
);
346 members
.remove(user
, {kiwi
: part_options
});
351 function onQuit(event
) {
355 quit_options
.type
= 'quit';
356 quit_options
.message
= event
.message
|| '';
357 quit_options
.time
= event
.time
;
359 $.each(this.panels
.models
, function (index
, panel
) {
360 if (!panel
.isChannel()) return;
362 member
= panel
.get('members').getByNick(event
.nick
);
364 panel
.get('members').remove(member
, {kiwi
: quit_options
});
371 function onKick(event
) {
372 var channel
, members
, user
,
375 part_options
.type
= 'kick';
376 part_options
.by
= event
.nick
;
377 part_options
.message
= event
.message
|| '';
378 part_options
.current_user_kicked
= (event
.kicked
== this.get('nick'));
379 part_options
.current_user_initiated
= (event
.nick
== this.get('nick'));
380 part_options
.time
= event
.time
;
382 channel
= this.panels
.getByName(event
.channel
);
383 if (!channel
) return;
385 members
= channel
.get('members');
386 if (!members
) return;
388 user
= members
.getByNick(event
.kicked
);
392 members
.remove(user
, {kiwi
: part_options
});
394 if (part_options
.current_user_kicked
) {
401 function onMsg(event
) {
403 is_pm
= (event
.channel
.toLowerCase() == this.get('nick').toLowerCase());
405 // An ignored user? don't do anything with it
406 if (this.isNickIgnored(event
.nick
)) {
411 // If a panel isn't found for this PM, create one
412 panel
= this.panels
.getByName(event
.nick
);
414 panel
= new _kiwi
.model
.Query({name
: event
.nick
});
415 this.panels
.add(panel
);
419 // If a panel isn't found for this channel, reroute to the
421 panel
= this.panels
.getByName(event
.channel
);
423 panel
= this.panels
.server
;
427 panel
.addMsg(event
.nick
, styleText('privmsg', {'%T': event
.msg
}), 'privmsg', {time
: event
.time
});
432 function onNick(event
) {
435 $.each(this.panels
.models
, function (index
, panel
) {
436 if (panel
.get('name') == event
.nick
)
437 panel
.set('name', event
.newnick
);
439 if (!panel
.isChannel()) return;
441 member
= panel
.get('members').getByNick(event
.nick
);
443 member
.set('nick', event
.newnick
);
444 panel
.addMsg('', styleText('client_models_network_nickname_changed', {'%N': event
.nick
, '%T': translateText('client_models_network_nickname_changed', [event
.newnick
]), '%C': name
}), 'action nick', {time
: event
.time
});
451 function onCtcpRequest(event
) {
452 // An ignored user? don't do anything with it
453 if (this.isNickIgnored(event
.nick
)) {
457 // Reply to a TIME ctcp
458 if (event
.msg
.toUpperCase() === 'TIME') {
459 this.gateway
.ctcp(false, event
.type
, event
.nick
, (new Date()).toString());
465 function onCtcpResponse(event
) {
466 // An ignored user? don't do anything with it
467 if (this.isNickIgnored(event
.nick
)) {
471 this.panels
.server
.addMsg('[' + event
.nick
+ ']', styleText('ctcp', {'%T': event
.msg
}), 'ctcp', {time
: event
.time
});
476 function onNotice(event
) {
477 var panel
, active_panel
, channel_name
;
479 // An ignored user? don't do anything with it
480 if (!event
.from_server
&& event
.nick
&& this.isNickIgnored(event
.nick
)) {
484 // Find a panel for the destination(channel) or who its from
485 if (!event
.from_server
) {
486 panel
= this.panels
.getByName(event
.target
) || this.panels
.getByName(event
.nick
);
488 // Forward ChanServ messages to its associated channel
489 if (event
.nick
&& event
.nick
.toLowerCase() == 'chanserv' && event
.msg
.charAt(0) == '[') {
490 channel_name
= /\[([^ \]]+)\]/gi.exec(event
.msg
);
491 if (channel_name
&& channel_name
[1]) {
492 channel_name
= channel_name
[1];
494 panel
= this.panels
.getByName(channel_name
);
499 panel
= this.panels
.server
;
502 panel
= this.panels
.server
;
505 panel
.addMsg('[' + (event
.nick
||'') + ']', styleText('notice', {'%T': event
.msg
}), 'notice', {time
: event
.time
});
507 // Show this notice to the active panel if it didn't have a set target, but only in an active channel or query window
508 active_panel
= _kiwi
.app
.panels().active
;
510 if (!event
.from_server
&& panel
=== this.panels
.server
&& active_panel
!== this.panels
.server
) {
511 if (active_panel
.isChannel() || active_panel
.isQuery())
512 _kiwi
.app
.panels().active
.addMsg('[' + (event
.nick
||'') + ']', styleText('notice', {'%T': event
.msg
}), 'notice', {time
: event
.time
});
518 function onAction(event
) {
520 is_pm
= (event
.channel
.toLowerCase() == this.get('nick').toLowerCase());
522 // An ignored user? don't do anything with it
523 if (this.isNickIgnored(event
.nick
)) {
528 // If a panel isn't found for this PM, create one
529 panel
= this.panels
.getByName(event
.nick
);
531 panel
= new _kiwi
.model
.Channel({name
: event
.nick
, network
: this});
532 this.panels
.add(panel
);
536 // If a panel isn't found for this channel, reroute to the
538 panel
= this.panels
.getByName(event
.channel
);
540 panel
= this.panels
.server
;
544 panel
.addMsg('', styleText('action', {'%N': event
.nick
, '%T': event
.msg
}), 'action', {time
: event
.time
});
549 function onTopic(event
) {
551 c
= this.panels
.getByName(event
.channel
);
554 // Set the channels topic
555 c
.set('topic', event
.topic
);
557 // If this is the active channel, update the topic bar too
558 if (c
.get('name') === this.panels
.active
.get('name')) {
559 _kiwi
.app
.topicbar
.setCurrentTopic(event
.topic
);
565 function onTopicSetBy(event
) {
567 c
= this.panels
.getByName(event
.channel
);
570 when
= formatDate(new Date(event
.when
* 1000));
571 c
.addMsg('', styleText('client_models_network_topic', {'%T': translateText('client_models_network_topic', [event
.nick
, when
]), '%C': event
.channel
}), 'topic');
576 function onChannelInfo(event
) {
577 var channel
= this.panels
.getByName(event
.channel
);
578 if (!channel
) return;
581 channel
.set('info_url', event
.url
);
582 } else if (event
.modes
) {
583 channel
.set('info_modes', event
.modes
);
589 function onUserlist(event
) {
591 channel
= this.panels
.getByName(event
.channel
);
593 // If we didn't find a channel for this, may aswell leave
594 if (!channel
) return;
596 channel
.temp_userlist
= channel
.temp_userlist
|| [];
597 _
.each(event
.users
, function (item
) {
598 var user
= new _kiwi
.model
.Member({
601 user_prefixes
: that
.get('user_prefixes')
603 channel
.temp_userlist
.push(user
);
609 function onUserlistEnd(event
) {
611 channel
= this.panels
.getByName(event
.channel
);
613 // If we didn't find a channel for this, may aswell leave
614 if (!channel
) return;
616 // Update the members list with the new list
617 channel
.get('members').reset(channel
.temp_userlist
|| []);
619 // Clear the temporary userlist
620 delete channel
.temp_userlist
;
625 function onBanlist(event
) {
626 var channel
= this.panels
.getByName(event
.channel
);
630 channel
.set('banlist', event
.bans
|| []);
635 function onMode(event
) {
636 var channel
, i
, prefixes
, members
, member
, find_prefix
,
637 request_updated_banlist
= false;
639 // Build a nicely formatted string to be displayed to a regular human
640 function friendlyModeString (event_modes
, alt_target
) {
641 var modes
= {}, return_string
;
643 // If no default given, use the main event info
645 event_modes
= event
.modes
;
646 alt_target
= event
.target
;
649 // Reformat the mode object to make it easier to work with
650 _
.each(event_modes
, function (mode
){
651 var param
= mode
.param
|| alt_target
|| '';
653 // Make sure we have some modes for this param
655 modes
[param
] = {'+':'', '-':''};
658 modes
[param
][mode
.mode
[0]] += mode
.mode
.substr(1);
661 // Put the string together from each mode
663 _
.each(modes
, function (modeset
, param
) {
665 if (modeset
['+']) str
+= '+' + modeset
['+'];
666 if (modeset
['-']) str
+= '-' + modeset
['-'];
667 return_string
.push(str
+ ' ' + param
);
669 return_string
= return_string
.join(', ');
671 return return_string
;
675 channel
= this.panels
.getByName(event
.target
);
677 prefixes
= this.get('user_prefixes');
678 find_prefix = function (p
) {
679 return event
.modes
[i
].mode
[1] === p
.mode
;
681 for (i
= 0; i
< event
.modes
.length
; i
++) {
682 if (_
.any(prefixes
, find_prefix
)) {
684 members
= channel
.get('members');
686 member
= members
.getByNick(event
.modes
[i
].param
);
688 console
.log('MODE command recieved for unknown member %s on channel %s', event
.modes
[i
].param
, event
.target
);
691 if (event
.modes
[i
].mode
[0] === '+') {
692 member
.addMode(event
.modes
[i
].mode
[1]);
693 } else if (event
.modes
[i
].mode
[0] === '-') {
694 member
.removeMode(event
.modes
[i
].mode
[1]);
699 // Channel mode being set
700 // TODO: Store this somewhere?
701 //channel.addMsg('', 'CHANNEL === ' + event.nick + ' set mode ' + event.modes[i].mode + ' on ' + event.target, 'action mode');
704 // TODO: Be smart, remove this specific ban from the banlist rather than request a whole banlist
705 if (event
.modes
[i
].mode
[1] == 'b')
706 request_updated_banlist
= true;
709 channel
.addMsg('', styleText('client_models_network_mode', {'%N': event
.nick
, '%T': translateText('client_models_network_mode', [friendlyModeString()]), '%C': event
.target
}), 'action mode', {time
: event
.time
});
711 // TODO: Be smart, remove the specific ban from the banlist rather than request a whole banlist
712 if (request_updated_banlist
)
713 this.gateway
.raw('MODE ' + channel
.get('name') + ' +b');
716 // This is probably a mode being set on us.
717 if (event
.target
.toLowerCase() === this.get("nick").toLowerCase()) {
718 this.panels
.server
.addMsg('', styleText('client_models_network_selfmode', {'%N': event
.nick
, '%T': translateText('client_models_network_mode', [friendlyModeString()]), '%C': event
.target
}), 'action mode');
720 console
.log('MODE command recieved for unknown target %s: ', event
.target
, event
);
727 function onWhois(event
) {
728 var logon_date
, idle_time
= '', panel
;
733 if (typeof event
.idle
!== 'undefined') {
734 idle_time
= secondsToTime(parseInt(event
.idle
, 10));
735 idle_time
= idle_time
.h
.toString().lpad(2, "0") + ':' + idle_time
.m
.toString().lpad(2, "0") + ':' + idle_time
.s
.toString().lpad(2, "0");
738 panel
= _kiwi
.app
.panels().active
;
740 panel
.addMsg(event
.nick
, styleText('whois_ident', {'%N': event
.nick
, '%J': event
.ident
, '%H': event
.host
, '%T': event
.msg
}), 'whois');
742 } else if (event
.chans
) {
743 panel
.addMsg(event
.nick
, styleText('client_models_network_channels', {'%N': event
.nick
, '%T': translateText('client_models_network_channels', [event
.chans
])}), 'whois');
744 } else if (event
.irc_server
) {
745 panel
.addMsg(event
.nick
, styleText('client_models_network_server', {'%N': event
.nick
, '%T': translateText('client_models_network_server', [event
.irc_server
, event
.server_info
])}), 'whois');
746 } else if (event
.msg
) {
747 panel
.addMsg(event
.nick
, styleText('whois', {'%T': event
.msg
}), 'whois');
748 } else if (event
.logon
) {
749 logon_date
= new Date();
750 logon_date
.setTime(event
.logon
* 1000);
751 logon_date
= formatDate(logon_date
);
753 panel
.addMsg(event
.nick
, styleText('client_models_network_idle_and_signon', {'%N': event
.nick
, '%T': translateText('client_models_network_idle_and_signon', [idle_time
, logon_date
])}), 'whois');
754 } else if (event
.away_reason
) {
755 panel
.addMsg(event
.nick
, styleText('client_models_network_away', {'%N': event
.nick
, '%T': translateText('client_models_network_away', [event
.away_reason
])}), 'whois');
757 panel
.addMsg(event
.nick
, styleText('client_models_network_idle', {'%N': event
.nick
, '%T': translateText('client_models_network_idle', [idle_time
])}), 'whois');
761 function onWhowas(event
) {
767 panel
= _kiwi
.app
.panels().active
;
769 panel
.addMsg(event
.nick
, styleText('who', {'%N': event
.nick
, '%J': event
.ident
, '%H': event
.host
, '%R': event
.real_name
, '%T': event
.msg
}), 'whois');
771 panel
.addMsg(event
.nick
, styleText('client_models_network_nickname_notfound', {'%N': event
.nick
, '%T': translateText('client_models_network_nickname_notfound', [])}), 'whois');
776 function onAway(event
) {
777 $.each(this.panels
.models
, function (index
, panel
) {
778 if (!panel
.isChannel()) return;
780 member
= panel
.get('members').getByNick(event
.nick
);
782 member
.set('away', !(!event
.reason
));
789 function onListStart(event
) {
790 var chanlist
= _kiwi
.model
.Applet
.loadOnce('kiwi_chanlist');
791 chanlist
.view
.show();
796 function onIrcError(event
) {
799 if (event
.channel
!== undefined && !(panel
= this.panels
.getByName(event
.channel
))) {
800 panel
= this.panels
.server
;
803 switch (event
.error
) {
804 case 'banned_from_channel':
805 panel
.addMsg(' ', styleText('client_models_network_banned', {'%N': event
.nick
, '%T': translateText('client_models_network_banned', [event
.channel
, event
.reason
]), '%C': event
.channel
}), 'status');
806 _kiwi
.app
.message
.text(_kiwi
.global
.i18n
.translate('client_models_network_banned').fetch(event
.channel
, event
.reason
));
808 case 'bad_channel_key':
809 panel
.addMsg(' ', styleText('client_models_network_channel_badkey', {'%N': event
.nick
, '%T': translateText('client_models_network_channel_badkey', [event
.channel
]), '%C': event
.channel
}), 'status');
810 _kiwi
.app
.message
.text(_kiwi
.global
.i18n
.translate('client_models_network_channel_badkey').fetch(event
.channel
));
812 case 'invite_only_channel':
813 panel
.addMsg(' ', styleText('client_models_network_channel_inviteonly', {'%N': event
.nick
, '%T': translateText('client_models_network_channel_inviteonly', [event
.nick
, event
.channel
]), '%C': event
.channel
}), 'status');
814 _kiwi
.app
.message
.text(event
.channel
+ ' ' + _kiwi
.global
.i18n
.translate('client_models_network_channel_inviteonly').fetch());
816 case 'user_on_channel':
817 panel
.addMsg(' ', styleText('client_models_network_channel_alreadyin', {'%N': event
.nick
, '%T': translateText('client_models_network_channel_alreadyin'), '%C': event
.channel
}));
819 case 'channel_is_full':
820 panel
.addMsg(' ', styleText('client_models_network_channel_limitreached', {'%N': event
.nick
, '%T': translateText('client_models_network_channel_limitreached', [event
.channel
]), '%C': event
.channel
}), 'status');
821 _kiwi
.app
.message
.text(event
.channel
+ ' ' + _kiwi
.global
.i18n
.translate('client_models_network_channel_limitreached').fetch(event
.channel
));
823 case 'chanop_privs_needed':
824 panel
.addMsg(' ', styleText('chanop_privs_needed', {'%T': event
.reason
, '%C': event
.channel
}), 'status');
825 _kiwi
.app
.message
.text(event
.reason
+ ' (' + event
.channel
+ ')');
828 tmp
= this.panels
.getByName(event
.nick
);
830 tmp
.addMsg(' ', styleText('no_such_nick', {'%N': event
.nick
, '%T': event
.reason
, '%C': event
.channel
}), 'status');
832 this.panels
.server
.addMsg(' ', styleText('no_such_nick', {'%N': event
.nick
, '%T': event
.reason
, '%C': event
.channel
}), 'status');
835 case 'nickname_in_use':
836 this.panels
.server
.addMsg(' ', styleText('client_models_network_nickname_alreadyinuse', {'%N': event
.nick
, '%T': translateText('client_models_network_nickname_alreadyinuse', [event
.nick
]), '%C': event
.channel
}), 'status');
837 if (this.panels
.server
!== this.panels
.active
) {
838 _kiwi
.app
.message
.text(_kiwi
.global
.i18n
.translate('client_models_network_nickname_alreadyinuse').fetch(event
.nick
));
841 // Only show the nickchange component if the controlbox is open
842 if (_kiwi
.app
.controlbox
.$el
.css('display') !== 'none') {
843 (new _kiwi
.view
.NickChangeBox()).render();
848 case 'password_mismatch':
849 this.panels
.server
.addMsg(' ', styleText('client_models_network_badpassword', {'%N': event
.nick
, '%T': translateText('client_models_network_badpassword', []), '%C': event
.channel
}), 'status');
852 // We don't know what data contains, so don't do anything with it.
853 //_kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status');
858 function onUnknownCommand(event
) {
859 var display_params
= _
.clone(event
.params
);
861 // A lot of commands have our nick as the first parameter. This is redundant for us
862 if (display_params
[0] && display_params
[0] == this.get('nick')) {
863 display_params
.shift();
866 this.panels
.server
.addMsg('', styleText('unknown_command', {'%T': '[' + event
.command
+ '] ' + display_params
.join(', ', '')}));