diff src/plugins/plugin_xep_0277.py @ 1649:b58c8b4715c6

plugin XEP-0277: fixed entries in atom feed
author Goffi <goffi@goffi.org>
date Mon, 23 Nov 2015 15:51:19 +0100
parents 2b8a975ff712
children 069abd15354f
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Mon Nov 23 14:58:18 2015 +0100
+++ b/src/plugins/plugin_xep_0277.py	Mon Nov 23 15:51:19 2015 +0100
@@ -857,7 +857,6 @@
         """
         if node is None:
             node = NS_MICROBLOG
-        items, metadata = yield self._p.getItems(service_jid, node, max_items=max_items, item_ids=item_ids, rsm_request=rsm_request, extra=extra, profile_key=profile_key)
 
         feed_elt = domish.Element((NS_ATOM, 'feed'))
         title = D_(u"{user}'s blogposts").format(user=service_jid.user)
@@ -874,4 +873,12 @@
         feed_elt.addElement('id', content=node)
         feed_elt.addElement('updated', rfc3339.timestamp_from_tf(rfc3339.tf_utc()))
 
+        # FIXME: no cleaning is done here
+        # FIXME: no check is done neither, we have to be sure that we get microblogs
+        items, metadata = yield self._p.getItems(service_jid, node, max_items=max_items, item_ids=item_ids, rsm_request=rsm_request, extra=extra, profile_key=profile_key)
+
+        for item in items:
+            entry_elt = item.elements(NS_ATOM, 'entry').next()
+            feed_elt.addChild(entry_elt)
+
         defer.returnValue(u'<?xml version="1.0" encoding="utf-8"?>'+feed_elt.toXml())