annotate sat/plugins/plugin_xep_0313.py @ 2683:38af118a7d74

template: better css files order
author Goffi <goffi@goffi.org>
date Wed, 03 Oct 2018 20:38:10 +0200
parents 56f94936df1e
children 2ea2369ae7de
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1934
2daf7b4c6756 use of /usr/bin/env instead of /usr/bin/python in shebang
Goffi <goffi@goffi.org>
parents: 1776
diff changeset
1 #!/usr/bin/env python2
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
3
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # SAT plugin for Message Archive Management (XEP-0313)
2483
0046283a285d dates update
Goffi <goffi@goffi.org>
parents: 2414
diff changeset
5 # Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org)
1766
d17772b0fe22 copyright update
Goffi <goffi@goffi.org>
parents: 1409
diff changeset
6 # Copyright (C) 2013-2016 Adrien Cossa (souliane@mailoo.org)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
7
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # This program is free software: you can redistribute it and/or modify
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # it under the terms of the GNU Affero General Public License as published by
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # the Free Software Foundation, either version 3 of the License, or
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
11 # (at your option) any later version.
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
12
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful,
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
16 # GNU Affero General Public License for more details.
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
17
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # You should have received a copy of the GNU Affero General Public License
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
20
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
21 from sat.core.constants import Const as C
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
22 from sat.core.i18n import _
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
23 from sat.core.log import getLogger
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
24
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
25 log = getLogger(__name__)
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
26 from sat.core import exceptions
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
27
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
28 from twisted.words.protocols.jabber import jid
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
29
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
30 from zope.interface import implements
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
31
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
32 from wokkel import disco
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
33 import uuid
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
34
2413
70399d1acb47 tmp: removed sat.tmp hierarchy and fixed references to it as it is now an independant sat_tmp repository
Goffi <goffi@goffi.org>
parents: 2145
diff changeset
35 # XXX: mam and rsm come from sat_tmp.wokkel
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
36 from wokkel import rsm
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
37 from wokkel import mam
1285
ed2c718bfe03 tmp, plugins: fixes the imports fron sat.tmp
souliane <souliane@mailoo.org>
parents: 1284
diff changeset
38
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
39
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
40 MESSAGE_RESULT = "/message/result[@xmlns='{mam_ns}' and @queryid='{query_id}']"
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
41
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
42 PLUGIN_INFO = {
2145
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
43 C.PI_NAME: "Message Archive Management",
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
44 C.PI_IMPORT_NAME: "XEP-0313",
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
45 C.PI_TYPE: "XEP",
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
46 C.PI_PROTOCOLS: ["XEP-0313"],
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
47 C.PI_MAIN: "XEP_0313",
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
48 C.PI_HANDLER: "yes",
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
49 C.PI_DESCRIPTION: _("""Implementation of Message Archive Management"""),
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
50 }
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
51
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
52
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
53 class XEP_0313(object):
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
54 def __init__(self, host):
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
55 log.info(_("Message Archive Management plugin initialization"))
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
56 self.host = host
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
57
2144
1d3f73e065e1 core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
58 def getHandler(self, client):
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
59 mam_client = client._mam = SatMAMClient()
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
60 return mam_client
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
61
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
62 def queryFields(self, client, service=None):
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
63 """Ask the server about supported fields.
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
64
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
65 @param service: entity offering the MAM service (None for user archives)
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
66 @return (D(data_form.Form)): form with the implemented fields (cf XEP-0313 §4.1.5)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
67 """
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
68 return client._mam.queryFields(service)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
69
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
70 def queryArchive(self, client, mam_query, service=None):
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
71 """Query a user, MUC or pubsub archive.
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
72
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
73 @param mam_query(mam.MAMRequest): MAM query instance
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
74 @param service(jid.JID, None): entity offering the MAM service
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
75 None for user server
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
76 @return (D(domish.Element)): <IQ/> result
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
77 """
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
78 return client._mam.queryArchive(mam_query, service)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
79
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
80 def _appendMessage(self, elt_list, message_cb, message_elt):
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
81 if message_cb is not None:
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
82 elt_list.append(message_cb(message_elt))
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
83 else:
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
84 elt_list.append(message_elt)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
85
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
86 def _queryFinished(self, iq_result, client, elt_list, event):
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
87 client.xmlstream.removeObserver(event, self._appendMessage)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
88 try:
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
89 fin_elt = iq_result.elements(mam.NS_MAM, "fin").next()
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
90 except StopIteration:
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
91 raise exceptions.DataError(u"Invalid MAM result")
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
92
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
93 try:
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
94 rsm_response = rsm.RSMResponse.fromElement(fin_elt)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
95 except rsm.RSMNotFoundError:
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
96 rsm_response = None
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
97
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
98 return (elt_list, rsm_response)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
99
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
100 def getArchives(self, client, query, service=None, message_cb=None):
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
101 """Query archive then grab and return them all in the result
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
102
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
103 """
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
104 if query.query_id is None:
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
105 query.query_id = unicode(uuid.uuid4())
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
106 elt_list = []
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
107 event = MESSAGE_RESULT.format(mam_ns=mam.NS_MAM, query_id=query.query_id)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
108 client.xmlstream.addObserver(event, self._appendMessage, 0, elt_list, message_cb)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
109 d = self.queryArchive(client, query, service)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
110 d.addCallback(self._queryFinished, client, elt_list, event)
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
111 return d
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
112
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
113 def getPrefs(self, client, service=None):
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
114 """Retrieve the current user preferences.
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
115
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
116 @param service: entity offering the MAM service (None for user archives)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
117 @return: the server response as a Deferred domish.Element
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
118 """
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
119 # http://xmpp.org/extensions/xep-0313.html#prefs
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
120 return client._mam.queryPrefs(service)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
121
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
122 def _setPrefs(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
123 self,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
124 service_s=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
125 default="roster",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
126 always=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
127 never=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
128 profile_key=C.PROF_KEY_NONE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
129 ):
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
130 service = jid.JID(service_s) if service_s else None
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
131 always_jid = [jid.JID(entity) for entity in always]
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
132 never_jid = [jid.JID(entity) for entity in never]
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
133 # TODO: why not build here a MAMPrefs object instead of passing the args separately?
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
134 return self.setPrefs(service, default, always_jid, never_jid, profile_key)
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
135
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
136 def setPrefs(self, client, service=None, default="roster", always=None, never=None):
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
137 """Set news user preferences.
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
138
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
139 @param service: entity offering the MAM service (None for user archives)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
140 @param default (unicode): a value in ('always', 'never', 'roster')
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
141 @param always (list): a list of JID instances
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
142 @param never (list): a list of JID instances
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
143 @param profile_key (unicode): %(doc_profile_key)s
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
144 @return: the server response as a Deferred domish.Element
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
145 """
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
146 # http://xmpp.org/extensions/xep-0313.html#prefs
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
147 return client._mam.setPrefs(service, default, always, never)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
148
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
149
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
150 class SatMAMClient(mam.MAMClient):
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
151 implements(disco.IDisco)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
152
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
153 def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
154 return [disco.DiscoFeature(mam.NS_MAM)]
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
155
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
156 def getDiscoItems(self, requestor, target, nodeIdentifier=""):
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
157 return []