瀏覽代碼

Variables were moved to common file

JC Brand 7 年之前
父節點
當前提交
2515001a5c
共有 3 個文件被更改,包括 199 次插入47 次删除
  1. 199 45
      dist/converse.js
  2. 0 1
      sass/converse/_variables.scss
  3. 0 1
      sass/inverse/_variables.scss

+ 199 - 45
dist/converse.js

@@ -43368,7 +43368,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
   _.extend(_converse, Backbone.Events); // Core plugins are whitelisted automatically
 
 
-  _converse.core_plugins = ['converse-bookmarks', 'converse-chatboxes', 'converse-chatview', 'converse-controlbox', 'converse-core', 'converse-disco', 'converse-dragresize', 'converse-embedded', 'converse-fullscreen', 'converse-headline', 'converse-mam', 'converse-message-view', 'converse-minimize', 'converse-modal', 'converse-muc', 'converse-muc-views', 'converse-notification', 'converse-otr', 'converse-ping', 'converse-profile', 'converse-register', 'converse-roomslist', 'converse-roster', 'converse-rosterview', 'converse-singleton', 'converse-spoilers', 'converse-vcard']; // Make converse pluggable
+  _converse.core_plugins = ['converse-bookmarks', 'converse-chatboxes', 'converse-chatview', 'converse-caps', 'converse-controlbox', 'converse-core', 'converse-disco', 'converse-dragresize', 'converse-embedded', 'converse-fullscreen', 'converse-headline', 'converse-mam', 'converse-message-view', 'converse-minimize', 'converse-modal', 'converse-muc', 'converse-muc-views', 'converse-notification', 'converse-otr', 'converse-ping', 'converse-profile', 'converse-register', 'converse-roomslist', 'converse-roster', 'converse-rosterview', 'converse-singleton', 'converse-spoilers', 'converse-vcard']; // Make converse pluggable
 
   pluggable.enable(_converse, '_converse', 'pluggable'); // Module-level constants
 
@@ -45622,12 +45622,11 @@ define("emojione", (function (global) {
     };
 }(this)));
 
-// Converse.js (A browser based XMPP chat client)
+// Converse.js
 // http://conversejs.org
 //
-// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
+// Copyright (c) 2013-2018, the Converse.js developers
 // Licensed under the Mozilla Public License (MPLv2)
-//
 
 /* This is a Converse.js plugin which add support for XEP-0030: Service Discovery */
 
@@ -45832,19 +45831,19 @@ define("emojione", (function (global) {
 
       function addClientFeatures() {
         // See http://xmpp.org/registrar/disco-categories.html
-        _converse.api.disco.addIdentity('client', 'web', 'Converse.js');
+        _converse.api.disco.own.identities.add('client', 'web', 'Converse.js');
 
-        _converse.api.disco.addFeature(Strophe.NS.BOSH);
+        _converse.api.disco.own.features.add(Strophe.NS.BOSH);
 
-        _converse.api.disco.addFeature(Strophe.NS.CHATSTATES);
+        _converse.api.disco.own.features.add(Strophe.NS.CHATSTATES);
 
-        _converse.api.disco.addFeature(Strophe.NS.DISCO_INFO);
+        _converse.api.disco.own.features.add(Strophe.NS.DISCO_INFO);
 
-        _converse.api.disco.addFeature(Strophe.NS.ROSTERX); // Limited support
+        _converse.api.disco.own.features.add(Strophe.NS.ROSTERX); // Limited support
 
 
         if (_converse.message_carbons) {
-          _converse.api.disco.addFeature(Strophe.NS.CARBONS);
+          _converse.api.disco.own.features.add(Strophe.NS.CARBONS);
         }
 
         _converse.emit('addClientFeatures');
@@ -45948,7 +45947,120 @@ define("emojione", (function (global) {
 
 
       _.extend(_converse.api, {
+        /**
+         * The service discovery API
+         * @namespace
+         */
         'disco': {
+          /**
+           * The "own" grouping
+           * @namespace
+           */
+          'own': {
+            /**
+             * The "identities" grouping
+             * @namespace
+             */
+            'identities': {
+              /**
+               * Lets you add new identities for this client (i.e. instance of Converse.js)
+               * @function
+               *
+               * @param {String} category - server, client, gateway, directory, etc.
+               * @param {String} type - phone, pc, web, etc.
+               * @param {String} name - "Converse.js"
+               * @param {String} lang - en, el, de, etc.
+               *
+               * @example
+               * _converse.api.disco.own.identities.clear();
+               */
+              add: function add(category, type, name, lang) {
+                for (var i = 0; i < plugin._identities.length; i++) {
+                  if (plugin._identities[i].category == category && plugin._identities[i].type == type && plugin._identities[i].name == name && plugin._identities[i].lang == lang) {
+                    return false;
+                  }
+                }
+
+                plugin._identities.push({
+                  category: category,
+                  type: type,
+                  name: name,
+                  lang: lang
+                });
+              },
+
+              /**
+               * Clears all previously registered identities.
+               * @function
+               *
+               * @example
+               * _converse.api.disco.own.identities.clear();
+               */
+              clear: function clear() {
+                plugin._identities = [];
+              },
+
+              /**
+               * Returns all of the identities registered for this client
+               * (i.e. instance of Converse.js).
+               * @function
+               *
+               * @example
+               * const identities = _converse.api.disco.own.identities.get();
+               */
+              get: function get() {
+                return plugin._identities;
+              }
+            },
+
+            /**
+             * The "features" grouping
+             * @namespace
+             */
+            'features': {
+              /**
+               * Lets you register new disco features for this client (i.e. instance of Converse.js)
+               * @function
+               *
+               * @param {String} name - e.g. http://jabber.org/protocol/caps
+               *
+               * @example
+               * _converse.api.disco.own.features.add("http://jabber.org/protocol/caps");
+               */
+              add: function add(name) {
+                for (var i = 0; i < plugin._features.length; i++) {
+                  if (plugin._features[i] == name) {
+                    return false;
+                  }
+                }
+
+                plugin._features.push(name);
+              },
+
+              /**
+               * Clears all previously registered features.
+               * @function
+               *
+               * @example
+               * _converse.api.disco.own.features.clear();
+               */
+              clear: function clear() {
+                plugin._features = [];
+              },
+
+              /**
+               * Returns all of the features registered for this client
+               * (i.e. instance of Converse.js).
+               * @function
+               *
+               * @example
+               * const features = _converse.api.disco.own.features.get();
+               */
+              get: function get() {
+                return plugin._features;
+              }
+            }
+          },
           'info': function info(jid, node, callback, errback, timeout) {
             var attrs = {
               xmlns: Strophe.NS.DISCO_INFO
@@ -46037,29 +46149,6 @@ define("emojione", (function (global) {
               });
             }).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
           },
-          'addIdentity': function addIdentity(category, type, name, lang) {
-            for (var i = 0; i < plugin._identities.length; i++) {
-              if (plugin._identities[i].category == category && plugin._identities[i].type == type && plugin._identities[i].name == name && plugin._identities[i].lang == lang) {
-                return false;
-              }
-            }
-
-            plugin._identities.push({
-              category: category,
-              type: type,
-              name: name,
-              lang: lang
-            });
-          },
-          'addFeature': function addFeature(name) {
-            for (var i = 0; i < plugin._features.length; i++) {
-              if (plugin._features[i] == name) {
-                return false;
-              }
-            }
-
-            plugin._features.push(name);
-          },
           'getIdentity': function getIdentity(category, type, entity_jid) {
             /* Returns a Promise which resolves with a map indicating
              * whether an identity with a given type is provided by
@@ -47461,7 +47550,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
 // Converse.js
 // http://conversejs.org
 //
-// Copyright (c) 2012-2018, the Converse.js developers
+// Copyright (c) 2013-2018, the Converse.js developers
 // Licensed under the Mozilla Public License (MPLv2)
 (function (root, factory) {
   define('converse-muc',["form-utils", "converse-core", "emojione", "converse-disco", "backbone.overview", "backbone.orderedlistview", "backbone.vdomview", "muc-utils"], factory);
@@ -48754,11 +48843,11 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
 
       _converse.on('addClientFeatures', function () {
         if (_converse.allow_muc) {
-          _converse.api.disco.addFeature(Strophe.NS.MUC);
+          _converse.api.disco.own.features.add(Strophe.NS.MUC);
         }
 
         if (_converse.allow_muc_invitations) {
-          _converse.api.disco.addFeature('jabber:x:conference'); // Invites
+          _converse.api.disco.own.features.add('jabber:x:conference'); // Invites
 
         }
       });
@@ -49570,6 +49659,70 @@ return __p
   });
 });
 //# sourceMappingURL=converse-bookmarks.js.map;
+// Converse.js
+// http://conversejs.org
+//
+// Copyright (c) 2013-2018, the Converse.js developers
+// Licensed under the Mozilla Public License (MPLv2)
+
+(function (root, factory) {
+    define('converse-caps',["converse-core"], factory);
+}(this, function (converse) {
+
+    const { Strophe, $build, _, b64_sha1 } = converse.env;
+
+    Strophe.addNamespace('CAPS', "http://jabber.org/protocol/caps");
+
+    function propertySort (array, property) {
+        return array.sort((a, b) => { return a[property] > b[property] ? -1 : 1 });
+    }
+
+    function generateVerificationString (_converse) {
+        const identities = _converse.api.disco.own.identities.get(),
+              features = _converse.api.disco.own.features.get();
+
+        if (identities.length > 1) {
+            propertySort(identities, "category");
+            propertySort(identities, "type");
+            propertySort(identities, "lang");
+        }
+
+        let S = _.reduce(
+            identities,
+            (result, id) => `${result}${id.category}/${id.type}/${_.get(id, 'lang', '')}/${id.name}<`,
+            "");
+
+        features.sort();
+        S = _.reduce(features, (result, feature) => `${result}${feature}<`, S);
+        return b64_sha1(S);
+    }
+
+    function createCapsNode (_converse) {
+        return $build("c", {
+            'xmlns': Strophe.NS.CAPS,
+            'hash': "sha-1",
+            'node': "https://conversejs.org",
+            'ver': generateVerificationString(_converse)
+        }).nodeTree;
+    }
+
+    converse.plugins.add('converse-caps', {
+
+        overrides: {
+            // Overrides mentioned here will be picked up by converse.js's
+            // plugin architecture they will replace existing methods on the
+            // relevant objects or classes.
+            XMPPStatus: {
+                constructPresence () {
+                    const presence = this.__super__.constructPresence.apply(this, arguments);
+                    presence.root().cnode(createCapsNode(this.__super__._converse));
+                    return presence;
+                }
+            }
+        }
+    });
+}));
+
 // Native Javascript for Bootstrap 4 v2.0.22 | © dnp_theme | MIT-License
 (function (root, factory) {
   if (typeof define === 'function' && define.amd) {
@@ -54450,9 +54603,9 @@ return __p
       });
 
       _converse.on('addClientFeatures', function () {
-        _converse.api.disco.addFeature(Strophe.NS.HTTPUPLOAD);
+        _converse.api.disco.own.features.add(Strophe.NS.HTTPUPLOAD);
 
-        _converse.api.disco.addFeature(Strophe.NS.OUTOFBAND);
+        _converse.api.disco.own.features.add(Strophe.NS.OUTOFBAND);
       });
 
       _converse.api.listen.on('pluginsInitialized', function () {
@@ -55931,7 +56084,7 @@ return __p
 
       _converse.on('connected', function () {
         // Advertise that we support XEP-0382 Message Spoilers
-        _converse.api.disco.addFeature(Strophe.NS.SPOILER);
+        _converse.api.disco.own.features.add(Strophe.NS.SPOILER);
       });
       /************************ BEGIN API ************************/
 
@@ -60643,7 +60796,7 @@ return __p
       _converse.api.listen.on('connectionInitialized', _converse.initVCardCollection);
 
       _converse.on('addClientFeatures', function () {
-        _converse.api.disco.addFeature(Strophe.NS.VCARD);
+        _converse.api.disco.own.features.add(Strophe.NS.VCARD);
       });
 
       _.extend(_converse.api, {
@@ -61945,7 +62098,7 @@ return __p
 
 define('tpl!inverse_brand_heading', ['lodash'], function(_) {return function(o) {
 var __t, __p = '';
-__p += '<div class="row">\n    <div class="container brand-heading-container">\n        <h1 class="brand-heading"><i class="icon-conversejs"></i>inVerse</h1>\n        <p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://conversejs.org">Open Source</a> XMPP chat client</p>\n        <p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">Translate</a> into your own language</p>\n    <div>\n</div>\n';
+__p += '<div class="row">\n    <div class="container brand-heading-container">\n        <h1 class="brand-heading"><i class="icon-conversejs"></i>Converse</h1>\n        <p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://conversejs.org">Open Source</a> XMPP chat client</p>\n        <p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">Translate</a> into your own language</p>\n    <div>\n</div>\n';
 return __p
 };});
 
@@ -62772,7 +62925,7 @@ Strophe.RSM.prototype = {
       });
 
       _converse.on('addClientFeatures', function () {
-        _converse.api.disco.addFeature(Strophe.NS.MAM);
+        _converse.api.disco.own.features.add(Strophe.NS.MAM);
       });
 
       _converse.on('afterMessagesFetched', function (chatboxview) {
@@ -71663,7 +71816,7 @@ return __p
 
       _converse.registerPongHandler = function () {
         if (!_.isUndefined(_converse.connection.disco)) {
-          _converse.api.disco.addFeature(Strophe.NS.PING);
+          _converse.api.disco.own.features.add(Strophe.NS.PING);
         }
 
         _converse.connection.ping.addPingHandler(_converse.pong);
@@ -73381,7 +73534,7 @@ return __p
 define('tpl!rooms_list_item', ['lodash'], function(_) {return function(o) {
 var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
 function print() { __p += __j.call(arguments, '') }
-__p += '<div class="list-item room-item">\n<div class="available-chatroom d-flex flex-row ';
+__p += '<div class="list-item available-chatroom d-flex flex-row ';
  if (o.num_unread_general) { ;
 __p += ' unread-msgs ';
  } ;
@@ -73433,7 +73586,7 @@ __p += '\n<a class="room-info fa fa-info-circle align-self-center" data-room-jid
 __e(o.jid) +
 '"\n   title="' +
 __e(o.info_title) +
-'" href="#">&nbsp;</a>\n</div>\n<div>\n';
+'" href="#">&nbsp;</a>\n</div>\n';
 return __p
 };});
 
@@ -73733,6 +73886,7 @@ if (typeof define !== 'undefined') {
          * Any of the following components may be removed if they're not needed.
          */
         "converse-bookmarks",       // XEP-0048 Bookmarks
+        "converse-caps",
         "converse-chatview",        // Renders standalone chat boxes for single user chat
         "converse-controlbox",      // The control box
         "converse-dragresize",      // Allows chat boxes to be resized by dragging them

+ 0 - 1
sass/converse/_variables.scss

@@ -6,7 +6,6 @@ $roster-item-height: 60px !default;
 $chat-head-height: 55px !default;
 
 $controlbox-dropdown-height: 25px !default;
-$controlbox-head-color: $light-blue !default;
 $controlbox-head-height: 55px !default;
 $controlbox-pane-padding: 1em !default;
 

+ 0 - 1
sass/inverse/_variables.scss

@@ -8,7 +8,6 @@ $flyout-padding: 1.2em;
 $chat-head-height: 62px !default;
 
 $controlbox-dropdown-height: 30px !default;
-$controlbox-head-color: $light-blue !default;
 $controlbox-head-height: 63px !default;
 $controlbox-pane-padding: $flyout-padding !default;