slidge 0.2.7.post1__py3-none-any.whl → 0.2.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- slidge/__init__.py +8 -0
- slidge/command/admin.py +3 -3
- slidge/contact/contact.py +2 -2
- slidge/contact/roster.py +2 -3
- slidge/core/dispatcher/session_dispatcher.py +6 -1
- slidge/core/gateway.py +13 -2
- slidge/core/mixins/message_maker.py +3 -3
- slidge/core/session.py +2 -2
- slidge/db/store.py +3 -0
- slidge/group/archive.py +11 -3
- slidge/group/bookmarks.py +4 -5
- slidge/group/participant.py +33 -35
- slidge/group/room.py +15 -14
- slidge/main.py +3 -3
- slidge/slixfix/__init__.py +18 -78
- slidge/util/jid_escaping.py +52 -0
- slidge/util/types.py +1 -7
- slidge/util/util.py +0 -13
- slidge-0.2.9.dist-info/METADATA +134 -0
- {slidge-0.2.7.post1.dist-info → slidge-0.2.9.dist-info}/RECORD +24 -26
- {slidge-0.2.7.post1.dist-info → slidge-0.2.9.dist-info}/WHEEL +1 -1
- slidge-0.2.9.dist-info/licenses/LICENSE +661 -0
- slidge/__version__.py +0 -5
- slidge/slixfix/xep_0492/__init__.py +0 -8
- slidge/slixfix/xep_0492/notify.py +0 -16
- slidge/slixfix/xep_0492/stanza.py +0 -107
- slidge-0.2.7.post1.dist-info/METADATA +0 -793
- {slidge-0.2.7.post1.dist-info → slidge-0.2.9.dist-info}/entry_points.txt +0 -0
- {slidge-0.2.7.post1.dist-info → slidge-0.2.9.dist-info}/top_level.txt +0 -0
@@ -1,16 +0,0 @@
|
|
1
|
-
from slixmpp.plugins import BasePlugin
|
2
|
-
from . import stanza
|
3
|
-
|
4
|
-
|
5
|
-
class XEP_0492(BasePlugin):
|
6
|
-
"""
|
7
|
-
XEP-0492: Chat notification settings
|
8
|
-
"""
|
9
|
-
|
10
|
-
name = "xep_0492"
|
11
|
-
description = "XEP-0492: Chat notification settings"
|
12
|
-
dependencies = {"xep_0402"}
|
13
|
-
stanza = stanza
|
14
|
-
|
15
|
-
def plugin_init(self):
|
16
|
-
stanza.register_plugin()
|
@@ -1,107 +0,0 @@
|
|
1
|
-
from typing import Literal, Optional, cast
|
2
|
-
|
3
|
-
from slixmpp import register_stanza_plugin
|
4
|
-
from slixmpp.plugins.xep_0402.stanza import Extensions
|
5
|
-
from slixmpp.xmlstream import ElementBase
|
6
|
-
|
7
|
-
from ...util.types import ClientType
|
8
|
-
|
9
|
-
NS = "urn:xmpp:notification-settings:0"
|
10
|
-
|
11
|
-
WhenLiteral = Literal["never", "always", "on-mention"]
|
12
|
-
|
13
|
-
|
14
|
-
class Notify(ElementBase):
|
15
|
-
"""
|
16
|
-
Chat notification settings element
|
17
|
-
|
18
|
-
|
19
|
-
To enable it on a Conference element, use configure() like this:
|
20
|
-
|
21
|
-
.. code-block::python
|
22
|
-
|
23
|
-
# C being a Conference element
|
24
|
-
C['extensions']["notify"].configure("always", client_type="pc")
|
25
|
-
|
26
|
-
Which will add the <notify> element to the <extensions> element.
|
27
|
-
"""
|
28
|
-
|
29
|
-
namespace = NS
|
30
|
-
name = "notify"
|
31
|
-
plugin_attrib = "notify"
|
32
|
-
interfaces = {"notify"}
|
33
|
-
|
34
|
-
def configure(self, when: WhenLiteral, client_type: Optional[ClientType] = None) -> None:
|
35
|
-
"""
|
36
|
-
Configure the chat notification settings for this bookmark.
|
37
|
-
|
38
|
-
This method ensures that there are no conflicting settings, e.g.,
|
39
|
-
both a <never /> and a <always /> element.
|
40
|
-
"""
|
41
|
-
cls = _CLASS_MAP[when]
|
42
|
-
element = cls()
|
43
|
-
if client_type is not None:
|
44
|
-
element["client-type"] = client_type
|
45
|
-
|
46
|
-
match = client_type if client_type is not None else ""
|
47
|
-
for child in self:
|
48
|
-
if isinstance(child, _Base) and child["client-type"] == match:
|
49
|
-
self.xml.remove(child.xml)
|
50
|
-
|
51
|
-
self.append(element)
|
52
|
-
|
53
|
-
def get_config(
|
54
|
-
self, client_type: Optional[ClientType] = None
|
55
|
-
) -> Optional[WhenLiteral]:
|
56
|
-
"""
|
57
|
-
Get the chat notification settings for this bookmark.
|
58
|
-
|
59
|
-
:param client_type: Optionally, get the notification for a specific client type.
|
60
|
-
If unset, returns the global notification setting.
|
61
|
-
|
62
|
-
:return: The chat notification setting as a string, or None if unset.
|
63
|
-
"""
|
64
|
-
match = client_type if client_type is not None else ""
|
65
|
-
for child in self:
|
66
|
-
if isinstance(child, _Base) and child["client-type"] == match:
|
67
|
-
return cast(WhenLiteral, child.name)
|
68
|
-
return None
|
69
|
-
|
70
|
-
class _Base(ElementBase):
|
71
|
-
namespace = NS
|
72
|
-
interfaces = {"client-type"}
|
73
|
-
|
74
|
-
|
75
|
-
class Never(_Base):
|
76
|
-
name = "never"
|
77
|
-
plugin_attrib = name
|
78
|
-
|
79
|
-
|
80
|
-
class Always(_Base):
|
81
|
-
name = "always"
|
82
|
-
plugin_attrib = name
|
83
|
-
|
84
|
-
|
85
|
-
class OnMention(_Base):
|
86
|
-
name = "on-mention"
|
87
|
-
plugin_attrib = name
|
88
|
-
|
89
|
-
|
90
|
-
class Advanced(ElementBase):
|
91
|
-
namespace = NS
|
92
|
-
name = plugin_attrib = "advanced"
|
93
|
-
|
94
|
-
|
95
|
-
_CLASS_MAP = {
|
96
|
-
"never": Never,
|
97
|
-
"always": Always,
|
98
|
-
"on-mention": OnMention,
|
99
|
-
}
|
100
|
-
|
101
|
-
|
102
|
-
def register_plugin():
|
103
|
-
register_stanza_plugin(Extensions, Notify)
|
104
|
-
register_stanza_plugin(Notify, Advanced)
|
105
|
-
register_stanza_plugin(Notify, Never, iterable=True)
|
106
|
-
register_stanza_plugin(Notify, Always, iterable=True)
|
107
|
-
register_stanza_plugin(Notify, OnMention, iterable=True)
|