diff options
author | Kim Alvefur <zash@zash.se> | 2013-12-26 18:14:34 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-12-26 18:14:34 +0100 |
commit | f4ad02905f0fbfbf5c73a9913cf4f66534dd04e1 (patch) | |
tree | cfd2cccb88357260407cf9fac0c08776613a3b9a | |
parent | d08cb0c7a2a0e06f2860ae0e9e7c7b29e30f8f78 (diff) | |
download | prosody-f4ad02905f0fbfbf5c73a9913cf4f66534dd04e1.tar.gz prosody-f4ad02905f0fbfbf5c73a9913cf4f66534dd04e1.zip |
util.pubsub: Fire events on more actions
-rw-r--r-- | util/pubsub.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua index 0dfd196b..a68b256c 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -219,6 +219,7 @@ function service:create(node, actor) 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 @@ function service:delete(node, actor) 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 @@ function service:retract(node, actor, id, retract) 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 @@ function service:purge(node, actor, notify) 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 |