equal
deleted
inserted
replaced
197 lm.message_node.parse ( message, r ) |
197 lm.message_node.parse ( message, r ) |
198 return r |
198 return r |
199 end |
199 end |
200 |
200 |
201 -- the same table, as for lm.connection.create, but with few more fields: |
201 -- the same table, as for lm.connection.create, but with few more fields: |
202 -- ssl.validate |
202 -- ssl.validate - boolean |
203 -- onconnect |
203 -- preopen - callback to call after connection creation but before opening (to install log handler, for example) |
204 -- onopen |
204 -- onopen - callback to call after connection is established, but before authentication |
|
205 -- onconnect - callback to call after connection will be established |
205 -- username |
206 -- username |
206 -- password |
207 -- password |
207 -- resource |
208 -- resource |
208 function lm.connect ( a ) |
209 function lm.connect ( a ) |
209 if type ( a ) ~= "table" then |
210 if type ( a ) ~= "table" then |
216 return false |
217 return false |
217 end |
218 end |
218 end |
219 end |
219 end |
220 end |
220 local c = lm.connection.create ( a ) |
221 local c = lm.connection.create ( a ) |
|
222 if type ( a.preopen ) == "function" then |
|
223 a.preopen ( c ) -- XXX |
|
224 end |
221 c:open ( |
225 c:open ( |
222 function ( obj, status ) |
226 function ( obj, status ) |
223 if status then |
227 if status then |
224 if type ( a.onopen ) == "function" then |
228 if type ( a.onopen ) == "function" then |
225 a.onopen ( obj ) |
229 a.onopen ( obj ) |
235 return c |
239 return c |
236 end |
240 end |
237 |
241 |
238 return lm |
242 return lm |
239 |
243 |
240 -- vim: se ts=4: -- |
244 -- vim: se ts=4 sw=4: -- |