[omemo] Adapt updating caps
This commit is contained in:
@@ -23,7 +23,6 @@ import nbxmpp
|
|||||||
from nbxmpp.protocol import NodeProcessed
|
from nbxmpp.protocol import NodeProcessed
|
||||||
from nbxmpp.protocol import JID
|
from nbxmpp.protocol import JID
|
||||||
from nbxmpp.util import is_error_result
|
from nbxmpp.util import is_error_result
|
||||||
from nbxmpp.const import StatusCode
|
|
||||||
from nbxmpp.const import PresenceType
|
from nbxmpp.const import PresenceType
|
||||||
from nbxmpp.const import Affiliation
|
from nbxmpp.const import Affiliation
|
||||||
from nbxmpp.structs import StanzaHandler
|
from nbxmpp.structs import StanzaHandler
|
||||||
@@ -31,7 +30,6 @@ from nbxmpp.modules.omemo import create_omemo_message
|
|||||||
from nbxmpp.modules.omemo import get_key_transport_message
|
from nbxmpp.modules.omemo import get_key_transport_message
|
||||||
|
|
||||||
from gajim.common import app
|
from gajim.common import app
|
||||||
from gajim.common import helpers
|
|
||||||
from gajim.common import configpaths
|
from gajim.common import configpaths
|
||||||
from gajim.common.nec import NetworkEvent
|
from gajim.common.nec import NetworkEvent
|
||||||
from gajim.common.const import EncryptionData
|
from gajim.common.const import EncryptionData
|
||||||
@@ -137,9 +135,7 @@ class OMEMO(BaseModule):
|
|||||||
def activate(self):
|
def activate(self):
|
||||||
""" Method called when the Plugin is activated in the PluginManager
|
""" Method called when the Plugin is activated in the PluginManager
|
||||||
"""
|
"""
|
||||||
if app.caps_hash[self._account] != '':
|
self._con.get_module('Caps').update_caps()
|
||||||
# Gajim has already a caps hash calculated, update it
|
|
||||||
helpers.update_optional_features(self._account)
|
|
||||||
|
|
||||||
if app.account_is_connected(self._account):
|
if app.account_is_connected(self._account):
|
||||||
self._log.info('Announce Support after Plugin Activation')
|
self._log.info('Announce Support after Plugin Activation')
|
||||||
@@ -152,12 +148,6 @@ class OMEMO(BaseModule):
|
|||||||
"""
|
"""
|
||||||
self._query_for_bundles = []
|
self._query_for_bundles = []
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def update_caps(account):
|
|
||||||
node = '%s+notify' % nbxmpp.NS_OMEMO_TEMP_DL
|
|
||||||
if node not in app.gajim_optional_features[account]:
|
|
||||||
app.gajim_optional_features[account].append(node)
|
|
||||||
|
|
||||||
def encrypt_message(self, conn, event, callback, groupchat):
|
def encrypt_message(self, conn, event, callback, groupchat):
|
||||||
if not event.message:
|
if not event.message:
|
||||||
callback(event)
|
callback(event)
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ from gi.repository import GLib
|
|||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gdk
|
from gi.repository import Gdk
|
||||||
|
|
||||||
|
import nbxmpp
|
||||||
|
|
||||||
from gajim import dialogs
|
from gajim import dialogs
|
||||||
from gajim.common import app, ged
|
from gajim.common import app, ged
|
||||||
from gajim.plugins import GajimPlugin
|
from gajim.plugins import GajimPlugin
|
||||||
@@ -188,10 +190,10 @@ class OmemoPlugin(GajimPlugin):
|
|||||||
return
|
return
|
||||||
self.get_omemo(event.account).on_muc_joined(event)
|
self.get_omemo(event.account).on_muc_joined(event)
|
||||||
|
|
||||||
def _update_caps(self, account):
|
def _update_caps(self, account, features):
|
||||||
if not self._is_enabled_account(account):
|
if not self._is_enabled_account(account):
|
||||||
return
|
return
|
||||||
self.get_omemo(account).update_caps(account)
|
features.append('%s+notify' % nbxmpp.NS_OMEMO_TEMP_DL)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def activate_encryption(chat_control):
|
def activate_encryption(chat_control):
|
||||||
|
|||||||
Reference in New Issue
Block a user