Mercurial > libervia-backend
annotate src/plugins/plugin_xep_0313.py @ 1579:d5e332055d9f
quick_frontend, primitivus (xmlui): removed _xmluiClose from workflow were submit is triggered, as submit launch the callback which close the dialog itself + fixed dialogs _xmluiClose
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 11 Nov 2015 18:29:32 +0100 |
parents | 3265a2639182 |
children | d17772b0fe22 |
rev | line source |
---|---|
1277 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
4 # SAT plugin for Message Archive Management (XEP-0313) | |
1396 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Jérôme Poisson (goffi@goffi.org) |
6 # Copyright (C) 2013, 2014, 2015 Adrien Cossa (souliane@mailoo.org) | |
1277 | 7 |
8 # This program is free software: you can redistribute it and/or modify | |
9 # it under the terms of the GNU Affero General Public License as published by | |
10 # the Free Software Foundation, either version 3 of the License, or | |
11 # (at your option) any later version. | |
12 | |
13 # This program is distributed in the hope that it will be useful, | |
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 # GNU Affero General Public License for more details. | |
17 | |
18 # You should have received a copy of the GNU Affero General Public License | |
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 | |
21 from sat.core.constants import Const as C | |
22 from sat.core.i18n import _ | |
23 from sat.core.log import getLogger | |
24 log = getLogger(__name__) | |
25 | |
26 try: | |
27 from twisted.words.protocols.xmlstream import XMPPHandler | |
28 except ImportError: | |
29 from wokkel.subprotocols import XMPPHandler | |
30 from twisted.words.xish import domish | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
31 from twisted.words.protocols.jabber import jid |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
32 |
1277 | 33 from zope.interface import implements |
34 | |
1285
ed2c718bfe03
tmp, plugins: fixes the imports fron sat.tmp
souliane <souliane@mailoo.org>
parents:
1284
diff
changeset
|
35 from wokkel import disco, data_form |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
36 from wokkel.generic import parseXml |
1287
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
37 from wokkel.pubsub import NS_PUBSUB_EVENT, ItemsEvent |
1277 | 38 |
1285
ed2c718bfe03
tmp, plugins: fixes the imports fron sat.tmp
souliane <souliane@mailoo.org>
parents:
1284
diff
changeset
|
39 # TODO: change this when RSM and MAM are in wokkel |
ed2c718bfe03
tmp, plugins: fixes the imports fron sat.tmp
souliane <souliane@mailoo.org>
parents:
1284
diff
changeset
|
40 from sat.tmp.wokkel.rsm import RSMRequest |
ed2c718bfe03
tmp, plugins: fixes the imports fron sat.tmp
souliane <souliane@mailoo.org>
parents:
1284
diff
changeset
|
41 from sat.tmp.wokkel import mam |
ed2c718bfe03
tmp, plugins: fixes the imports fron sat.tmp
souliane <souliane@mailoo.org>
parents:
1284
diff
changeset
|
42 |
1277 | 43 |
44 NS_MAM = 'urn:xmpp:mam:0' | |
45 NS_SF = 'urn:xmpp:forward:0' | |
46 NS_DD = 'urn:xmpp:delay' | |
47 NS_CLIENT = 'jabber:client' | |
48 | |
49 PLUGIN_INFO = { | |
50 "name": "Message Archive Management", | |
51 "import_name": "XEP-0313", | |
52 "type": "XEP", | |
53 "protocols": ["XEP-0313"], | |
54 "dependencies": ["XEP-0059", "XEP-0297", "XEP-0203"], | |
55 "recommendations": ["XEP-0334"], | |
56 "main": "XEP_0313", | |
57 "handler": "yes", | |
58 "description": _("""Implementation of Message Archive Management""") | |
59 } | |
60 | |
61 | |
62 class XEP_0313(object): | |
63 | |
64 def __init__(self, host): | |
65 log.info(_("Message Archive Management plugin initialization")) | |
66 self.host = host | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
67 self.clients = {} # bind profile name to SatMAMClient |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
68 host.bridge.addMethod("MAMqueryFields", ".plugin", in_sign='ss', out_sign='s', |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
69 method=self._queryFields, |
1277 | 70 async=True, |
71 doc={}) | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
72 host.bridge.addMethod("MAMqueryArchive", ".plugin", in_sign='ssa{ss}ss', out_sign='s', |
1277 | 73 method=self._queryArchive, |
74 async=True, | |
75 doc={}) | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
76 host.bridge.addMethod("MAMgetPrefs", ".plugin", in_sign='ss', out_sign='s', |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
77 method=self._getPrefs, |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
78 async=True, |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
79 doc={}) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
80 host.bridge.addMethod("MAMsetPrefs", ".plugin", in_sign='ssasass', out_sign='s', |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
81 method=self._setPrefs, |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
82 async=True, |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
83 doc={}) |
1277 | 84 host.trigger.add("MessageReceived", self.messageReceivedTrigger) |
85 | |
86 def getHandler(self, profile): | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
87 self.clients[profile] = SatMAMClient(self, profile) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
88 return self.clients[profile] |
1277 | 89 |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
90 def profileDisconnected(self, profile): |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
91 try: |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
92 del self.clients[profile] |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
93 except KeyError: |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
94 pass |
1277 | 95 |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
96 def _queryFields(self, service_s=None, profile_key=C.PROF_KEY_NONE): |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
97 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
|
98 return self.queryFields(service, profile_key) |
1277 | 99 |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
100 def queryFields(self, service=None, profile_key=C.PROF_KEY_NONE): |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
101 """Ask the server about additional supported fields. |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
102 |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
103 @param service: entity offering the MAM service (None for user archives) |
1277 | 104 @param profile_key (unicode): %(doc_profile_key)s |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
105 @return: the server response as a Deferred domish.Element |
1277 | 106 """ |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
107 # http://xmpp.org/extensions/xep-0313.html#query-form |
1277 | 108 def eb(failure): |
109 # typically StanzaError with condition u'service-unavailable' | |
110 log.error(failure.getErrorMessage()) | |
111 return '' | |
112 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
113 profile = self.host.memory.getProfileName(profile_key) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
114 d = self.clients[profile].queryFields(service) |
1277 | 115 return d.addCallbacks(lambda elt: elt.toXml(), eb) |
116 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
117 def _queryArchive(self, service_s=None, form_xml=None, rsm_dict=None, node=None, profile_key=C.PROF_KEY_NONE): |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
118 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
|
119 if form_xml: |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
120 form = data_form.Form.fromElement(parseXml(form_xml)) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
121 if form.formNamespace != NS_MAM: |
1409
3265a2639182
massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
souliane <souliane@mailoo.org>
parents:
1396
diff
changeset
|
122 log.error(_(u"Expected a MAM Data Form, got instead: %s") % form.formNamespace) |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
123 form = None |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
124 else: |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
125 form = None |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
126 rsm = RSMRequest(**rsm_dict) if rsm_dict else None |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
127 return self.queryArchive(service, form, rsm, node, profile_key) |
1277 | 128 |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
129 def queryArchive(self, service=None, form=None, rsm=None, node=None, profile_key=C.PROF_KEY_NONE): |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
130 """Query a user, MUC or pubsub archive. |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
131 |
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) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
133 @param form (Form): data form to filter the request |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
134 @param rsm (RSMRequest): RSM request instance |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
135 @param node (unicode): pubsub node to query, or None if inappropriate |
1277 | 136 @param profile_key (unicode): %(doc_profile_key)s |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
137 @return: a Deferred when the message has been sent |
1277 | 138 """ |
139 def eb(failure): | |
140 # typically StanzaError with condition u'service-unavailable' | |
141 log.error(failure.getErrorMessage()) | |
142 return '' | |
143 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
144 profile = self.host.memory.getProfileName(profile_key) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
145 d = self.clients[profile].queryArchive(service, form, rsm, node) |
1277 | 146 return d.addCallbacks(lambda elt: elt.toXml(), eb) |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
147 # TODO: add the handler for receiving the final message |
1277 | 148 |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
149 def _getPrefs(self, service_s=None, profile_key=C.PROF_KEY_NONE): |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
150 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
|
151 return self.getPrefs(service, profile_key) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
152 |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
153 def getPrefs(self, service=None, profile_key=C.PROF_KEY_NONE): |
1277 | 154 """Retrieve the current user preferences. |
155 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
156 @param service: entity offering the MAM service (None for user archives) |
1277 | 157 @param profile_key (unicode): %(doc_profile_key)s |
158 @return: the server response as a Deferred domish.Element | |
159 """ | |
160 # http://xmpp.org/extensions/xep-0313.html#prefs | |
161 def eb(failure): | |
162 # typically StanzaError with condition u'service-unavailable' | |
163 log.error(failure.getErrorMessage()) | |
164 return '' | |
165 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
166 profile = self.host.memory.getProfileName(profile_key) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
167 d = self.clients[profile].queryPrefs(service) |
1277 | 168 return d.addCallbacks(lambda elt: elt.toXml(), eb) |
169 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
170 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
|
171 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
|
172 always_jid = [jid.JID(entity) for entity in always] |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
173 never_jid = [jid.JID(entity) for entity in never] |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
174 #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
|
175 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
|
176 |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
177 def setPrefs(self, service=None, default='roster', always=None, never=None, profile_key=C.PROF_KEY_NONE): |
1277 | 178 """Set news user preferences. |
179 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
180 @param service: entity offering the MAM service (None for user archives) |
1277 | 181 @param default (unicode): a value in ('always', 'never', 'roster') |
182 @param always (list): a list of JID instances | |
183 @param never (list): a list of JID instances | |
184 @param profile_key (unicode): %(doc_profile_key)s | |
185 @return: the server response as a Deferred domish.Element | |
186 """ | |
187 # http://xmpp.org/extensions/xep-0313.html#prefs | |
188 def eb(failure): | |
189 # typically StanzaError with condition u'service-unavailable' | |
190 log.error(failure.getErrorMessage()) | |
191 return '' | |
192 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
193 profile = self.host.memory.getProfileName(profile_key) |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
194 d = self.clients[profile].setPrefs(service, default, always, never) |
1277 | 195 return d.addCallbacks(lambda elt: elt.toXml(), eb) |
196 | |
197 def messageReceivedTrigger(self, message, post_treat, profile): | |
198 """Check if the message is a MAM result. If so, extract the original | |
199 message, stop processing the current message and process the original | |
200 message instead. | |
201 """ | |
202 try: | |
203 result = domish.generateElementsQNamed(message.elements(), "result", NS_MAM).next() | |
204 except StopIteration: | |
205 return True | |
206 try: | |
207 forwarded = domish.generateElementsQNamed(result.elements(), "forwarded", NS_SF).next() | |
208 except StopIteration: | |
209 log.error(_("MAM result misses its <forwarded/> mandatory element!")) | |
210 return False | |
211 try: | |
212 # TODO: delay is not here for nothing, get benefice of it! | |
213 delay = domish.generateElementsQNamed(forwarded.elements(), "delay", NS_DD).next() | |
214 msg = domish.generateElementsQNamed(forwarded.elements(), "message", NS_CLIENT).next() | |
215 except StopIteration: | |
216 log.error(_("<forwarded/> element misses a mandatory child!")) | |
217 return False | |
218 log.debug(_("MAM found a forwarded message")) | |
1287
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
219 |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
220 if msg.event and msg.event.uri == NS_PUBSUB_EVENT: |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
221 event = ItemsEvent(jid.JID(message['from']), |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
222 jid.JID(message['to']), |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
223 msg.event.items['node'], |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
224 msg.event.items.elements(), |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
225 {}) |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
226 self.host.plugins["XEP-0060"].clients[profile].itemsReceived(event) |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
227 return False |
2eaa98f7b84c
plugin XEP-0313: handle forwarded pubsub event
souliane <souliane@mailoo.org>
parents:
1285
diff
changeset
|
228 |
1277 | 229 client = self.host.getClient(profile) |
230 client.messageProt.onMessage(msg) | |
231 return False | |
232 | |
233 | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
234 class SatMAMClient(mam.MAMClient): |
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
235 implements(disco.IDisco) |
1277 | 236 |
237 def __init__(self, plugin_parent, profile): | |
238 self.plugin_parent = plugin_parent | |
239 self.host = plugin_parent.host | |
240 self.profile = profile | |
1284
41ffe2c2dddc
plugin XEP-0313: update (still draft)
souliane <souliane@mailoo.org>
parents:
1277
diff
changeset
|
241 mam.MAMClient.__init__(self) |
1277 | 242 |
243 def getDiscoInfo(self, requestor, target, nodeIdentifier=''): | |
244 return [disco.DiscoFeature(NS_MAM)] | |
245 | |
246 def getDiscoItems(self, requestor, target, nodeIdentifier=''): | |
247 return [] |