verse.client: Reopen stream in response to 'connected' event

Fri, 18 Mar 2011 21:39:57 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 18 Mar 2011 21:39:57 +0000
changeset 199
33b54389ed9c
parent 198
f6702e7ce5f9
child 200
4166213cc9bd

verse.client: Reopen stream in response to 'connected' event

client.lua file | annotate | diff | comparison | revisions
--- 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

mercurial