Changeset

109:60a03b2cabec

verse.plugins.disco: Auto-disco local services on connect, and delay 'ready' event until done
author Matthew Wild <mwild1@gmail.com>
date Tue, 24 Aug 2010 11:11:17 +0100
parents 108:c67ed3fc5571
children 110:3fca7dd127df
files plugins/disco.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/disco.lua	Tue Aug 24 11:10:42 2010 +0100
+++ b/plugins/disco.lua	Tue Aug 24 11:11:17 2010 +0100
@@ -332,7 +332,10 @@
 		end
 	end);
 	
+	local initial_disco_started;
 	stream:hook("ready", function ()
+		if initial_disco_started then return; end
+		initial_disco_started = true;
 		stream:disco_local_services(function (services)
 			for _, service in ipairs(services) do
 				for identity in pairs(stream.disco.cache[service.jid].identities) do
@@ -342,7 +345,9 @@
 					});
 				end
 			end
+			stream:event("ready");
 		end);
+		return true;
 	end, 5);
 end