From: Cory Chaplin Date: Sat, 10 May 2014 23:26:58 +0000 (+0200) Subject: Adding network object to network panel and query panel - fixes channel links in the... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=17fd8703027dd1523a2ab138752086562d557d95;p=KiwiIRC.git Adding network object to network panel and query panel - fixes channel links in the two panels. --- diff --git a/client/src/models/network.js b/client/src/models/network.js index 4cfcad5..cca4716 100644 --- a/client/src/models/network.js +++ b/client/src/models/network.js @@ -77,7 +77,7 @@ //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; }, @@ -411,7 +411,7 @@ // 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); } diff --git a/client/src/views/channel.js b/client/src/views/channel.js index 1f24f7c..1ebc666 100644 --- a/client/src/views/channel.js +++ b/client/src/views/channel.js @@ -59,7 +59,7 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ 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)) { @@ -74,7 +74,10 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ 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 '' + _.escape(match.trim()) + ''; + if(match.match(/^\s+/g)) { + extra_space = ' '; + } + return extra_space + '' + _.escape(match.trim()) + ''; }); }