summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0382/spoiler.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-01-22 18:40:37 +0100
committermathieui <mathieui@mathieui.net>2021-01-22 18:40:37 +0100
commit81ebf4e8ba7d273cfd51df9c64fc5153cc687989 (patch)
tree5374a4983ff72eef22fdbb1ba8803c64bc845b4b /slixmpp/plugins/xep_0382/spoiler.py
parentb784b68bcdface791f2a6e0e0a5482096b03ee06 (diff)
downloadslixmpp-81ebf4e8ba7d273cfd51df9c64fc5153cc687989.tar.gz
slixmpp-81ebf4e8ba7d273cfd51df9c64fc5153cc687989.tar.bz2
slixmpp-81ebf4e8ba7d273cfd51df9c64fc5153cc687989.tar.xz
slixmpp-81ebf4e8ba7d273cfd51df9c64fc5153cc687989.zip
XEP-0382: Spoiler Messages
Diffstat (limited to 'slixmpp/plugins/xep_0382/spoiler.py')
-rw-r--r--slixmpp/plugins/xep_0382/spoiler.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0382/spoiler.py b/slixmpp/plugins/xep_0382/spoiler.py
new file mode 100644
index 00000000..2f556f77
--- /dev/null
+++ b/slixmpp/plugins/xep_0382/spoiler.py
@@ -0,0 +1,32 @@
+"""
+ Slixmpp: The Slick XMPP Library
+ Copyright (C) 2021 Mathieu Pasquet <mathieui@mathieui.net>
+ This file is part of Slixmpp.
+
+ See the file LICENSE for copying permission.
+"""
+from slixmpp import JID
+from slixmpp.plugins import BasePlugin
+from slixmpp.plugins.xep_0382 import stanza
+from slixmpp.stanza import Message
+
+
+class XEP_0382(BasePlugin):
+ '''XEP-0382: Spoiler Messages'''
+
+ name = 'xep_0382'
+ description = 'Spoiler Messages'
+ dependencies = {'xep_0030'}
+ stanza = stanza
+ namespace = stanza.NS
+
+ def plugin_init(self) -> None:
+ stanza.register_plugins()
+ Message.sub_interfaces.add('spoiler')
+
+ def session_bind(self, jid: JID):
+ self.xmpp['xep_0030'].add_feature(stanza.NS)
+
+ def plugin_end(self):
+ self.xmpp.plugin['xep_0030'].del_feature(feature=stanza.NS)
+ Message.sub_interfaces.remove('spoiler')