Software /
code /
prosody
Diff
util/pubsub.lua @ 5971:637731f0b9a3
util.pubsub: Fire events on more actions
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 26 Dec 2013 18:14:34 +0100 |
parent | 5776:bd0ff8ae98a8 |
child | 5972:f365d3c8fd2c |
line wrap: on
line diff
--- a/util/pubsub.lua Mon Dec 30 21:49:17 2013 +0100 +++ b/util/pubsub.lua Thu Dec 26 18:14:34 2013 +0100 @@ -219,6 +219,7 @@ data = {}; affiliations = {}; }; + self.events.fire_event("node-created", { node = node, actor = actor }); local ok, err = self:set_affiliation(node, true, actor, "owner"); if not ok then self.nodes[node] = nil; @@ -237,6 +238,7 @@ return false, "item-not-found"; end self.nodes[node] = nil; + self.events.fire_event("node-deleted", { node = node, actor = actor }); self.config.broadcaster("delete", node, node_obj.subscribers); return true; end @@ -274,6 +276,7 @@ if (not node_obj) or (not node_obj.data[id]) then return false, "item-not-found"; end + self.events.fire_event("item-retracted", { node = node, actor = actor, id = id }); node_obj.data[id] = nil; if retract then self.config.broadcaster("items", node, node_obj.subscribers, retract); @@ -292,6 +295,7 @@ return false, "item-not-found"; end node_obj.data = {}; -- Purge + self.events.fire_event("node-purged", { node = node, actor = actor }); if notify then self.config.broadcaster("purge", node, node_obj.subscribers); end