# HG changeset patch # User Matthew Wild # Date 1282841337 -3600 # Node ID 9f8cacfca7c74a732a75d2a0d67666f3516d461b # Parent 37f5966cff154ef9a3e7609f6673b2f07a17b2a9 verse.plugins.disco: Add stream:add_disco_item() diff -r 37f5966cff15 -r 9f8cacfca7c7 plugins/disco.lua --- 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