15 |
15 |
16 -- Note, this requires glib module, that is not released yet |
16 -- Note, this requires glib module, that is not released yet |
17 -- (and, probably, will not be released ever), thus, this |
17 -- (and, probably, will not be released ever), thus, this |
18 -- code is provided only as example. |
18 -- code is provided only as example. |
19 |
19 |
20 require 'glib' |
20 local g = require 'glib' |
21 local lm = require 'lm' |
21 local lm = require 'lm' |
22 |
22 |
23 g.log.handler ( |
23 g.log.handler ( |
24 function ( domain, lvl, mesg ) |
24 function ( domain, lvl, mesg ) |
25 print ( mesg ) |
25 print ( mesg ) |
26 end ) |
26 end ) |
27 |
27 |
28 sent = false |
28 local sent = false |
29 |
29 |
30 username, server = arg[1]:match ( '(.+)@(.+)' ) |
30 local username, server = arg[1]:match ( '(.+)@(.+)' ) |
31 password = arg[2] |
31 local password = arg[2] |
32 recipient = arg[3] or arg[1] |
32 local recipient = arg[3] or arg[1] |
33 fingerprint = arg[4] or '01:23:45:67:89:ab:cd:ef:fe:dc:ba:98:76:54:32:10' |
33 local fingerprint = arg[4] or '01:23:45:67:89:ab:cd:ef:fe:dc:ba:98:76:54:32:10' |
|
34 |
|
35 print ( ("Connectng to %s with username %s\nWill contact %s."):format ( server, username, recipient ) ) |
34 |
36 |
35 --[[ |
37 --[[ |
36 -- What's goes on, pretty close to C api, |
38 -- What's goes on, pretty close to C api, |
37 -- but already some luxury... |
39 -- but already some luxury... |
38 you_need_your_own_context = true |
40 you_need_your_own_context = true |