diff --git a/clientapp/helpers/xmppEventHandlers.js b/clientapp/helpers/xmppEventHandlers.js index b328871..d94d28c 100644 --- a/clientapp/helpers/xmppEventHandlers.js +++ b/clientapp/helpers/xmppEventHandlers.js @@ -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}); diff --git a/clientapp/models/resource.js b/clientapp/models/resource.js index 1ce7f18..568bb7a 100644 --- a/clientapp/models/resource.js +++ b/clientapp/models/resource.js @@ -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; } }, diff --git a/clientapp/pages/groupchat.js b/clientapp/pages/groupchat.js index 1032ab3..8377998 100644 --- a/clientapp/pages/groupchat.js +++ b/clientapp/pages/groupchat.js @@ -30,6 +30,9 @@ module.exports = BasePage.extend(chatHelpers).extend({ 'click .joinRoom': 'handleJoin', 'click .leaveRoom': 'handleLeave' }, + classBindings: { + joined: '.controls' + }, srcBindings: { avatar: 'header .avatar' }, diff --git a/public/css/otalk.css b/public/css/otalk.css index 992140c..7c0362f 100644 --- a/public/css/otalk.css +++ b/public/css/otalk.css @@ -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; diff --git a/public/css/pages/chat.styl b/public/css/pages/chat.styl index b339d31..ed8dec7 100644 --- a/public/css/pages/chat.styl +++ b/public/css/pages/chat.styl @@ -13,7 +13,7 @@ padding: 0px width: 100% borderbox() - + header padding: 5px border-bottom: 2px solid $gray-lighter @@ -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() diff --git a/public/x-manifest.cache b/public/x-manifest.cache index 88235e2..1e857af 100644 --- a/public/x-manifest.cache +++ b/public/x-manifest.cache @@ -1,5 +1,5 @@ CACHE MANIFEST -# 0.0.1 1386980007554 +# 0.0.1 1387217113439 CACHE: /app.js