# HG changeset patch # User Matthew Wild # Date 1638781790 0 # Node ID 98dc1750584d8011c3bfb6d2b252c492edbb2986 # Parent 2762abec4c63ebfc99185b37bac848e2a9ff370a pubsub: Support for 'notify' in retract and purge operations This is a slight API change for :retract(), but should be backwards-compatible. diff -r 2762abec4c63 -r 98dc1750584d plugins/pubsub.lua --- a/plugins/pubsub.lua Mon Dec 06 09:03:39 2021 +0000 +++ b/plugins/pubsub.lua Mon Dec 06 09:09:50 2021 +0000 @@ -256,15 +256,39 @@ , callback); end -function pubsub_node:retract(id, callback) - self.stream:send_iq(pubsub_iq("set", self.service, nil, "retract", self.node, nil, id) - , callback); +function pubsub_node:retract(id, notify, callback) + if type(notify) == "function" then -- COMPAT w/ older versions before 'notify' was added + notify, callback = false, notify; + end + self.stream:send_iq( + pubsub_iq( + "set", + self.service, + nil, + "retract", + self.node, + nil, + id, + { notify = notify and "1" or nil } + ), + callback + ); end function pubsub_node:purge(notify, callback) - assert(not notify, "Not implemented yet."); - self.stream:send_iq(pubsub_iq("set", self.service, xmlns_pubsub_owner, "purge", self.node) - , callback); + self.stream:send_iq( + pubsub_iq( + "set", + self.service, + xmlns_pubsub_owner, + "purge", + self.node, + nil, + nil, + { notify = notify and "1" or nil } + ), + callback + ); end function pubsub_node:delete(redirect_uri, callback)