Use push event to query privacy list after edit

This commit is contained in:
Philipp Hörist 2017-01-27 23:48:27 +01:00
parent 18e29ebc55
commit 63335357be
3 changed files with 5 additions and 6 deletions

View File

@ -1776,7 +1776,6 @@ class Connection(CommonConnection, ConnectionHandlers):
if len(self.blocked_list) == 1:
self.set_active_list(self.privacy_default_list)
self.set_default_list(self.privacy_default_list)
self.get_privacy_list(self.privacy_default_list)
def unblock_contacts(self, contact_list):
if not self.privacy_rules_supported:
@ -1799,7 +1798,6 @@ class Connection(CommonConnection, ConnectionHandlers):
or rule['value'] not in self.to_unblock:
self.new_blocked_list.append(rule)
self.set_privacy_list(self.privacy_default_list, self.new_blocked_list)
self.get_privacy_list(self.privacy_default_list)
if len(self.new_blocked_list) == 0:
self.blocked_list = []
self.blocked_contacts = []
@ -1832,7 +1830,6 @@ class Connection(CommonConnection, ConnectionHandlers):
if len(self.blocked_list) == 1:
self.set_active_list(self.privacy_default_list)
self.set_default_list(self.privacy_default_list)
self.get_privacy_list(self.privacy_default_list)
def unblock_group(self, group, contact_list):
if not self.privacy_rules_supported:
@ -1845,7 +1842,6 @@ class Connection(CommonConnection, ConnectionHandlers):
rule['value'] != group:
self.new_blocked_list.append(rule)
self.set_privacy_list(self.privacy_default_list, self.new_blocked_list)
self.get_privacy_list(self.privacy_default_list)
if len(self.new_blocked_list) == 0:
self.blocked_list = []
self.blocked_contacts = []

View File

@ -2061,6 +2061,11 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
if q:
result.delChild(q)
self.connection.send(result)
for list_ in iq_obj.getQueryPayload():
if list_.getName() == 'list':
self.get_privacy_list(list_.getAttr('name'))
raise nbxmpp.NodeProcessed
def _getRoster(self):

View File

@ -2783,7 +2783,6 @@ class GroupchatControl(ChatControlBase):
if len(connection.blocked_list) == 1:
connection.set_active_list(default)
connection.set_default_list(default)
connection.get_privacy_list(default)
def on_unblock(self, widget, nick):
fjid = self.room_jid + '/' + nick
@ -2800,7 +2799,6 @@ class GroupchatControl(ChatControlBase):
connection.new_blocked_list.append(rule)
connection.set_privacy_list(default, connection.new_blocked_list)
connection.get_privacy_list(default)
if len(connection.new_blocked_list) == 0:
connection.blocked_list = []
connection.blocked_contacts = []