blather 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -14,5 +14,5 @@ rdoc
14
14
  notes
15
15
  .yardoc
16
16
  *.rbc
17
- lib/.DS_Store
18
17
  vendor
18
+ .rvmrc
@@ -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
data/CHANGELOG CHANGED
@@ -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
 
data/Rakefile CHANGED
@@ -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
@@ -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"])
@@ -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,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 @@ module Blather
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
@@ -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
 
@@ -9,6 +9,9 @@ module Blather
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 @@ module Blather
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
@@ -97,7 +97,10 @@ module Blather
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
@@ -12,7 +12,7 @@ module Blather
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 @@ module Blather
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
@@ -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
@@ -9,7 +9,7 @@ module Blather
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
  #
@@ -8,6 +8,8 @@ module MockFileReceiver
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 @@ describe Blather::FileTransfer do
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 @@ describe Blather::FileTransfer do
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
metadata CHANGED
@@ -1,213 +1,161 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: blather
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 5
8
- - 3
9
- version: 0.5.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.4
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Jeff Smick
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-06-26 00:00:00 +01:00
12
+ date: 2011-08-11 00:00:00.000000000 +01:00
18
13
  default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
21
16
  name: eventmachine
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2153050540 !ruby/object:Gem::Requirement
24
18
  none: false
25
- requirements:
19
+ requirements:
26
20
  - - ~>
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 12
31
- - 6
21
+ - !ruby/object:Gem::Version
32
22
  version: 0.12.6
33
23
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: nokogiri
37
24
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2153050540
26
+ - !ruby/object:Gem::Dependency
27
+ name: nokogiri
28
+ requirement: &2156390300 !ruby/object:Gem::Requirement
39
29
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- segments:
44
- - 1
45
- - 4
46
- - 0
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
47
33
  version: 1.4.0
48
34
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: niceogiri
52
35
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *2156390300
37
+ - !ruby/object:Gem::Dependency
38
+ name: niceogiri
39
+ requirement: &2156389820 !ruby/object:Gem::Requirement
54
40
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- segments:
59
- - 0
60
- - 0
61
- - 4
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
62
44
  version: 0.0.4
63
45
  type: :runtime
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: minitest
67
46
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *2156389820
48
+ - !ruby/object:Gem::Dependency
49
+ name: minitest
50
+ requirement: &2156389340 !ruby/object:Gem::Requirement
69
51
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 7
76
- - 1
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
77
55
  version: 1.7.1
78
56
  type: :runtime
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: activesupport
82
57
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
58
+ version_requirements: *2156389340
59
+ - !ruby/object:Gem::Dependency
60
+ name: activesupport
61
+ requirement: &2156388860 !ruby/object:Gem::Requirement
84
62
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- segments:
89
- - 3
90
- - 0
91
- - 7
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
92
66
  version: 3.0.7
93
67
  type: :runtime
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: minitest
97
68
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
69
+ version_requirements: *2156388860
70
+ - !ruby/object:Gem::Dependency
71
+ name: minitest
72
+ requirement: &2156388380 !ruby/object:Gem::Requirement
99
73
  none: false
100
- requirements:
74
+ requirements:
101
75
  - - ~>
102
- - !ruby/object:Gem::Version
103
- segments:
104
- - 1
105
- - 7
106
- - 1
76
+ - !ruby/object:Gem::Version
107
77
  version: 1.7.1
108
78
  type: :development
109
- version_requirements: *id006
110
- - !ruby/object:Gem::Dependency
111
- name: mocha
112
79
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
80
+ version_requirements: *2156388380
81
+ - !ruby/object:Gem::Dependency
82
+ name: mocha
83
+ requirement: &2156387900 !ruby/object:Gem::Requirement
114
84
  none: false
115
- requirements:
85
+ requirements:
116
86
  - - ~>
117
- - !ruby/object:Gem::Version
118
- segments:
119
- - 0
120
- - 9
121
- - 12
87
+ - !ruby/object:Gem::Version
122
88
  version: 0.9.12
123
89
  type: :development
124
- version_requirements: *id007
125
- - !ruby/object:Gem::Dependency
126
- name: bundler
127
90
  prerelease: false
128
- requirement: &id008 !ruby/object:Gem::Requirement
91
+ version_requirements: *2156387900
92
+ - !ruby/object:Gem::Dependency
93
+ name: bundler
94
+ requirement: &2156387420 !ruby/object:Gem::Requirement
129
95
  none: false
130
- requirements:
96
+ requirements:
131
97
  - - ~>
132
- - !ruby/object:Gem::Version
133
- segments:
134
- - 1
135
- - 0
136
- - 0
98
+ - !ruby/object:Gem::Version
137
99
  version: 1.0.0
138
100
  type: :development
139
- version_requirements: *id008
140
- - !ruby/object:Gem::Dependency
141
- name: rcov
142
101
  prerelease: false
143
- requirement: &id009 !ruby/object:Gem::Requirement
102
+ version_requirements: *2156387420
103
+ - !ruby/object:Gem::Dependency
104
+ name: rcov
105
+ requirement: &2156386940 !ruby/object:Gem::Requirement
144
106
  none: false
145
- requirements:
107
+ requirements:
146
108
  - - ~>
147
- - !ruby/object:Gem::Version
148
- segments:
149
- - 0
150
- - 9
151
- - 9
109
+ - !ruby/object:Gem::Version
152
110
  version: 0.9.9
153
111
  type: :development
154
- version_requirements: *id009
155
- - !ruby/object:Gem::Dependency
156
- name: yard
157
112
  prerelease: false
158
- requirement: &id010 !ruby/object:Gem::Requirement
113
+ version_requirements: *2156386940
114
+ - !ruby/object:Gem::Dependency
115
+ name: yard
116
+ requirement: &2156386460 !ruby/object:Gem::Requirement
159
117
  none: false
160
- requirements:
118
+ requirements:
161
119
  - - ~>
162
- - !ruby/object:Gem::Version
163
- segments:
164
- - 0
165
- - 6
166
- - 1
120
+ - !ruby/object:Gem::Version
167
121
  version: 0.6.1
168
122
  type: :development
169
- version_requirements: *id010
170
- - !ruby/object:Gem::Dependency
171
- name: bluecloth
172
123
  prerelease: false
173
- requirement: &id011 !ruby/object:Gem::Requirement
124
+ version_requirements: *2156386460
125
+ - !ruby/object:Gem::Dependency
126
+ name: bluecloth
127
+ requirement: &2156385980 !ruby/object:Gem::Requirement
174
128
  none: false
175
- requirements:
129
+ requirements:
176
130
  - - ~>
177
- - !ruby/object:Gem::Version
178
- segments:
179
- - 2
180
- - 1
181
- - 0
131
+ - !ruby/object:Gem::Version
182
132
  version: 2.1.0
183
133
  type: :development
184
- version_requirements: *id011
185
- - !ruby/object:Gem::Dependency
186
- name: rake
187
134
  prerelease: false
188
- requirement: &id012 !ruby/object:Gem::Requirement
135
+ version_requirements: *2156385980
136
+ - !ruby/object:Gem::Dependency
137
+ name: rake
138
+ requirement: &2156385600 !ruby/object:Gem::Requirement
189
139
  none: false
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- segments:
194
- - 0
195
- version: "0"
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
196
144
  type: :development
197
- version_requirements: *id012
145
+ prerelease: false
146
+ version_requirements: *2156385600
198
147
  description: An XMPP DSL for Ruby written on top of EventMachine and Nokogiri
199
148
  email: sprsquish@gmail.com
200
149
  executables: []
201
-
202
150
  extensions: []
203
-
204
- extra_rdoc_files:
151
+ extra_rdoc_files:
205
152
  - LICENSE
206
153
  - README.md
207
- files:
154
+ files:
208
155
  - .autotest
209
156
  - .gemtest
210
157
  - .gitignore
158
+ - .travis.yml
211
159
  - CHANGELOG
212
160
  - Gemfile
213
161
  - LICENSE
@@ -222,7 +170,6 @@ files:
222
170
  - examples/rosterprint.rb
223
171
  - examples/stream_only.rb
224
172
  - examples/xmpp4r/echo.rb
225
- - lib/.DS_Store
226
173
  - lib/blather.rb
227
174
  - lib/blather/client.rb
228
175
  - lib/blather/client/client.rb
@@ -341,36 +288,30 @@ files:
341
288
  has_rdoc: true
342
289
  homepage: http://github.com/sprsquish/blather
343
290
  licenses: []
344
-
345
291
  post_install_message:
346
- rdoc_options:
292
+ rdoc_options:
347
293
  - --charset=UTF-8
348
- require_paths:
294
+ require_paths:
349
295
  - lib
350
- required_ruby_version: !ruby/object:Gem::Requirement
296
+ required_ruby_version: !ruby/object:Gem::Requirement
351
297
  none: false
352
- requirements:
353
- - - ">="
354
- - !ruby/object:Gem::Version
355
- segments:
356
- - 0
357
- version: "0"
358
- required_rubygems_version: !ruby/object:Gem::Requirement
298
+ requirements:
299
+ - - ! '>='
300
+ - !ruby/object:Gem::Version
301
+ version: '0'
302
+ required_rubygems_version: !ruby/object:Gem::Requirement
359
303
  none: false
360
- requirements:
361
- - - ">="
362
- - !ruby/object:Gem::Version
363
- segments:
364
- - 0
365
- version: "0"
304
+ requirements:
305
+ - - ! '>='
306
+ - !ruby/object:Gem::Version
307
+ version: '0'
366
308
  requirements: []
367
-
368
309
  rubyforge_project:
369
- rubygems_version: 1.3.7
310
+ rubygems_version: 1.6.2
370
311
  signing_key:
371
312
  specification_version: 3
372
313
  summary: Simpler XMPP built for speed
373
- test_files:
314
+ test_files:
374
315
  - spec/blather/client/client_spec.rb
375
316
  - spec/blather/client/dsl/pubsub_spec.rb
376
317
  - spec/blather/client/dsl_spec.rb