Add support for XEP0402 (PEP Native bookmarks)
This commit is contained in:
parent
bc2cebae6c
commit
8f77bd4ee5
4 changed files with 51 additions and 0 deletions
|
@ -102,6 +102,7 @@ PLUGINS = [
|
|||
'xep_0380', # Explicit Message Encryption
|
||||
'xep_0382', # Spoiler Messages
|
||||
'xep_0394', # Message Markup
|
||||
'xep_0402', # PEP Native Bookmarks
|
||||
'xep_0403', # MIX-Presence
|
||||
'xep_0404', # MIX-Anon
|
||||
'xep_0405', # MIX-PAM
|
||||
|
|
6
slixmpp/plugins/xep_0402/__init__.py
Normal file
6
slixmpp/plugins/xep_0402/__init__.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from slixmpp.plugins.base import register_plugin
|
||||
|
||||
from . import stanza
|
||||
from .bookmarks import XEP_0402
|
||||
|
||||
register_plugin(XEP_0402)
|
18
slixmpp/plugins/xep_0402/bookmarks.py
Normal file
18
slixmpp/plugins/xep_0402/bookmarks.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from slixmpp.plugins import BasePlugin
|
||||
|
||||
from . import stanza
|
||||
|
||||
|
||||
class XEP_0402(BasePlugin):
|
||||
|
||||
"""
|
||||
XEP-0402: PEP Native bookmarks
|
||||
"""
|
||||
|
||||
name = "xep_0402"
|
||||
description = "XEP-0402: PEP Native bookmarks"
|
||||
dependencies = {"xep_0402"}
|
||||
stanza = stanza
|
||||
|
||||
def plugin_init(self):
|
||||
stanza.register_plugin()
|
26
slixmpp/plugins/xep_0402/stanza.py
Normal file
26
slixmpp/plugins/xep_0402/stanza.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
from slixmpp import register_stanza_plugin
|
||||
from slixmpp.plugins.xep_0060.stanza import Item
|
||||
from slixmpp.xmlstream import ElementBase
|
||||
|
||||
NS = "urn:xmpp:bookmarks:1"
|
||||
|
||||
|
||||
class Conference(ElementBase):
|
||||
namespace = NS
|
||||
name = "conference"
|
||||
plugin_attrib = "conference"
|
||||
interfaces = {"name", "autojoin", "nick"}
|
||||
sub_interfaces = {"nick"}
|
||||
|
||||
def set_autojoin(self, v: bool):
|
||||
self._set_attr('autojoin', "true" if v else "false")
|
||||
|
||||
def get_autojoin(self):
|
||||
v = self._get_attr('autojoin', '')
|
||||
if not v:
|
||||
return False
|
||||
return v == "1" or v.lower() == "true"
|
||||
|
||||
|
||||
def register_plugin():
|
||||
register_stanza_plugin(Item, Conference)
|
Loading…
Reference in a new issue