Commit d16eaa93 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

Roster: Add spam reporting

parent 2a3927f7
...@@ -2740,10 +2740,12 @@ class RosterWindow: ...@@ -2740,10 +2740,12 @@ class RosterWindow:
When clicked on the 'block' button in context menu. list_ is a list of When clicked on the 'block' button in context menu. list_ is a list of
(contact, account) (contact, account)
""" """
def on_continue(msg, pep_dict): def _block_it(is_checked=None, report=None):
if msg is None: if is_checked is not None: # Dialog has been shown
# user pressed Cancel to change status message dialog if is_checked:
return app.config.set('confirm_block', 'no')
else:
app.config.set('confirm_block', 'yes')
accounts = [] accounts = []
for _, account in list_: for _, account in list_:
...@@ -2755,7 +2757,7 @@ class RosterWindow: ...@@ -2755,7 +2757,7 @@ class RosterWindow:
l_ = [i[0] for i in list_ if i[1] == acct] l_ = [i[0] for i in list_ if i[1] == acct]
con = app.connections[acct] con = app.connections[acct]
jid_list = [contact.jid for contact in l_] jid_list = [contact.jid for contact in l_]
con.get_module('Blocking').block(jid_list) con.get_module('Blocking').block(jid_list, report)
for contact in l_: for contact in l_:
ctrl = app.interface.msg_win_mgr.get_control( ctrl = app.interface.msg_win_mgr.get_control(
contact.jid, acct) contact.jid, acct)
...@@ -2768,14 +2770,6 @@ class RosterWindow: ...@@ -2768,14 +2770,6 @@ class RosterWindow:
return return
self.draw_contact(contact.jid, acct) self.draw_contact(contact.jid, acct)
def _block_it(is_checked=None):
if is_checked is not None: # Dialog has been shown
if is_checked:
app.config.set('confirm_block', 'no')
else:
app.config.set('confirm_block', 'yes')
self.get_status_message('offline', on_continue, show_pep=False)
# Check if confirmation is needed for blocking # Check if confirmation is needed for blocking
confirm_block = app.config.get('confirm_block') confirm_block = app.config.get('confirm_block')
if confirm_block == 'no': if confirm_block == 'no':
...@@ -2789,6 +2783,10 @@ class RosterWindow: ...@@ -2789,6 +2783,10 @@ class RosterWindow:
'will not receive further messages.'), 'will not receive further messages.'),
_('_Do not ask again'), _('_Do not ask again'),
[DialogButton.make('Cancel'), [DialogButton.make('Cancel'),
DialogButton.make('OK',
text=_('_Report Spam'),
callback=_block_it,
kwargs={'report': 'spam'}),
DialogButton.make('Remove', DialogButton.make('Remove',
text=_('_Block'), text=_('_Block'),
callback=_block_it)], callback=_block_it)],
......
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