1 kiwi
.model
.Application = function () {
2 // Set to a reference to this object within initialize()
5 // The auto connect details entered into the server select box
6 var auto_connect_details
= {};
9 var model = function () {
10 /** Instance of kiwi.model.PanelList */
13 /** kiwi.view.Application */
16 /** kiwi.view.StatusMessage */
19 /* Address for the kiwi server */
20 this.kiwi_server
= null;
22 this.initialize = function (options
) {
25 if (options
[0].container
) {
26 this.set('container', options
[0].container
);
29 // Best guess at where the kiwi server is
30 this.detectKiwiServer();
33 this.start = function () {
34 // Only debug if set in the querystring
35 if (!getQueryVariable('debug')) {
42 kiwi
.gateway
= new kiwi
.model
.Gateway();
43 this.bindGatewayCommands(kiwi
.gateway
);
45 this.initializeClient();
46 this.initializeGlobals();
48 this.view
.barsHide(true);
50 this.panels
.server
.server_login
.bind('server_connect', function (event
) {
51 var server_login
= this;
52 auto_connect_details
= event
;
54 server_login
.networkConnecting();
56 $script(that
.kiwi_server
+ '/socket.io/socket.io.js?ts='+(new Date().getTime()), function () {
61 kiwi
.gateway
.set('kiwi_server', that
.kiwi_server
+ '/kiwi');
62 kiwi
.gateway
.set('nick', event
.nick
);
64 kiwi
.gateway
.connect(event
.server
, event
.port
, event
.ssl
, event
.password
, function () {});
68 // TODO: Shouldn't really be here but it's not working in the view.. :/
69 // Hack for firefox browers: Focus is not given on this event loop iteration
70 setTimeout(function(){
71 kiwi
.app
.panels
.server
.server_login
.$el
.find('.nick').select();
76 function kiwiServerNotFound (e
) {
77 that
.panels
.server
.server_login
.showError();
81 this.detectKiwiServer = function () {
82 // If running from file, default to localhost:7777 by default
83 if (window
.location
.protocol
=== 'file:') {
84 this.kiwi_server
= 'http://localhost:7778';
86 // Assume the kiwi server is on the same server
87 this.kiwi_server
= window
.location
.protocol
+ '//' + window
.location
.host
;
92 this.initializeClient = function () {
93 this.view
= new kiwi
.view
.Application({model
: this, el
: this.get('container')});
96 * Set the UI components up
98 this.panels
= new kiwi
.model
.PanelList();
100 this.controlbox
= new kiwi
.view
.ControlBox({el
: $('#controlbox')[0]});
101 this.bindControllboxCommands(this.controlbox
);
103 this.topicbar
= new kiwi
.view
.TopicBar({el
: $('#topic')[0]});
105 this.message
= new kiwi
.view
.StatusMessage({el
: $('#status_message')[0]});
107 this.resize_handle
= new kiwi
.view
.ResizeHandler({el
: $('#memberlists_resize_handle')[0]});
109 this.panels
.server
.view
.show();
111 // Rejigg the UI sizes
112 this.view
.doLayout();
114 this.populateDefaultServerSettings();
118 this.initializeGlobals = function () {
119 kiwi
.global
.control
= this.controlbox
;
123 this.populateDefaultServerSettings = function () {
126 nick
: getQueryVariable('nick') || 'kiwi_' + Math
.ceil(Math
.random() * 10000).toString(),
127 server
: 'irc.kiwiirc.com',
130 channel
: window
.location
.hash
|| '#kiwiirc'
133 // Process the URL part by part, extracting as we go
134 parts
= window
.location
.pathname
.toString().split('/');
137 if (parts
.length
> 0 && parts
[0].toLowerCase() === 'client') {
140 if (parts
.length
> 0 && parts
[0]) {
141 // TODO: Extract the port from this hostname
142 defaults
.server
= parts
[0];
146 if (parts
.length
> 0 && parts
[0]) {
147 defaults
.channel
= '#' + parts
[0];
152 // Set any random numbers if needed
153 defaults
.nick
= defaults
.nick
.replace('?', Math
.floor(Math
.random() * 100000).toString());
155 // Populate the server select box with defaults
156 this.panels
.server
.server_login
.populateFields(defaults
);
160 this.bindGatewayCommands = function (gw
) {
161 gw
.on('onmotd', function (event
) {
162 that
.panels
.server
.addMsg(kiwi
.gateway
.get('name'), event
.msg
, 'motd');
166 gw
.on('onconnect', function (event
) {
167 that
.view
.barsShow();
169 if (auto_connect_details
.channel
) {
170 that
.controlbox
.processInput('/JOIN ' + auto_connect_details
.channel
);
178 gw
.on('disconnect', function (event
) {
179 var msg
= 'You have been disconnected. Attempting to reconnect for you..';
180 that
.message
.text(msg
, {timeout
: 10000});
182 // Mention the disconnection on every channel
183 $.each(kiwi
.app
.panels
.models
, function (idx
, panel
) {
184 if (!panel
|| !panel
.isChannel()) return;
185 panel
.addMsg('', msg
, 'action quit');
187 kiwi
.app
.panels
.server
.addMsg('', msg
, 'action quit');
191 gw
.on('reconnecting', function (event
) {
192 msg
= 'You have been disconnected. Attempting to reconnect again in ' + (event
.delay
/1000) + ' seconds..';
193 kiwi
.app
.panels
.server
.addMsg('', msg
, 'action quit');
195 gw
.on('connect', function (event
) {
196 if (gw_stat
!== 1) return;
198 var msg
= 'It\'s OK, you\'re connected again :)';
199 that
.message
.text(msg
, {timeout
: 5000});
201 // Mention the disconnection on every channel
202 $.each(kiwi
.app
.panels
.models
, function (idx
, panel
) {
203 if (!panel
|| !panel
.isChannel()) return;
204 panel
.addMsg('', msg
, 'action join');
206 kiwi
.app
.panels
.server
.addMsg('', msg
, 'action join');
213 gw
.on('onjoin', function (event
) {
214 var c
, members
, user
;
215 c
= that
.panels
.getByName(event
.channel
);
217 c
= new kiwi
.model
.Channel({name
: event
.channel
});
221 members
= c
.get('members');
222 if (!members
) return;
224 user
= new kiwi
.model
.Member({nick
: event
.nick
, ident
: event
.ident
, hostname
: event
.hostname
});
226 // TODO: highlight the new channel in some way
230 gw
.on('onpart', function (event
) {
231 var channel
, members
, user
,
234 part_options
.type
= 'part';
235 part_options
.message
= event
.message
|| '';
237 channel
= that
.panels
.getByName(event
.channel
);
238 if (!channel
) return;
240 // If this is us, close the panel
241 if (event
.nick
=== kiwi
.gateway
.get('nick')) {
246 members
= channel
.get('members');
247 if (!members
) return;
249 user
= members
.getByNick(event
.nick
);
252 members
.remove(user
, part_options
);
256 gw
.on('onquit', function (event
) {
260 quit_options
.type
= 'quit';
261 quit_options
.message
= event
.message
|| '';
263 $.each(that
.panels
.models
, function (index
, panel
) {
264 if (!panel
.isChannel()) return;
266 member
= panel
.get('members').getByNick(event
.nick
);
268 panel
.get('members').remove(member
, quit_options
);
274 gw
.on('onkick', function (event
) {
275 var channel
, members
, user
,
278 part_options
.type
= 'kick';
279 part_options
.by
= event
.nick
;
280 part_options
.message
= event
.message
|| '';
282 channel
= that
.panels
.getByName(event
.channel
);
283 if (!channel
) return;
285 members
= channel
.get('members');
286 if (!members
) return;
288 user
= members
.getByNick(event
.kicked
);
291 members
.remove(user
, part_options
);
293 if (event
.kicked
=== kiwi
.gateway
.get('nick')) {
300 gw
.on('onmsg', function (event
) {
302 is_pm
= (event
.channel
== kiwi
.gateway
.get('nick'));
305 // If a panel isn't found for this PM, create one
306 panel
= that
.panels
.getByName(event
.nick
);
308 panel
= new kiwi
.model
.Channel({name
: event
.nick
});
309 that
.panels
.add(panel
);
313 // If a panel isn't found for this channel, reroute to the
315 panel
= that
.panels
.getByName(event
.channel
);
317 panel
= that
.panels
.server
;
321 panel
.addMsg(event
.nick
, event
.msg
);
325 gw
.on('onnotice', function (event
) {
328 // Find a panel for the destination(channel) or who its from
329 panel
= that
.panels
.getByName(event
.target
) || that
.panels
.getByName(event
.nick
);
331 panel
= that
.panels
.server
;
334 panel
.addMsg('[' + (event
.nick
||'') + ']', event
.msg
);
338 gw
.on('onaction', function (event
) {
340 is_pm
= (event
.channel
== kiwi
.gateway
.get('nick'));
343 // If a panel isn't found for this PM, create one
344 panel
= that
.panels
.getByName(event
.nick
);
346 panel
= new kiwi
.model
.Channel({name
: event
.nick
});
347 that
.panels
.add(panel
);
351 // If a panel isn't found for this channel, reroute to the
353 panel
= that
.panels
.getByName(event
.channel
);
355 panel
= that
.panels
.server
;
359 panel
.addMsg('', '* ' + event
.nick
+ ' ' + event
.msg
, 'action');
363 gw
.on('ontopic', function (event
) {
365 c
= that
.panels
.getByName(event
.channel
);
368 // Set the channels topic
369 c
.set('topic', event
.topic
);
371 // If this is the active channel, update the topic bar too
372 if (c
.get('name') === kiwi
.app
.panels
.active
.get('name')) {
373 that
.topicbar
.setCurrentTopic(event
.topic
);
378 gw
.on('ontopicsetby', function (event
) {
380 c
= that
.panels
.getByName(event
.channel
);
383 when
= formatDate(new Date(event
.when
* 1000));
384 c
.addMsg('', 'Topic set by ' + event
.nick
+ ' at ' + when
, 'topic');
388 gw
.on('onuserlist', function (event
) {
390 channel
= that
.panels
.getByName(event
.channel
);
392 // If we didn't find a channel for this, may aswell leave
393 if (!channel
) return;
395 channel
.temp_userlist
= channel
.temp_userlist
|| [];
396 _
.each(event
.users
, function (item
) {
397 var user
= new kiwi
.model
.Member({nick
: item
.nick
, modes
: item
.modes
});
398 channel
.temp_userlist
.push(user
);
403 gw
.on('onuserlist_end', function (event
) {
405 channel
= that
.panels
.getByName(event
.channel
);
407 // If we didn't find a channel for this, may aswell leave
408 if (!channel
) return;
410 // Update the members list with the new list
411 channel
.get('members').reset(channel
.temp_userlist
|| []);
413 // Clear the temporary userlist
414 delete channel
.temp_userlist
;
418 gw
.on('onmode', function (event
) {
419 var channel
, i
, prefixes
, members
, member
, find_prefix
;
421 // Build a nicely formatted string to be displayed to a regular human
422 function friendlyModeString (event_modes
, alt_target
) {
423 var modes
= {}, return_string
;
425 // If no default given, use the main event info
427 event_modes
= event
.modes
;
428 alt_target
= event
.target
;
431 // Reformat the mode object to make it easier to work with
432 _
.each(event_modes
, function (mode
){
433 var param
= mode
.param
|| alt_target
|| '';
435 // Make sure we have some modes for this param
437 modes
[param
] = {'+':'', '-':''};
440 modes
[param
][mode
.mode
[0]] += mode
.mode
.substr(1);
443 // Put the string together from each mode
445 _
.each(modes
, function (modeset
, param
) {
447 if (modeset
['+']) str
+= '+' + modeset
['+'];
448 if (modeset
['-']) str
+= '-' + modeset
['-'];
449 return_string
.push(str
+ ' ' + param
);
451 return_string
= return_string
.join(', ');
453 return return_string
;
457 channel
= that
.panels
.getByName(event
.target
);
459 prefixes
= kiwi
.gateway
.get('user_prefixes');
460 find_prefix = function (p
) {
461 return event
.modes
[i
].mode
[1] === p
.mode
;
463 for (i
= 0; i
< event
.modes
.length
; i
++) {
464 if (_
.any(prefixes
, find_prefix
)) {
466 members
= channel
.get('members');
468 member
= members
.getByNick(event
.modes
[i
].param
);
470 console
.log('MODE command recieved for unknown member %s on channel %s', event
.modes
[i
].param
, event
.target
);
473 if (event
.modes
[i
].mode
[0] === '+') {
474 member
.addMode(event
.modes
[i
].mode
[1]);
475 } else if (event
.modes
[i
].mode
[0] === '-') {
476 member
.removeMode(event
.modes
[i
].mode
[1]);
479 //channel.addMsg('', '== ' + event.nick + ' set mode ' + event.modes[i].mode + ' ' + event.modes[i].param, 'action mode');
482 // Channel mode being set
483 // TODO: Store this somewhere?
484 //channel.addMsg('', 'CHANNEL === ' + event.nick + ' set mode ' + event.modes[i].mode + ' on ' + event.target, 'action mode');
488 channel
.addMsg('', '== ' + event
.nick
+ ' sets mode ' + friendlyModeString(), 'action mode');
490 // This is probably a mode being set on us.
491 if (event
.target
.toLowerCase() === kiwi
.gateway
.get("nick").toLowerCase()) {
492 that
.panels
.server
.addMsg('', '== ' + event
.nick
+ ' set mode ' + friendlyModeString(), 'action mode');
494 console
.log('MODE command recieved for unknown target %s: ', event
.target
, event
);
500 gw
.on('onnick', function (event
) {
503 $.each(that
.panels
.models
, function (index
, panel
) {
504 if (!panel
.isChannel()) return;
506 member
= panel
.get('members').getByNick(event
.nick
);
508 member
.set('nick', event
.newnick
);
509 panel
.addMsg('', '== ' + event
.nick
+ ' is now known as ' + event
.newnick
, 'action nick');
515 gw
.on('onwhois', function (event
) {
516 /*globals secondsToTime */
517 var logon_date
, idle_time
= '', panel
;
523 if (typeof event
.idle
!== 'undefined') {
524 idle_time
= secondsToTime(parseInt(event
.idle
, 10));
525 idle_time
= idle_time
.h
.toString().lpad(2, "0") + ':' + idle_time
.m
.toString().lpad(2, "0") + ':' + idle_time
.s
.toString().lpad(2, "0");
528 panel
= kiwi
.app
.panels
.active
;
530 panel
.addMsg(event
.nick
, 'is ' + event
.nick
+ '!' + event
.ident
+ '@' + event
.host
+ ' * ' + event
.msg
, 'whois');
531 } else if (event
.chans
) {
532 panel
.addMsg(event
.nick
, 'on ' + event
.chans
, 'whois');
533 } else if (event
.server
) {
534 panel
.addMsg(event
.nick
, 'using ' + event
.server
, 'whois');
535 } else if (event
.msg
) {
536 panel
.addMsg(event
.nick
, event
.msg
, 'whois');
537 } else if (event
.logon
) {
538 logon_date
= new Date();
539 logon_date
.setTime(event
.logon
* 1000);
540 logon_date
= formatDate(logon_date
);
542 panel
.addMsg(event
.nick
, 'idle for ' + idle_time
+ ', signed on ' + logon_date
, 'whois');
544 panel
.addMsg(event
.nick
, 'idle for ' + idle_time
, 'whois');
549 gw
.on('onlist_start', function (data
) {
550 if (kiwi
.app
.channel_list
) {
551 kiwi
.app
.channel_list
.close();
552 delete kiwi
.app
.channel_list
;
555 var panel
= new kiwi
.model
.Applet(),
556 applet
= new kiwi
.applets
.Chanlist();
560 kiwi
.app
.panels
.add(panel
);
563 kiwi
.app
.channel_list
= applet
;
567 gw
.on('onlist_channel', function (data
) {
568 // TODO: Put this listener within the applet itself
569 kiwi
.app
.channel_list
.addChannel(data
.chans
);
573 gw
.on('onlist_end', function (data
) {
574 // TODO: Put this listener within the applet itself
575 delete kiwi
.app
.channel_list
;
579 gw
.on('onirc_error', function (data
) {
582 if (data
.channel
!== undefined && !(panel
= kiwi
.app
.panels
.getByName(data
.channel
))) {
583 panel
= kiwi
.app
.panels
.server
;
586 switch (data
.error
) {
587 case 'banned_from_channel':
588 panel
.addMsg(' ', '== You are banned from ' + data
.channel
+ '. ' + data
.reason
, 'status');
589 kiwi
.app
.message
.text('You are banned from ' + data
.channel
+ '. ' + data
.reason
);
591 case 'bad_channel_key':
592 panel
.addMsg(' ', '== Bad channel key for ' + data
.channel
, 'status');
593 kiwi
.app
.message
.text('Bad channel key or password for ' + data
.channel
);
595 case 'invite_only_channel':
596 panel
.addMsg(' ', '== ' + data
.channel
+ ' is invite only.', 'status');
597 kiwi
.app
.message
.text(data
.channel
+ ' is invite only');
599 case 'channel_is_full':
600 panel
.addMsg(' ', '== ' + data
.channel
+ ' is full.', 'status');
601 kiwi
.app
.message
.text(data
.channel
+ ' is full');
603 case 'chanop_privs_needed':
604 panel
.addMsg(' ', '== ' + data
.reason
, 'status');
605 kiwi
.app
.message
.text(data
.reason
+ ' (' + data
.channel
+ ')');
608 tmp
= kiwi
.app
.panels
.getByName(data
.nick
);
610 tmp
.addMsg(' ', '== ' + data
.nick
+ ': ' + data
.reason
, 'status');
612 kiwi
.app
.panels
.server
.addMsg(' ', '== ' + data
.nick
+ ': ' + data
.reason
, 'status');
615 case 'nickname_in_use':
616 kiwi
.app
.panels
.server
.addMsg(' ', '== The nickname ' + data
.nick
+ ' is already in use. Please select a new nickname', 'status');
617 if (kiwi
.app
.panels
.server
!== kiwi
.app
.panels
.active
) {
618 kiwi
.app
.message
.text('The nickname "' + data
.nick
+ '" is already in use. Please select a new nickname');
621 // Only show the nickchange component if the controlbox is open
622 if (that
.controlbox
.$el
.css('display') !== 'none') {
623 (new kiwi
.view
.NickChangeBox()).render();
628 // We don't know what data contains, so don't do anything with it.
629 //kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status');
637 * Bind to certain commands that may be typed into the control box
639 this.bindControllboxCommands = function (controlbox
) {
641 $.extend(controlbox
.preprocessor
.aliases
, {
643 '/me': '/action $1+',
648 '/slap': '/me throws the juciest, sweetest kiwi at $1. Hits right in the kisser!',
649 '/throw': '/slap $1+'
652 controlbox
.on('unknown_command', unknownCommand
);
654 controlbox
.on('command', allCommands
);
655 controlbox
.on('command_msg', msgCommand
);
657 controlbox
.on('command_action', actionCommand
);
659 controlbox
.on('command_join', joinCommand
);
661 controlbox
.on('command_part', partCommand
);
663 controlbox
.on('command_nick', function (ev
) {
664 kiwi
.gateway
.changeNick(ev
.params
[0]);
667 controlbox
.on('command_query', queryCommand
);
669 controlbox
.on('command_topic', topicCommand
);
671 controlbox
.on('command_notice', noticeCommand
);
673 controlbox
.on('command_quote', quoteCommand
);
675 controlbox
.on('command_kick', kickCommand
);
678 controlbox
.on('command_css', function (ev
) {
679 var queryString
= '?reload=' + new Date().getTime();
680 $('link[rel="stylesheet"]').each(function () {
681 this.href
= this.href
.replace(/\?.*|$/, queryString
);
685 controlbox
.on('command_js', function (ev
) {
686 if (!ev
.params
[0]) return;
687 $script(ev
.params
[0] + '?' + (new Date().getTime()));
690 controlbox
.on('command_alias', function (ev
) {
693 // No parameters passed so list them
695 $.each(controlbox
.preprocessor
.aliases
, function (name
, rule
) {
696 kiwi
.app
.panels
.server
.addMsg(' ', name
+ ' => ' + rule
);
701 // Deleting an alias?
702 if (ev
.params
[0] === 'del' || ev
.params
[0] === 'delete') {
704 if (name
[0] !== '/') name
= '/' + name
;
705 delete controlbox
.preprocessor
.aliases
[name
];
712 rule
= ev
.params
.join(' ');
714 // Make sure the name starts with a slash
715 if (name
[0] !== '/') name
= '/' + name
;
717 // Now actually add the alias
718 controlbox
.preprocessor
.aliases
[name
] = rule
;
721 controlbox
.on('command_applet', appletCommand
);
722 controlbox
.on('command_settings', settingsCommand
);
725 // A fallback action. Send a raw command to the server
726 function unknownCommand (ev
) {
727 var raw_cmd
= ev
.command
+ ' ' + ev
.params
.join(' ');
728 console
.log('RAW: ' + raw_cmd
);
729 kiwi
.gateway
.raw(raw_cmd
);
732 function allCommands (ev
) {}
734 function joinCommand (ev
) {
735 var channel
, channel_names
;
737 channel_names
= ev
.params
.join(' ').split(',');
739 $.each(channel_names
, function (index
, channel_name
) {
740 // Trim any whitespace off the name
741 channel_name
= channel_name
.trim();
743 // Check if we have the panel already. If not, create it
744 channel
= that
.panels
.getByName(channel_name
);
746 channel
= new kiwi
.model
.Channel({name
: channel_name
});
747 kiwi
.app
.panels
.add(channel
);
750 kiwi
.gateway
.join(channel_name
);
753 if (channel
) channel
.view
.show();
757 function queryCommand (ev
) {
758 var destination
, panel
;
760 destination
= ev
.params
[0];
762 // Check if we have the panel already. If not, create it
763 panel
= that
.panels
.getByName(destination
);
765 panel
= new kiwi
.model
.Channel({name
: destination
});
766 kiwi
.app
.panels
.add(panel
);
769 if (panel
) panel
.view
.show();
773 function msgCommand (ev
) {
774 var destination
= ev
.params
[0],
775 panel
= that
.panels
.getByName(destination
) || that
.panels
.server
;
779 panel
.addMsg(kiwi
.gateway
.get('nick'), ev
.params
.join(' '));
780 kiwi
.gateway
.privmsg(destination
, ev
.params
.join(' '));
783 function actionCommand (ev
) {
784 if (kiwi
.app
.panels
.active
=== kiwi
.app
.panels
.server
) {
788 var panel
= kiwi
.app
.panels
.active
;
789 panel
.addMsg('', '* ' + kiwi
.gateway
.get('nick') + ' ' + ev
.params
.join(' '), 'action');
790 kiwi
.gateway
.action(panel
.get('name'), ev
.params
.join(' '));
793 function partCommand (ev
) {
794 if (ev
.params
.length
=== 0) {
795 kiwi
.gateway
.part(kiwi
.app
.panels
.active
.get('name'));
797 _
.each(ev
.params
, function (channel
) {
798 kiwi
.gateway
.part(channel
);
801 // TODO: More responsive = close tab now, more accurate = leave until part event
802 //kiwi.app.panels.remove(kiwi.app.panels.active);
805 function topicCommand (ev
) {
808 if (ev
.params
.length
=== 0) return;
810 if (that
.isChannelName(ev
.params
[0])) {
811 channel_name
= ev
.params
[0];
814 channel_name
= kiwi
.app
.panels
.active
.get('name');
817 kiwi
.gateway
.topic(channel_name
, ev
.params
.join(' '));
820 function noticeCommand (ev
) {
823 // Make sure we have a destination and some sort of message
824 if (ev
.params
.length
<= 1) return;
826 destination
= ev
.params
[0];
829 kiwi
.gateway
.notice(destination
, ev
.params
.join(' '));
832 function quoteCommand (ev
) {
833 var raw
= ev
.params
.join(' ');
834 kiwi
.gateway
.raw(raw
);
837 function kickCommand (ev
) {
838 var nick
, panel
= kiwi
.app
.panels
.active
;
840 if (!panel
.isChannel()) return;
842 // Make sure we have a nick
843 if (ev
.params
.length
=== 0) return;
848 kiwi
.gateway
.kick(panel
.get('name'), nick
, ev
.params
.join(' '));
851 function settingsCommand (ev
) {
852 var panel
= new kiwi
.model
.Applet();
853 panel
.load(new kiwi
.applets
.Settings());
855 kiwi
.app
.panels
.add(panel
);
859 function appletCommand (ev
) {
860 if (!ev
.params
[0]) return;
862 var panel
= new kiwi
.model
.Applet();
865 // Url and name given
866 panel
.load(ev
.params
[0], ev
.params
[1]);
868 // Load a pre-loaded applet
869 if (kiwi
.applets
[ev
.params
[0]]) {
870 panel
.load(new kiwi
.applets
[ev
.params
[0]]());
872 kiwi
.app
.panels
.server
.addMsg('', 'Applet "' + ev
.params
[0] + '" does not exist');
877 kiwi
.app
.panels
.add(panel
);
885 this.isChannelName = function (channel_name
) {
886 var channel_prefix
= kiwi
.gateway
.get('channel_prefix');
888 if (!channel_name
|| !channel_name
.length
) return false;
889 return (channel_prefix
.indexOf(channel_name
[0]) > -1);
895 model
= Backbone
.Model
.extend(new model());
897 return new model(arguments
);