Changeset

199:33b54389ed9c

verse.client: Reopen stream in response to 'connected' event
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 Mar 2011 21:39:57 +0000
parents 198:f6702e7ce5f9
children 200:4166213cc9bd
files client.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client.lua	Fri Mar 18 21:33:53 2011 +0000
+++ b/client.lua	Fri Mar 18 21:39:57 2011 +0000
@@ -72,6 +72,7 @@
 		self:close("xml-not-well-formed");
 	end
 	
+	self:hook("connected", function () self:reopen(); end);
 	self:hook("incoming-raw", function (data) return self.data(self.conn, data); end);
 	
 	self.curr_id = 0;
@@ -136,7 +137,6 @@
 	local function start_connect()
 		-- Initialise connection
 		self:connect(self.connect_host or self.host, self.connect_port or 5222);
-		self:reopen();
 	end
 	
 	if not (self.connect_host or self.connect_port) then