comparison mod_cloud_notify/mod_cloud_notify.lua @ 2253:97ebd28a8a75

mod_cloud_notify: Apply pre-serialization to publish-options
author Kim Alvefur <zash@zash.se>
date Tue, 26 Jul 2016 13:29:51 +0200
parents a96f2d0f8750
children 122cb5f4930f
comparison
equal deleted inserted replaced
2252:a96f2d0f8750 2253:97ebd28a8a75
46 end 46 end
47 user_push_services[push_jid .. "<" .. (push_node or "")] = { 47 user_push_services[push_jid .. "<" .. (push_node or "")] = {
48 jid = push_jid; 48 jid = push_jid;
49 node = push_node; 49 node = push_node;
50 count = 0; 50 count = 0;
51 options = publish_options; 51 options = publish_options and st.preserialize(publish_options);
52 }; 52 };
53 local ok, err = push_enabled:set(origin.username, user_push_services); 53 local ok, err = push_enabled:set(origin.username, user_push_services);
54 if not ok then 54 if not ok then
55 origin.send(st.error_reply(stanza, "wait", "internal-server-error")); 55 origin.send(st.error_reply(stanza, "wait", "internal-server-error"));
56 else 56 else
114 push_publish:add_child(push_form:form(form_data)); 114 push_publish:add_child(push_form:form(form_data));
115 push_publish:up(); -- / notification 115 push_publish:up(); -- / notification
116 push_publish:up(); -- / publish 116 push_publish:up(); -- / publish
117 push_publish:up(); -- / pubsub 117 push_publish:up(); -- / pubsub
118 if push_info.options then 118 if push_info.options then
119 push_publish:tag("publish-options"):add_child(push_info.options); 119 push_publish:tag("publish-options"):add_child(st.deserialize(push_info.options));
120 end 120 end
121 module:send(push_publish); 121 module:send(push_publish);
122 end 122 end
123 end 123 end
124 124