[omemo] 2.8.17

This commit is contained in:
wurstsalat
2022-10-06 17:20:49 +02:00
parent 29260fcc6f
commit da2046d4bb
4 changed files with 19 additions and 19 deletions

View File

@@ -137,7 +137,7 @@ class OMEMOConfigDialog(Gtk.ApplicationWindow):
def cleardevice_button_clicked_cb(self, button, *args): def cleardevice_button_clicked_cb(self, button, *args):
active = self._ui.account_combobox.get_active() active = self._ui.account_combobox.get_active()
account = self._ui.account_store[active][0] account = self._ui.account_store[active][0]
app.connections[account].get_module('OMEMO').clear_devicelist() app.get_client(account).get_module('OMEMO').clear_devicelist()
self.update_context_list() self.update_context_list()
def refresh_button_clicked_cb(self, button, *args): def refresh_button_clicked_cb(self, button, *args):

View File

@@ -85,8 +85,8 @@ class OMEMO(BaseModule):
'request_bundle', 'request_bundle',
] ]
def __init__(self, con): def __init__(self, client):
BaseModule.__init__(self, con, plugin=True) BaseModule.__init__(self, client, plugin=True)
self.handlers = [ self.handlers = [
StanzaHandler(name='message', StanzaHandler(name='message',
@@ -103,7 +103,7 @@ class OMEMO(BaseModule):
self.available = True self.available = True
self._own_jid = self._con.get_own_jid().bare self._own_jid = self._client.get_own_jid().bare
self._backend = self._get_backend() self._backend = self._get_backend()
self._omemo_groupchats = set() self._omemo_groupchats = set()
@@ -114,8 +114,8 @@ class OMEMO(BaseModule):
def get_own_jid(self, stripped=False): def get_own_jid(self, stripped=False):
if stripped: if stripped:
return self._con.get_own_jid().bare return self._client.get_own_jid().bare
return self._con.get_own_jid() return self._client.get_own_jid()
@property @property
def backend(self): def backend(self):
@@ -138,7 +138,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
""" """
self._con.get_module('Caps').update_caps() self._client.get_module('Caps').update_caps()
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')
@@ -190,7 +190,7 @@ class OMEMO(BaseModule):
transport_message = get_key_transport_message(typ, jid, omemo_message) transport_message = get_key_transport_message(typ, jid, omemo_message)
self._log.info('Send key transport message %s (%s)', jid, devices) self._log.info('Send key transport message %s (%s)', jid, devices)
self._con.connection.send(transport_message) self._client.connection.send(transport_message)
def _message_received(self, _con, stanza, properties): def _message_received(self, _con, stanza, properties):
if not properties.is_omemo: if not properties.is_omemo:
@@ -259,7 +259,8 @@ class OMEMO(BaseModule):
# History Message from MUC # History Message from MUC
return properties.muc_ofrom.bare return properties.muc_ofrom.bare
contact = self._con.get_module('Contacts').get_contact(properties.jid) contact = self._client.get_module('Contacts').get_contact(
properties.jid)
if contact.real_jid is not None: if contact.real_jid is not None:
return contact.real_jid.bare return contact.real_jid.bare
@@ -336,11 +337,11 @@ class OMEMO(BaseModule):
if jid == self._own_jid: if jid == self._own_jid:
return True return True
roster_item = self._con.get_module('Roster').get_item(jid) roster_item = self._client.get_module('Roster').get_item(jid)
if roster_item is None: if roster_item is None:
return False return False
contact = self._con.get_module('Contacts').get_contact(jid) contact = self._client.get_module('Contacts').get_contact(jid)
return contact.subscription == 'both' return contact.subscription == 'both'
def on_muc_disco_update(self, event): def on_muc_disco_update(self, event):
@@ -484,7 +485,7 @@ class OMEMO(BaseModule):
self._process_devicelist_update(str(properties.jid), devicelist) self._process_devicelist_update(str(properties.jid), devicelist)
def _process_devicelist_update(self, jid, devicelist): def _process_devicelist_update(self, jid, devicelist):
own_devices = jid is None or self._con.get_own_jid().bare_match(jid) own_devices = jid is None or self._client.get_own_jid().bare_match(jid)
if own_devices: if own_devices:
jid = self._own_jid jid = self._own_jid

View File

@@ -18,5 +18,5 @@
"gajim>=1.5.0" "gajim>=1.5.0"
], ],
"short_name": "omemo", "short_name": "omemo",
"version": "2.8.16" "version": "2.8.17"
} }

View File

@@ -135,7 +135,7 @@ class OmemoPlugin(GajimPlugin):
@staticmethod @staticmethod
def get_omemo(account): def get_omemo(account):
return app.connections[account].get_module('OMEMO') return app.get_client(account).get_module('OMEMO')
@staticmethod @staticmethod
def _load_css(): def _load_css():
@@ -159,7 +159,7 @@ class OmemoPlugin(GajimPlugin):
""" """
Method called when the Plugin is activated in the PluginManager Method called when the Plugin is activated in the PluginManager
""" """
for account in app.connections: for account in app.settings.get_active_accounts():
if not self._is_enabled_account(account): if not self._is_enabled_account(account):
continue continue
self.get_omemo(account).activate() self.get_omemo(account).activate()
@@ -168,16 +168,15 @@ class OmemoPlugin(GajimPlugin):
""" """
Method called when the Plugin is deactivated in the PluginManager Method called when the Plugin is deactivated in the PluginManager
""" """
for account in app.connections: for account in app.settings.get_active_accounts():
if not self._is_enabled_account(account): if not self._is_enabled_account(account):
continue continue
self.get_omemo(account).deactivate() self.get_omemo(account).deactivate()
def _on_signed_in(self, event): def _on_signed_in(self, event):
account = event.conn.name if not self._is_enabled_account(event.account):
if not self._is_enabled_account(account):
return return
self.get_omemo(account).on_signed_in() self.get_omemo(event.account).on_signed_in()
def _on_muc_disco_update(self, event): def _on_muc_disco_update(self, event):
if not self._is_enabled_account(event.account): if not self._is_enabled_account(event.account):