xmpp4r 0.5 → 0.5.5

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.
Files changed (41) hide show
  1. data/CHANGELOG +21 -0
  2. data/README.rdoc +29 -38
  3. data/Rakefile +11 -18
  4. data/data/doc/xmpp4r/examples/advanced/recvfile.rb +5 -4
  5. data/lib/xmpp4r/bytestreams/helper/filetransfer.rb +2 -0
  6. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +1 -0
  7. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +1 -1
  8. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +4 -1
  9. data/lib/xmpp4r/caps/helper/generator.rb +2 -2
  10. data/lib/xmpp4r/client.rb +18 -4
  11. data/lib/xmpp4r/connection.rb +8 -5
  12. data/lib/xmpp4r/delay/x/delay.rb +1 -1
  13. data/lib/xmpp4r/entity_time.rb +6 -0
  14. data/lib/xmpp4r/entity_time/iq.rb +45 -0
  15. data/lib/xmpp4r/entity_time/responder.rb +57 -0
  16. data/lib/xmpp4r/httpbinding/client.rb +178 -44
  17. data/lib/xmpp4r/message.rb +46 -0
  18. data/lib/xmpp4r/muc/helper/mucclient.rb +8 -1
  19. data/lib/xmpp4r/observable.rb +9 -0
  20. data/lib/xmpp4r/observable/contact.rb +61 -0
  21. data/lib/xmpp4r/observable/helper.rb +389 -0
  22. data/lib/xmpp4r/observable/observable_thing.rb +191 -0
  23. data/lib/xmpp4r/observable/pubsub.rb +211 -0
  24. data/lib/xmpp4r/observable/subscription.rb +57 -0
  25. data/lib/xmpp4r/observable/thread_store.rb +65 -0
  26. data/lib/xmpp4r/pubsub/children/unsubscribe.rb +16 -1
  27. data/lib/xmpp4r/pubsub/helper/servicehelper.rb +48 -14
  28. data/lib/xmpp4r/rexmladdons.rb +46 -6
  29. data/lib/xmpp4r/roster/helper/roster.rb +19 -9
  30. data/lib/xmpp4r/sasl.rb +1 -1
  31. data/lib/xmpp4r/stream.rb +2 -2
  32. data/lib/xmpp4r/xmpp4r.rb +1 -1
  33. data/test/bytestreams/tc_socks5bytestreams.rb +2 -2
  34. data/test/entity_time/tc_responder.rb +65 -0
  35. data/test/roster/tc_helper.rb +2 -3
  36. data/test/tc_message.rb +52 -1
  37. data/test/tc_stream.rb +2 -2
  38. data/test/tc_streamComponent.rb +11 -1
  39. data/test/ts_xmpp4r.rb +11 -2
  40. data/xmpp4r.gemspec +20 -9
  41. metadata +41 -35
@@ -241,14 +241,13 @@ class Roster::HelperTest < Test::Unit::TestCase
241
241
  assert_equal(true, h['a@b.c'].online?)
242
242
  presences = 0
243
243
  h['a@b.c'].each_presence { presences += 1 }
244
- assert_equal(2, presences)
244
+ assert_equal(1, presences)
245
245
 
246
246
  send("<presence from='a@b.c/r2'/>")
247
247
  presence_waiter.wait
248
248
 
249
249
  assert_kind_of(Roster::Helper::RosterItem, cb_item)
250
- assert_kind_of(Presence, cb_op)
251
- assert_equal(:unavailable, cb_op.type)
250
+ assert_nil(cb_op)
252
251
  assert_kind_of(Presence, cb_p)
253
252
  assert_nil(cb_p.type)
254
253
  assert_equal(true, h['a@b.c'].online?)
@@ -47,7 +47,7 @@ class MessageTest < Test::Unit::TestCase
47
47
  assert_equal(nil, x.type)
48
48
  end
49
49
 
50
- def test_body
50
+ def test_should_update_body
51
51
  x = Message.new()
52
52
  assert_equal(nil, x.body)
53
53
  assert_equal(x, x.set_body("trezrze ezfrezr ezr zer ezr ezrezrez ezr z"))
@@ -56,6 +56,57 @@ class MessageTest < Test::Unit::TestCase
56
56
  assert_equal("2", x.body)
57
57
  end
58
58
 
59
+ def test_should_update_xhtml_body
60
+ x = Message.new()
61
+ assert_equal(nil, x.xhtml_body)
62
+ assert_equal(x, x.set_xhtml_body("check this <a href='domain.com'>link</a> out"))
63
+ assert_equal("check this <a href='domain.com'>link</a> out", x.xhtml_body)
64
+ x.xhtml_body = "2"
65
+ assert_equal("2", x.xhtml_body)
66
+ end
67
+
68
+ def test_should_get_bodies
69
+ x = Message.new()
70
+
71
+ x.set_body("check this link <domain.com> out")
72
+ assert_equal("check this link <domain.com> out", x.body)
73
+
74
+ x.set_xhtml_body("<span style='font-weight: bold'>check <i>this</i> <a href='domain.com'>link</a> out</span>")
75
+ assert_equal("<span style='font-weight: bold'>check <i>this</i> <a href='domain.com'>link</a> out</span>", x.xhtml_body)
76
+
77
+ x.first_element("html").remove
78
+ assert_equal(nil, x.xhtml_body)
79
+
80
+ # Some clients send markupped body without <html/> wrapper,
81
+ # and we need to be able to deal with this also
82
+ el = REXML::Element.new("body")
83
+ el.add_namespace("http://www.w3.org/1999/xhtml")
84
+ el.add_text("xhtml body without wrapper")
85
+ x.add_element(el)
86
+ assert_equal("xhtml body without wrapper", x.xhtml_body)
87
+ end
88
+
89
+ def test_should_get_xhtml_body_of_new_message
90
+ x = Message.new()
91
+
92
+ x.set_xhtml_body("check <i>this</i> <a href='domain.com'>link</a> out")
93
+ assert_equal("check <i>this</i> <a href='domain.com'>link</a> out", x.xhtml_body)
94
+
95
+ doc = REXML::Document.new x.to_s
96
+ x2 = Message.new.import doc.root
97
+
98
+ assert_equal(x.to_s, x2.to_s)
99
+ assert_equal("check <i>this</i> <a href='domain.com'>link</a> out", x2.xhtml_body)
100
+ end
101
+
102
+ def test_should_raise_exception_with_invalid_xhtml_body
103
+ x = Message.new()
104
+
105
+ assert_raise Jabber::ArgumentError do
106
+ x.set_xhtml_body("check <i>this <a href='domain.com'>link</a> out")
107
+ end
108
+ end
109
+
59
110
  def test_subject
60
111
  x = Message.new
61
112
  assert_equal(nil, x.subject)
@@ -18,7 +18,7 @@ class StreamTest < Test::Unit::TestCase
18
18
 
19
19
  def busywait(&block)
20
20
  n = 0
21
- while not block.yield and n < 1000
21
+ while not block.call and n < 10000
22
22
  Thread::pass
23
23
  n += 1
24
24
  end
@@ -92,7 +92,7 @@ class StreamTest < Test::Unit::TestCase
92
92
  @server.send(Iq.new(:result).set_id('3').delete_namespace)
93
93
  else
94
94
  p e
95
- end
95
+ end
96
96
  end
97
97
 
98
98
  called_outer = 0
@@ -44,7 +44,17 @@ class StreamComponentTest < Test::Unit::TestCase
44
44
  end
45
45
 
46
46
  def teardown
47
- @stream.close
47
+ n = 0
48
+ while @stream.processing > 0 and n < 1000
49
+ Thread::pass
50
+ n += 1
51
+ end
52
+ n = 0
53
+ while @server.processing > 0 and n < 1000
54
+ Thread::pass
55
+ n += 1
56
+ end
57
+ #@stream.close
48
58
  @server.close
49
59
  end
50
60
 
@@ -13,7 +13,16 @@ require 'find'
13
13
 
14
14
  # List files' basenames, not full path!
15
15
  # EXCLUDED_FILES = [ 'tc_muc_simplemucclient.rb' ]
16
- EXCLUDED_FILES = []
16
+ EXCLUDED_FILES = %w[
17
+ tc_disconnect_cleanup.rb
18
+ ./pubsub/tc_helper.rb
19
+ ./muc/tc_muc_mucclient.rb
20
+ ./reliable/tc_reliable_connection.rb
21
+ ./reliable/tc_disconnect_exception.rb
22
+ ./reliable/tc_listener_mocked_test.rb
23
+ ./reliable/tc_reliable_connection.rb
24
+ ./bytestreams/tc_socks5bytestreams.rb
25
+ ].map {|f| f.gsub(%r[^\.], File.dirname(__FILE__)) }
17
26
 
18
27
  tc_files = []
19
28
  tc_subdirs = []
@@ -39,6 +48,6 @@ tc_subdirs.each do |dir|
39
48
  end
40
49
 
41
50
  tc_files.each do |f|
42
- next if EXCLUDED_FILES.include?(File::basename(f))
51
+ next if EXCLUDED_FILES.include?(File::basename(f)) or EXCLUDED_FILES.include?(f)
43
52
  require f
44
53
  end
@@ -2,10 +2,11 @@
2
2
  # RUN : 'rake gem:update_gemspec'
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.authors = ["Lucas Nussbaum", "Stephan Maka", "Glenn Rempe"]
5
+ s.activated = false
6
+ s.authors = ["Lucas Nussbaum", "Stephan Maka", "Glenn Rempe", "Kaoru Maeda", "Harisankar P S"]
6
7
  s.bindir = "bin"
7
- s.description = "XMPP4R is an XMPP/Jabber library for Ruby."
8
- s.email = "xmpp4r-devel@gna.org"
8
+ s.description = "XMPP/Jabber library for ruby"
9
+ s.email = "mailme@hsps.in"
9
10
  s.extra_rdoc_files = ["CHANGELOG", "COPYING", "LICENSE", "README.rdoc", "README_ruby19.txt"]
10
11
  s.files = ["CHANGELOG",
11
12
  "COPYING",
@@ -90,6 +91,9 @@ Gem::Specification.new do |s|
90
91
  "lib/xmpp4r/discovery/helper/responder.rb",
91
92
  "lib/xmpp4r/discovery/iq/discoinfo.rb",
92
93
  "lib/xmpp4r/discovery/iq/discoitems.rb",
94
+ "lib/xmpp4r/entity_time.rb",
95
+ "lib/xmpp4r/entity_time/iq.rb",
96
+ "lib/xmpp4r/entity_time/responder.rb",
93
97
  "lib/xmpp4r/errors.rb",
94
98
  "lib/xmpp4r/feature_negotiation.rb",
95
99
  "lib/xmpp4r/feature_negotiation/iq/feature.rb",
@@ -118,6 +122,13 @@ Gem::Specification.new do |s|
118
122
  "lib/xmpp4r/muc/x/muc.rb",
119
123
  "lib/xmpp4r/muc/x/mucuserinvite.rb",
120
124
  "lib/xmpp4r/muc/x/mucuseritem.rb",
125
+ "lib/xmpp4r/observable.rb",
126
+ "lib/xmpp4r/observable/contact.rb",
127
+ "lib/xmpp4r/observable/helper.rb",
128
+ "lib/xmpp4r/observable/observable_thing.rb",
129
+ "lib/xmpp4r/observable/pubsub.rb",
130
+ "lib/xmpp4r/observable/subscription.rb",
131
+ "lib/xmpp4r/observable/thread_store.rb",
121
132
  "lib/xmpp4r/presence.rb",
122
133
  "lib/xmpp4r/pubsub.rb",
123
134
  "lib/xmpp4r/pubsub/children/configuration.rb",
@@ -175,6 +186,7 @@ Gem::Specification.new do |s|
175
186
  "test/dataforms/tc_data.rb",
176
187
  "test/delay/tc_xdelay.rb",
177
188
  "test/discovery/tc_responder.rb",
189
+ "test/entity_time/tc_responder.rb",
178
190
  "test/last/tc_helper.rb",
179
191
  "test/lib/assert_equal_xml.rb",
180
192
  "test/lib/clienttester.rb",
@@ -222,17 +234,16 @@ Gem::Specification.new do |s|
222
234
  "tools/xmpp4r-gemspec-test.rb",
223
235
  "xmpp4r.gemspec"]
224
236
  s.has_rdoc = true
225
- s.homepage = "http://home.gna.org/xmpp4r/"
226
- s.loaded = false
237
+ s.homepage = "https://xmpp4r.github.io"
227
238
  s.name = "xmpp4r"
228
239
  s.platform = "ruby"
229
- s.rdoc_options = ["--quiet", "--title", "XMPP4R is an XMPP/Jabber library for Ruby.", "--opname", "index.html", "--main", "lib/xmpp4r.rb", "--line-numbers", "--inline-source"]
240
+ s.rdoc_options = ["--quiet", "--title", "XMPP/Jabber library for ruby", "--opname", "index.html", "--main", "lib/xmpp4r.rb", "--line-numbers", "--inline-source"]
230
241
  s.require_paths = ["lib"]
231
242
  s.required_ruby_version = ">= 1.8.4"
232
243
  s.required_rubygems_version = ">= 0"
233
244
  s.rubyforge_project = "xmpp4r"
234
- s.rubygems_version = "1.3.4"
245
+ s.rubygems_version = "1.8.23"
235
246
  s.specification_version = 3
236
- s.summary = "XMPP4R is an XMPP/Jabber library for Ruby."
237
- s.version = "0.5"
247
+ s.summary = "XMPP/Jabber library for ruby"
248
+ s.version = "0.5.5"
238
249
  end
metadata CHANGED
@@ -1,33 +1,31 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xmpp4r
3
- version: !ruby/object:Gem::Version
4
- version: "0.5"
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.5
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Lucas Nussbaum
8
9
  - Stephan Maka
9
10
  - Glenn Rempe
11
+ - Kaoru Maeda
12
+ - Harisankar P S
10
13
  autorequire:
11
14
  bindir: bin
12
15
  cert_chain: []
13
-
14
- date: 2009-07-15 00:00:00 -04:00
15
- default_executable:
16
+ date: 2013-10-06 00:00:00.000000000 Z
16
17
  dependencies: []
17
-
18
- description: XMPP4R is an XMPP/Jabber library for Ruby.
19
- email: xmpp4r-devel@gna.org
18
+ description: XMPP/Jabber library for ruby
19
+ email: mailme@hsps.in
20
20
  executables: []
21
-
22
21
  extensions: []
23
-
24
- extra_rdoc_files:
22
+ extra_rdoc_files:
25
23
  - CHANGELOG
26
24
  - COPYING
27
25
  - LICENSE
28
26
  - README.rdoc
29
27
  - README_ruby19.txt
30
- files:
28
+ files:
31
29
  - CHANGELOG
32
30
  - COPYING
33
31
  - LICENSE
@@ -111,6 +109,9 @@ files:
111
109
  - lib/xmpp4r/discovery/helper/responder.rb
112
110
  - lib/xmpp4r/discovery/iq/discoinfo.rb
113
111
  - lib/xmpp4r/discovery/iq/discoitems.rb
112
+ - lib/xmpp4r/entity_time.rb
113
+ - lib/xmpp4r/entity_time/iq.rb
114
+ - lib/xmpp4r/entity_time/responder.rb
114
115
  - lib/xmpp4r/errors.rb
115
116
  - lib/xmpp4r/feature_negotiation.rb
116
117
  - lib/xmpp4r/feature_negotiation/iq/feature.rb
@@ -139,6 +140,13 @@ files:
139
140
  - lib/xmpp4r/muc/x/muc.rb
140
141
  - lib/xmpp4r/muc/x/mucuserinvite.rb
141
142
  - lib/xmpp4r/muc/x/mucuseritem.rb
143
+ - lib/xmpp4r/observable.rb
144
+ - lib/xmpp4r/observable/contact.rb
145
+ - lib/xmpp4r/observable/helper.rb
146
+ - lib/xmpp4r/observable/observable_thing.rb
147
+ - lib/xmpp4r/observable/pubsub.rb
148
+ - lib/xmpp4r/observable/subscription.rb
149
+ - lib/xmpp4r/observable/thread_store.rb
142
150
  - lib/xmpp4r/presence.rb
143
151
  - lib/xmpp4r/pubsub.rb
144
152
  - lib/xmpp4r/pubsub/children/configuration.rb
@@ -196,6 +204,7 @@ files:
196
204
  - test/dataforms/tc_data.rb
197
205
  - test/delay/tc_xdelay.rb
198
206
  - test/discovery/tc_responder.rb
207
+ - test/entity_time/tc_responder.rb
199
208
  - test/last/tc_helper.rb
200
209
  - test/lib/assert_equal_xml.rb
201
210
  - test/lib/clienttester.rb
@@ -242,41 +251,38 @@ files:
242
251
  - tools/gen_requires.bash
243
252
  - tools/xmpp4r-gemspec-test.rb
244
253
  - xmpp4r.gemspec
245
- has_rdoc: true
246
- homepage: http://home.gna.org/xmpp4r/
254
+ homepage: https://xmpp4r.github.io
247
255
  licenses: []
248
-
249
256
  post_install_message:
250
- rdoc_options:
257
+ rdoc_options:
251
258
  - --quiet
252
259
  - --title
253
- - XMPP4R is an XMPP/Jabber library for Ruby.
260
+ - XMPP/Jabber library for ruby
254
261
  - --opname
255
262
  - index.html
256
263
  - --main
257
264
  - lib/xmpp4r.rb
258
265
  - --line-numbers
259
266
  - --inline-source
260
- require_paths:
267
+ require_paths:
261
268
  - lib
262
- required_ruby_version: !ruby/object:Gem::Requirement
263
- requirements:
264
- - - ">="
265
- - !ruby/object:Gem::Version
269
+ required_ruby_version: !ruby/object:Gem::Requirement
270
+ none: false
271
+ requirements:
272
+ - - ! '>='
273
+ - !ruby/object:Gem::Version
266
274
  version: 1.8.4
267
- version:
268
- required_rubygems_version: !ruby/object:Gem::Requirement
269
- requirements:
270
- - - ">="
271
- - !ruby/object:Gem::Version
272
- version: "0"
273
- version:
275
+ required_rubygems_version: !ruby/object:Gem::Requirement
276
+ none: false
277
+ requirements:
278
+ - - ! '>='
279
+ - !ruby/object:Gem::Version
280
+ version: '0'
274
281
  requirements: []
275
-
276
282
  rubyforge_project: xmpp4r
277
- rubygems_version: 1.3.4
283
+ rubygems_version: 1.8.23
278
284
  signing_key:
279
285
  specification_version: 3
280
- summary: XMPP4R is an XMPP/Jabber library for Ruby.
286
+ summary: XMPP/Jabber library for ruby
281
287
  test_files: []
282
-
288
+ has_rdoc: true