Software /
code /
verse
Comparison
plugins/disco.lua @ 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 |
parent | 113:769366a8b238 |
child | 119:989cb40f8e62 |
comparison
equal
deleted
inserted
replaced
114:37f5966cff15 | 115:9f8cacfca7c7 |
---|---|
95 if disco_feature.var == feature then | 95 if disco_feature.var == feature then |
96 table.remove(self.disco.info.features, idx); | 96 table.remove(self.disco.info.features, idx); |
97 return true; | 97 return true; |
98 end | 98 end |
99 end | 99 end |
100 end | |
101 | |
102 function stream:add_disco_item(item, node) | |
103 local disco_items = self.disco.items; | |
104 if node then | |
105 disco_items = self.disco.nodes[node]; | |
106 if not disco_items then | |
107 disco_items = { features = {}, items = {} }; | |
108 self.disco.nodes[node] = disco_items; | |
109 disco_items = disco_items.items; | |
110 end | |
111 end | |
112 table.insert(disco_items, item); | |
100 end | 113 end |
101 | 114 |
102 function stream:jid_has_identity(jid, category, type) | 115 function stream:jid_has_identity(jid, category, type) |
103 local cached_disco = self.disco.cache[jid]; | 116 local cached_disco = self.disco.cache[jid]; |
104 if not cached_disco then | 117 if not cached_disco then |