1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-22 09:12:19 -05:00

Make MUC join/leave buttons toggle

This commit is contained in:
Lance Stout 2013-12-16 10:06:03 -08:00
parent 2ca32ca3bd
commit 2d07337967
6 changed files with 40 additions and 5 deletions

View File

@ -176,6 +176,11 @@ module.exports = function (client, app) {
}
resource.fetchTimezone();
}
var muc = pres.muc || {};
if (muc.codes && muc.codes.indexOf('110') >= 0) {
contact.joined = true;
}
}
});
@ -195,6 +200,10 @@ module.exports = function (client, app) {
contact.resources.remove(resource);
}
var muc = pres.muc || {};
if (muc.codes && muc.codes.indexOf('110') >= 0) {
contact.joined = false;
}
}
});
@ -223,7 +232,6 @@ module.exports = function (client, app) {
var resource = contact.resources.get(info.from.full);
if (resource) {
resource.chatState = info.chatState;
console.log(info.chatState);
if (info.chatState === 'gone') {
contact.lockedResource = undefined;
} else {
@ -393,7 +401,6 @@ module.exports = function (client, app) {
});
client.on('jingle:remotestream:added', function (session) {
console.log('remote stream', session);
var contact = me.getContact(session.peer);
if (!contact) {
contact = new Contact({jid: client.JID(session.peer).bare});

View File

@ -22,7 +22,7 @@ module.exports = HumanModel.define({
deps: ['discoInfo'],
fn: function () {
if (!this.discoInfo) return false;
var features = this.discoInfo.features;
var features = this.discoInfo.features || [];
return features.indexOf('http://jabber.org/protocol/chatstate') >= 0;
}
},

View File

@ -30,6 +30,9 @@ module.exports = BasePage.extend(chatHelpers).extend({
'click .joinRoom': 'handleJoin',
'click .leaveRoom': 'handleLeave'
},
classBindings: {
joined: '.controls'
},
srcBindings: {
avatar: 'header .avatar'
},

View File

@ -897,6 +897,18 @@ button.secondary:hover:not(:disabled) {
.conversation header .controls {
float: right;
}
.conversation header .controls .leaveRoom {
display: none;
}
.conversation header .controls .joinRoom {
display: block;
}
.conversation header .joined .joinRoom {
display: none;
}
.conversation header .joined .leaveRoom {
display: block;
}
.conversation header .avatar {
margin-right: 5px;
width: 30px;

View File

@ -27,6 +27,19 @@
.controls
float: right
.leaveRoom
display: none
.joinRoom
display: block
.joined
.joinRoom
display: none
.leaveRoom
display: block
.avatar
margin-right: 5px
avatar()

View File

@ -1,5 +1,5 @@
CACHE MANIFEST
# 0.0.1 1386980007554
# 0.0.1 1387217113439
CACHE:
/app.js