annotate src/plugins/plugin_xep_0313.py @ 2210:f8d61592f1fc

plugin invitations: raise ValueError if url_template and message_body are both not specified
author Goffi <goffi@goffi.org>
date Wed, 29 Mar 2017 19:30:29 +0200
parents 33c8c4973743
children 70399d1acb47
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)
1766
d17772b0fe22 copyright update
Goffi <goffi@goffi.org>
parents: 1409
diff changeset
5 # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org)
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
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
24 log = getLogger(__name__)
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
25 from sat.core import exceptions
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
26
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
27 from twisted.words.protocols.jabber import jid
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
28
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
29 from zope.interface import implements
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
30
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
31 from wokkel import disco
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
32 import uuid
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
33
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
34 # XXX: mam and rsm come from tmp.wokkel
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
35 from wokkel import rsm
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
36 from wokkel import mam
1285
ed2c718bfe03 tmp, plugins: fixes the imports fron sat.tmp
souliane <souliane@mailoo.org>
parents: 1284
diff changeset
37
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
38
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
39 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
40
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
41 PLUGIN_INFO = {
2145
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
42 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
43 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
44 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
45 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
46 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
47 C.PI_HANDLER: "yes",
33c8c4973743 core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents: 2144
diff changeset
48 C.PI_DESCRIPTION: _("""Implementation of Message Archive Management""")
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
49 }
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 class XEP_0313(object):
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
53
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:
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
89 fin_elt = iq_result.elements(mam.NS_MAM, 'fin').next()
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
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
122 def _setPrefs(self, service_s=None, default='roster', always=None, never=None, profile_key=C.PROF_KEY_NONE):
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
123 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
124 always_jid = [jid.JID(entity) for entity in always]
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
125 never_jid = [jid.JID(entity) for entity in never]
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
126 #TODO: why not build here a MAMPrefs object instead of passing the args separately?
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
127 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
128
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
129 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
130 """Set news user preferences.
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
131
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
132 @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
133 @param default (unicode): a value in ('always', 'never', 'roster')
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
134 @param always (list): a list of JID instances
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
135 @param never (list): a list of JID instances
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
136 @param profile_key (unicode): %(doc_profile_key)s
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
137 @return: the server response as a Deferred domish.Element
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
138 """
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
139 # http://xmpp.org/extensions/xep-0313.html#prefs
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
140 return client._mam.setPrefs(service, default, always, never)
1277
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
141
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
142
1284
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
143 class SatMAMClient(mam.MAMClient):
41ffe2c2dddc plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents: 1277
diff changeset
144 implements(disco.IDisco)
1277
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 def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
1776
4fc1bf1af48f plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents: 1766
diff changeset
147 return [disco.DiscoFeature(mam.NS_MAM)]
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 def getDiscoItems(self, requestor, target, nodeIdentifier=''):
3a3e3014f9f8 plugin XEP-0313: first draft:
souliane <souliane@mailoo.org>
parents:
diff changeset
150 return []