services/presence/server_plugin: Use set operations to update the subscribe set
This commit is contained in:
parent
7aee70e047
commit
aad2afdae2
@ -857,16 +857,22 @@ class ServerPlugin(gobject.GObject):
|
|||||||
|
|
||||||
def _subscribe_members_changed_cb(self, added, removed, local_pending,
|
def _subscribe_members_changed_cb(self, added, removed, local_pending,
|
||||||
remote_pending, actor, reason):
|
remote_pending, actor, reason):
|
||||||
for handle in added:
|
|
||||||
self._subscribe_members.add(handle)
|
added = set(added)
|
||||||
for handle in local_pending:
|
removed = set(removed)
|
||||||
self._subscribe_local_pending.add(handle)
|
local_pending = set(local_pending)
|
||||||
for handle in remote_pending:
|
remote_pending = set(remote_pending)
|
||||||
self._subscribe_remote_pending.add(handle)
|
|
||||||
for handle in removed:
|
affected = added|removed
|
||||||
self._subscribe_members.discard(handle)
|
affected |= local_pending
|
||||||
self._subscribe_local_pending.discard(handle)
|
affected |= remote_pending
|
||||||
self._subscribe_remote_pending.discard(handle)
|
|
||||||
|
self._subscribe_members -= affected
|
||||||
|
self._subscribe_members |= added
|
||||||
|
self._subscribe_local_pending -= affected
|
||||||
|
self._subscribe_local_pending |= local_pending
|
||||||
|
self._subscribe_remote_pending -= affected
|
||||||
|
self._subscribe_remote_pending |= remote_pending
|
||||||
|
|
||||||
def _publish_members_changed_cb(self, added, removed, local_pending,
|
def _publish_members_changed_cb(self, added, removed, local_pending,
|
||||||
remote_pending, actor, reason):
|
remote_pending, actor, reason):
|
||||||
|
Loading…
Reference in New Issue
Block a user