Coverage for slidge/slixfix/xep_0317/stanza.py: 100%
20 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-11-07 05:11 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-11-07 05:11 +0000
1from slixmpp import Presence
2from slixmpp.xmlstream import ElementBase, register_stanza_plugin
4NS = "urn:xmpp:hats:0"
7class Hats(ElementBase):
8 name = plugin_attrib = "hats"
9 namespace = NS
11 def add_hats(self, data: list[tuple[str, str]]):
12 for uri, title in data:
13 hat = Hat()
14 hat["uri"] = uri
15 hat["title"] = title
16 self.append(hat)
19class Hat(ElementBase):
20 name = plugin_attrib = "hat"
21 namespace = NS
22 interfaces = {"uri", "title"}
23 plugin_multi_attrib = "hats"
26def register():
27 register_stanza_plugin(Hats, Hat, iterable=True)
28 register_stanza_plugin(Presence, Hats)