1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-12-25 08:58:53 -05:00

Tidy up muc state on join/leave

This commit is contained in:
Lance Stout 2014-01-01 17:42:36 -08:00
parent 2cfb7f32b6
commit a2c2993012
3 changed files with 8 additions and 1 deletions

View File

@ -108,6 +108,8 @@ module.exports = HumanModel.define({
if (!this.nick) {
this.nick = me.jid.local;
}
this.messages.reset();
this.resources.reset();
client.joinRoom(this.jid, this.nick, {
history: {
maxstanzas: 50
@ -116,6 +118,7 @@ module.exports = HumanModel.define({
});
},
leave: function () {
this.resources.reset();
client.leaveRoom(this.jid, this.nick);
}
});

View File

@ -20,6 +20,7 @@ module.exports = BasePage.extend({
this.listenTo(this, 'pageunloaded', this.handlePageUnloaded);
this.listenTo(this.model.messages, 'change', this.refreshModel);
this.listenTo(this.model.messages, 'reset', this.resetMessages);
this.render();
},
@ -225,5 +226,8 @@ module.exports = BasePage.extend({
refreshModel: function (model) {
var existing = this.$('#chat' + model.cid);
existing.replaceWith(model.partialTemplateHtml);
},
resetMessages: function () {
this.$messageList.empty();
}
});

View File

@ -1,5 +1,5 @@
CACHE MANIFEST
# 0.0.1 1388621918000
# 0.0.1 1388626859519
CACHE:
/app.js