Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: negativecode/blather
base: 5fc5fef772
...
head fork: negativecode/blather
compare: 4c3d6c5555
  • 15 commits
  • 15 files changed
  • 0 commit comments
  • 3 contributors
Commits on Jun 26, 2011
@benlangfeld benlangfeld Merge branch 'release/0.5.3' into develop 15b698f
Commits on Jul 19, 2011
@fyafighter fyafighter Fixes the private method error message 6584cb2
@fyafighter fyafighter Makes it much easier to allow private network addresses a9a3ddd
@fyafighter fyafighter Adds a test for the addition of allow_private_ips dae71ca
Commits on Aug 02, 2011
@benlangfeld benlangfeld Add config for Travis CI 43d63c6
Commits on Aug 11, 2011
@fyafighter fyafighter Adds a test for the s5b fix 6bd4630
@zlu 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
@benlangfeld benlangfeld Peg our nokogiri dependency to the 1.4.x series. Temporarily fixes #55 30079a4
@zlu zlu added .rvmrc to git ignore 43ee2f9
@zlu 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
@zlu 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
@benlangfeld benlangfeld Merge remote-tracking branch 'refs/remotes/negativecode/fixs5b' into …
…develop
2580f28
@benlangfeld benlangfeld Merge remote-tracking branch 'refs/remotes/negativecode/setallowpriva…
…teips' into develop
3915f83
@benlangfeld benlangfeld Bump version and update changelog 1641ced
@benlangfeld benlangfeld Merge branch 'release/0.5.4' 4c3d6c5
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

No commit comments for this range

Something went wrong with that request. Please try again.