summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0403/mix_presence.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2020-12-02 19:19:14 +0100
committermathieui <mathieui@mathieui.net>2020-12-02 19:19:14 +0100
commit4d5586f4a1712050940ee582187c6d955a8e18f4 (patch)
tree3cdbdaa3e8d9537d01adfdd9277e5ac209949816 /slixmpp/plugins/xep_0403/mix_presence.py
parent54b9721f3a67beb6580d09a307c9f8b168d96568 (diff)
parent4eb2bb7da855e67f1fff0d86470cc78c06e64c95 (diff)
downloadslixmpp-4d5586f4a1712050940ee582187c6d955a8e18f4.tar.gz
slixmpp-4d5586f4a1712050940ee582187c6d955a8e18f4.tar.bz2
slixmpp-4d5586f4a1712050940ee582187c6d955a8e18f4.tar.xz
slixmpp-4d5586f4a1712050940ee582187c6d955a8e18f4.zip
Merge branch 'mix-implementation' into 'master'
First try at a MIX implementation See merge request poezio/slixmpp!63
Diffstat (limited to 'slixmpp/plugins/xep_0403/mix_presence.py')
-rw-r--r--slixmpp/plugins/xep_0403/mix_presence.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0403/mix_presence.py b/slixmpp/plugins/xep_0403/mix_presence.py
new file mode 100644
index 00000000..995439b9
--- /dev/null
+++ b/slixmpp/plugins/xep_0403/mix_presence.py
@@ -0,0 +1,47 @@
+"""
+ 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 typing import (
+ Optional,
+ Set,
+)
+
+from slixmpp import JID, Iq
+from slixmpp.exceptions import IqError, IqTimeout
+from slixmpp.plugins import BasePlugin
+from slixmpp.plugins.xep_0403 import stanza
+from slixmpp.xmlstream.matcher import MatchXPath
+from slixmpp.xmlstream.handler import Callback
+
+
+NODES = [
+ 'urn:xmpp:mix:nodes:presence'
+]
+
+
+class XEP_0403(BasePlugin):
+ '''XEP-0403: MIX-Presence'''
+
+ name = 'xep_0403'
+ description = 'MIX-Presence'
+ dependencies = {'xep_0369'}
+ stanza = stanza
+ namespace = stanza.NS
+
+ def plugin_init(self) -> None:
+ stanza.register_plugins()
+
+ self.xmpp.register_handler(
+ Callback(
+ 'MIX Presence received',
+ MatchXPath('{%s}presence/{%s}mix' % (self.xmpp.default_ns, stanza.NS)),
+ self._handle_mix_presence,
+ )
+ )
+
+ def _handle_mix_presence(self, presence):
+ self.xmpp.event('mix_presence', presence)