Permalink
Browse files

Merge branch 'release/0.5.4'

  • Loading branch information...
2 parents 5fc5fef + 1641ced commit 4c3d6c55557aca187ff2506dea6397f407c67168 @benlangfeld benlangfeld committed Aug 11, 2011
View
2 .gitignore
@@ -14,5 +14,5 @@ rdoc
notes
.yardoc
*.rbc
-lib/.DS_Store
vendor
+.rvmrc
View
13 .travis.yml
@@ -0,0 +1,13 @@
+rvm:
+ - 1.9.2
+ - rbx
+ - rbx-2.0
+ - jruby
+ - 1.8.7
+ - ree
+ - ruby-head
+
+branches:
+ only:
+ - master
+ - develop
View
6 CHANGELOG
@@ -1,3 +1,9 @@
+v0.5.4
+ Bugfix(fyafighter): Regression related to earlier refactoring: https://github.com/sprsquish/blather/issues/53
+ Feature(fyafighter): Make it much easier to allow private network addresses
+ Bugfix(benlangfeld): Fix the Nokogiri dependency to the 1.4.x series, due to a bug in 1.5.x
+ Bugfix(zlu): Replace class_inheritable_attribute with class_attribute because it is deprecated in ActiveSupport 3.1
+
v0.5.3
Feature(benlangfeld): Add XMPP Ping (XEP-0199) support
View
2 Rakefile
@@ -6,7 +6,7 @@ Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
- test.libs << 'lib' << 'spec'
+ test.libs << 'spec'
test.pattern = 'spec/**/*_spec.rb'
test.verbose = true
end
View
2 blather.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = %w{LICENSE README.md}
s.add_dependency("eventmachine", ["~> 0.12.6"])
- s.add_dependency("nokogiri", [">= 1.4.0"])
+ s.add_dependency("nokogiri", ["~> 1.4.0"])
s.add_dependency("niceogiri", [">= 0.0.4"])
s.add_dependency("minitest", [">= 1.7.1"])
s.add_dependency("activesupport", [">= 3.0.7"])
View
BIN lib/.DS_Store
Binary file not shown.
View
2 lib/blather.rb
@@ -8,7 +8,7 @@
digest/sha1
logger
- active_support/core_ext/class/inheritable_attributes
+ active_support/core_ext/class/attribute
active_support/core_ext/object/blank
blather/core_ext/eventmachine
View
4 lib/blather/errors.rb
@@ -4,7 +4,7 @@ module Blather
#
# @handler :error
class BlatherError < StandardError
- class_inheritable_array :handler_hierarchy
+ class_attribute :handler_hierarchy
self.handler_hierarchy ||= []
# @private
@@ -15,7 +15,7 @@ class BlatherError < StandardError
# @param [Symbol] handler the handler name
def self.register(handler)
@@handler_list << handler
- self.handler_hierarchy.unshift handler
+ self.handler_hierarchy = [handler] + self.handler_hierarchy
end
# The list of registered handlers
View
2 lib/blather/errors/sasl_error.rb
@@ -8,7 +8,7 @@ class SASLError < BlatherError
# @private
SASL_ERR_NS = 'urn:ietf:params:xml:ns:xmpp-sasl'
- class_inheritable_accessor :err_name
+ class_attribute :err_name
# @private
@@registrations = {}
View
4 lib/blather/file_transfer.rb
@@ -9,6 +9,9 @@ class FileTransfer
# Set this to false if you don't want to use SOCKS5 Bytestreams
attr_accessor :allow_s5b
+ # Set this to true if you want SOCKS5 Bytestreams to attempt to use private network addresses
+ attr_accessor :allow_private_ips
+
# Create a new FileTransfer
#
# @param [Blather::Stream] stream the stream the file transfer should use
@@ -37,6 +40,7 @@ def accept(handler, *params)
@stream.register_handler :s5b_open, :from => @iq.from do |iq|
transfer = Blather::FileTransfer::S5b.new(@stream, iq)
transfer.allow_ibb_fallback = true if @allow_ibb
+ transfer.allow_private_ips = true if @allow_private_ips
transfer.accept(handler, *params)
true
end
View
5 lib/blather/file_transfer/s5b.rb
@@ -97,7 +97,10 @@ def initialize(host, port, handler, *params)
def post_init
self.succeed
- (class << self; self; end).include(@@handler)
+
+ class << self
+ include @@handler
+ end
send(:initialize, *@params)
post_init
end
View
4 lib/blather/stanza.rb
@@ -12,7 +12,7 @@ class Stanza < XMPPNode
# @private
@@handler_list = []
- class_inheritable_array :handler_hierarchy
+ class_attribute :handler_hierarchy
# Registers a callback onto the callback stack
#
@@ -24,7 +24,7 @@ class Stanza < XMPPNode
def self.register(handler, name = nil, ns = nil)
@@handler_list << handler
self.handler_hierarchy ||= [:stanza]
- self.handler_hierarchy.unshift handler
+ self.handler_hierarchy = [handler] + self.handler_hierarchy
name = name || self.registered_name || handler
super name, ns
View
2 lib/blather/version.rb
@@ -1,4 +1,4 @@
module Blather
# Blather version number
- VERSION = '0.5.3'
+ VERSION = '0.5.4'
end
View
2 lib/blather/xmpp_node.rb
@@ -9,7 +9,7 @@ class XMPPNode < Niceogiri::XML::Node
# @private
@@registrations = {}
- class_inheritable_accessor :registered_ns, :registered_name
+ class_attribute :registered_ns, :registered_name
# Register a new stanza class to a name and/or namespace
#
View
37 spec/blather/file_transfer_spec.rb
@@ -8,6 +8,8 @@ def receive_data(data)
end
def unbind
end
+ def send(data, params)
+ end
end
def si_xml
@@ -68,6 +70,21 @@ def si_xml
transfer.allow_ibb = false
transfer.accept(MockFileReceiver)
end
+
+ it 'can allow s5b private ips' do
+ iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
+
+ @client.stubs(:write).with do |answer|
+ answer.si.feature.x.field('stream-method').value.must_equal Blather::Stanza::Iq::S5b::NS_S5B
+ true
+ end
+
+ transfer = Blather::FileTransfer.new(@client, iq)
+ transfer.allow_s5b = true
+ transfer.allow_private_ips = true
+ transfer.allow_ibb = false
+ transfer.accept(MockFileReceiver)
+ end
it 'can response no-valid-streams' do
iq = Blather::XMPPNode.import(parse_stanza(si_xml).root)
@@ -97,4 +114,24 @@ def si_xml
transfer = Blather::FileTransfer.new(@client, iq)
transfer.decline
end
+
+ it 'can s5b post_init include the handler' do
+ class TestS5B < Blather::FileTransfer::S5b::SocketConnection
+ def initialize()
+ super("0.0.0.0", 1, MockFileReceiver, nil)
+ restore_methods
+ self.post_init()
+ end
+
+ def self.new(*args)
+ allocate.instance_eval do
+ initialize(*args)
+ self
+ end
+ end
+ end
+ assert_nothing_raised do
+ TestS5B.new()
+ end
+ end
end

0 comments on commit 4c3d6c5

Please sign in to comment.