changeset 801:133ee88d19ae

mod_pubsub_hub: Add compat wrapping of Atom content for interop with PuSH
author Kim Alvefur <zash@zash.se>
date Fri, 17 Aug 2012 17:23:52 +0200
parents 966993356d2b
children 4e43becc3bbe
files mod_pubsub_hub/mod_pubsub_hub.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_hub/mod_pubsub_hub.lua	Thu Aug 16 22:31:08 2012 +0200
+++ b/mod_pubsub_hub/mod_pubsub_hub.lua	Fri Aug 17 17:23:52 2012 +0200
@@ -186,7 +186,14 @@
 	return m_max((now - next_check) - min_lease, min_lease);
 end
 
+local xmlns_atom = "http://www.w3.org/2005/Atom";
+local st = require "util.stanza";
+
 local function on_notify(subscription, content)
+	if content.attr and content.attr.xmlns == xmlns_atom then
+		-- COMPAT This is required by the PubSubHubbub spec.
+		content = st.stanza("feed", {xmlns=xmlns_atom}):add_child(content);
+	end
 	local body = tostring(content);
 	local headers = {
 		["Content-Type"] = "application/xml",