Commit 1ca474e7 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

[omemo] Fix an endless loop with devicelists

parent 2ed1c39f
...@@ -443,10 +443,13 @@ class OMEMO(BaseModule): ...@@ -443,10 +443,13 @@ class OMEMO(BaseModule):
NetworkEvent('omemo-new-fingerprint', chat_control=ctrl)) NetworkEvent('omemo-new-fingerprint', chat_control=ctrl))
def set_devicelist(self): def set_devicelist(self, devicelist=None):
devicelist_ = set([self.backend.own_device])
if devicelist is not None:
devicelist_.add(devicelist)'%s => Publishing own devicelist: %s','%s => Publishing own devicelist: %s',
self._account, self.backend.devices_for_publish) self._account, devicelist_)
self._nbxmpp('OMEMO').set_devicelist(self.backend.devices_for_publish) self._nbxmpp('OMEMO').set_devicelist(devicelist_)
def clear_devicelist(self): def clear_devicelist(self):
self.backend.update_devicelist(self._own_jid, [self.backend.own_device]) self.backend.update_devicelist(self._own_jid, [self.backend.own_device])
...@@ -488,7 +491,8 @@ class OMEMO(BaseModule): ...@@ -488,7 +491,8 @@ class OMEMO(BaseModule):'%s => Received device list for %s: %s','%s => Received device list for %s: %s',
self._account, jid, devicelist) self._account, jid, devicelist)
self.backend.update_devicelist(jid, devicelist) # Pass a copy, we need the full list for potential set_devicelist()
self.backend.update_devicelist(jid, list(devicelist))
if jid in self._query_for_bundles: if jid in self._query_for_bundles:
self._query_for_bundles.remove(jid) self._query_for_bundles.remove(jid)
...@@ -497,7 +501,7 @@ class OMEMO(BaseModule): ...@@ -497,7 +501,7 @@ class OMEMO(BaseModule):
if not self.backend.is_own_device_published: if not self.backend.is_own_device_published:
# Our own device_id is not in the list, it could be # Our own device_id is not in the list, it could be
# overwritten by some other client # overwritten by some other client
self.set_devicelist() self.set_devicelist(devicelist)
self._check_for_missing_sessions(jid) self._check_for_missing_sessions(jid)
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