annotate sat/plugins/plugin_xep_0359.py @ 3857:7d11e42b150e

cli (blog/set): show ID of published item
author Goffi <goffi@goffi.org>
date Thu, 14 Jul 2022 12:55:30 +0200
parents cc653b2685f0
children 8289ac1b34f4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
1 #!/usr/bin/env python3
3137
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
2
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
3
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # SAT plugin for Message Archive Management (XEP-0359)
3479
be6d91572633 date update
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
6 # Copyright (C) 2013-2016 Adrien Cossa (souliane@mailoo.org)
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
7
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # This program is free software: you can redistribute it and/or modify
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # it under the terms of the GNU Affero General Public License as published by
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # the Free Software Foundation, either version 3 of the License, or
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
11 # (at your option) any later version.
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
12
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful,
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
16 # GNU Affero General Public License for more details.
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
17
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # You should have received a copy of the GNU Affero General Public License
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
20
3103
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
21 import uuid
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
22 from zope.interface import implementer
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
23 from twisted.words.protocols.jabber import xmlstream
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
24 from wokkel import disco
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
25 from sat.core.constants import Const as C
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from sat.core import exceptions
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
27 from sat.core.i18n import _
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
28 from sat.core.log import getLogger
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
29
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
30 log = getLogger(__name__)
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
31
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
32
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
33 PLUGIN_INFO = {
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
34 C.PI_NAME: "Unique and Stable Stanza IDs",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
35 C.PI_IMPORT_NAME: "XEP-0359",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
36 C.PI_TYPE: "XEP",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
37 C.PI_PROTOCOLS: ["XEP-0359"],
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
38 C.PI_MAIN: "XEP_0359",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
39 C.PI_HANDLER: "yes",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
40 C.PI_DESCRIPTION: _("""Implementation of Unique and Stable Stanza IDs"""),
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
41 }
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
42
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
43 NS_SID = "urn:xmpp:sid:0"
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
44
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
45
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
46 class XEP_0359(object):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
47
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
48 def __init__(self, host):
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
49 log.info(_("Unique and Stable Stanza IDs plugin initialization"))
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
50 self.host = host
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
51 host.registerNamespace("stanza_id", NS_SID)
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
52 host.trigger.add("message_parse", self._message_parseTrigger)
3797
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
53 host.trigger.add("sendMessageData", self._sendMessageDataTrigger)
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
54
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
55 def _message_parseTrigger(self, client, message_elt, mess_data):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
56 """Check if message has a stanza-id"""
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
57 stanza_id = self.getStanzaId(message_elt, client.jid.userhostJID())
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
58 if stanza_id is not None:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
59 mess_data['extra']['stanza_id'] = stanza_id
3797
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
60 origin_id = self.getOriginId(message_elt)
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
61 if origin_id is not None:
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
62 mess_data['extra']['origin_id'] = origin_id
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
63 return True
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
64
3797
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
65 def _sendMessageDataTrigger(self, client, mess_data):
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
66 origin_id = mess_data["extra"].get("origin_id")
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
67 if not origin_id:
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
68 origin_id = str(uuid.uuid4())
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
69 mess_data["extra"]["origin_id"] = origin_id
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
70 message_elt = mess_data["xml"]
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
71 self.addOriginId(message_elt, origin_id)
cc653b2685f0 core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
72
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
73 def getStanzaId(self, element, by):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
74 """Return stanza-id if found in element
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
75
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
76 @param element(domish.Element): element to parse
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
77 @param by(jid.JID): entity which should have set a stanza-id
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
78 @return (unicode, None): stanza-id if found
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
79 """
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
80 stanza_id = None
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
81 for stanza_elt in element.elements(NS_SID, "stanza-id"):
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
82 if stanza_elt.getAttribute("by") == by.full():
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
83 if stanza_id is not None:
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
84 # we must not have more than one element (§3 #4)
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
85 raise exceptions.DataError(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
86 "More than one corresponding stanza-id found!")
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
87 stanza_id = stanza_elt.getAttribute("id")
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
88 # we don't break to be sure that there is no more than one element
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
89 # with this "by" attribute
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
90
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
91 return stanza_id
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
92
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
93 def addStanzaId(self, client, element, stanza_id, by=None):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
94 """Add a <stanza-id/> to a stanza
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
95
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
96 @param element(domish.Element): stanza where the <stanza-id/> must be added
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
97 @param stanza_id(unicode): id to use
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
98 @param by(jid.JID, None): jid to use or None to use client.jid
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
99 """
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
100 sid_elt = element.addElement((NS_SID, "stanza-id"))
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
101 sid_elt["by"] = client.jid.userhost() if by is None else by.userhost()
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
102 sid_elt["id"] = stanza_id
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
103
3103
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
104 def getOriginId(self, element):
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
105 """Return origin-id if found in element
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
106
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
107 @param element(domish.Element): element to parse
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
108 @return (unicode, None): origin-id if found
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
109 """
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
110 try:
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
111 origin_elt = next(element.elements(NS_SID, "origin-id"))
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
112 except StopIteration:
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
113 return None
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
114 else:
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
115 return origin_elt.getAttribute("id")
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
116
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
117 def addOriginId(self, element, origin_id=None):
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
118 """Add a <origin-id/> to a stanza
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
119
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
120 @param element(domish.Element): stanza where the <origin-id/> must be added
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
121 @param origin_id(str): id to use, None to automatically generate
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
122 @return (str): origin_id
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
123 """
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
124 if origin_id is None:
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
125 origin_id = str(uuid.uuid4())
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
126 sid_elt = element.addElement((NS_SID, "origin-id"))
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
127 sid_elt["id"] = origin_id
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
128 return origin_id
f0f48b4deb35 plugin XEP-0359: handle origin-id
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
129
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
130 def getHandler(self, client):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
131 return XEP_0359_handler()
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
132
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
133
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
134 @implementer(disco.IDisco)
2696
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
135 class XEP_0359_handler(xmlstream.XMPPHandler):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
136
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
137 def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
138 return [disco.DiscoFeature(NS_SID)]
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
139
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
140 def getDiscoItems(self, requestor, target, nodeIdentifier=""):
5849dcaab99d plugin XEP-0359: Unique and Stable Stanza IDs implementation, first draft
Goffi <goffi@goffi.org>
parents:
diff changeset
141 return []