aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-12-19 02:57:58 +0000
committerMatthew Wild <mwild1@gmail.com>2010-12-19 02:57:58 +0000
commita41d900875ad6df24c037b638adedaf0ae987543 (patch)
tree79151528bfc32407c0c94775d10b3ada3cdc0b48 /util
parent70c61a59def387a4aa1439aacbdba15a16a702d7 (diff)
downloadprosody-a41d900875ad6df24c037b638adedaf0ae987543.tar.gz
prosody-a41d900875ad6df24c037b638adedaf0ae987543.zip
mod_pubsub, util.pubsub: Remove from 0.8
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua84
1 files changed, 0 insertions, 84 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
deleted file mode 100644
index 811f4a15..00000000
--- a/util/pubsub.lua
+++ /dev/null
@@ -1,84 +0,0 @@
-module("pubsub", package.seeall);
-
-local service = {};
-local service_mt = { __index = service };
-
-function new(cb)
- return setmetatable({ cb = cb or {}, nodes = {} }, service_mt);
-end
-
-function service:add_subscription(node, actor, jid)
- local node_obj = self.nodes[node];
- if not node_obj then
- return false, "item-not-found";
- end
- node_obj.subscribers[jid] = true;
- return true;
-end
-
-function service:remove_subscription(node, actor, jid)
- local node_obj = self.nodes[node];
- if not node_obj then
- return false, "item-not-found";
- end
- if not node_obj.subscribers[jid] then
- return false, "not-subscribed";
- end
- node_obj.subscribers[jid] = nil;
- return true;
-end
-
-function service:get_subscription(node, actor, jid)
- local node_obj = self.nodes[node];
- if node_obj then
- return node_obj.subscribers[jid];
- end
-end
-
-function service:create(node, actor)
- if not self.nodes[node] then
- self.nodes[node] = { name = node, subscribers = {}, config = {}, data = {} };
- return true;
- end
- return false, "conflict";
-end
-
-function service:publish(node, actor, id, item)
- local node_obj = self.nodes[node];
- if not node_obj then
- node_obj = { name = node, subscribers = {}, config = {}, data = {} };
- self.nodes[node] = node_obj;
- end
- node_obj.data[id] = item;
- self.cb.broadcaster(node, node_obj.subscribers, item);
- return true;
-end
-
-function service:retract(node, actor, id, retract)
- local node_obj = self.nodes[node];
- if (not node_obj) or (not node_obj.data[id]) then
- return false, "item-not-found";
- end
- node_obj.data[id] = nil;
- if retract then
- self.cb.broadcaster(node, node_obj.subscribers, retract);
- end
- return true
-end
-
-function service:get(node, actor, id)
- local node_obj = self.nodes[node];
- if node_obj then
- if id then
- return { node_obj.data[id] };
- else
- return node_obj.data;
- end
- end
-end
-
-function service:get_nodes(actor)
- return true, self.nodes;
-end
-
-return _M;