Software /
code /
prosody-modules
Diff
mod_cloud_notify/mod_cloud_notify.lua @ 2254:122cb5f4930f
mod_cloud_notify: Cache <enable> in local
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 28 Jul 2016 12:10:09 +0200 |
parent | 2253:97ebd28a8a75 |
child | 2255:cdfc917a8cc7 |
line wrap: on
line diff
--- a/mod_cloud_notify/mod_cloud_notify.lua Tue Jul 26 13:29:51 2016 +0200 +++ b/mod_cloud_notify/mod_cloud_notify.lua Thu Jul 28 12:10:09 2016 +0200 @@ -26,16 +26,17 @@ -- http://xmpp.org/extensions/xep-0357.html#enabling module:hook("iq-set/self/"..xmlns_push..":enable", function (event) local origin, stanza = event.origin, event.stanza; + local enable = stanza.tags[1]; origin.log("debug", "Attempting to enable push notifications"); -- MUST contain a 'jid' attribute of the XMPP Push Service being enabled - local push_jid = stanza.tags[1].attr.jid; + local push_jid = enable.attr.jid; -- SHOULD contain a 'node' attribute - local push_node = stanza.tags[1].attr.node; + local push_node = enable.attr.node; if not push_jid then origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing jid")); return true; end - local publish_options = stanza.tags[1].tags[1]; + local publish_options = enable.tags[1]; if publish_options and ( publish_options.name ~= "x" or publish_options.attr.xmlns ~= "jabber:x:data" ) then origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid publish options")); return true;