Software /
code /
prosody-modules
Changeset
1456:2cd667d8edbd
mod_pubsub_feeds: Handle denied subscription requests
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 26 Jun 2014 18:33:13 +0200 |
parents | 1455:13e359c48b5b |
children | 1457:720ff25d94e6 |
files | mod_pubsub_feeds/mod_pubsub_feeds.lua |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_pubsub_feeds/mod_pubsub_feeds.lua Thu Jun 26 18:32:43 2014 +0200 +++ b/mod_pubsub_feeds/mod_pubsub_feeds.lua Thu Jun 26 18:33:13 2014 +0200 @@ -208,13 +208,15 @@ module:log("debug", "Invalid topic: %s", tostring(query["hub.topic"])) return 404 end - if query["hub.mode"] ~= feed.subscription then + if query["hub.mode"] == "denied" then + module:log("info", "Subscription denied: %s", tostring(query["hub.reason"] or "No reason given")) + feed.subscription = "denied"; + return "Ok then :("; + elseif query["hub.mode"] == feed.subscription then + module:log("debug", "Confirming %s request to %s", feed.subscription, feed.url) + else module:log("debug", "Invalid mode: %s", tostring(query["hub.mode"])) return 400 - -- Would this work for unsubscribe? - -- Also, if feed.subscription is changed here, - -- it would probably invalidate the subscription - -- when/if the hub asks if it should be renewed end local lease_seconds = tonumber(query["hub.lease_seconds"]); if lease_seconds then