Changeset

115:9f8cacfca7c7

verse.plugins.disco: Add stream:add_disco_item()
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Aug 2010 17:48:57 +0100
parents 114:37f5966cff15
children 116:151c8cc776df
files plugins/disco.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/disco.lua	Wed Aug 25 16:27:30 2010 +0100
+++ b/plugins/disco.lua	Thu Aug 26 17:48:57 2010 +0100
@@ -99,6 +99,19 @@
 		end
 	end
 
+	function stream:add_disco_item(item, node)
+		local disco_items = self.disco.items;
+		if node then
+			disco_items = self.disco.nodes[node];
+			if not disco_items then
+				disco_items = { features = {}, items = {} };
+				self.disco.nodes[node] = disco_items;
+				disco_items = disco_items.items;
+			end
+		end
+		table.insert(disco_items, item);
+	end
+
 	function stream:jid_has_identity(jid, category, type)
 		local cached_disco = self.disco.cache[jid];
 		if not cached_disco then