2f4c2d9c735c01d73a670cfea6ea678d3a721713
1 _kiwi
.model
.Application = function () {
2 // Set to a reference to this object within initialize()
6 var model = function () {
7 /** _kiwi.view.Application */
10 /** _kiwi.view.StatusMessage */
13 /* Address for the kiwi server */
14 this.kiwi_server
= null;
16 this.initialize = function (options
) {
19 if (options
[0].container
) {
20 this.set('container', options
[0].container
);
23 // The base url to the kiwi server
24 this.set('base_path', options
[0].base_path
? options
[0].base_path
: '/kiwi');
26 // Any options sent down from the server
27 this.server_settings
= options
[0].server_settings
|| {};
28 this.translations
= options
[0].translations
|| {};
30 // Best guess at where the kiwi server is
31 this.detectKiwiServer();
33 // Takes instances of model_network
34 this.connections
= new _kiwi
.model
.NetworkPanelList();
36 // Set any default settings before anything else is applied
37 if (this.server_settings
&& this.server_settings
.client
&& this.server_settings
.client
.settings
) {
38 this.applyDefaultClientSettings(this.server_settings
.client
.settings
);
43 this.start = function () {
44 // Only debug if set in the querystring
45 if (!getQueryVariable('debug')) {
52 _kiwi
.gateway
= new _kiwi
.model
.Gateway();
53 this.bindGatewayCommands(_kiwi
.gateway
);
55 this.initializeClient();
56 this.initializeGlobals();
58 this.view
.barsHide(true);
60 this.showIntialConenctionDialog();
64 this.detectKiwiServer = function () {
65 // If running from file, default to localhost:7777 by default
66 if (window
.location
.protocol
=== 'file:') {
67 this.kiwi_server
= 'http://localhost:7778';
69 // Assume the kiwi server is on the same server
70 this.kiwi_server
= window
.location
.protocol
+ '//' + window
.location
.host
;
75 this.showIntialConenctionDialog = function() {
76 var connection_dialog
= new _kiwi
.model
.NewConnection();
77 this.populateDefaultServerSettings(connection_dialog
);
79 connection_dialog
.view
.$el
.addClass('initial');
80 this.view
.$el
.find('.panel_container:first').append(connection_dialog
.view
.$el
);
82 var $info
= $($('#tmpl_new_connection_info').html().trim());
85 connection_dialog
.view
.infoBoxSet($info
);
86 connection_dialog
.view
.infoBoxShow();
89 // TODO: Shouldn't really be here but it's not working in the view.. :/
90 // Hack for firefox browers: Focus is not given on this event loop iteration
91 setTimeout(function(){
92 connection_dialog
.view
.$el
.find('.nick').select();
95 // Once connected, close this dialog and remove its own event
97 connection_dialog
.view
.$el
.slideUp(function() {
98 connection_dialog
.view
.dispose();
99 connection_dialog
= null;
101 _kiwi
.gateway
.off('onconnect', fn
);
105 _kiwi
.gateway
.on('onconnect', fn
);
109 this.initializeClient = function () {
110 this.view
= new _kiwi
.view
.Application({model
: this, el
: this.get('container')});
112 // Applets panel list
113 this.applet_panels
= new _kiwi
.model
.PanelList();
114 this.applet_panels
.view
.$el
.addClass('panellist applets');
115 this.view
.$el
.find('.tabs').append(this.applet_panels
.view
.$el
);
118 * Set the UI components up
120 this.controlbox
= new _kiwi
.view
.ControlBox({el
: $('#kiwi .controlbox')[0]});
121 this.bindControllboxCommands(this.controlbox
);
123 this.topicbar
= new _kiwi
.view
.TopicBar({el
: this.view
.$el
.find('.topic')[0]});
125 new _kiwi
.view
.AppToolbar({el
: _kiwi
.app
.view
.$el
.find('.toolbar .app_tools')[0]});
127 this.message
= new _kiwi
.view
.StatusMessage({el
: this.view
.$el
.find('.status_message')[0]});
129 this.resize_handle
= new _kiwi
.view
.ResizeHandler({el
: this.view
.$el
.find('.memberlists_resize_handle')[0]});
131 // Rejigg the UI sizes
132 this.view
.doLayout();
136 this.initializeGlobals = function () {
137 _kiwi
.global
.connections
= this.connections
;
139 _kiwi
.global
.panels
= this.panels
;
140 _kiwi
.global
.panels
.applets
= this.applet_panels
;
142 _kiwi
.global
.components
.Applet
= _kiwi
.model
.Applet
;
143 _kiwi
.global
.components
.Panel
=_kiwi
.model
.Panel
;
147 this.applyDefaultClientSettings = function (settings
) {
148 _
.each(settings
, function (value
, setting
) {
149 if (typeof _kiwi
.global
.settings
.get(setting
) === 'undefined') {
150 _kiwi
.global
.settings
.set(setting
, value
);
156 this.populateDefaultServerSettings = function (new_connection_dialog
) {
170 * Get any settings set by the server
171 * These settings may be changed in the server selection dialog or via URL parameters
173 if (this.server_settings
.client
) {
174 if (this.server_settings
.client
.nick
)
175 defaults
.nick
= this.server_settings
.client
.nick
;
177 if (this.server_settings
.client
.server
)
178 defaults
.server
= this.server_settings
.client
.server
;
180 if (this.server_settings
.client
.port
)
181 defaults
.port
= this.server_settings
.client
.port
;
183 if (this.server_settings
.client
.ssl
)
184 defaults
.ssl
= this.server_settings
.client
.ssl
;
186 if (this.server_settings
.client
.channel
)
187 defaults
.channel
= this.server_settings
.client
.channel
;
189 if (this.server_settings
.client
.channel_key
)
190 defaults
.channel_key
= this.server_settings
.client
.channel_key
;
196 * Get any settings passed in the URL
197 * These settings may be changed in the server selection dialog
200 // Any query parameters first
201 if (getQueryVariable('nick'))
202 defaults
.nick
= getQueryVariable('nick');
204 if (window
.location
.hash
)
205 defaults
.channel
= window
.location
.hash
;
208 // Process the URL part by part, extracting as we go
209 parts
= window
.location
.pathname
.toString().replace(this.get('base_path'), '').split('/');
211 if (parts
.length
> 0) {
214 if (parts
.length
> 0 && parts
[0]) {
215 // Check to see if we're dealing with an irc: uri, or whether we need to extract the server/channel info from the HTTP URL path.
216 uricheck
= parts
[0].substr(0, 7).toLowerCase();
217 if ((uricheck
=== 'ircs%3a') || (uricheck
.substr(0,6) === 'irc%3a')) {
218 parts
[0] = decodeURIComponent(parts
[0]);
219 // irc[s]://<host>[:<port>]/[<channel>[?<password>]]
220 uricheck
= /^irc(s)?:(?:\/\/?)?([^:\/]+)(?::([0-9]+))?(?:(?:\/)([^\?]*)(?:(?:\?)(.*))?)?$/.exec(parts
[0]);
222 uricheck[1] = ssl (optional)
224 uricheck[3] = port (optional)
225 uricheck[4] = channel (optional)
226 uricheck[5] = channel key (optional, channel must also be set)
229 if (typeof uricheck
[1] !== 'undefined') {
231 if (defaults
.port
=== 6667) {
232 defaults
.port
= 6697;
235 defaults
.server
= uricheck
[2];
236 if (typeof uricheck
[3] !== 'undefined') {
237 defaults
.port
= uricheck
[3];
239 if (typeof uricheck
[4] !== 'undefined') {
240 defaults
.channel
= '#' + uricheck
[4];
241 if (typeof uricheck
[5] !== 'undefined') {
242 defaults
.channel_key
= uricheck
[5];
248 // Extract the port+ssl if we find one
249 if (parts
[0].search(/:/) > 0) {
250 defaults
.port
= parts
[0].substring(parts
[0].search(/:/) + 1);
251 defaults
.server
= parts
[0].substring(0, parts
[0].search(/:/));
252 if (defaults
.port
[0] === '+') {
253 defaults
.port
= parseInt(defaults
.port
.substring(1), 10);
256 defaults
.ssl
= false;
260 defaults
.server
= parts
[0];
267 if (parts
.length
> 0 && parts
[0]) {
268 defaults
.channel
= '#' + parts
[0];
273 // If any settings have been given by the server.. override any auto detected settings
275 * Get any server restrictions as set in the server config
276 * These settings can not be changed in the server selection dialog
278 if (this.server_settings
&& this.server_settings
.connection
) {
279 if (this.server_settings
.connection
.server
) {
280 defaults
.server
= this.server_settings
.connection
.server
;
283 if (this.server_settings
.connection
.port
) {
284 defaults
.port
= this.server_settings
.connection
.port
;
287 if (this.server_settings
.connection
.ssl
) {
288 defaults
.ssl
= this.server_settings
.connection
.ssl
;
291 if (this.server_settings
.connection
.channel
) {
292 defaults
.channel
= this.server_settings
.connection
.channel
;
295 if (this.server_settings
.connection
.channel_key
) {
296 defaults
.channel_key
= this.server_settings
.connection
.channel_key
;
299 if (this.server_settings
.connection
.nick
) {
300 defaults
.nick
= this.server_settings
.connection
.nick
;
304 // Set any random numbers if needed
305 defaults
.nick
= defaults
.nick
.replace('?', Math
.floor(Math
.random() * 100000).toString());
307 // Populate the server select box with defaults
308 new_connection_dialog
.view
.populateFields(defaults
);
312 this.panels
= (function() {
313 var fn = function(panel_type
) {
316 // Default panel type
317 panel_type
= panel_type
|| 'connections';
319 switch (panel_type
) {
321 panels
= this.connections
.panels();
324 panels
= this.applet_panels
.models
;
328 // Active panels / server
329 panels
.active
= this.connections
.active_panel
;
330 panels
.server
= this.connections
.active_connection
?
331 this.connections
.active_connection
.panels
.server
:
337 _
.extend(fn
, Backbone
.Events
);
343 this.bindGatewayCommands = function (gw
) {
344 gw
.on('onconnect', function (event
) {
345 that
.view
.barsShow();
350 * Handle the reconnections to the kiwi server
355 gw
.on('disconnect', function (event
) {
356 var msg
= _kiwi
.global
.i18n
.translate('You have been disconnected. Attempting to reconnect for you').fetch() + '...';
357 that
.message
.text(msg
, {timeout
: 10000});
359 that
.view
.$el
.removeClass('connected');
361 // Mention the disconnection on every channel
362 _kiwi
.app
.connections
.forEach(function(connection
) {
363 connection
.panels
.server
.addMsg('', msg
, 'action quit');
365 connection
.panels
.forEach(function(panel
) {
366 if (!panel
.isChannel())
369 panel
.addMsg('', msg
, 'action quit');
377 gw
.on('reconnecting', function (event
) {
378 var msg
= _kiwi
.global
.i18n
.translate('You have been disconnected. Attempting to reconnect again in %d seconds').fetch(event
.delay
/1000) + '...';
380 // Only need to mention the repeating re-connection messages on server panels
381 _kiwi
.app
.connections
.forEach(function(connection
) {
382 connection
.panels
.server
.addMsg('', msg
, 'action quit');
387 gw
.on('onconnect', function (event
) {
388 that
.view
.$el
.addClass('connected');
389 if (gw_stat
!== 1) return;
391 var msg
= _kiwi
.global
.i18n
.translate('It\'s OK, you\'re connected again').fetch() + ':)';
392 that
.message
.text(msg
, {timeout
: 5000});
394 // Mention the disconnection on every channel
395 _kiwi
.app
.connections
.forEach(function(connection
) {
396 connection
.panels
.server
.addMsg('', msg
, 'action join');
398 connection
.panels
.forEach(function(panel
) {
399 if (!panel
.isChannel())
402 panel
.addMsg('', msg
, 'action join');
415 * Bind to certain commands that may be typed into the control box
417 this.bindControllboxCommands = function (controlbox
) {
419 $.extend(controlbox
.preprocessor
.aliases
, {
422 '/me': '/action $1+',
426 '/raw': '/quote $1+',
428 // Op related aliases
429 '/op': '/quote mode $channel +o $1+',
430 '/deop': '/quote mode $channel -o $1+',
431 '/hop': '/quote mode $channel +h $1+',
432 '/dehop': '/quote mode $channel -h $1+',
433 '/voice': '/quote mode $channel +v $1+',
434 '/devoice': '/quote mode $channel -v $1+',
435 '/k': '/kick $channel $1+',
438 '/slap': '/me slaps $1 around a bit with a large trout'
441 controlbox
.on('unknown_command', unknownCommand
);
443 controlbox
.on('command', allCommands
);
444 controlbox
.on('command:msg', msgCommand
);
446 controlbox
.on('command:action', actionCommand
);
448 controlbox
.on('command:join', joinCommand
);
450 controlbox
.on('command:part', partCommand
);
452 controlbox
.on('command:nick', function (ev
) {
453 _kiwi
.gateway
.changeNick(null, ev
.params
[0]);
456 controlbox
.on('command:query', queryCommand
);
458 controlbox
.on('command:topic', topicCommand
);
460 controlbox
.on('command:notice', noticeCommand
);
462 controlbox
.on('command:quote', quoteCommand
);
464 controlbox
.on('command:kick', kickCommand
);
466 controlbox
.on('command:clear', clearCommand
);
468 controlbox
.on('command:ctcp', ctcpCommand
);
470 controlbox
.on('command:server', serverCommand
);
472 controlbox
.on('command:whois', whoisCommand
);
474 controlbox
.on('command:whowas', whowasCommand
);
476 controlbox
.on('command:encoding', encodingCommand
);
478 controlbox
.on('command:css', function (ev
) {
479 var queryString
= '?reload=' + new Date().getTime();
480 $('link[rel="stylesheet"]').each(function () {
481 this.href
= this.href
.replace(/\?.*|$/, queryString
);
485 controlbox
.on('command:js', function (ev
) {
486 if (!ev
.params
[0]) return;
487 $script(ev
.params
[0] + '?' + (new Date().getTime()));
491 controlbox
.on('command:set', function (ev
) {
492 if (!ev
.params
[0]) return;
494 var setting
= ev
.params
[0],
497 // Do we have a second param to set a value?
501 value
= ev
.params
.join(' ');
503 // If we're setting a true boolean value..
504 if (value
=== 'true')
507 // If we're setting a false boolean value..
508 if (value
=== 'false')
511 // If we're setting a number..
512 if (parseInt(value
, 10).toString() === value
)
513 value
= parseInt(value
, 10);
515 _kiwi
.global
.settings
.set(setting
, value
);
518 // Read the value to the user
519 _kiwi
.app
.panels().active
.addMsg('', setting
+ ' = ' + _kiwi
.global
.settings
.get(setting
).toString());
523 controlbox
.on('command:save', function (ev
) {
524 _kiwi
.global
.settings
.save();
525 _kiwi
.app
.panels().active
.addMsg('', _kiwi
.global
.i18n
.translate('Settings have been saved').fetch());
529 controlbox
.on('command:alias', function (ev
) {
532 // No parameters passed so list them
534 $.each(controlbox
.preprocessor
.aliases
, function (name
, rule
) {
535 _kiwi
.app
.panels().server
.addMsg(' ', name
+ ' => ' + rule
);
540 // Deleting an alias?
541 if (ev
.params
[0] === 'del' || ev
.params
[0] === 'delete') {
543 if (name
[0] !== '/') name
= '/' + name
;
544 delete controlbox
.preprocessor
.aliases
[name
];
551 rule
= ev
.params
.join(' ');
553 // Make sure the name starts with a slash
554 if (name
[0] !== '/') name
= '/' + name
;
556 // Now actually add the alias
557 controlbox
.preprocessor
.aliases
[name
] = rule
;
561 controlbox
.on('command:ignore', function (ev
) {
562 var list
= _kiwi
.gateway
.get('ignore_list');
564 // No parameters passed so list them
566 if (list
.length
> 0) {
567 _kiwi
.app
.panels().active
.addMsg(' ', _kiwi
.global
.i18n
.translate('Ignored nicks').fetch() + ':');
568 $.each(list
, function (idx
, ignored_pattern
) {
569 _kiwi
.app
.panels().active
.addMsg(' ', ignored_pattern
);
572 _kiwi
.app
.panels().active
.addMsg(' ', _kiwi
.global
.i18n
.translate('Not ignoring anybody').fetch());
577 // We have a parameter, so add it
578 list
.push(ev
.params
[0]);
579 _kiwi
.gateway
.set('ignore_list', list
);
580 _kiwi
.app
.panels().active
.addMsg(' ', _kiwi
.global
.i18n
.translate('Ignoring %s').fetch(ev
.params
[0]));
584 controlbox
.on('command:unignore', function (ev
) {
585 var list
= _kiwi
.gateway
.get('ignore_list');
588 _kiwi
.app
.panels().active
.addMsg(' ', _kiwi
.global
.i18n
.translate('Specifiy which nick you wish to stop ignoring').fetch());
592 list
= _
.reject(list
, function(pattern
) {
593 return pattern
=== ev
.params
[0];
596 _kiwi
.gateway
.set('ignore_list', list
);
598 _kiwi
.app
.panels().active
.addMsg(' ', _kiwi
.global
.i18n
.translate('Stopped ignoring %s').fetch(ev
.params
[0]));
602 controlbox
.on('command:applet', appletCommand
);
603 controlbox
.on('command:settings', settingsCommand
);
604 controlbox
.on('command:script', scriptCommand
);
607 // A fallback action. Send a raw command to the server
608 function unknownCommand (ev
) {
609 var raw_cmd
= ev
.command
+ ' ' + ev
.params
.join(' ');
610 console
.log('RAW: ' + raw_cmd
);
611 _kiwi
.gateway
.raw(null, raw_cmd
);
614 function allCommands (ev
) {}
616 function joinCommand (ev
) {
617 var panels
, channel_names
;
619 channel_names
= ev
.params
.join(' ').split(',');
620 panels
= that
.connections
.active_connection
.createAndJoinChannels(channel_names
);
622 // Show the last channel if we have one
624 panels
[panels
.length
- 1].view
.show();
627 function queryCommand (ev
) {
628 var destination
, panel
;
630 destination
= ev
.params
[0];
632 // Check if we have the panel already. If not, create it
633 panel
= that
.connections
.active_connection
.panels
.getByName(destination
);
635 panel
= new _kiwi
.model
.Query({name
: destination
});
636 that
.connections
.active_connection
.panels
.add(panel
);
639 if (panel
) panel
.view
.show();
643 function msgCommand (ev
) {
644 var destination
= ev
.params
[0],
645 panel
= that
.connections
.active_connection
.panels
.getByName(destination
) || that
.panels().server
;
649 panel
.addMsg(_kiwi
.app
.connections
.active_connection
.get('nick'), ev
.params
.join(' '));
650 _kiwi
.gateway
.privmsg(null, destination
, ev
.params
.join(' '));
653 function actionCommand (ev
) {
654 if (_kiwi
.app
.panels().active
.isServer()) {
658 var panel
= _kiwi
.app
.panels().active
;
659 panel
.addMsg('', '* ' + _kiwi
.app
.connections
.active_connection
.get('nick') + ' ' + ev
.params
.join(' '), 'action');
660 _kiwi
.gateway
.action(null, panel
.get('name'), ev
.params
.join(' '));
663 function partCommand (ev
) {
664 if (ev
.params
.length
=== 0) {
665 _kiwi
.gateway
.part(null, _kiwi
.app
.panels().active
.get('name'));
667 _
.each(ev
.params
, function (channel
) {
668 _kiwi
.gateway
.part(null, channel
);
673 function topicCommand (ev
) {
676 if (ev
.params
.length
=== 0) return;
678 if (that
.isChannelName(ev
.params
[0])) {
679 channel_name
= ev
.params
[0];
682 channel_name
= _kiwi
.app
.panels().active
.get('name');
685 _kiwi
.gateway
.topic(null, channel_name
, ev
.params
.join(' '));
688 function noticeCommand (ev
) {
691 // Make sure we have a destination and some sort of message
692 if (ev
.params
.length
<= 1) return;
694 destination
= ev
.params
[0];
697 _kiwi
.gateway
.notice(null, destination
, ev
.params
.join(' '));
700 function quoteCommand (ev
) {
701 var raw
= ev
.params
.join(' ');
702 _kiwi
.gateway
.raw(null, raw
);
705 function kickCommand (ev
) {
706 var nick
, panel
= _kiwi
.app
.panels().active
;
708 if (!panel
.isChannel()) return;
710 // Make sure we have a nick
711 if (ev
.params
.length
=== 0) return;
716 _kiwi
.gateway
.kick(null, panel
.get('name'), nick
, ev
.params
.join(' '));
719 function clearCommand (ev
) {
720 // Can't clear a server or applet panel
721 if (_kiwi
.app
.panels().active
.isServer() || _kiwi
.app
.panels().active
.isApplet()) {
725 if (_kiwi
.app
.panels().active
.clearMessages
) {
726 _kiwi
.app
.panels().active
.clearMessages();
730 function ctcpCommand(ev
) {
733 // Make sure we have a target and a ctcp type (eg. version, time)
734 if (ev
.params
.length
< 2) return;
736 target
= ev
.params
[0];
742 _kiwi
.gateway
.ctcp(null, true, type
, target
, ev
.params
.join(' '));
745 function settingsCommand (ev
) {
746 var settings
= _kiwi
.model
.Applet
.loadOnce('kiwi_settings');
747 settings
.view
.show();
750 function scriptCommand (ev
) {
751 var editor
= _kiwi
.model
.Applet
.loadOnce('kiwi_script_editor');
755 function appletCommand (ev
) {
756 if (!ev
.params
[0]) return;
758 var panel
= new _kiwi
.model
.Applet();
761 // Url and name given
762 panel
.load(ev
.params
[0], ev
.params
[1]);
764 // Load a pre-loaded applet
765 if (_kiwi
.applets
[ev
.params
[0]]) {
766 panel
.load(new _kiwi
.applets
[ev
.params
[0]]());
768 _kiwi
.app
.panels().server
.addMsg('', _kiwi
.global
.i18n
.translate('Applet "%s" does not exist').fetch(ev
.params
[0]));
773 _kiwi
.app
.connections
.active_connection
.panels
.add(panel
);
778 function whoisCommand (ev
) {
783 } else if (_kiwi
.app
.panels().active
.isQuery()) {
784 nick
= _kiwi
.app
.panels().active
.get('name');
788 _kiwi
.app
.connections
.active_connection
.gateway
.raw('WHOIS ' + nick
+ ' ' + nick
);
792 function whowasCommand (ev
) {
797 } else if (_kiwi
.app
.panels().active
.isQuery()) {
798 nick
= _kiwi
.app
.panels().active
.get('name');
802 _kiwi
.app
.connections
.active_connection
.gateway
.raw('WHOWAS ' + nick
);
805 function encodingCommand (ev
) {
807 _kiwi
.gateway
.setEncoding(null, ev
.params
[0], function (success
) {
809 _kiwi
.app
.panels().active
.addMsg('', _kiwi
.global
.i18n
.translate('Encoding modified to %s').fetch(ev
.params
[0]));
811 _kiwi
.app
.panels().active
.addMsg('', _kiwi
.global
.i18n
.translate('%s is not a valid encoding').fetch(ev
.params
[0]));
815 _kiwi
.app
.panels().active
.addMsg('', _kiwi
.global
.i18n
.translate('Encoding not specified').fetch());
816 _kiwi
.app
.panels().active
.addMsg('', _kiwi
.global
.i18n
.translate('Usage: /encoding [NEW-ENCODING]').fetch());
820 function serverCommand (ev
) {
821 var server
, port
, ssl
, password
, nick
,
824 // If no server address given, show the new connection dialog
826 tmp
= new _kiwi
.view
.MenuBox(_kiwi
.global
.i18n
.translate('New Connection').fetch());
827 tmp
.addItem('new_connection', new _kiwi
.model
.NewConnection().view
.$el
);
830 // Center screen the dialog
832 top
: (that
.view
.$el
.height() / 2) - (tmp
.$el
.height() / 2),
833 left
: (that
.view
.$el
.width() / 2) - (tmp
.$el
.width() / 2)
839 // Port given in 'host:port' format and no specific port given after a space
840 if (ev
.params
[0].indexOf(':') > 0) {
841 tmp
= ev
.params
[0].split(':');
845 password
= ev
.params
[1] || undefined;
848 // Server + port given as 'host port'
849 server
= ev
.params
[0];
850 port
= ev
.params
[1] || 6667;
852 password
= ev
.params
[2] || undefined;
855 // + in the port means SSL
856 if (port
.toString()[0] === '+') {
858 port
= parseInt(port
.substring(1), 10);
863 // Default port if one wasn't found
866 // Use the same nick as we currently have
867 nick
= _kiwi
.app
.connections
.active_connection
.get('nick');
869 _kiwi
.app
.panels().active
.addMsg('', _kiwi
.global
.i18n
.translate('Connecting to %s:%s...').fetch(server
, port
.toString()));
871 _kiwi
.gateway
.newConnection({
877 }, function(err
, new_connection
) {
879 _kiwi
.app
.panels().active
.addMsg('', _kiwi
.global
.i18n
.translate('Error connecting to %s:%s (%s)').fetch(server
, port
.toString(), err
.toString()));
887 this.isChannelName = function (channel_name
) {
888 var channel_prefix
= _kiwi
.gateway
.get('channel_prefix');
890 if (!channel_name
|| !channel_name
.length
) return false;
891 return (channel_prefix
.indexOf(channel_name
[0]) > -1);
898 model
= Backbone
.Model
.extend(new model());
900 return new model(arguments
);