comparison src/plugins/plugin_xep_0313.py @ 1287:2eaa98f7b84c

plugin XEP-0313: handle forwarded pubsub event
author souliane <souliane@mailoo.org>
date Thu, 15 Jan 2015 21:54:53 +0100
parents ed2c718bfe03
children 069ad98b360d
comparison
equal deleted inserted replaced
1286:d9939b476526 1287:2eaa98f7b84c
32 32
33 from zope.interface import implements 33 from zope.interface import implements
34 34
35 from wokkel import disco, data_form 35 from wokkel import disco, data_form
36 from wokkel.generic import parseXml 36 from wokkel.generic import parseXml
37 from wokkel.pubsub import NS_PUBSUB_EVENT, ItemsEvent
37 38
38 # TODO: change this when RSM and MAM are in wokkel 39 # TODO: change this when RSM and MAM are in wokkel
39 from sat.tmp.wokkel.rsm import RSMRequest 40 from sat.tmp.wokkel.rsm import RSMRequest
40 from sat.tmp.wokkel import mam 41 from sat.tmp.wokkel import mam
41 42
213 msg = domish.generateElementsQNamed(forwarded.elements(), "message", NS_CLIENT).next() 214 msg = domish.generateElementsQNamed(forwarded.elements(), "message", NS_CLIENT).next()
214 except StopIteration: 215 except StopIteration:
215 log.error(_("<forwarded/> element misses a mandatory child!")) 216 log.error(_("<forwarded/> element misses a mandatory child!"))
216 return False 217 return False
217 log.debug(_("MAM found a forwarded message")) 218 log.debug(_("MAM found a forwarded message"))
219
220 if msg.event and msg.event.uri == NS_PUBSUB_EVENT:
221 event = ItemsEvent(jid.JID(message['from']),
222 jid.JID(message['to']),
223 msg.event.items['node'],
224 msg.event.items.elements(),
225 {})
226 self.host.plugins["XEP-0060"].clients[profile].itemsReceived(event)
227 return False
228
218 client = self.host.getClient(profile) 229 client = self.host.getClient(profile)
219 client.messageProt.onMessage(msg) 230 client.messageProt.onMessage(msg)
220 return False 231 return False
221 232
222 233