blather 0.4.15 → 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.autotest +13 -0
- data/.gitignore +18 -0
- data/CHANGELOG +150 -0
- data/Gemfile +4 -0
- data/Rakefile +32 -0
- data/TODO.md +2 -0
- data/blather.gemspec +49 -0
- data/lib/blather.rb +3 -0
- data/lib/blather/client/client.rb +139 -1
- data/lib/blather/client/dsl.rb +16 -0
- data/lib/blather/core_ext/active_support.rb +1 -1
- data/lib/blather/core_ext/ipaddr.rb +19 -0
- data/lib/blather/file_transfer/s5b.rb +8 -0
- data/lib/blather/roster_item.rb +5 -2
- data/lib/blather/stanza/disco.rb +7 -0
- data/lib/blather/stanza/disco/disco_info.rb +13 -19
- data/lib/blather/stanza/disco/disco_items.rb +5 -11
- data/lib/blather/stanza/presence.rb +15 -5
- data/lib/blather/stanza/presence/c.rb +103 -0
- data/lib/blather/stanza/x.rb +2 -4
- data/lib/blather/version.rb +3 -0
- data/lib/blather/xmpp_node.rb +8 -0
- data/spec/blather/client/client_spec.rb +87 -1
- data/spec/blather/client/dsl/pubsub_spec.rb +2 -2
- data/spec/blather/client/dsl_spec.rb +85 -5
- data/spec/blather/core_ext/nokogiri_spec.rb +1 -1
- data/spec/blather/errors/sasl_error_spec.rb +1 -1
- data/spec/blather/errors/stanza_error_spec.rb +2 -2
- data/spec/blather/errors/stream_error_spec.rb +2 -2
- data/spec/blather/errors_spec.rb +1 -1
- data/spec/blather/file_transfer_spec.rb +2 -2
- data/spec/blather/jid_spec.rb +1 -1
- data/spec/blather/roster_item_spec.rb +1 -1
- data/spec/blather/roster_spec.rb +1 -1
- data/spec/blather/stanza/discos/disco_info_spec.rb +1 -11
- data/spec/blather/stanza/discos/disco_items_spec.rb +1 -6
- data/spec/blather/stanza/iq/command_spec.rb +3 -3
- data/spec/blather/stanza/iq/ibb_spec.rb +2 -2
- data/spec/blather/stanza/iq/query_spec.rb +1 -1
- data/spec/blather/stanza/iq/roster_spec.rb +1 -1
- data/spec/blather/stanza/iq/s5b_spec.rb +2 -2
- data/spec/blather/stanza/iq/si_spec.rb +2 -2
- data/spec/blather/stanza/iq/vcard_spec.rb +3 -3
- data/spec/blather/stanza/iq_spec.rb +1 -1
- data/spec/blather/stanza/message_spec.rb +2 -2
- data/spec/blather/stanza/presence/c_spec.rb +46 -0
- data/spec/blather/stanza/presence/status_spec.rb +1 -1
- data/spec/blather/stanza/presence/subscription_spec.rb +1 -1
- data/spec/blather/stanza/presence_spec.rb +1 -1
- data/spec/blather/stanza/pubsub/affiliations_spec.rb +2 -2
- data/spec/blather/stanza/pubsub/create_spec.rb +3 -3
- data/spec/blather/stanza/pubsub/event_spec.rb +2 -2
- data/spec/blather/stanza/pubsub/items_spec.rb +2 -2
- data/spec/blather/stanza/pubsub/publish_spec.rb +2 -2
- data/spec/blather/stanza/pubsub/retract_spec.rb +2 -2
- data/spec/blather/stanza/pubsub/subscribe_spec.rb +2 -2
- data/spec/blather/stanza/pubsub/subscription_spec.rb +3 -3
- data/spec/blather/stanza/pubsub/subscriptions_spec.rb +2 -2
- data/spec/blather/stanza/pubsub/unsubscribe_spec.rb +2 -2
- data/spec/blather/stanza/pubsub_owner/delete_spec.rb +2 -2
- data/spec/blather/stanza/pubsub_owner/purge_spec.rb +3 -3
- data/spec/blather/stanza/pubsub_owner_spec.rb +2 -2
- data/spec/blather/stanza/pubsub_spec.rb +2 -8
- data/spec/blather/stanza/x_spec.rb +1 -6
- data/spec/blather/stanza_spec.rb +1 -1
- data/spec/blather/stream/client_spec.rb +3 -3
- data/spec/blather/stream/component_spec.rb +1 -1
- data/spec/blather/stream/parser_spec.rb +1 -1
- data/spec/blather/xmpp_node_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -12
- data/yard/templates/default/class/html/handlers.erb +18 -0
- data/yard/templates/default/class/setup.rb +10 -0
- data/yard/templates/default/class/text/handlers.erb +1 -0
- metadata +123 -13
- data/lib/test.rb +0 -55
data/lib/test.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require "blather/client/client"
|
2
|
-
require "openssl"
|
3
|
-
require "em-http"
|
4
|
-
require "cgi"
|
5
|
-
|
6
|
-
module S3FileReceiver
|
7
|
-
def initialize(iq)
|
8
|
-
p "initialize"
|
9
|
-
@filename = iq.si.file["name"]
|
10
|
-
@size = iq.si.file["size"].to_i
|
11
|
-
end
|
12
|
-
|
13
|
-
def post_init
|
14
|
-
p "post_init"
|
15
|
-
time = Time.now.httpdate
|
16
|
-
sign = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), "qHG5ywFiZR2EK7oUvLVLhGHr2Rp05ggriTdExw0I", "PUT\n\n\n#{time}\n/jaconda-dev/#{CGI::escape(@filename)}")).strip
|
17
|
-
@s3 = EM::HttpRequest.new("https://jaconda-dev.s3.amazonaws.com:443/#{CGI::escape(@filename)}").put({:timeout => 10, :head => {'date' => time, 'url' => "/jaconda-dev/#{CGI::escape(@filename)}", 'Content-Length' => @size, "Authorization" => "AWS AKIAIVULGEHUOR7PIR4Q:#{sign}"}})
|
18
|
-
@s3.errback do |e|
|
19
|
-
p "error: #{e.response_header.inspect}"
|
20
|
-
end
|
21
|
-
@s3.callback do |s|
|
22
|
-
p "success: #{s.response.inspect}"
|
23
|
-
end
|
24
|
-
EM::enable_proxy(self, @s3)
|
25
|
-
end
|
26
|
-
|
27
|
-
def proxy_target_unbound
|
28
|
-
close_connection_after_writing
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
EM.run do
|
33
|
-
Blather.logger = Logger.new("/Users/antonmironov/Desktop/blather.log")
|
34
|
-
Blather.logger.level = Logger::DEBUG
|
35
|
-
|
36
|
-
im = Blather::Client.setup "ant.mironov@jabber.ru/test", "zzzxxx"
|
37
|
-
|
38
|
-
im.register_handler :disco_info, :type => :get do |iq|
|
39
|
-
answer = iq.reply
|
40
|
-
answer.identities = [{:type => 'pc', :category => 'client'}]
|
41
|
-
answer.features = ["http://jabber.org/protocol/si/profile/file-transfer", "http://jabber.org/protocol/si", "http://jabber.org/protocol/bytestreams", "http://jabber.org/protocol/ibb"]
|
42
|
-
|
43
|
-
im.write answer
|
44
|
-
end
|
45
|
-
|
46
|
-
im.register_handler :file_transfer do |iq|
|
47
|
-
transfer = Blather::FileTransfer.new(im, iq)
|
48
|
-
# transfer.allow_bytestreams = false
|
49
|
-
|
50
|
-
transfer.accept(S3FileReceiver, iq)
|
51
|
-
|
52
|
-
true
|
53
|
-
end
|
54
|
-
im.connect
|
55
|
-
end
|