summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0425/stanza.py
blob: f195c99bdda1032697af9f5b47f3ba22e835db3a (plain)
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

# 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
from slixmpp.stanza import Message, Iq
from slixmpp.xmlstream import (
    ElementBase,
    register_stanza_plugin,
)
from slixmpp.plugins.xep_0422.stanza import ApplyTo
from slixmpp.plugins.xep_0421.stanza import OccupantId
from slixmpp.plugins.xep_0424.stanza import Retract, Retracted


NS = 'urn:xmpp:message-moderate:0'


class Moderate(ElementBase):
    namespace = NS
    name = 'moderate'
    plugin_attrib = 'moderate'
    interfaces = {'reason'}
    sub_interfaces = {'reason'}


class Moderated(ElementBase):
    namespace = NS
    name = 'moderated'
    plugin_attrib = 'moderated'
    interfaces = {'reason', 'by'}
    sub_interfaces = {'reason'}


def register_plugins():
    register_stanza_plugin(Iq, ApplyTo)
    register_stanza_plugin(ApplyTo, Moderate)
    register_stanza_plugin(Moderate, Retract)

    register_stanza_plugin(Message, Moderated)
    register_stanza_plugin(ApplyTo, Moderated)
    register_stanza_plugin(Moderated, Retract)
    register_stanza_plugin(Moderated, Retracted)
    register_stanza_plugin(Moderated, OccupantId)