aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-05-16 20:17:07 +0100
committerMatthew Wild <mwild1@gmail.com>2012-05-16 20:17:07 +0100
commit62272027cf25e7aecefdc316b2fb90b84a180506 (patch)
tree3ac23f81512c9bd6e65062fcfa1ad56cef4bc734
parent0c3b73623b1fcb542c63800874134a2e0f79d7c2 (diff)
downloadprosody-62272027cf25e7aecefdc316b2fb90b84a180506.tar.gz
prosody-62272027cf25e7aecefdc316b2fb90b84a180506.zip
Remove util.broadcast
-rw-r--r--util/broadcast.lua68
1 files changed, 0 insertions, 68 deletions
diff --git a/util/broadcast.lua b/util/broadcast.lua
deleted file mode 100644
index be17461d..00000000
--- a/util/broadcast.lua
+++ /dev/null
@@ -1,68 +0,0 @@
--- Prosody IM
--- Copyright (C) 2008-2010 Matthew Wild
--- Copyright (C) 2008-2010 Waqas Hussain
---
--- This project is MIT/X11 licensed. Please see the
--- COPYING file in the source package for more information.
---
-
-
-local ipairs, pairs, setmetatable, type =
- ipairs, pairs, setmetatable, type;
-
-module "pubsub"
-
-local pubsub_node_mt = { __index = _M };
-
-function new_node(name)
- return setmetatable({ name = name, subscribers = {} }, pubsub_node_mt);
-end
-
-function set_subscribers(node, subscribers_list, list_type)
- local subscribers = node.subscribers;
-
- if list_type == "array" then
- for _, jid in ipairs(subscribers_list) do
- if not subscribers[jid] then
- node:add_subscriber(jid);
- end
- end
- elseif (not list_type) or list_type == "set" then
- for jid in pairs(subscribers_list) do
- if type(jid) == "string" then
- node:add_subscriber(jid);
- end
- end
- end
-end
-
-function get_subscribers(node)
- return node.subscribers;
-end
-
-function publish(node, item, dispatcher, data)
- local subscribers = node.subscribers;
- for i = 1,#subscribers do
- item.attr.to = subscribers[i];
- dispatcher(data, item);
- end
-end
-
-function add_subscriber(node, jid)
- local subscribers = node.subscribers;
- if not subscribers[jid] then
- local space = #subscribers;
- subscribers[space] = jid;
- subscribers[jid] = space;
- end
-end
-
-function remove_subscriber(node, jid)
- local subscribers = node.subscribers;
- if subscribers[jid] then
- subscribers[subscribers[jid]] = nil;
- subscribers[jid] = nil;
- end
-end
-
-return _M;