Software /
code /
verse
Diff
init.lua @ 163:48a47bca9a63
verse: Change to set conn:send in only one place, and fire new events 'outgoing' and 'outgoing-raw'
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 15 Dec 2010 14:48:55 +0000 |
parent | 162:2950079d4319 |
child | 173:3112a9e450ac |
line wrap: on
line diff
--- 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