diff --git a/client/css/style.css b/client/css/style.css index 327dce7f..93bf88a3 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -403,16 +403,14 @@ button { line-height: 50px !important; height: 48px; padding: 0 20px; + overflow: hidden; } #windows .header .title { font: 14px Lato; } #windows .header .topic { - /* Hidden for now */ - display: none; color: #777; margin-left: 8px; - text-transform: capitalize; } #windows .header .right { float: right; diff --git a/client/js/shout.js b/client/js/shout.js index 9c2dace5..eb80e928 100644 --- a/client/js/shout.js +++ b/client/js/shout.js @@ -314,6 +314,14 @@ $(function() { } }); + socket.on("topic", function(data) { + // .text() escapes HTML but not quotes. That only matters with text inside attributes. + var topic = $("#chan-" + data.chan).find(".header .topic"); + topic.text(data.topic); + // .attr() is safe escape-wise but consider the capabilities of the attribute + topic.attr("title", data.topic); + }); + socket.on("users", function(data) { var users = chat.find("#chan-" + data.chan).find(".users").html(render("user", data)); var nicks = []; diff --git a/src/plugins/irc-events/topic.js b/src/plugins/irc-events/topic.js index 779360bd..1b54c249 100644 --- a/src/plugins/irc-events/topic.js +++ b/src/plugins/irc-events/topic.js @@ -9,27 +9,24 @@ module.exports = function(irc, network) { return; } var from = data.nick || chan.name; - var self = false; - if (from.toLowerCase() == irc.me.toLowerCase()) { - self = true; - } var topic = data.topic; + var msg = new Msg({ type: Msg.Type.TOPIC, mode: chan.getMode(from), from: from, text: topic, - self: self + self: (from.toLowerCase() === irc.me.toLowerCase()) }); chan.messages.push(msg); client.emit("msg", { chan: chan.id, msg: msg }); - chan.topic = topic + chan.topic = topic; client.emit("topic", { chan: chan.id, - topic: _.escape(topic) + topic: chan.topic }); }); };