# HG changeset patch # User Kim Alvefur # Date 1508305620 -7200 # Node ID 9db72349095fcebdf2b97e14ba17712370ba225c # Parent 036e46d12b78a15dccefde9348561c57deabc9c5 mod_pep_plus: Use dispatch function from pubsub.lib diff -r 036e46d12b78 -r 9db72349095f plugins/mod_pep_plus.lua --- 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);