Forráskód Böngészése

ADD Omemo default support (#1476)

Malcolm 6 éve
szülő
commit
b163d05323
3 módosított fájl, 14 hozzáadás és 0 törlés
  1. 1 0
      CHANGES.md
  2. 7 0
      docs/source/configuration.rst
  3. 6 0
      src/converse-omemo.js

+ 1 - 0
CHANGES.md

@@ -38,6 +38,7 @@
 - #1445: Participants list uses big font in embedded mode
 - #1445: Participants list uses big font in embedded mode
 - #1455: Avatar in controlbox status-view not updated
 - #1455: Avatar in controlbox status-view not updated
 - #1465: When highlighting a roster contact, they're incorrectly shown as online
 - #1465: When highlighting a roster contact, they're incorrectly shown as online
+- #1476: Support OMEMO on by default for chats via a config variable
 - #1494: Trim whitespace around messages
 - #1494: Trim whitespace around messages
 - #1495: Mentions should always include a URI attribute
 - #1495: Mentions should always include a URI attribute
 - #1502: Fatal error when using prebind
 - #1502: Fatal error when using prebind

+ 7 - 0
docs/source/configuration.rst

@@ -1105,6 +1105,13 @@ with.
         });
         });
 
 
 
 
+omemo_default
+-------------
+
+* Default:  ``false``
+
+Use OMEMO encryption by default when the chat supports it.
+
 ping_interval
 ping_interval
 -------------
 -------------
 
 

+ 6 - 0
src/converse-omemo.js

@@ -84,6 +84,9 @@ converse.plugins.add('converse-omemo', {
 
 
             initialize () {
             initialize () {
                 const { _converse } = this.__super__;
                 const { _converse } = this.__super__;
+                _converse.api.settings.update({
+                    'omemo_default': false,
+                });
                 this.debouncedRender = _.debounce(this.render, 50);
                 this.debouncedRender = _.debounce(this.render, 50);
                 this.devicelist = _converse.devicelists.get(_converse.bare_jid);
                 this.devicelist = _converse.devicelists.get(_converse.bare_jid);
                 this.devicelist.devices.on('change:bundle', this.debouncedRender, this);
                 this.devicelist.devices.on('change:bundle', this.debouncedRender, this);
@@ -1227,6 +1230,9 @@ converse.plugins.add('converse-omemo', {
                 supported = await _converse.contactHasOMEMOSupport(chatbox.get('jid'));
                 supported = await _converse.contactHasOMEMOSupport(chatbox.get('jid'));
             }
             }
             chatbox.set('omemo_supported', supported);
             chatbox.set('omemo_supported', supported);
+            if (supported && _converse.omemo_default) {
+                chatbox.set('omemo_active', true);
+            }
         }
         }
 
 
         _converse.api.waitUntil('chatBoxesInitialized').then(() =>
         _converse.api.waitUntil('chatBoxesInitialized').then(() =>