mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-11-30 21:22:17 -05:00
Tidy up muc state on join/leave
This commit is contained in:
parent
2cfb7f32b6
commit
a2c2993012
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
# 0.0.1 1388621918000
|
# 0.0.1 1388626859519
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
/app.js
|
/app.js
|
||||||
|
Loading…
Reference in New Issue
Block a user