diff --git a/src/models/chan.js b/src/models/chan.js index 6b81cf75..6bcf51b2 100644 --- a/src/models/chan.js +++ b/src/models/chan.js @@ -26,16 +26,22 @@ function Chan(attr) { } Chan.prototype.pushMessage = function(client, msg) { + client.emit("msg", { + chan: this.id, + msg: msg + }); + + // Never store messages in public mode as the session + // is completely destroyed when the page gets closed + if (config.public) { + return; + } + this.messages.push(msg); if (config.maxHistory >= 0 && this.messages.length > config.maxHistory) { this.messages.splice(0, this.messages.length - config.maxHistory); } - - client.emit("msg", { - chan: this.id, - msg: msg - }); }; Chan.prototype.sortUsers = function(irc) {