Diff

plugins/mod_disco.lua @ 4337:a2ee8ab82dd9

core.modulemanager, mod_disco: Add support for XEP-0128: Service Discovery Extensions
author Kim Alvefur <zash@zash.se>
date Mon, 08 Aug 2011 18:23:53 +0200
parent 3695:d2c4856c7ed5
child 4985:0f72123ff513
line wrap: on
line diff
--- a/plugins/mod_disco.lua	Thu Aug 04 14:00:24 2011 -0400
+++ b/plugins/mod_disco.lua	Mon Aug 08 18:23:53 2011 +0200
@@ -54,6 +54,12 @@
 			done[feature] = true;
 		end
 	end
+	for _,extension in ipairs(module:get_host_items("extension")) do
+		if not done[extension] then
+			query:add_child(extension);
+			done[extension] = true;
+		end
+	end
 	_cached_server_disco_info = query;
 	_cached_server_caps_hash = calculate_hash(query);
 	_cached_server_caps_feature = st.stanza("c", {
@@ -81,8 +87,10 @@
 
 module:hook("item-added/identity", clear_disco_cache);
 module:hook("item-added/feature", clear_disco_cache);
+module:hook("item-added/extension", clear_disco_cache);
 module:hook("item-removed/identity", clear_disco_cache);
 module:hook("item-removed/feature", clear_disco_cache);
+module:hook("item-removed/extension", clear_disco_cache);
 
 -- Handle disco requests to the server
 module:hook("iq/host/http://jabber.org/protocol/disco#info:query", function(event)