aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-10-08 01:27:04 +0200
committerKim Alvefur <zash@zash.se>2017-10-08 01:27:04 +0200
commit2d6ea5d99d8da18bd3132f50625ca9b889a9c489 (patch)
tree3572e49bfed5e99ae69b5b578a3ecab80700956e
parent30ac4f0bef3476ebace0ec4c5f4c3b54393c746c (diff)
downloadprosody-2d6ea5d99d8da18bd3132f50625ca9b889a9c489.tar.gz
prosody-2d6ea5d99d8da18bd3132f50625ca9b889a9c489.zip
util.pubsub: Clear data store if it supports being cleared, otherwise fall back to creating a new one
-rw-r--r--util/pubsub.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 014aaa86..6dbbad20 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -312,7 +312,11 @@ function service:purge(node, actor, notify)
if not node_obj then
return false, "item-not-found";
end
- self.data[node] = self.config.itemstore(self.nodes[node].config, node);
+ if self.data[node] and self.data[node].clear then
+ self.data[node]:clear()
+ else
+ self.data[node] = self.config.itemstore(self.nodes[node].config, node);
+ end
self.events.fire_event("node-purged", { node = node, actor = actor });
if notify then
self.config.broadcaster("purge", node, node_obj.subscribers);