//this.panels.network = this;
// Automatically create a server tab
- var server_panel = new _kiwi.model.Server({name: 'Server'});
+ var server_panel = new _kiwi.model.Server({name: 'Server', network: this});
this.panels.add(server_panel);
this.panels.server = this.panels.active = server_panel;
},
// If a panel isn't found for this PM, create one
panel = this.panels.getByName(event.nick);
if (!panel) {
- panel = new _kiwi.model.Query({name: event.nick});
+ panel = new _kiwi.model.Query({name: event.nick, network: this});
this.panels.add(panel);
}
time_difference,
sb = this.model.get('scrollback'),
prev_msg = sb[sb.length-2],
- network, hour, pm;
+ network, hour, pm, extra_space = '';
// Nick highlight detecting
if ((new RegExp('(^|\\W)(' + escapeRegex(_kiwi.app.connections.active_connection.get('nick')) + ')(\\W|$)', 'i')).test(msg.msg)) {
if ((network = this.model.get('network'))) {
re = new RegExp('(?:^|\\s)([' + escapeRegex(network.get('channel_prefix')) + '][^ ,\\007]+)', 'g');
msg.msg = msg.msg.replace(re, function (match) {
- return '<a class="chan" data-channel="' + _.escape(match.trim()) + '">' + _.escape(match.trim()) + '</a>';
+ if(match.match(/^\s+/g)) {
+ extra_space = ' ';
+ }
+ return extra_space + '<a class="chan" data-channel="' + _.escape(match.trim()) + '">' + _.escape(match.trim()) + '</a>';
});
}