xmpp4r 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/README.rdoc +4 -1
- data/Rakefile +10 -20
- data/data/doc/xmpp4r/examples/advanced/versionpoll.rb +20 -1
- data/lib/xmpp4r/bytestreams/helper/ibb/target.rb +7 -0
- data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +7 -1
- data/lib/xmpp4r/callbacks.rb +9 -0
- data/lib/xmpp4r/caps/c.rb +14 -0
- data/lib/xmpp4r/caps/helper/helper.rb +1 -4
- data/lib/xmpp4r/client.rb +42 -15
- data/lib/xmpp4r/connection.rb +7 -3
- data/lib/xmpp4r/debuglog.rb +22 -1
- data/lib/xmpp4r/discovery.rb +1 -0
- data/lib/xmpp4r/discovery/helper/helper.rb +58 -0
- data/lib/xmpp4r/discovery/iq/discoinfo.rb +2 -2
- data/lib/xmpp4r/discovery/iq/discoitems.rb +2 -2
- data/lib/xmpp4r/errors.rb +5 -2
- data/lib/xmpp4r/httpbinding/client.rb +9 -19
- data/lib/xmpp4r/last.rb +2 -0
- data/lib/xmpp4r/last/helper/helper.rb +37 -0
- data/lib/xmpp4r/last/iq/last.rb +67 -0
- data/lib/xmpp4r/location.rb +2 -0
- data/lib/xmpp4r/location/helper/helper.rb +56 -0
- data/lib/xmpp4r/location/location.rb +179 -0
- data/lib/xmpp4r/message.rb +32 -0
- data/lib/xmpp4r/presence.rb +1 -1
- data/lib/xmpp4r/pubsub/children/configuration.rb +1 -1
- data/lib/xmpp4r/pubsub/children/items.rb +11 -2
- data/lib/xmpp4r/pubsub/children/publish.rb +14 -0
- data/lib/xmpp4r/pubsub/children/retract.rb +41 -0
- data/lib/xmpp4r/pubsub/helper/nodebrowser.rb +2 -3
- data/lib/xmpp4r/pubsub/helper/nodehelper.rb +4 -4
- data/lib/xmpp4r/pubsub/helper/oauth_service_helper.rb +90 -0
- data/lib/xmpp4r/pubsub/helper/servicehelper.rb +58 -19
- data/lib/xmpp4r/reliable.rb +168 -0
- data/lib/xmpp4r/rexmladdons.rb +6 -0
- data/lib/xmpp4r/roster/helper/roster.rb +5 -2
- data/lib/xmpp4r/sasl.rb +19 -8
- data/lib/xmpp4r/stream.rb +133 -31
- data/lib/xmpp4r/streamparser.rb +9 -1
- data/lib/xmpp4r/test/listener_mocker.rb +118 -0
- data/lib/xmpp4r/xmpp4r.rb +3 -1
- data/test/bytestreams/tc_ibb.rb +6 -4
- data/test/bytestreams/tc_socks5bytestreams.rb +3 -2
- data/test/caps/tc_helper.rb +4 -2
- data/test/dataforms/tc_data.rb +1 -1
- data/test/last/tc_helper.rb +75 -0
- data/test/lib/clienttester.rb +43 -14
- data/test/muc/tc_muc_mucclient.rb +6 -2
- data/test/pubsub/tc_helper.rb +131 -8
- data/test/pubsub/tc_nodeconfig.rb +7 -0
- data/test/reliable/tc_disconnect_cleanup.rb +334 -0
- data/test/reliable/tc_disconnect_exception.rb +37 -0
- data/test/reliable/tc_listener_mocked_test.rb +68 -0
- data/test/reliable/tc_reliable_connection.rb +31 -0
- data/test/roster/tc_helper.rb +21 -11
- data/test/rpc/tc_helper.rb +2 -2
- data/test/tc_callbacks.rb +3 -3
- data/test/tc_message.rb +15 -0
- data/test/tc_stream.rb +59 -121
- data/test/tc_streamError.rb +2 -4
- data/test/tc_streamparser.rb +26 -13
- data/test/ts_xmpp4r.rb +0 -9
- data/test/tune/tc_helper_recv.rb +0 -2
- data/test/vcard/tc_helper.rb +1 -1
- data/xmpp4r.gemspec +31 -84
- metadata +116 -167
- data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb.orig +0 -62
@@ -1,62 +0,0 @@
|
|
1
|
-
# =XMPP4R - XMPP Library for Ruby
|
2
|
-
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
|
3
|
-
# Website::http://home.gna.org/xmpp4r/
|
4
|
-
|
5
|
-
module Jabber
|
6
|
-
module Bytestreams
|
7
|
-
##
|
8
|
-
# SOCKS5 Bytestreams implementation of the target site
|
9
|
-
class SOCKS5BytestreamsTarget < SOCKS5Bytestreams
|
10
|
-
##
|
11
|
-
# Wait until the stream has been established
|
12
|
-
#
|
13
|
-
# May raise various exceptions
|
14
|
-
def accept
|
15
|
-
error = nil
|
16
|
-
connect_sem = Semaphore.new
|
17
|
-
|
18
|
-
@stream.add_iq_callback(200, self) { |iq|
|
19
|
-
if iq.type == :set and iq.from == @initiator_jid and iq.to == @target_jid and iq.query.kind_of?(IqQueryBytestreams)
|
20
|
-
begin
|
21
|
-
@stream.delete_iq_callback(self)
|
22
|
-
|
23
|
-
iq.query.each_element('streamhost') { |streamhost|
|
24
|
-
if streamhost.host and streamhost.port and not @socks
|
25
|
-
begin
|
26
|
-
@socks = connect_socks(streamhost)
|
27
|
-
@streamhost_used = streamhost
|
28
|
-
rescue Exception => e
|
29
|
-
Jabber::debuglog("SOCKS5 Bytestreams: #{e.class}: #{e}\n#{e.backtrace.join("\n")}")
|
30
|
-
@streamhost_cbs.process(streamhost, :failure, e)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
}
|
34
|
-
|
35
|
-
reply = iq.answer(false)
|
36
|
-
if @streamhost_used
|
37
|
-
reply.type = :result
|
38
|
-
reply.add(IqQueryBytestreams.new)
|
39
|
-
reply.query.add(StreamHostUsed.new(@streamhost_used.jid))
|
40
|
-
else
|
41
|
-
reply.type = :error
|
42
|
-
reply.add(ErrorResponse.new('item-not-found'))
|
43
|
-
end
|
44
|
-
@stream.send(reply)
|
45
|
-
rescue Exception => e
|
46
|
-
error = e
|
47
|
-
end
|
48
|
-
|
49
|
-
connect_sem.run
|
50
|
-
true
|
51
|
-
else
|
52
|
-
false
|
53
|
-
end
|
54
|
-
}
|
55
|
-
|
56
|
-
connect_sem.wait
|
57
|
-
raise error if error
|
58
|
-
(@socks != nil)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|