# HG changeset patch # User Matthew Wild # Date 1292424535 0 # Node ID 48a47bca9a63b2acd6d84dee724afe6c92cb306d # Parent 2950079d4319e62546a283c65c9988e43dee0218 verse: Change to set conn:send in only one place, and fire new events 'outgoing' and 'outgoing-raw' diff -r 2950079d4319 -r 48a47bca9a63 init.lua --- a/init.lua Wed Dec 15 11:57:23 2010 +0000 +++ b/init.lua Wed Dec 15 14:48:55 2010 +0000 @@ -89,8 +89,12 @@ end self.conn = conn; - local w, t = conn.write, tostring; - self.send = function (_, data) return w(conn, t(data)); end + self.send = function (stream, data) + self:event("outgoing", data); + data = tostring(data); + self:event("outgoing-raw", data); + return conn:write(data); + end; return true; end @@ -186,7 +190,6 @@ function conn_listener.onconnect(conn) stream.connected = true; - stream.send = function (stream, data) stream:debug("Sending data: "..tostring(data)); return conn:write(tostring(data)); end; stream:event("connected"); end