From 8a127f61d06dd837c7fbac0b9ce849f2012a2b70 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 8 Feb 2025 12:52:33 +0100 Subject: [PATCH] XEP-0223: fix node standalone configuration (fixes #3555) also add a stream test for that --- slixmpp/plugins/xep_0223.py | 6 +++++- tests/test_stream_xep_0223.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/test_stream_xep_0223.py diff --git a/slixmpp/plugins/xep_0223.py b/slixmpp/plugins/xep_0223.py index 2a684299..b255ad49 100644 --- a/slixmpp/plugins/xep_0223.py +++ b/slixmpp/plugins/xep_0223.py @@ -48,8 +48,12 @@ class XEP_0223(BasePlugin): :param node: Node to set the configuration at. """ - config = self.xmpp['xep_0004'].Form() + config = self.xmpp['xep_0004'].stanza.Form() config['type'] = 'submit' + config.add_field( + var='FORM_TYPE', + ftype='hidden', + value='http://jabber.org/protocol/pubsub#node_config') for field, value in self.profile.items(): config.add_field(var=field, value=value) diff --git a/tests/test_stream_xep_0223.py b/tests/test_stream_xep_0223.py new file mode 100644 index 00000000..d0a16e46 --- /dev/null +++ b/tests/test_stream_xep_0223.py @@ -0,0 +1,28 @@ +import unittest +from slixmpp.test import SlixTest + + +class TestPrivatePEP(SlixTest): + + def testConfigureNode(self): + self.stream_start(mode='client', plugins=['xep_0223']) + + self.xmpp.plugin['xep_0223'].configure(node="toto") + self.send(""" + + + + + + http://jabber.org/protocol/pubsub#node_config + + 1 + whitelist + + + + + """) + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestPrivatePEP)