From: Darren Date: Sun, 2 Sep 2012 18:02:30 +0000 (+0100) Subject: Topics showing correctly, IRC formatting fixed X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6821a8f07c9602d19270e865f0bde925a62d6ff3;p=KiwiIRC.git Topics showing correctly, IRC formatting fixed --- diff --git a/client_backbone/dev/model_panel.js b/client_backbone/dev/model_panel.js index 3bc446f..7f5e81b 100644 --- a/client_backbone/dev/model_panel.js +++ b/client_backbone/dev/model_panel.js @@ -24,10 +24,6 @@ kiwi.model.Panel = Backbone.Model.extend({ opts.style = ''; } - // Escape any HTML that may be in here - // This doesn't seem right to be here.. should be in view (??) - msg = $('
').text(msg).html(); - // Run through the plugins message_obj = {"msg": msg, "time": opts.time, "nick": nick, "chan": this.get("name"), "type": type, "style": opts.style}; //tmp = kiwi.plugs.run('addmsg', message_obj); @@ -45,9 +41,6 @@ kiwi.model.Panel = Backbone.Model.extend({ message_obj.msg = ''; } - // Convert IRC formatting into HTML formatting - message_obj.msg = formatIRCMsg(message_obj.msg); - // Update the scrollback bs = this.get("scrollback"); bs.push(message_obj); diff --git a/client_backbone/dev/view.js b/client_backbone/dev/view.js index 1c25b16..f18866d 100644 --- a/client_backbone/dev/view.js +++ b/client_backbone/dev/view.js @@ -175,13 +175,19 @@ kiwi.view.Panel = Backbone.View.extend({ // TODO: make sure that the message pane is scrolled to the bottom (Or do we? ~Darren) var re, line_msg, $this = this.$el; + // Escape any HTML that may be in here + msg.msg = $('
').text(msg.msg).html(); + // Make the channels clickable - // TODO: HTML parsing may be going into the model.. move this? - re = new RegExp('\\B(' + kiwi.gateway.channel_prefix + '[^ ,.\\007]+)', 'g'); + re = new RegExp('\\B([' + kiwi.gateway.get('channel_prefix') + '][^ ,.\\007]+)', 'g'); msg.msg = msg.msg.replace(re, function (match) { return '' + match + ''; }); + + // Convert IRC formatting into HTML formatting + msg.msg = formatIRCMsg(msg.msg); + // Build up and add the line line_msg = '
<%- time %>
<%- nick %>
<%= msg %>
'; $this.append(_.template(line_msg, msg)); @@ -196,7 +202,7 @@ kiwi.view.Panel = Backbone.View.extend({ } }, chanClick: function (x) { - console.log(x); + kiwi.gateway.join($(x.srcElement).text()); }, show: function () { var $this = this.$el; @@ -351,7 +357,11 @@ kiwi.view.TopicBar = Backbone.View.extend({ }, setCurrentTopic: function (new_topic) { - $('input', this.$el).val(new_topic); + new_topic = new_topic || ''; + + // We only want a plain text version + new_topic = $('
').html(formatIRCMsg(new_topic)); + $('input', this.$el).val(new_topic.text()); } });