1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-08-13 17:03:51 -04: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) { if (!this.nick) {
this.nick = me.jid.local; this.nick = me.jid.local;
} }
this.messages.reset();
this.resources.reset();
client.joinRoom(this.jid, this.nick, { client.joinRoom(this.jid, this.nick, {
history: { history: {
maxstanzas: 50 maxstanzas: 50
@ -116,6 +118,7 @@ module.exports = HumanModel.define({
}); });
}, },
leave: function () { leave: function () {
this.resources.reset();
client.leaveRoom(this.jid, this.nick); 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, 'pageunloaded', this.handlePageUnloaded);
this.listenTo(this.model.messages, 'change', this.refreshModel); this.listenTo(this.model.messages, 'change', this.refreshModel);
this.listenTo(this.model.messages, 'reset', this.resetMessages);
this.render(); this.render();
}, },
@ -225,5 +226,8 @@ module.exports = BasePage.extend({
refreshModel: function (model) { refreshModel: function (model) {
var existing = this.$('#chat' + model.cid); var existing = this.$('#chat' + model.cid);
existing.replaceWith(model.partialTemplateHtml); existing.replaceWith(model.partialTemplateHtml);
},
resetMessages: function () {
this.$messageList.empty();
} }
}); });

View File

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