equal
deleted
inserted
replaced
2 -- IN-BAND BYTESTREAMS (XEP-0047) |
2 -- IN-BAND BYTESTREAMS (XEP-0047) |
3 |
3 |
4 -- library |
4 -- library |
5 |
5 |
6 require 'lm' |
6 require 'lm' |
|
7 require 'iq' |
7 require 'base64' |
8 require 'base64' |
8 |
|
9 iq = { } |
|
10 |
|
11 function iq.send ( conn, to, smtype, data, success, fail ) |
|
12 data.mtype = 'iq-' .. smtype |
|
13 data.to = to |
|
14 conn:send ( lm.message.create ( data ), |
|
15 function ( conn, mess ) |
|
16 local mtype, smtype = mess:type () |
|
17 if smtype == 'result' then |
|
18 success () |
|
19 elseif smtype == 'error' then |
|
20 fail ( mess:child( 'error' ):children():name () ) -- FIXME |
|
21 else |
|
22 fail ( mess:xml () ) |
|
23 return false |
|
24 end |
|
25 return true |
|
26 end ) |
|
27 end |
|
28 |
9 |
29 -- public |
10 -- public |
30 |
11 |
31 ibb = { |
12 ibb = { |
32 block_size = 4096, |
13 block_size = 4096, |