Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/nbxmpp
diff options
context:
space:
mode:
authorDaniel Brötzmann <mailtrash@posteo.de>2020-07-03 11:25:47 +0300
committerDaniel Brötzmann <mailtrash@posteo.de>2020-07-03 11:27:35 +0300
commit496d79a39c81b272fc1c878c3d9db6d26692a564 (patch)
tree3d28d2eb07b6a5a5d3993782565956af2563dc41 /nbxmpp
parentdafb82e82694cace846fb1148f02e97610a21bb5 (diff)
Blocking: Add XEP-0377 Spam Reporting
Diffstat (limited to 'nbxmpp')
-rw-r--r--nbxmpp/modules/blocking.py8
-rw-r--r--nbxmpp/namespaces.py1
2 files changed, 7 insertions, 2 deletions
diff --git a/nbxmpp/modules/blocking.py b/nbxmpp/modules/blocking.py
index 1f55e4f..8d62274 100644
--- a/nbxmpp/modules/blocking.py
+++ b/nbxmpp/modules/blocking.py
@@ -56,12 +56,16 @@ class Blocking(BaseModule):
return BlockingListResult(blocking_list=blocked)
@call_on_response('_default_response')
- def block(self, jids):
+ def block(self, jids, report=None):
self._log.info('Block: %s', jids)
iq = Iq('set', Namespace.BLOCKING)
query = iq.setQuery(name='block')
for jid in jids:
- query.addChild(name='item', attrs={'jid': jid})
+ item = query.addChild(name='item', attrs={'jid': jid})
+ if report in ('spam', 'abuse'):
+ action = item.addChild(name='report',
+ namespace=Namespace.REPORTING)
+ action.setTag(report)
return iq
@call_on_response('_default_response')
diff --git a/nbxmpp/namespaces.py b/nbxmpp/namespaces.py
index e30526f..b97dfd0 100644
--- a/nbxmpp/namespaces.py
+++ b/nbxmpp/namespaces.py
@@ -128,6 +128,7 @@ class _Namespaces:
RECEIPTS: str = 'urn:xmpp:receipts'
REGISTER: str = 'jabber:iq:register'
REGISTER_FEATURE: str = 'http://jabber.org/features/iq-register'
+ REPORTING: str = 'urn:xmpp:reporting:0'
ROSTER: str = 'jabber:iq:roster'
ROSTERNOTES: str = 'storage:rosternotes'
ROSTERX: str = 'http://jabber.org/protocol/rosterx'