Software /
code /
prosody
Changeset
8335:9db72349095f
mod_pep_plus: Use dispatch function from pubsub.lib
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 18 Oct 2017 07:47:00 +0200 |
parents | 8334:036e46d12b78 |
children | 8336:587305c0ff85 |
files | plugins/mod_pep_plus.lua |
diffstat | 1 files changed, 2 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_pep_plus.lua Wed Oct 18 07:46:44 2017 +0200 +++ b/plugins/mod_pep_plus.lua Wed Oct 18 07:47:00 2017 +0200 @@ -217,21 +217,13 @@ function handle_pubsub_iq(event) local origin, stanza = event.origin, event.stanza; - local pubsub_tag = stanza.tags[1]; - local action = pubsub_tag.tags[1]; - if not action then - return origin.send(st.error_reply(stanza, "cancel", "bad-request")); - end local service_name = origin.username; if stanza.attr.to ~= nil then service_name = jid_split(stanza.attr.to); end local service = get_pep_service(service_name); - local handler = handlers[stanza.attr.type.."_"..action.name]; - if handler then - handler(origin, stanza, action, service); - return true; - end + + return lib_pubsub.handle_pubsub_iq(event, service) end module:hook("iq/bare/"..xmlns_pubsub..":pubsub", handle_pubsub_iq);