Comparison

mod_cloud_notify/mod_cloud_notify.lua @ 2255:cdfc917a8cc7

mod_cloud_notify: Retrieve data form by name and namespace so unknown elements are ignored
author Kim Alvefur <zash@zash.se>
date Thu, 28 Jul 2016 12:12:23 +0200
parent 2254:122cb5f4930f
child 2257:f84b51f9aa82
comparison
equal deleted inserted replaced
2254:122cb5f4930f 2255:cdfc917a8cc7
34 local push_node = enable.attr.node; 34 local push_node = enable.attr.node;
35 if not push_jid then 35 if not push_jid then
36 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing jid")); 36 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing jid"));
37 return true; 37 return true;
38 end 38 end
39 local publish_options = enable.tags[1]; 39 local publish_options = enable:get_child("x", "jabber:x:data");
40 if publish_options and ( publish_options.name ~= "x" or publish_options.attr.xmlns ~= "jabber:x:data" ) then
41 origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid publish options"));
42 return true;
43 end
44 local user_push_services = push_enabled:get(origin.username); 40 local user_push_services = push_enabled:get(origin.username);
45 if not user_push_services then 41 if not user_push_services then
46 user_push_services = {}; 42 user_push_services = {};
47 end 43 end
48 user_push_services[push_jid .. "<" .. (push_node or "")] = { 44 user_push_services[push_jid .. "<" .. (push_node or "")] = {