Commit 41cd8530 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

[omemo] Dont register GUI event handlers in module

parent 3a8fb991
......@@ -109,11 +109,6 @@ class OMEMO(BaseModule):
self.query_for_bundles = []
self.query_for_devicelists = []
app.ged.register_event_handler('signed-in', ged.PRECORE,
self.signed_in)
app.ged.register_event_handler('muc-config-changed', ged.GUI2,
self._on_config_changed)
def get_own_jid(self, stripped=False):
if stripped:
return self._con.get_own_jid().getStripped()
......@@ -126,10 +121,7 @@ class OMEMO(BaseModule):
conn.execute("PRAGMA secure_delete=1")
return OmemoState(self.own_jid, conn, self._account, self)
def signed_in(self, event):
if event.conn.name != self._account:
return
def on_signed_in(self):
log.info('%s => Announce Support after Sign In', self._account)
self.query_for_bundles = []
self.set_bundle()
......@@ -346,10 +338,7 @@ class OMEMO(BaseModule):
return False
return contact.sub == 'both'
def _on_config_changed(self, event):
if event.account != self._account:
return
def on_muc_config_changed(self, event):
room = event.jid.getBare()
status_codes = event.status_codes or []
if StatusCode.CONFIG_NON_ANONYMOUS in status_codes:
......
......@@ -87,8 +87,9 @@ class OmemoPlugin(GajimPlugin):
self.encryption_name = 'OMEMO'
self.allow_groupchat = True
self.events_handlers = {
'signed-in': (ged.PRECORE, self.signed_in),
'omemo-new-fingerprint': (ged.PRECORE, self._on_new_fingerprints),
'signed-in': (ged.PRECORE, self._on_signed_in),
'muc-config-changed': (ged.GUI2, self._on_muc_config_changed),
}
self.modules = [omemo]
self.config_dialog = OMEMOConfigDialog(self)
......@@ -138,18 +139,15 @@ class OmemoPlugin(GajimPlugin):
except Exception:
log.exception('Error loading application css')
def signed_in(self, event):
""" Method called on SignIn
Parameters
----------
event : SignedInEvent
"""
account = event.conn.name
if account == 'Local':
def _on_signed_in(self, event):
if event.conn.name in self.disabled_accounts:
return
if account in self.disabled_accounts:
app.connections[event.conn.name].get_module('OMEMO').on_signed_in()
def _on_muc_config_changed(self, event):
if event.account in self.disabled_accounts:
return
app.connections[event.account].get_module('OMEMO').on_muc_config_changed(event)
def activate(self):
""" Method called when the Plugin is activated in the PluginManager
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment