changeset 525ab51c07b5 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=525ab51c07b5 description: better handling of block list. Fixes #6005
diffstat:
src/gui_interface.py | 35 +++++++++++++++++++++++------------ 1 files changed, 23 insertions(+), 12 deletions(-)
diffs (47 lines):
diff -r fad6c51410ab -r 525ab51c07b5 src/gui_interface.py --- a/src/gui_interface.py Sun Oct 31 18:21:04 2010 +0100 +++ b/src/gui_interface.py Sun Oct 31 18:21:33 2010 +0100 @@ -1661,20 +1661,31 @@ self.instances[account]['privacy_list_%s' % name].\ privacy_list_received(rules) if name == 'block': - gajim.connections[account].blocked_contacts = [] - gajim.connections[account].blocked_groups = [] - gajim.connections[account].blocked_list = [] + con = gajim.connections[account] + con.blocked_contacts = [] + con.blocked_groups = [] + con.blocked_list = [] gajim.connections[account].blocked_all = False for rule in rules: - if not 'type' in rule: - gajim.connections[account].blocked_all = True - elif rule['type'] == 'jid' and rule['action'] == 'deny': - gajim.connections[account].blocked_contacts.append( - rule['value']) - elif rule['type'] == 'group' and rule['action'] == 'deny': - gajim.connections[account].blocked_groups.append( - rule['value']) - gajim.connections[account].blocked_list.append(rule) + if rule['action'] == 'allow': + if not 'type' in rule: + con.blocked_all = False + elif rule['type'] == 'jid' and rule['value'] in \ + con.blocked_contacts: + con.blocked_contacts.remove(rule['value']) + elif rule['type'] == 'group' and rule['value'] in \ + con.blocked_groups: + con.blocked_groups.remove(rule['value']) + elif rule['action'] == 'deny': + if not 'type' in rule: + con.blocked_all = True + elif rule['type'] == 'jid' and rule['value'] not in \ + con.blocked_contacts: + con.blocked_contacts.append(rule['value']) + elif rule['type'] == 'group' and rule['value'] not in \ + con.blocked_groups: + con.blocked_groups.append(rule['value']) + con.blocked_list.append(rule) if 'blocked_contacts' in self.instances[account]: self.instances[account]['blocked_contacts'].\ privacy_list_received(rules)