# HG changeset patch # User Myhailo Danylenko # Date 1309107568 -10800 # Node ID 41df6f2a7aa8b07449a7971ffbdd3f974ac2f30c # Parent 5945cab29028c17a1e2cd4a568b75e9a372934cb Add preconnect hook to lm.connect To allow easy installation of log handler diff -r 5945cab29028 -r 41df6f2a7aa8 lm.lua --- a/lm.lua Sun Jun 26 16:28:53 2011 +0300 +++ b/lm.lua Sun Jun 26 19:59:28 2011 +0300 @@ -199,9 +199,10 @@ end -- the same table, as for lm.connection.create, but with few more fields: --- ssl.validate --- onconnect --- onopen +-- ssl.validate - boolean +-- preopen - callback to call after connection creation but before opening (to install log handler, for example) +-- onopen - callback to call after connection is established, but before authentication +-- onconnect - callback to call after connection will be established -- username -- password -- resource @@ -218,6 +219,9 @@ end end local c = lm.connection.create ( a ) + if type ( a.preopen ) == "function" then + a.preopen ( c ) -- XXX + end c:open ( function ( obj, status ) if status then @@ -237,4 +241,4 @@ return lm --- vim: se ts=4: -- +-- vim: se ts=4 sw=4: --