# HG changeset patch # User Myhailo Danylenko # Date 1354060512 -7200 # Node ID 2dcfa81100e40c1e2075e9e5a36e73a87311017e # Parent c7031f15125d699df5c0848fcc06839de6f39a68 Some fixes to test diff -r c7031f15125d -r 2dcfa81100e4 test.lua --- a/test.lua Tue Nov 06 18:53:11 2012 +0200 +++ b/test.lua Wed Nov 28 01:55:12 2012 +0200 @@ -17,7 +17,7 @@ -- (and, probably, will not be released ever), thus, this -- code is provided only as example. -require 'glib' +local g = require 'glib' local lm = require 'lm' g.log.handler ( @@ -25,12 +25,14 @@ print ( mesg ) end ) -sent = false +local sent = false -username, server = arg[1]:match ( '(.+)@(.+)' ) -password = arg[2] -recipient = arg[3] or arg[1] -fingerprint = arg[4] or '01:23:45:67:89:ab:cd:ef:fe:dc:ba:98:76:54:32:10' +local username, server = arg[1]:match ( '(.+)@(.+)' ) +local password = arg[2] +local recipient = arg[3] or arg[1] +local fingerprint = arg[4] or '01:23:45:67:89:ab:cd:ef:fe:dc:ba:98:76:54:32:10' + +print ( ("Connectng to %s with username %s\nWill contact %s."):format ( server, username, recipient ) ) --[[ -- What's goes on, pretty close to C api, @@ -97,9 +99,9 @@ -- Shortened version with convenience lua functions: -conn = lm.connect { +local conn = lm.connect { server = server, - port = 5223, + port = 5222, ssl = { fingerprint = fingerprint, validate = false, @@ -133,7 +135,7 @@ end, } -cont = g.main_context.default () +local cont = g.main_context.default () print ( 'Entering main loop...' ) while not sent do cont:iteration ( true )