changeset 1287:2eaa98f7b84c

plugin XEP-0313: handle forwarded pubsub event
author souliane <souliane@mailoo.org>
date Thu, 15 Jan 2015 21:54:53 +0100
parents d9939b476526
children 8aa4dab01206
files src/plugins/plugin_xep_0313.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0313.py	Thu Jan 15 21:02:41 2015 +0100
+++ b/src/plugins/plugin_xep_0313.py	Thu Jan 15 21:54:53 2015 +0100
@@ -34,6 +34,7 @@
 
 from wokkel import disco, data_form
 from wokkel.generic import parseXml
+from wokkel.pubsub import NS_PUBSUB_EVENT, ItemsEvent
 
 # TODO: change this when RSM and MAM are in wokkel
 from sat.tmp.wokkel.rsm import RSMRequest
@@ -215,6 +216,16 @@
             log.error(_("<forwarded/> element misses a mandatory child!"))
             return False
         log.debug(_("MAM found a forwarded message"))
+
+        if msg.event and msg.event.uri == NS_PUBSUB_EVENT:
+            event = ItemsEvent(jid.JID(message['from']),
+                               jid.JID(message['to']),
+                               msg.event.items['node'],
+                               msg.event.items.elements(),
+                               {})
+            self.host.plugins["XEP-0060"].clients[profile].itemsReceived(event)
+            return False
+
         client = self.host.getClient(profile)
         client.messageProt.onMessage(msg)
         return False