comparison mod_admin_web/admin_web/mod_admin_web.lua @ 901:e3ad5f3aa6d4

mod_admin_web: Adapt to util.pubsub changes
author Florian Zeitz <florob@babelmonkeys.de>
date Sat, 26 Jan 2013 00:15:24 +0100
parents 292ea8df7267
children d643c385d3f6
comparison
equal deleted inserted replaced
900:aca1c5eb0508 901:e3ad5f3aa6d4
112 ["GET /*"] = serve_file; 112 ["GET /*"] = serve_file;
113 } 113 }
114 }); 114 });
115 115
116 -- Setup adminsub service 116 -- Setup adminsub service
117 local function simple_broadcast(node, jids, item) 117 local function simple_broadcast(kind, node, jids, item)
118 item = st.clone(item); 118 if item then
119 item.attr.xmlns = nil; -- Clear the pubsub namespace 119 item = st.clone(item);
120 item.attr.xmlns = nil; -- Clear the pubsub namespace
121 end
120 local message = st.message({ from = module.host, type = "headline" }) 122 local message = st.message({ from = module.host, type = "headline" })
121 :tag("event", { xmlns = xmlns_adminsub .. "#event" }) 123 :tag("event", { xmlns = xmlns_adminsub .. "#event" })
122 :tag("items", { node = node }) 124 :tag(kind, { node = node })
123 :add_child(item); 125 :add_child(item);
124 for jid in pairs(jids) do 126 for jid in pairs(jids) do
125 module:log("debug", "Sending notification to %s", jid); 127 module:log("debug", "Sending notification to %s", jid);
126 message.attr.to = jid; 128 message.attr.to = jid;
127 module:send(message); 129 module:send(message);