From c392a4e598b6a37dd5ae3edb5135d15d3951a8f3 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 11 May 2013 08:50:01 +0200 Subject: [PATCH] Show all available room features when clicking the info icon next to a room's name --- CHANGES.rst | 23 +++++++++++------- converse.css | 9 ++++--- converse.js | 67 +++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 81 insertions(+), 18 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index cde69b9f0..44ea02515 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,22 +4,27 @@ Changelog 0.3 (unreleased) ---------------- -- Add vCard support [jcbrand] -- Remember custom status messages upon reload. [jcbrand] -- Remove jquery-ui dependency. [jcbrand] +- Add vCard support + [jcbrand] +- Remember custom status messages upon reload. + [jcbrand] +- Remove jquery-ui dependency. + [jcbrand] - Use backbone.localStorage to store the contacts roster, open chatboxes and - chat messages. [jcbrand] -- Fixed user status handling, which wasn't 100% according to the - spec. [jcbrand] -- Separate messages according to day in chats. [jcbrand] + chat messages. + [jcbrand] +- Fixed user status handling, which wasn't 100% according to the spec. + [jcbrand] +- Separate messages according to day in chats. + [jcbrand] - Add support for specifying the BOSH bind URL as configuration setting. [jcbrand] - Improve the message counter to only increment when the window is not focused [witekdev] - Make fetching of list of chatrooms on a server a configuration option. [jcbrand] -- Use service discovery to show whether a chatroom is password protected as - well as its number of occupents. [jcbrand] +- Use service discovery to show all available features on a room. + [jcbrand] 0.2 (2013-03-28) diff --git a/converse.css b/converse.css index 2ac332211..f18bda248 100644 --- a/converse.css +++ b/converse.css @@ -468,12 +468,15 @@ dd.available-chatroom, text-shadow: 0 1px 0 rgba(250, 250, 250, 1); } -p.room-info { - margin: 0; - padding: 0; +.room-info { font-size: 11px; font-style: normal; font-weight: normal; +} + +p.room-info { + margin: 0; + padding: 0; display: block; white-space: normal; } diff --git a/converse.js b/converse.js index f8af727fb..06e0fa6d5 100644 --- a/converse.js +++ b/converse.js @@ -697,9 +697,41 @@ '
'+ '

Description: {{desc}}

' + '

Occupants: {{occ}}

' + - '{[ if (locked) { ]}' + - '

Requires authentication

' + + '

Features:

' ), @@ -788,14 +820,36 @@ $(target).attr('data-room-jid'), null, $.proxy(function (stanza) { - var desc = $(stanza).find('field[var="muc#roominfo_description"] value').text(); - var occ = $(stanza).find('field[var="muc#roominfo_occupants"] value').text(); - var locked = $(stanza).find('feature[var="muc_passwordprotected"]').length; + var $stanza = $(stanza); + // All MUC features shown here: http://xmpp.org/registrar/disco-features.html + var desc = $stanza.find('field[var="muc#roominfo_description"] value').text(); + var occ = $stanza.find('field[var="muc#roominfo_occupants"] value').text(); + var hidden = $stanza.find('feature[var="muc_hidden"]').length; + var membersonly = $stanza.find('feature[var="muc_membersonly"]').length; + var moderated = $stanza.find('feature[var="muc_moderated"]').length; + var nonanonymous = $stanza.find('feature[var="muc_nonanonymous"]').length; + var open = $stanza.find('feature[var="muc_open"]').length; + var passwordprotected = $stanza.find('feature[var="muc_passwordprotected"]').length; + var persistent = $stanza.find('feature[var="muc_persistent"]').length; + var publicroom = $stanza.find('feature[var="muc_public"]').length; + var semianonymous = $stanza.find('feature[var="muc_semianonymous"]').length; + var temporary = $stanza.find('feature[var="muc_temporary"]').length; + var unmoderated = $stanza.find('feature[var="muc_unmoderated"]').length; $dd.find('img.spinner').replaceWith( this.room_description_template({ 'desc':desc, 'occ':occ, - 'locked':locked + 'hidden':hidden, + 'membersonly':membersonly, + 'moderated':moderated, + 'nonanonymous':nonanonymous, + 'open':open, + 'passwordprotected':passwordprotected, + 'persistent':persistent, + 'publicroom': publicroom, + 'semianonymous':semianonymous, + 'temporary':temporary, + 'unmoderated':unmoderated })); }, this)); } @@ -1958,6 +2012,7 @@ * This collection stores Feature Models, representing features * provided by available XMPP entities (e.g. servers) * See XEP-0030 for more details: http://xmpp.org/extensions/xep-0030.html + * All features are shown here: http://xmpp.org/registrar/disco-features.html */ model: converse.Feature, initialize: function () {