24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/vendor/xmpp4r/data/doc/xmpp4r/examples/advanced/fileserve.rb', line 24
def initialize(filetransfer, peer, filename, filesize, msgblock)
@filetransfer = filetransfer
@peer = peer
@filename = filename
@filesize = filesize
@msgblock = msgblock
@done = false
@bytes = 0
@stats = [0]
@stats_lock = Mutex.new
@stats_thread = Thread.new { stats_loop }
@streamhost_cb = lambda { |streamhost,state,e|
case state
when :connecting
say "Connecting to #{streamhost.jid} (#{streamhost.host}:#{streamhost.port})"
when :success
say "Successfully using #{streamhost.jid} (#{streamhost.host}:#{streamhost.port})"
when :failure
say "Error using #{streamhost.jid} (#{streamhost.host}:#{streamhost.port}): #{e}"
end
}
end
|