summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2020-12-02 19:54:14 +0100
committermathieui <mathieui@mathieui.net>2020-12-04 19:14:32 +0100
commit54d556280ae5003eb56eeb419dfcb0b906506938 (patch)
tree81b3366cfda9f35b4fa37e2ef47abfda9f7120de
parentc63e9a32b9481ccd52f5ccf3dcdd3a61f0109f21 (diff)
downloadslixmpp-54d556280ae5003eb56eeb419dfcb0b906506938.tar.gz
slixmpp-54d556280ae5003eb56eeb419dfcb0b906506938.tar.bz2
slixmpp-54d556280ae5003eb56eeb419dfcb0b906506938.tar.xz
slixmpp-54d556280ae5003eb56eeb419dfcb0b906506938.zip
XEP-0428: Fallback Indication
-rw-r--r--slixmpp/plugins/__init__.py1
-rw-r--r--slixmpp/plugins/xep_0428/__init__.py13
-rw-r--r--slixmpp/plugins/xep_0428/fallback.py22
-rw-r--r--slixmpp/plugins/xep_0428/stanza.py26
4 files changed, 62 insertions, 0 deletions
diff --git a/slixmpp/plugins/__init__.py b/slixmpp/plugins/__init__.py
index 758cccd1..0bc62676 100644
--- a/slixmpp/plugins/__init__.py
+++ b/slixmpp/plugins/__init__.py
@@ -95,5 +95,6 @@ __all__ = [
'xep_0405', # MIX-PAM
'xep_0421', # Anonymous unique occupant identifiers for MUCs
'xep_0422', # Message Fastening
+ 'xep_0428', # Message Fallback
'xep_0444', # Message Reactions
]
diff --git a/slixmpp/plugins/xep_0428/__init__.py b/slixmpp/plugins/xep_0428/__init__.py
new file mode 100644
index 00000000..864f4ed3
--- /dev/null
+++ b/slixmpp/plugins/xep_0428/__init__.py
@@ -0,0 +1,13 @@
+"""
+ Slixmpp: The Slick XMPP Library
+ Copyright (C) 2020 Mathieu Pasquet <mathieui@mathieui.net>
+ This file is part of Slixmpp.
+
+ See the file LICENSE for copying permission.
+"""
+
+from slixmpp.plugins.base import register_plugin
+from slixmpp.plugins.xep_0428.stanza import *
+from slixmpp.plugins.xep_0428.fallback import XEP_0428
+
+register_plugin(XEP_0428)
diff --git a/slixmpp/plugins/xep_0428/fallback.py b/slixmpp/plugins/xep_0428/fallback.py
new file mode 100644
index 00000000..61e913e3
--- /dev/null
+++ b/slixmpp/plugins/xep_0428/fallback.py
@@ -0,0 +1,22 @@
+"""
+ Slixmpp: The Slick XMPP Library
+ Copyright (C) 2020 Mathieu Pasquet <mathieui@mathieui.net>
+ This file is part of Slixmpp.
+
+ See the file LICENSE for copying permission.
+"""
+from slixmpp.plugins import BasePlugin
+from slixmpp.plugins.xep_0428 import stanza
+
+
+class XEP_0428(BasePlugin):
+ '''XEP-0428: Fallback Indication'''
+
+ name = 'xep_0428'
+ description = 'Fallback Indication'
+ dependencies = set()
+ stanza = stanza
+ namespace = stanza.NS
+
+ def plugin_init(self) -> None:
+ stanza.register_plugins()
diff --git a/slixmpp/plugins/xep_0428/stanza.py b/slixmpp/plugins/xep_0428/stanza.py
new file mode 100644
index 00000000..41df80d0
--- /dev/null
+++ b/slixmpp/plugins/xep_0428/stanza.py
@@ -0,0 +1,26 @@
+"""
+ Slixmpp: The Slick XMPP Library
+ Copyright (C) 2020 Mathieu Pasquet <mathieui@mathieui.net>
+ This file is part of Slixmpp.
+
+ See the file LICENSE for copying permissio
+"""
+
+from slixmpp.stanza import Message
+from slixmpp.xmlstream import (
+ ElementBase,
+ register_stanza_plugin,
+)
+
+
+NS = 'urn:xmpp:fallback:0'
+
+
+class Fallback(ElementBase):
+ namespace = NS
+ name = 'fallback'
+ plugin_attrib = 'fallback'
+
+
+def register_plugins():
+ register_stanza_plugin(Message, Fallback)