comparison mod_pubsub_hub/mod_pubsub_hub.lua @ 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 e781e63a49f4
children 853a382c9bd6
comparison
equal deleted inserted replaced
800:966993356d2b 801:133ee88d19ae
184 end 184 end
185 end 185 end
186 return m_max((now - next_check) - min_lease, min_lease); 186 return m_max((now - next_check) - min_lease, min_lease);
187 end 187 end
188 188
189 local xmlns_atom = "http://www.w3.org/2005/Atom";
190 local st = require "util.stanza";
191
189 local function on_notify(subscription, content) 192 local function on_notify(subscription, content)
193 if content.attr and content.attr.xmlns == xmlns_atom then
194 -- COMPAT This is required by the PubSubHubbub spec.
195 content = st.stanza("feed", {xmlns=xmlns_atom}):add_child(content);
196 end
190 local body = tostring(content); 197 local body = tostring(content);
191 local headers = { 198 local headers = {
192 ["Content-Type"] = "application/xml", 199 ["Content-Type"] = "application/xml",
193 }; 200 };
194 if subscription.secret then 201 if subscription.secret then