Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 15 commits
  • 15 files changed
  • 0 comments
  • 3 contributors
Jun 26, 2011
Ben Langfeld benlangfeld Merge branch 'release/0.5.3' into develop 15b698f
Jul 19, 2011
Christopher Johnson fyafighter Fixes the private method error message 6584cb2
Christopher Johnson fyafighter Makes it much easier to allow private network addresses a9a3ddd
Christopher Johnson fyafighter Adds a test for the addition of allow_private_ips dae71ca
Aug 02, 2011
Ben Langfeld benlangfeld Add config for Travis CI 43d63c6
Aug 10, 2011
Christopher Johnson fyafighter Adds a test for the s5b fix 6bd4630
Aug 11, 2011
Zhao Lu zlu lib directory is included by default in Rake::TestTask so it is not
necessary to explictly specifying it.

Before removing it, running rake shows:
zlu-mba:blather zlu$ rake
(in /Users/zlu/projects/thelab/blather)
/Users/zlu/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby -I"lib:lib:spec" "/Users/zlu/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "spec/blather/client/client_spec.rb"

Note that -I includes 2 lib.
e9b69cc
Ben Langfeld benlangfeld Peg our nokogiri dependency to the 1.4.x series. Temporarily fixes #55 30079a4
Zhao Lu zlu added .rvmrc to git ignore 43ee2f9
Zhao Lu zlu Removed .DS_Store from repo, it shouldn't have been there in the firs…
…t place.

Also removed the exclusion of it from .gitignore as it is no longer necessary.
Developers who have it locally will need to manually remove it.
a12c36c
Zhao Lu zlu Getting rid of all class_inheriable_attribute warnings by replaceing …
…them with class attribute.

Some tests were broken because the class_attribute are mutable arrays and modifying them in subclass
has inevitabled changed their values in superclass.  This behavior is undesirable.  The fix is simply not using unshift method and use setter on array instead.
627c3c5
Ben Langfeld benlangfeld Merge remote-tracking branch 'refs/remotes/negativecode/fixs5b' into …
…develop
2580f28
Ben Langfeld benlangfeld Merge remote-tracking branch 'refs/remotes/negativecode/setallowpriva…
…teips' into develop
3915f83
Ben Langfeld benlangfeld Bump version and update changelog 1641ced
Ben Langfeld benlangfeld Merge branch 'release/0.5.4' 4c3d6c5
2  .gitignore
@@ -14,5 +14,5 @@ rdoc
14 14 notes
15 15 .yardoc
16 16 *.rbc
17   -lib/.DS_Store
18 17 vendor
  18 +.rvmrc
13 .travis.yml
... ... @@ -0,0 +1,13 @@
  1 +rvm:
  2 + - 1.9.2
  3 + - rbx
  4 + - rbx-2.0
  5 + - jruby
  6 + - 1.8.7
  7 + - ree
  8 + - ruby-head
  9 +
  10 +branches:
  11 + only:
  12 + - master
  13 + - develop
6 CHANGELOG
... ... @@ -1,3 +1,9 @@
  1 +v0.5.4
  2 + Bugfix(fyafighter): Regression related to earlier refactoring: https://github.com/sprsquish/blather/issues/53
  3 + Feature(fyafighter): Make it much easier to allow private network addresses
  4 + Bugfix(benlangfeld): Fix the Nokogiri dependency to the 1.4.x series, due to a bug in 1.5.x
  5 + Bugfix(zlu): Replace class_inheritable_attribute with class_attribute because it is deprecated in ActiveSupport 3.1
  6 +
1 7 v0.5.3
2 8 Feature(benlangfeld): Add XMPP Ping (XEP-0199) support
3 9
2  Rakefile
@@ -6,7 +6,7 @@ Bundler::GemHelper.install_tasks
6 6
7 7 require 'rake/testtask'
8 8 Rake::TestTask.new(:test) do |test|
9   - test.libs << 'lib' << 'spec'
  9 + test.libs << 'spec'
10 10 test.pattern = 'spec/**/*_spec.rb'
11 11 test.verbose = true
12 12 end
2  blather.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21 21 s.extra_rdoc_files = %w{LICENSE README.md}
22 22
23 23 s.add_dependency("eventmachine", ["~> 0.12.6"])
24   - s.add_dependency("nokogiri", [">= 1.4.0"])
  24 + s.add_dependency("nokogiri", ["~> 1.4.0"])
25 25 s.add_dependency("niceogiri", [">= 0.0.4"])
26 26 s.add_dependency("minitest", [">= 1.7.1"])
27 27 s.add_dependency("activesupport", [">= 3.0.7"])
BIN  lib/.DS_Store
Binary file not shown
2  lib/blather.rb
@@ -8,7 +8,7 @@
8 8 digest/sha1
9 9 logger
10 10
11   - active_support/core_ext/class/inheritable_attributes
  11 + active_support/core_ext/class/attribute
12 12 active_support/core_ext/object/blank
13 13
14 14 blather/core_ext/eventmachine
4 lib/blather/errors.rb
@@ -4,7 +4,7 @@ module Blather
4 4 #
5 5 # @handler :error
6 6 class BlatherError < StandardError
7   - class_inheritable_array :handler_hierarchy
  7 + class_attribute :handler_hierarchy
8 8 self.handler_hierarchy ||= []
9 9
10 10 # @private
@@ -15,7 +15,7 @@ class BlatherError < StandardError
15 15 # @param [Symbol] handler the handler name
16 16 def self.register(handler)
17 17 @@handler_list << handler
18   - self.handler_hierarchy.unshift handler
  18 + self.handler_hierarchy = [handler] + self.handler_hierarchy
19 19 end
20 20
21 21 # The list of registered handlers
2  lib/blather/errors/sasl_error.rb
@@ -8,7 +8,7 @@ class SASLError < BlatherError
8 8 # @private
9 9 SASL_ERR_NS = 'urn:ietf:params:xml:ns:xmpp-sasl'
10 10
11   - class_inheritable_accessor :err_name
  11 + class_attribute :err_name
12 12 # @private
13 13 @@registrations = {}
14 14
4 lib/blather/file_transfer.rb
@@ -9,6 +9,9 @@ class FileTransfer
9 9 # Set this to false if you don't want to use SOCKS5 Bytestreams
10 10 attr_accessor :allow_s5b
11 11
  12 + # Set this to true if you want SOCKS5 Bytestreams to attempt to use private network addresses
  13 + attr_accessor :allow_private_ips
  14 +
12 15 # Create a new FileTransfer
13 16 #
14 17 # @param [Blather::Stream] stream the stream the file transfer should use
@@ -37,6 +40,7 @@ def accept(handler, *params)
37 40 @stream.register_handler :s5b_open, :from => @iq.from do |iq|
38 41 transfer = Blather::FileTransfer::S5b.new(@stream, iq)
39 42 transfer.allow_ibb_fallback = true if @allow_ibb
  43 + transfer.allow_private_ips = true if @allow_private_ips
40 44 transfer.accept(handler, *params)
41 45 true
42 46 end
5 lib/blather/file_transfer/s5b.rb
@@ -97,7 +97,10 @@ def initialize(host, port, handler, *params)
97 97
98 98 def post_init
99 99 self.succeed
100   - (class << self; self; end).include(@@handler)
  100 +
  101 + class << self
  102 + include @@handler
  103 + end
101 104 send(:initialize, *@params)
102 105 post_init
103 106 end
4 lib/blather/stanza.rb
@@ -12,7 +12,7 @@ class Stanza < XMPPNode
12 12 # @private
13 13 @@handler_list = []
14 14
15   - class_inheritable_array :handler_hierarchy
  15 + class_attribute :handler_hierarchy
16 16
17 17 # Registers a callback onto the callback stack
18 18 #
@@ -24,7 +24,7 @@ class Stanza < XMPPNode
24 24 def self.register(handler, name = nil, ns = nil)
25 25 @@handler_list << handler
26 26 self.handler_hierarchy ||= [:stanza]
27   - self.handler_hierarchy.unshift handler
  27 + self.handler_hierarchy = [handler] + self.handler_hierarchy
28 28
29 29 name = name || self.registered_name || handler
30 30 super name, ns
2  lib/blather/version.rb
... ... @@ -1,4 +1,4 @@
1 1 module Blather
2 2 # Blather version number
3   - VERSION = '0.5.3'
  3 + VERSION = '0.5.4'
4 4 end
2  lib/blather/xmpp_node.rb
@@ -9,7 +9,7 @@ class XMPPNode < Niceogiri::XML::Node
9 9 # @private
10 10 @@registrations = {}
11 11
12   - class_inheritable_accessor :registered_ns, :registered_name
  12 + class_attribute :registered_ns, :registered_name
13 13
14 14 # Register a new stanza class to a name and/or namespace
15 15 #
37 spec/blather/file_transfer_spec.rb
@@ -8,6 +8,8 @@ def receive_data(data)
8 8 end
9 9 def unbind
10 10 end
  11 + def send(data, params)
  12 + end
11 13 end
12 14
13 15 def si_xml
@@ -68,6 +70,21 @@ def si_xml
68 70 transfer.allow_ibb = false
69 71 transfer.accept(MockFileReceiver)
70 72 end
  73 +
  74 + it 'can allow s5b private ips' do
  75 + iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
  76 +
  77 + @client.stubs(:write).with do |answer|
  78 + answer.si.feature.x.field('stream-method').value.must_equal Blather::Stanza::Iq::S5b::NS_S5B
  79 + true
  80 + end
  81 +
  82 + transfer = Blather::FileTransfer.new(@client, iq)
  83 + transfer.allow_s5b = true
  84 + transfer.allow_private_ips = true
  85 + transfer.allow_ibb = false
  86 + transfer.accept(MockFileReceiver)
  87 + end
71 88
72 89 it 'can response no-valid-streams' do
73 90 iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
@@ -97,4 +114,24 @@ def si_xml
97 114 transfer = Blather::FileTransfer.new(@client, iq)
98 115 transfer.decline
99 116 end
  117 +
  118 + it 'can s5b post_init include the handler' do
  119 + class TestS5B < Blather::FileTransfer::S5b::SocketConnection
  120 + def initialize()
  121 + super("0.0.0.0", 1, MockFileReceiver, nil)
  122 + restore_methods
  123 + self.post_init()
  124 + end
  125 +
  126 + def self.new(*args)
  127 + allocate.instance_eval do
  128 + initialize(*args)
  129 + self
  130 + end
  131 + end
  132 + end
  133 + assert_nothing_raised do
  134 + TestS5B.new()
  135 + end
  136 + end
100 137 end

No commit comments for this range

Something went wrong with that request. Please try again.