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', network
: this});
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('channel:join', onJoin
, this);
129 this.gateway
.on('channel:part', onPart
, this);
130 this.gateway
.on('channel:kick', onKick
, this);
131 this.gateway
.on('quit', onQuit
, this);
132 this.gateway
.on('message', onMessage
, 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('topic', onTopic
, this);
137 this.gateway
.on('topicsetby', onTopicSetBy
, this);
138 this.gateway
.on('userlist', onUserlist
, this);
139 this.gateway
.on('userlist_end', onUserlistEnd
, this);
140 this.gateway
.on('banlist', onBanlist
, this);
141 this.gateway
.on('mode', onMode
, this);
142 this.gateway
.on('whois', onWhois
, this);
143 this.gateway
.on('whowas', onWhowas
, this);
144 this.gateway
.on('away', onAway
, this);
145 this.gateway
.on('list_start', onListStart
, this);
146 this.gateway
.on('irc_error', onIrcError
, this);
147 this.gateway
.on('unknown_command', onUnknownCommand
, this);
148 this.gateway
.on('channel_info', onChannelInfo
, this);
149 this.gateway
.on('wallops', onWallops
, this);
154 * Create panels and join the channel
155 * This will not wait for the join event to create a panel. This
156 * increases responsiveness in case of network lag
158 createAndJoinChannels: function (channels
) {
162 // Multiple channels may come as comma-delimited
163 if (typeof channels
=== 'string') {
164 channels
= channels
.split(',');
167 $.each(channels
, function (index
, channel_name_key
) {
168 // We may have a channel key so split it off
169 var spli
= channel_name_key
.trim().split(' '),
170 channel_name
= spli
[0],
171 channel_key
= spli
[1] || '';
173 // Trim any whitespace off the name
174 channel_name
= channel_name
.trim();
176 // Add channel_prefix in front of the first channel if missing
177 if (that
.get('channel_prefix').indexOf(channel_name
[0]) === -1) {
178 // Could be many prefixes but '#' is highly likely the required one
179 channel_name
= '#' + channel_name
;
182 // Check if we have the panel already. If not, create it
183 channel
= that
.panels
.getByName(channel_name
);
185 channel
= new _kiwi
.model
.Channel({name
: channel_name
, network
: that
});
186 that
.panels
.add(channel
);
189 panels
.push(channel
);
191 that
.gateway
.join(channel_name
, channel_key
);
200 * Join all the open channels we have open
201 * Reconnecting to a network would typically call this.
203 rejoinAllChannels: function() {
206 this.panels
.forEach(function(panel
) {
207 if (!panel
.isChannel())
210 that
.gateway
.join(panel
.get('name'));
214 isChannelName: function (channel_name
) {
215 var channel_prefix
= this.get('channel_prefix');
217 if (!channel_name
|| !channel_name
.length
) return false;
218 return (channel_prefix
.indexOf(channel_name
[0]) > -1);
221 // Check a nick alongside our ignore list
222 isNickIgnored: function (nick
) {
223 var idx
, list
= this.get('ignore_list');
226 for (idx
= 0; idx
< list
.length
; idx
++) {
227 pattern
= list
[idx
].replace(/([.+^$[\]\\(){}|-])/g, "\\$1")
231 regex
= new RegExp(pattern
, 'i');
232 if (regex
.test(nick
)) return true;
241 function onDisconnect(event
) {
242 $.each(this.panels
.models
, function (index
, panel
) {
243 if (!panel
.isApplet()) {
244 panel
.addMsg('', styleText('network_disconnected', {text
: translateText('client_models_network_disconnected', [])}), 'action quit');
251 function onConnect(event
) {
252 var panels
, channel_names
;
254 // Update our nick with what the network gave us
255 this.set('nick', event
.nick
);
257 // If this is a re-connection then we may have some channels to re-join
258 this.rejoinAllChannels();
260 // Auto joining channels
261 if (this.auto_join
&& this.auto_join
.channel
) {
262 panels
= this.createAndJoinChannels(this.auto_join
.channel
+ ' ' + (this.auto_join
.key
|| ''));
264 // Show the last channel if we have one
266 panels
[panels
.length
- 1].view
.show();
268 delete this.auto_join
;
274 function onOptions(event
) {
277 $.each(event
.options
, function (name
, value
) {
280 that
.set('channel_prefix', value
.join(''));
283 that
.set('name', value
);
286 that
.set('user_prefixes', value
);
291 this.set('cap', event
.cap
);
296 function onMotd(event
) {
297 this.panels
.server
.addMsg(this.get('name'), styleText('motd', {text
: event
.msg
}), 'motd');
302 function onJoin(event
) {
303 var c
, members
, user
;
304 c
= this.panels
.getByName(event
.channel
);
306 c
= new _kiwi
.model
.Channel({name
: event
.channel
, network
: this});
310 members
= c
.get('members');
311 if (!members
) return;
313 user
= new _kiwi
.model
.Member({
316 hostname
: event
.hostname
,
317 user_prefixes
: this.get('user_prefixes')
319 members
.add(user
, {kiwi
: event
});
324 function onPart(event
) {
325 var channel
, members
, user
,
328 part_options
.type
= 'part';
329 part_options
.message
= event
.message
|| '';
330 part_options
.time
= event
.time
;
332 channel
= this.panels
.getByName(event
.channel
);
333 if (!channel
) return;
335 // If this is us, close the panel
336 if (event
.nick
=== this.get('nick')) {
341 members
= channel
.get('members');
342 if (!members
) return;
344 user
= members
.getByNick(event
.nick
);
347 members
.remove(user
, {kiwi
: part_options
});
352 function onQuit(event
) {
356 quit_options
.type
= 'quit';
357 quit_options
.message
= event
.message
|| '';
358 quit_options
.time
= event
.time
;
360 $.each(this.panels
.models
, function (index
, panel
) {
361 // Let any query panels know they quit
362 if (panel
.isQuery() && panel
.get('name').toLowerCase() === event
.nick
.toLowerCase()) {
363 panel
.addMsg(' ', styleText('channel_quit', {
365 text
: translateText('client_models_channel_quit', [quit_options
.message
])
366 }), 'action quit', {time
: quit_options
.time
});
369 // Remove the nick from any channels
370 if (panel
.isChannel()) {
371 member
= panel
.get('members').getByNick(event
.nick
);
373 panel
.get('members').remove(member
, {kiwi
: quit_options
});
381 function onKick(event
) {
382 var channel
, members
, user
,
385 part_options
.type
= 'kick';
386 part_options
.by
= event
.nick
;
387 part_options
.message
= event
.message
|| '';
388 part_options
.current_user_kicked
= (event
.kicked
== this.get('nick'));
389 part_options
.current_user_initiated
= (event
.nick
== this.get('nick'));
390 part_options
.time
= event
.time
;
392 channel
= this.panels
.getByName(event
.channel
);
393 if (!channel
) return;
395 members
= channel
.get('members');
396 if (!members
) return;
398 user
= members
.getByNick(event
.kicked
);
402 members
.remove(user
, {kiwi
: part_options
});
404 if (part_options
.current_user_kicked
) {
411 function onMessage(event
) {
412 _kiwi
.global
.events
.emit('message:new', {network
: this, message
: event
})
413 .done(_
.bind(function() {
415 is_pm
= ((event
.target
|| '').toLowerCase() == this.get('nick').toLowerCase());
417 // An ignored user? don't do anything with it
418 if (this.isNickIgnored(event
.nick
)) {
422 if (event
.type
== 'notice') {
423 if (event
.from_server
) {
424 panel
= this.panels
.server
;
427 panel
= this.panels
.getByName(event
.target
) || this.panels
.getByName(event
.nick
);
429 // Forward ChanServ messages to its associated channel
430 if (event
.nick
&& event
.nick
.toLowerCase() == 'chanserv' && event
.msg
.charAt(0) == '[') {
431 channel_name
= /\[([^ \]]+)\]/gi.exec(event
.msg
);
432 if (channel_name
&& channel_name
[1]) {
433 channel_name
= channel_name
[1];
435 panel
= this.panels
.getByName(channel_name
);
442 panel
= this.panels
.server
;
446 // If a panel isn't found for this PM, create one
447 panel
= this.panels
.getByName(event
.nick
);
449 panel
= new _kiwi
.model
.Query({name
: event
.nick
, network
: this});
450 this.panels
.add(panel
);
454 // If a panel isn't found for this target, reroute to the
456 panel
= this.panels
.getByName(event
.target
);
458 panel
= this.panels
.server
;
464 panel
.addMsg(event
.nick
, styleText('privmsg', {text
: event
.msg
}), 'privmsg', {time
: event
.time
});
468 panel
.addMsg('', styleText('action', {nick
: event
.nick
, text
: event
.msg
}), 'action', {time
: event
.time
});
472 panel
.addMsg('[' + (event
.nick
||'') + ']', styleText('notice', {text
: event
.msg
}), 'notice', {time
: event
.time
});
474 // Show this notice to the active panel if it didn't have a set target, but only in an active channel or query window
475 active_panel
= _kiwi
.app
.panels().active
;
477 if (!event
.from_server
&& panel
=== this.panels
.server
&& active_panel
!== this.panels
.server
) {
478 if (active_panel
.get('network') === this && (active_panel
.isChannel() || active_panel
.isQuery()))
479 active_panel
.addMsg('[' + (event
.nick
||'') + ']', styleText('notice', {text
: event
.msg
}), 'notice', {time
: event
.time
});
488 function onNick(event
) {
491 $.each(this.panels
.models
, function (index
, panel
) {
492 if (panel
.get('name') == event
.nick
)
493 panel
.set('name', event
.newnick
);
495 if (!panel
.isChannel()) return;
497 member
= panel
.get('members').getByNick(event
.nick
);
499 member
.set('nick', event
.newnick
);
500 panel
.addMsg('', styleText('nick_changed', {nick
: event
.nick
, text
: translateText('client_models_network_nickname_changed', [event
.newnick
]), channel
: name
}), 'action nick', {time
: event
.time
});
507 function onCtcpRequest(event
) {
508 // An ignored user? don't do anything with it
509 if (this.isNickIgnored(event
.nick
)) {
513 // Reply to a TIME ctcp
514 if (event
.msg
.toUpperCase() === 'TIME') {
515 this.gateway
.ctcpResponse(event
.type
, event
.nick
, (new Date()).toString());
521 function onCtcpResponse(event
) {
522 // An ignored user? don't do anything with it
523 if (this.isNickIgnored(event
.nick
)) {
527 this.panels
.server
.addMsg('[' + event
.nick
+ ']', styleText('ctcp', {text
: event
.msg
}), 'ctcp', {time
: event
.time
});
532 function onTopic(event
) {
534 c
= this.panels
.getByName(event
.channel
);
537 // Set the channels topic
538 c
.set('topic', event
.topic
);
540 // If this is the active channel, update the topic bar too
541 if (c
.get('name') === this.panels
.active
.get('name')) {
542 _kiwi
.app
.topicbar
.setCurrentTopic(event
.topic
);
548 function onTopicSetBy(event
) {
550 c
= this.panels
.getByName(event
.channel
);
553 when
= formatDate(new Date(event
.when
* 1000));
554 c
.addMsg('', styleText('channel_topic_setby', {text
: translateText('client_models_network_topic', [event
.nick
, when
]), channel
: event
.channel
}), 'topic');
559 function onChannelInfo(event
) {
560 var channel
= this.panels
.getByName(event
.channel
);
561 if (!channel
) return;
564 channel
.set('info_url', event
.url
);
565 } else if (event
.modes
) {
566 channel
.set('info_modes', event
.modes
);
572 function onUserlist(event
) {
574 channel
= this.panels
.getByName(event
.channel
);
576 // If we didn't find a channel for this, may aswell leave
577 if (!channel
) return;
579 channel
.temp_userlist
= channel
.temp_userlist
|| [];
580 _
.each(event
.users
, function (item
) {
581 var user
= new _kiwi
.model
.Member({
584 user_prefixes
: that
.get('user_prefixes')
586 channel
.temp_userlist
.push(user
);
592 function onUserlistEnd(event
) {
594 channel
= this.panels
.getByName(event
.channel
);
596 // If we didn't find a channel for this, may aswell leave
597 if (!channel
) return;
599 // Update the members list with the new list
600 channel
.get('members').reset(channel
.temp_userlist
|| []);
602 // Clear the temporary userlist
603 delete channel
.temp_userlist
;
608 function onBanlist(event
) {
609 var channel
= this.panels
.getByName(event
.channel
);
613 channel
.set('banlist', event
.bans
|| []);
618 function onMode(event
) {
619 var channel
, i
, prefixes
, members
, member
, find_prefix
,
620 request_updated_banlist
= false;
622 // Build a nicely formatted string to be displayed to a regular human
623 function friendlyModeString (event_modes
, alt_target
) {
624 var modes
= {}, return_string
;
626 // If no default given, use the main event info
628 event_modes
= event
.modes
;
629 alt_target
= event
.target
;
632 // Reformat the mode object to make it easier to work with
633 _
.each(event_modes
, function (mode
){
634 var param
= mode
.param
|| alt_target
|| '';
636 // Make sure we have some modes for this param
638 modes
[param
] = {'+':'', '-':''};
641 modes
[param
][mode
.mode
[0]] += mode
.mode
.substr(1);
644 // Put the string together from each mode
646 _
.each(modes
, function (modeset
, param
) {
648 if (modeset
['+']) str
+= '+' + modeset
['+'];
649 if (modeset
['-']) str
+= '-' + modeset
['-'];
650 return_string
.push(str
+ ' ' + param
);
652 return_string
= return_string
.join(', ');
654 return return_string
;
658 channel
= this.panels
.getByName(event
.target
);
660 prefixes
= this.get('user_prefixes');
661 find_prefix = function (p
) {
662 return event
.modes
[i
].mode
[1] === p
.mode
;
664 for (i
= 0; i
< event
.modes
.length
; i
++) {
665 if (_
.any(prefixes
, find_prefix
)) {
667 members
= channel
.get('members');
669 member
= members
.getByNick(event
.modes
[i
].param
);
671 console
.log('MODE command recieved for unknown member %s on channel %s', event
.modes
[i
].param
, event
.target
);
674 if (event
.modes
[i
].mode
[0] === '+') {
675 member
.addMode(event
.modes
[i
].mode
[1]);
676 } else if (event
.modes
[i
].mode
[0] === '-') {
677 member
.removeMode(event
.modes
[i
].mode
[1]);
682 // Channel mode being set
683 // TODO: Store this somewhere?
684 //channel.addMsg('', 'CHANNEL === ' + event.nick + ' set mode ' + event.modes[i].mode + ' on ' + event.target, 'action mode');
687 // TODO: Be smart, remove this specific ban from the banlist rather than request a whole banlist
688 if (event
.modes
[i
].mode
[1] == 'b')
689 request_updated_banlist
= true;
692 channel
.addMsg('', styleText('mode', {nick
: event
.nick
, text
: translateText('client_models_network_mode', [friendlyModeString()]), channel
: event
.target
}), 'action mode', {time
: event
.time
});
694 // TODO: Be smart, remove the specific ban from the banlist rather than request a whole banlist
695 if (request_updated_banlist
)
696 this.gateway
.raw('MODE ' + channel
.get('name') + ' +b');
699 // This is probably a mode being set on us.
700 if (event
.target
.toLowerCase() === this.get("nick").toLowerCase()) {
701 this.panels
.server
.addMsg('', styleText('selfmode', {nick
: event
.nick
, text
: translateText('client_models_network_mode', [friendlyModeString()]), channel
: event
.target
}), 'action mode');
703 console
.log('MODE command recieved for unknown target %s: ', event
.target
, event
);
710 function onWhois(event
) {
711 var logon_date
, idle_time
= '', panel
;
716 if (typeof event
.idle
!== 'undefined') {
717 idle_time
= secondsToTime(parseInt(event
.idle
, 10));
718 idle_time
= idle_time
.h
.toString().lpad(2, "0") + ':' + idle_time
.m
.toString().lpad(2, "0") + ':' + idle_time
.s
.toString().lpad(2, "0");
721 panel
= _kiwi
.app
.panels().active
;
723 panel
.addMsg(event
.nick
, styleText('whois_ident', {nick
: event
.nick
, ident
: event
.ident
, host
: event
.hostname
, text
: event
.msg
}), 'whois');
725 } else if (event
.chans
) {
726 panel
.addMsg(event
.nick
, styleText('whois_channels', {nick
: event
.nick
, text
: translateText('client_models_network_channels', [event
.chans
])}), 'whois');
727 } else if (event
.irc_server
) {
728 panel
.addMsg(event
.nick
, styleText('whois_server', {nick
: event
.nick
, text
: translateText('client_models_network_server', [event
.irc_server
, event
.server_info
])}), 'whois');
729 } else if (event
.msg
) {
730 panel
.addMsg(event
.nick
, styleText('whois', {text
: event
.msg
}), 'whois');
731 } else if (event
.logon
) {
732 logon_date
= new Date();
733 logon_date
.setTime(event
.logon
* 1000);
734 logon_date
= formatDate(logon_date
);
736 panel
.addMsg(event
.nick
, styleText('whois_idle_and_signon', {nick
: event
.nick
, text
: translateText('client_models_network_idle_and_signon', [idle_time
, logon_date
])}), 'whois');
737 } else if (event
.away_reason
) {
738 panel
.addMsg(event
.nick
, styleText('whois_away', {nick
: event
.nick
, text
: translateText('client_models_network_away', [event
.away_reason
])}), 'whois');
740 panel
.addMsg(event
.nick
, styleText('whois_idle', {nick
: event
.nick
, text
: translateText('client_models_network_idle', [idle_time
])}), 'whois');
744 function onWhowas(event
) {
750 panel
= _kiwi
.app
.panels().active
;
751 if (event
.hostname
) {
752 panel
.addMsg(event
.nick
, styleText('who', {nick
: event
.nick
, ident
: event
.ident
, host
: event
.hostname
, realname
: event
.real_name
, text
: event
.msg
}), 'whois');
754 panel
.addMsg(event
.nick
, styleText('whois_notfound', {nick
: event
.nick
, text
: translateText('client_models_network_nickname_notfound', [])}), 'whois');
759 function onAway(event
) {
760 $.each(this.panels
.models
, function (index
, panel
) {
761 if (!panel
.isChannel()) return;
763 member
= panel
.get('members').getByNick(event
.nick
);
765 member
.set('away', !(!event
.reason
));
772 function onListStart(event
) {
773 var chanlist
= _kiwi
.model
.Applet
.loadOnce('kiwi_chanlist');
774 chanlist
.view
.show();
779 function onIrcError(event
) {
782 if (event
.channel
!== undefined && !(panel
= this.panels
.getByName(event
.channel
))) {
783 panel
= this.panels
.server
;
786 switch (event
.error
) {
787 case 'banned_from_channel':
788 panel
.addMsg(' ', styleText('channel_banned', {nick
: event
.nick
, text
: translateText('client_models_network_banned', [event
.channel
, event
.reason
]), channel
: event
.channel
}), 'status');
789 _kiwi
.app
.message
.text(_kiwi
.global
.i18n
.translate('client_models_network_banned').fetch(event
.channel
, event
.reason
));
791 case 'bad_channel_key':
792 panel
.addMsg(' ', styleText('channel_badkey', {nick
: event
.nick
, text
: translateText('client_models_network_channel_badkey', [event
.channel
]), channel
: event
.channel
}), 'status');
793 _kiwi
.app
.message
.text(_kiwi
.global
.i18n
.translate('client_models_network_channel_badkey').fetch(event
.channel
));
795 case 'invite_only_channel':
796 panel
.addMsg(' ', styleText('channel_inviteonly', {nick
: event
.nick
, text
: translateText('client_models_network_channel_inviteonly', [event
.nick
, event
.channel
]), channel
: event
.channel
}), 'status');
797 _kiwi
.app
.message
.text(event
.channel
+ ' ' + _kiwi
.global
.i18n
.translate('client_models_network_channel_inviteonly').fetch());
799 case 'user_on_channel':
800 panel
.addMsg(' ', styleText('channel_alreadyin', {nick
: event
.nick
, text
: translateText('client_models_network_channel_alreadyin'), channel
: event
.channel
}));
802 case 'channel_is_full':
803 panel
.addMsg(' ', styleText('channel_limitreached', {nick
: event
.nick
, text
: translateText('client_models_network_channel_limitreached', [event
.channel
]), channel
: event
.channel
}), 'status');
804 _kiwi
.app
.message
.text(event
.channel
+ ' ' + _kiwi
.global
.i18n
.translate('client_models_network_channel_limitreached').fetch(event
.channel
));
806 case 'chanop_privs_needed':
807 panel
.addMsg(' ', styleText('chanop_privs_needed', {text
: event
.reason
, channel
: event
.channel
}), 'status');
808 _kiwi
.app
.message
.text(event
.reason
+ ' (' + event
.channel
+ ')');
810 case 'cannot_send_to_channel':
811 panel
.addMsg(' ', '== ' + _kiwi
.global
.i18n
.translate('Cannot send message to channel, you are not voiced').fetch(event
.channel
, event
.reason
), 'status');
814 tmp
= this.panels
.getByName(event
.nick
);
816 tmp
.addMsg(' ', styleText('no_such_nick', {nick
: event
.nick
, text
: event
.reason
, channel
: event
.channel
}), 'status');
818 this.panels
.server
.addMsg(' ', styleText('no_such_nick', {nick
: event
.nick
, text
: event
.reason
, channel
: event
.channel
}), 'status');
821 case 'nickname_in_use':
822 this.panels
.server
.addMsg(' ', styleText('nickname_alreadyinuse', {nick
: event
.nick
, text
: translateText('client_models_network_nickname_alreadyinuse', [event
.nick
]), channel
: event
.channel
}), 'status');
823 if (this.panels
.server
!== this.panels
.active
) {
824 _kiwi
.app
.message
.text(_kiwi
.global
.i18n
.translate('client_models_network_nickname_alreadyinuse').fetch(event
.nick
));
827 // Only show the nickchange component if the controlbox is open
828 if (_kiwi
.app
.controlbox
.$el
.css('display') !== 'none') {
829 (new _kiwi
.view
.NickChangeBox()).render();
834 case 'password_mismatch':
835 this.panels
.server
.addMsg(' ', styleText('channel_badpassword', {nick
: event
.nick
, text
: translateText('client_models_network_badpassword', []), channel
: event
.channel
}), 'status');
838 // We don't know what data contains, so don't do anything with it.
839 //_kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status');
844 function onUnknownCommand(event
) {
845 var display_params
= _
.clone(event
.params
);
847 // A lot of commands have our nick as the first parameter. This is redundant for us
848 if (display_params
[0] && display_params
[0] == this.get('nick')) {
849 display_params
.shift();
852 this.panels
.server
.addMsg('', styleText('unknown_command', {text
: '[' + event
.command
+ '] ' + display_params
.join(', ', '')}));
856 function onWallops(event
) {
857 var active_panel
= _kiwi
.app
.panels().active
;
859 // Send to server panel
860 this.panels
.server
.addMsg('[' + (event
.nick
||'') + ']', styleText('wallops', {text
: event
.msg
}), 'wallops', {time
: event
.time
});
862 // Send to active panel if its a channel/query *and* it's related to this network
863 if (active_panel
!== this.panels
.server
&& (active_panel
.isChannel() || active_panel
.isQuery()) && active_panel
.get('network') === this)
864 active_panel
.addMsg('[' + (event
.nick
||'') + ']', styleText('wallops', {text
: event
.msg
}), 'wallops', {time
: event
.time
});