mirror of
https://github.com/thelounge/thelounge
synced 2024-11-21 19:43:07 +00:00
Emit topic over socket
This commit is contained in:
parent
b3712842bf
commit
f42a6487d6
6 changed files with 19 additions and 7 deletions
|
@ -19,7 +19,7 @@ module.exports = function(grunt) {
|
|||
grunt.loadNpmTasks("grunt-contrib-uglify");
|
||||
grunt.loadNpmTasks("grunt-contrib-watch");
|
||||
grunt.registerTask(
|
||||
"handlebars",
|
||||
"build",
|
||||
function() {
|
||||
grunt.util.spawn({
|
||||
cmd: "node",
|
||||
|
@ -36,6 +36,6 @@ module.exports = function(grunt) {
|
|||
);
|
||||
grunt.registerTask(
|
||||
"default",
|
||||
["uglify", "handlebars"]
|
||||
["uglify", "build"]
|
||||
);
|
||||
};
|
||||
|
|
|
@ -309,6 +309,10 @@ $(function() {
|
|||
break;
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("topic", function(data) {
|
||||
$("#chan-" + data.chan).find(".header .topic").html(data.topic);
|
||||
});
|
||||
|
||||
socket.on("users", function(data) {
|
||||
var users = chat.find("#chan-" + data.chan).find(".users").html(render("user", data));
|
||||
|
|
|
@ -40,9 +40,10 @@ templates['chat'] = template({"1":function(depth0,helpers,partials,data) {
|
|||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += " </button>\n </div>\n <span class=\"title\">"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</span>\n <span class=\"topic\">"
|
||||
+ escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"type","hash":{},"data":data}) : helper)))
|
||||
+ " </span>\n </div>\n <div class=\"chat\">\n <div class=\"show-more ";
|
||||
+ "</span>\n <span class=\"topic\">";
|
||||
stack1 = ((helpers.parse || (depth0 && depth0.parse) || helperMissing).call(depth0, (depth0 != null ? depth0.topic : depth0), {"name":"parse","hash":{},"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</span>\n </div>\n <div class=\"chat\">\n <div class=\"show-more ";
|
||||
stack1 = ((helpers.equal || (depth0 && depth0.equal) || helperMissing).call(depth0, ((stack1 = (depth0 != null ? depth0.messages : depth0)) != null ? stack1.length : stack1), 100, {"name":"equal","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "\">\n <button class=\"show-more-button\" data-id=\""
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<span class="title">{{name}}</span>
|
||||
<span class="topic">{{type}} </span>
|
||||
<span class="topic">{{{parse topic}}}</span>
|
||||
</div>
|
||||
<div class="chat">
|
||||
<div class="show-more {{#equal messages.length 100}}show{{/equal}}">
|
||||
|
|
|
@ -15,6 +15,7 @@ function Chan(attr) {
|
|||
id: id++,
|
||||
messages: [],
|
||||
name: "",
|
||||
topic: "",
|
||||
type: Chan.Type.CHANNEL,
|
||||
unread: 0,
|
||||
users: []
|
||||
|
|
|
@ -13,11 +13,12 @@ module.exports = function(irc, network) {
|
|||
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: data.topic,
|
||||
text: topic,
|
||||
self: self
|
||||
});
|
||||
chan.messages.push(msg);
|
||||
|
@ -25,5 +26,10 @@ module.exports = function(irc, network) {
|
|||
chan: chan.id,
|
||||
msg: msg
|
||||
});
|
||||
chan.topic = topic
|
||||
client.emit("topic", {
|
||||
chan: chan.id,
|
||||
topic: topic
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue