Changeset

20:972066e06f4c

verse: Update for new server connection API
author Matthew Wild <mwild1@gmail.com>
date Tue, 01 Dec 2009 04:14:52 +0000
parents 19:5d593126e62d
children 21:00da62000b83
files init.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/init.lua	Tue Dec 01 04:14:11 2009 +0000
+++ b/init.lua	Tue Dec 01 04:14:52 2009 +0000
@@ -48,7 +48,7 @@
 	
 	self.conn = conn;
 	local w, t = conn.write, tostring;
-	self.send = function (_, data) return w(t(data)); end
+	self.send = function (_, data) return w(conn, t(data)); end
 end
 
 -- Logging functions
@@ -90,11 +90,11 @@
 function new_listener(stream)
 	local conn_listener = {};
 	
-	function conn_listener.incoming(conn, data)
+	function conn_listener.onincoming(conn, data)
 		stream:debug("Data");
 		if not stream.connected then
 			stream.connected = true;
-			stream.send = function (stream, data) stream:debug("Sending data: "..tostring(data)); return conn.write(tostring(data)); end;
+			stream.send = function (stream, data) stream:debug("Sending data: "..tostring(data)); return conn:write(tostring(data)); end;
 			stream:event("connected");
 		end
 		if data then
@@ -102,7 +102,7 @@
 		end
 	end
 	
-	function conn_listener.disconnect(conn, err)
+	function conn_listener.ondisconnect(conn, err)
 		stream.connected = false;
 		stream:event("disconnected", { reason = err });
 	end