1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# 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
import xml.etree.ElementTree as ET
from slixmpp import JID
from slixmpp.stanza import (
Iq,
Message,
)
from slixmpp.xmlstream import (
ElementBase,
register_stanza_plugin,
)
from slixmpp.plugins.xep_0004.stanza import (
Form,
)
from slixmpp.plugins.xep_0060.stanza import (
EventItem,
Item,
)
NS = 'urn:xmpp:mix:core:1'
class MIX(ElementBase):
name = 'mix'
namespace = NS
plugin_attrib = 'mix'
interfaces = {'nick', 'jid'}
sub_interfaces = {'nick', 'jid'}
class Setnick(ElementBase):
name = 'setnick'
namespace = NS
plugin_attrib = 'mix_setnick'
interfaces = {'nick'}
sub_interfaces = {'nick'}
class Join(ElementBase):
namespace = NS
name = 'join'
plugin_attrib = 'mix_join'
interfaces = {'nick', 'id'}
sub_interfaces = {'nick'}
class Leave(ElementBase):
namespace = NS
name = 'leave'
plugin_attrib = 'mix_leave'
class Subscribe(ElementBase):
namespace = NS
name = 'subscribe'
plugin_attrib = 'subscribe'
interfaces = {'node'}
class Unsubscribe(ElementBase):
namespace = NS
name = 'unsubscribe'
plugin_attrib = 'unsubscribe'
interfaces = {'node'}
class UpdateSubscription(ElementBase):
namespace = NS
name = 'update-subscription'
plugin_attrib = 'mix_updatesub'
interfaces = {'jid'}
class Create(ElementBase):
name = 'create'
plugin_attrib = 'mix_create'
namespace = NS
interfaces = {'channel'}
class Participant(ElementBase):
namespace = NS
name = 'participant'
plugin_attrib = 'mix_participant'
interfaces = {'nick', 'jid'}
sub_interfaces = {'nick', 'jid'}
class Destroy(ElementBase):
name = 'destroy'
plugin_attrib = 'mix_destroy'
namespace = NS
interfaces = {'channel'}
def register_plugins():
register_stanza_plugin(Item, Form)
register_stanza_plugin(EventItem, Form)
register_stanza_plugin(EventItem, Participant)
register_stanza_plugin(Item, Participant)
register_stanza_plugin(Join, Subscribe, iterable=True)
register_stanza_plugin(Iq, Join)
register_stanza_plugin(UpdateSubscription, Subscribe, iterable=True)
register_stanza_plugin(UpdateSubscription, Unsubscribe, iterable=True)
register_stanza_plugin(Iq, UpdateSubscription)
register_stanza_plugin(Iq, Leave)
register_stanza_plugin(Iq, Create)
register_stanza_plugin(Iq, Setnick)
register_stanza_plugin(Message, MIX)
|