Merge branch 'xep-0382-spoiler-messages' into 'master'
XEP-0382: Spoiler Messages See merge request poezio/slixmpp!100
This commit is contained in:
commit
70b5081018
5 changed files with 80 additions and 0 deletions
8
doap.xml
8
doap.xml
|
@ -791,6 +791,14 @@
|
||||||
<xmpp:since>1.3.0</xmpp:since>
|
<xmpp:since>1.3.0</xmpp:since>
|
||||||
</xmpp:SupportedXep>
|
</xmpp:SupportedXep>
|
||||||
</implements>
|
</implements>
|
||||||
|
<implements>
|
||||||
|
<xmpp:SupportedXep>
|
||||||
|
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0382.html"/>
|
||||||
|
<xmpp:status>complete</xmpp:status>
|
||||||
|
<xmpp:version>0.2.0</xmpp:version>
|
||||||
|
<xmpp:since>1.7.0</xmpp:since>
|
||||||
|
</xmpp:SupportedXep>
|
||||||
|
</implements>
|
||||||
<implements>
|
<implements>
|
||||||
<xmpp:SupportedXep>
|
<xmpp:SupportedXep>
|
||||||
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0394.html"/>
|
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0394.html"/>
|
||||||
|
|
|
@ -100,6 +100,7 @@ __all__ = [
|
||||||
'xep_0369', # MIX-CORE
|
'xep_0369', # MIX-CORE
|
||||||
'xep_0377', # Spam reporting
|
'xep_0377', # Spam reporting
|
||||||
'xep_0380', # Explicit Message Encryption
|
'xep_0380', # Explicit Message Encryption
|
||||||
|
'xep_0382', # Spoiler Messages
|
||||||
'xep_0394', # Message Markup
|
'xep_0394', # Message Markup
|
||||||
'xep_0403', # MIX-Presence
|
'xep_0403', # MIX-Presence
|
||||||
'xep_0404', # MIX-Anon
|
'xep_0404', # MIX-Anon
|
||||||
|
|
13
slixmpp/plugins/xep_0382/__init__.py
Normal file
13
slixmpp/plugins/xep_0382/__init__.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
"""
|
||||||
|
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.plugins.base import register_plugin
|
||||||
|
from slixmpp.plugins.xep_0382.stanza import *
|
||||||
|
from slixmpp.plugins.xep_0382.spoiler import XEP_0382
|
||||||
|
|
||||||
|
register_plugin(XEP_0382)
|
32
slixmpp/plugins/xep_0382/spoiler.py
Normal file
32
slixmpp/plugins/xep_0382/spoiler.py
Normal file
|
@ -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')
|
26
slixmpp/plugins/xep_0382/stanza.py
Normal file
26
slixmpp/plugins/xep_0382/stanza.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
"""
|
||||||
|
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 permissio
|
||||||
|
"""
|
||||||
|
|
||||||
|
from slixmpp.stanza import Message
|
||||||
|
from slixmpp.xmlstream import (
|
||||||
|
register_stanza_plugin,
|
||||||
|
ElementBase,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
NS = 'urn:xmpp:spoiler:0'
|
||||||
|
|
||||||
|
|
||||||
|
class Spoiler(ElementBase):
|
||||||
|
namespace = NS
|
||||||
|
name = 'spoiler'
|
||||||
|
plugin_attrib = 'spoiler'
|
||||||
|
|
||||||
|
|
||||||
|
def register_plugins():
|
||||||
|
register_stanza_plugin(Message, Spoiler)
|
Loading…
Reference in a new issue