Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
496d79a3 by Daniel Brötzmann at 2020-07-03T10:27:35+02:00
Blocking: Add XEP-0377 Spam Reporting

- - - - -


2 changed files:

- nbxmpp/modules/blocking.py
- nbxmpp/namespaces.py


Changes:

=====================================
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')


=====================================
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'



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/496d79a39c81b272fc1c878c3d9db6d26692a564

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/496d79a39c81b272fc1c878c3d9db6d26692a564
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to