aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-12-26 18:14:34 +0100
committerKim Alvefur <zash@zash.se>2013-12-26 18:14:34 +0100
commitdbe25f8d3325674034a5dabb8b98e888d88767ee (patch)
treecfd2cccb88357260407cf9fac0c08776613a3b9a /util
parentbd8154130f88a89bd4f548264f935afb5e773951 (diff)
downloadprosody-dbe25f8d3325674034a5dabb8b98e888d88767ee.tar.gz
prosody-dbe25f8d3325674034a5dabb8b98e888d88767ee.zip
util.pubsub: Fire events on more actions
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua4
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