sprsquish-blather 0.1 → 0.2.3

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 (73) hide show
  1. data/LICENSE +2 -0
  2. data/README.rdoc +100 -0
  3. data/Rakefile +110 -0
  4. data/examples/drb_client.rb +5 -0
  5. data/examples/echo.rb +18 -0
  6. data/ext/extconf.rb +65 -0
  7. data/ext/push_parser.c +231 -0
  8. data/lib/blather/client.rb +219 -44
  9. data/lib/blather/{core/sugar.rb → core_ext/active_support.rb} +25 -13
  10. data/lib/blather/core_ext/libxml.rb +28 -0
  11. data/lib/blather/errors/sasl_error.rb +87 -0
  12. data/lib/blather/errors/stanza_error.rb +262 -0
  13. data/lib/blather/errors/stream_error.rb +253 -0
  14. data/lib/blather/errors.rb +48 -0
  15. data/lib/blather/{core/jid.rb → jid.rb} +15 -26
  16. data/lib/blather/{core/roster.rb → roster.rb} +22 -0
  17. data/lib/blather/{core/roster_item.rb → roster_item.rb} +39 -8
  18. data/lib/blather/stanza/iq/disco.rb +11 -0
  19. data/lib/blather/stanza/iq/discos/disco_info.rb +86 -0
  20. data/lib/blather/stanza/iq/discos/disco_items.rb +61 -0
  21. data/lib/blather/stanza/iq/query.rb +51 -0
  22. data/lib/blather/stanza/iq/roster.rb +90 -0
  23. data/lib/blather/stanza/iq.rb +38 -0
  24. data/lib/blather/stanza/message.rb +58 -0
  25. data/lib/blather/stanza/presence/status.rb +78 -0
  26. data/lib/blather/stanza/presence/subscription.rb +72 -0
  27. data/lib/blather/stanza/presence.rb +45 -0
  28. data/lib/blather/stanza.rb +101 -0
  29. data/lib/blather/stream/client.rb +26 -0
  30. data/lib/blather/stream/component.rb +34 -0
  31. data/lib/blather/stream/parser.rb +70 -0
  32. data/lib/blather/stream/resource.rb +48 -0
  33. data/lib/blather/stream/sasl.rb +173 -0
  34. data/lib/blather/stream/session.rb +36 -0
  35. data/lib/blather/stream/stream_handler.rb +39 -0
  36. data/lib/blather/stream/tls.rb +33 -0
  37. data/lib/blather/stream.rb +249 -0
  38. data/lib/blather/xmpp_node.rb +199 -0
  39. data/lib/blather.rb +40 -41
  40. data/spec/blather/core_ext/libxml_spec.rb +58 -0
  41. data/spec/blather/errors/sasl_error_spec.rb +56 -0
  42. data/spec/blather/errors/stanza_error_spec.rb +148 -0
  43. data/spec/blather/errors/stream_error_spec.rb +114 -0
  44. data/spec/blather/errors_spec.rb +40 -0
  45. data/spec/blather/{core/jid_spec.rb → jid_spec.rb} +9 -1
  46. data/spec/blather/{core/roster_item_spec.rb → roster_item_spec.rb} +6 -1
  47. data/spec/blather/{core/roster_spec.rb → roster_spec.rb} +16 -6
  48. data/spec/blather/stanza/iq/discos/disco_info_spec.rb +207 -0
  49. data/spec/blather/stanza/iq/discos/disco_items_spec.rb +136 -0
  50. data/spec/blather/stanza/iq/query_spec.rb +34 -0
  51. data/spec/blather/stanza/iq/roster_spec.rb +123 -0
  52. data/spec/blather/stanza/iq_spec.rb +40 -0
  53. data/spec/blather/stanza/message_spec.rb +52 -0
  54. data/spec/blather/stanza/presence/status_spec.rb +102 -0
  55. data/spec/blather/stanza/presence/subscription_spec.rb +85 -0
  56. data/spec/blather/stanza/presence_spec.rb +53 -0
  57. data/spec/blather/{core/stanza_spec.rb → stanza_spec.rb} +14 -2
  58. data/spec/blather/stream/client_spec.rb +787 -0
  59. data/spec/blather/stream/component_spec.rb +86 -0
  60. data/spec/blather/{core/xmpp_node_spec.rb → xmpp_node_spec.rb} +76 -23
  61. data/spec/build_safe.rb +20 -0
  62. data/spec/spec_helper.rb +7 -17
  63. metadata +79 -59
  64. data/CHANGELOG +0 -1
  65. data/blather.gemspec +0 -73
  66. data/lib/blather/callback.rb +0 -24
  67. data/lib/blather/core/errors.rb +0 -24
  68. data/lib/blather/core/stanza.rb +0 -90
  69. data/lib/blather/core/stream.rb +0 -179
  70. data/lib/blather/core/xmpp_node.rb +0 -95
  71. data/lib/blather/extensions/last_activity.rb +0 -57
  72. data/lib/blather/extensions/version.rb +0 -85
  73. data/spec/blather/core/stream_spec.rb +0 -263
@@ -0,0 +1,86 @@
1
+ require File.join(File.dirname(__FILE__), *%w[.. .. spec_helper])
2
+
3
+ describe 'Blather::Stream::Component' do
4
+ class MockServer; end
5
+ module ServerMock
6
+ def receive_data(data)
7
+ @server ||= MockServer.new
8
+ @server.receive_data data, self
9
+ end
10
+ end
11
+
12
+ def mocked_server(times = nil, &block)
13
+ @client ||= mock()
14
+ @client.stubs(:stopped) unless @client.respond_to?(:stopped)
15
+ @client.stubs(:jid=) unless @client.respond_to?(:jid=)
16
+
17
+ MockServer.any_instance.expects(:receive_data).send(*(times ? [:times, times] : [:at_least, 1])).with &block
18
+ EventMachine::run {
19
+ # Mocked server
20
+ EventMachine::start_server '127.0.0.1', 12345, ServerMock
21
+
22
+ # Stream connection
23
+ EM.connect('127.0.0.1', 12345, Stream::Component, @client, @jid || 'comp.id', 'secret') { |c| @stream = c }
24
+ }
25
+ end
26
+
27
+ it 'can be started' do
28
+ client = mock()
29
+ params = [client, 'comp.id', 'secret', 'host', 1234]
30
+ EM.expects(:connect).with do |*parms|
31
+ parms[0] == 'host' &&
32
+ parms[1] == 1234 &&
33
+ parms[3] == client &&
34
+ parms[4] == 'comp.id'
35
+ end
36
+
37
+ Stream::Component.start *params
38
+ end
39
+
40
+ it 'shakes hands with the server' do
41
+ state = nil
42
+ mocked_server(2) do |val, server|
43
+ case state
44
+ when nil
45
+ state = :started
46
+ server.send_data "<?xml version='1.0'?><stream:stream xmlns='jabber:component:accept' xmlns:stream='http://etherx.jabber.org/streams' id='12345'>"
47
+ val.must_match(/stream:stream/)
48
+
49
+ when :started
50
+ server.send_data '<handshake/>'
51
+ EM.stop
52
+ val.must_equal "<handshake>#{Digest::SHA1.hexdigest('12345'+"secret")}</handshake>"
53
+
54
+ end
55
+ end
56
+ end
57
+
58
+ it 'starts the stream once the connection is complete' do
59
+ mocked_server(1) { |val, _| EM.stop; val.must_match(/stream:stream/) }
60
+ end
61
+
62
+ it 'sends stanzas to the client when the stream is ready' do
63
+ @client = mock(:stream_started)
64
+ @client.expects(:call).with do |n|
65
+ EM.stop
66
+ n.kind_of?(Stanza::Message) && @stream.ready?.must_equal(true)
67
+ end
68
+
69
+ state = nil
70
+ mocked_server(2) do |val, server|
71
+ case state
72
+ when nil
73
+ state = :started
74
+ server.send_data "<?xml version='1.0'?><stream:stream xmlns='jabber:component:accept' xmlns:stream='http://etherx.jabber.org/streams' id='12345'>"
75
+ val.must_match(/stream:stream/)
76
+
77
+ when :started
78
+ server.send_data '<handshake/>'
79
+ server.send_data "<message to='comp.id' from='d@e/f' type='chat' xml:lang='en'><body>Message!</body></message>"
80
+ val.must_equal "<handshake>#{Digest::SHA1.hexdigest('12345'+"secret")}</handshake>"
81
+
82
+ end
83
+ end
84
+ end
85
+
86
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), *%w[.. .. spec_helper])
1
+ require File.join(File.dirname(__FILE__), *%w[.. spec_helper])
2
2
 
3
3
  describe 'Blather::XMPPNode' do
4
4
  it 'generates a new node' do
@@ -14,38 +14,85 @@ describe 'Blather::XMPPNode' do
14
14
 
15
15
  it 'sets the namespace on creation' do
16
16
  class Foo < XMPPNode; end
17
- Foo.xmlns = 'foo'
18
- Foo.new('foo').xmlns.must_equal 'foo'
17
+ Foo.ns = 'foo'
18
+ Foo.new('foo').namespace.must_equal 'foo'
19
19
  end
20
20
 
21
21
  it 'registers sub classes' do
22
22
  class Foo < XMPPNode; register 'foo', 'foo:bar'; end
23
23
  Foo.name.must_equal 'foo'
24
- Foo.xmlns.must_equal 'foo:bar'
24
+ Foo.ns.must_equal 'foo:bar'
25
25
  XMPPNode.class_from_registration('foo', 'foo:bar').must_equal Foo
26
26
  end
27
27
 
28
28
  it 'imports another node' do
29
29
  class Foo < XMPPNode; register 'foo', 'foo:bar'; end
30
30
  n = XMPPNode.new('foo')
31
- n.xmlns = 'foo:bar'
31
+ n.namespace = 'foo:bar'
32
32
  XMPPNode.import(n).must_be_kind_of Foo
33
33
  end
34
34
 
35
+ it 'provides an attribute_reader' do
36
+ class Foo < XMPPNode
37
+ attribute_reader :foo
38
+ end
39
+ f = Foo.new
40
+ f.must_respond_to :foo
41
+ f.foo.must_be_nil
42
+ f.attributes[:foo] = 'bar'
43
+ f.foo.must_equal :bar
44
+ end
45
+
46
+ it 'provides an attribute_reader and not convert to syms' do
47
+ class Foo < XMPPNode
48
+ attribute_reader :foo, :to_sym => false
49
+ end
50
+ f = Foo.new
51
+ f.must_respond_to :foo
52
+ f.foo.must_be_nil
53
+ f.attributes[:foo] = 'bar'
54
+ f.foo.must_equal 'bar'
55
+ end
56
+
57
+ it 'provides an attribute_writer' do
58
+ class Foo < XMPPNode
59
+ attribute_writer :foo
60
+ end
61
+ f = Foo.new
62
+ f.attributes[:foo].must_be_nil
63
+ f.foo = 'bar'
64
+ f.attributes[:foo].must_equal 'bar'
65
+ end
66
+
67
+ it 'provides an attribute_accessor' do
68
+ class Foo < XMPPNode
69
+ attribute_accessor :foo
70
+ attribute_accessor :bar, :to_sym => false
71
+ end
72
+ f = Foo.new
73
+ f.must_respond_to :foo
74
+ f.foo.must_be_nil
75
+ f.foo = 'bar'
76
+ f.foo.must_equal :bar
77
+
78
+ f.must_respond_to :bar
79
+ f.bar.must_be_nil
80
+ f.bar = 'baz'
81
+ f.bar.must_equal 'baz'
82
+ end
83
+
35
84
  it 'can convert itself into a stanza' do
36
85
  class Foo < XMPPNode; register 'foo'; end
37
86
  n = XMPPNode.new('foo')
38
87
  n.to_stanza.must_be_kind_of Foo
39
88
  end
40
89
 
41
- it 'provides "attr_accessor" for xmlns' do
90
+ it 'provides "attr_accessor" for namespace' do
42
91
  n = XMPPNode.new('foo')
43
- n.xmlns.must_be_nil
44
- n['xmlns'].must_be_nil
92
+ n.namespace.must_be_nil
45
93
 
46
- n.xmlns = 'foo:bar'
47
- n.xmlns.must_equal 'foo:bar'
48
- n['xmlns'].must_equal 'foo:bar'
94
+ n.namespace = 'foo:bar'
95
+ n.namespace.must_equal 'foo:bar'
49
96
  end
50
97
 
51
98
  it 'will remove a child element' do
@@ -53,22 +100,22 @@ describe 'Blather::XMPPNode' do
53
100
  n << XMPPNode.new('bar')
54
101
  n << XMPPNode.new('bar')
55
102
 
56
- n.find('bar').size.must_equal 2
103
+ n.find(:bar).size.must_equal 2
57
104
  n.remove_child 'bar'
58
- n.find('bar').size.must_equal 1
105
+ n.find(:bar).size.must_equal 1
59
106
  end
60
107
 
61
108
  it 'will remove a child with a specific xmlns' do
62
109
  n = XMPPNode.new 'foo'
63
110
  n << XMPPNode.new('bar')
64
111
  c = XMPPNode.new('bar')
65
- c.xmlns = 'foo:bar'
112
+ c.namespace = 'foo:bar'
66
113
  n << c
67
114
 
68
- n.find('bar').size.must_equal 2
115
+ n.find(:bar).size.must_equal 2
69
116
  n.remove_child 'bar', 'foo:bar'
70
- n.find('bar').size.must_equal 1
71
- n.find('bar').first.xmlns.must_be_nil
117
+ n.find(:bar).size.must_equal 1
118
+ n.find(:bar).first.namespace.must_be_nil
72
119
  end
73
120
 
74
121
  it 'will remove all child elements' do
@@ -76,9 +123,9 @@ describe 'Blather::XMPPNode' do
76
123
  n << XMPPNode.new('bar')
77
124
  n << XMPPNode.new('bar')
78
125
 
79
- n.find('bar').size.must_equal 2
126
+ n.find(:bar).size.must_equal 2
80
127
  n.remove_children 'bar'
81
- n.find('bar').size.must_equal 0
128
+ n.find(:bar).size.must_equal 0
82
129
  end
83
130
 
84
131
  it 'provides a helper to grab content from a child' do
@@ -113,18 +160,24 @@ describe 'Blather::XMPPNode' do
113
160
  n['foo'].must_equal 'bar'
114
161
  end
115
162
 
116
- it 'cuts line breaks out of #to_s' do
163
+ it 'cuts line breaks out of #to_xml' do
117
164
  n = XMPPNode.new 'foo'
118
165
  n << XMPPNode.new('bar', 'baz')
119
- n.to_s.scan(">\n<").size.must_equal 0
166
+ n.to_xml.scan(">\n<").size.must_equal 0
120
167
  end
121
168
 
122
169
  it 'overrides #find to find without xpath' do
123
170
  n = XMPPNode.new 'foo'
124
171
  n << XMPPNode.new('bar', 'baz')
125
- n.find('bar').must_be_kind_of Array
172
+ n.find(:bar).must_be_kind_of Array
126
173
 
127
174
  XML::Document.new.root = n
128
- n.find('bar').must_be_kind_of XML::XPath::Object
175
+ n.find(:bar).must_be_kind_of XML::XPath::Object
176
+ end
177
+
178
+ it 'can find using a symbol' do
179
+ n = XMPPNode.new 'foo'
180
+ n << XMPPNode.new('bar', 'baz')
181
+ n.find(:bar).first.to_s.must_equal "<bar>baz</bar>"
129
182
  end
130
183
  end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ require 'yaml'
3
+
4
+ if ARGV.size < 1
5
+ puts "Usage: github-test.rb my-project.gemspec"
6
+ exit
7
+ end
8
+
9
+ require 'rubygems/specification'
10
+ data = File.read(ARGV[0])
11
+ spec = nil
12
+
13
+ if data !~ %r{!ruby/object:Gem::Specification}
14
+ Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
15
+ else
16
+ spec = YAML.load(data)
17
+ end
18
+
19
+ puts spec
20
+ puts "OK"
data/spec/spec_helper.rb CHANGED
@@ -2,27 +2,23 @@ require File.join(File.dirname(__FILE__), *%w[.. lib blather])
2
2
  require 'rubygems'
3
3
  require 'minitest/spec'
4
4
  require 'mocha'
5
+ require 'mocha/expectation_error'
5
6
 
6
7
  module MiniTest
7
- if MINI_DIR =~ %r{^./}
8
- require 'pathname'
9
- path = Pathname.new(MINI_DIR).realpath
10
- # remove_const 'MINI_DIR'
11
- # const_set 'MINI_DIR', path.to_s
12
- end
8
+ require 'pathname' if MINI_DIR =~ %r{^./}
13
9
 
14
10
  module Assertions
15
- def assert_change(obj, method, args = {}, msg = nil)
11
+ def assert_change(stmt, args = {}, msg = nil)
16
12
  msg ||= proc {
17
- m = "Expected #{obj}.#{method} to change"
13
+ m = "Expected #{stmt} to change"
18
14
  m << " by #{mu_pp args[:by]}" if args[:by]
19
15
  m << (args[:from] ? " from #{mu_pp args[:from]}" : '') + " to #{mu_pp args[:to]}" if args[:to]
20
16
  m
21
17
  }.call
22
18
 
23
- init_val = eval(obj).__send__(method)
19
+ init_val = eval(stmt)
24
20
  yield
25
- new_val = eval(obj).__send__(method)
21
+ new_val = eval(stmt)
26
22
 
27
23
  assert_equal(args[:by], (new_val - init_val), msg) if args[:by]
28
24
  assert_equal([args[:from], args[:to]], [(init_val if args[:from]), new_val], msg) if args[:to]
@@ -33,17 +29,11 @@ end
33
29
 
34
30
  class Object
35
31
  def must_change *args, &block
36
- return MiniTest::Spec.current.assert_change(*args, &self) if Proc === self
37
- return MiniTest::Spec.current.assert_change(args.first, self) if args.size == 1
38
- return MiniTest::Spec.current.assert_change(self, *args)
32
+ return MiniTest::Spec.current.assert_change(*args, &self)
39
33
  end
40
34
  end
41
35
 
42
- require 'mocha/expectation_error'
43
-
44
36
  include Blather
45
37
  include MiniTest
46
38
 
47
- LOG.level = Logger::INFO
48
-
49
39
  Unit.autorun
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprsquish-blather
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Smick
@@ -9,80 +9,84 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-17 00:00:00 -08:00
12
+ date: 2009-05-07 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: eventmachine
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
- - - ">"
21
+ - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 0.0.0
23
+ version: 0.12.6
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
- name: libxml
26
+ name: libxml-ruby
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
29
- - - ">"
31
+ - - ">="
30
32
  - !ruby/object:Gem::Version
31
- version: 0.0.0
33
+ version: 1.1.3
32
34
  version:
33
- description: An evented XMPP library written on EventMachine and libxml-ruby
34
- email: jeff.smick@squishtech.com
35
+ description:
36
+ email: sprsquish@gmail.com
35
37
  executables: []
36
38
 
37
- extensions: []
38
-
39
+ extensions:
40
+ - Rakefile
39
41
  extra_rdoc_files:
40
- - README.rdoc
41
- - CHANGELOG
42
42
  - LICENSE
43
- files:
44
43
  - README.rdoc
45
- - CHANGELOG
46
- - blather.gemspec
44
+ files:
45
+ - examples/drb_client.rb
47
46
  - examples/echo.rb
48
- - examples/shell_client.rb
49
- - lib/blather/callback.rb
50
- - lib/blather/client.rb
51
- - lib/blather/core/errors.rb
52
- - lib/blather/core/jid.rb
53
- - lib/blather/core/roster.rb
54
- - lib/blather/core/roster_item.rb
55
- - lib/blather/core/stanza.rb
56
- - lib/blather/core/stanzas/error.rb
57
- - lib/blather/core/stanzas/iq.rb
58
- - lib/blather/core/stanzas/iqs/queries/roster.rb
59
- - lib/blather/core/stanzas/iqs/query.rb
60
- - lib/blather/core/stanzas/message.rb
61
- - lib/blather/core/stanzas/presence.rb
62
- - lib/blather/core/stanzas/presences/status.rb
63
- - lib/blather/core/stanzas/presences/subscription.rb
64
- - lib/blather/core/stream.rb
65
- - lib/blather/core/streams/parser.rb
66
- - lib/blather/core/streams/resource.rb
67
- - lib/blather/core/streams/sasl.rb
68
- - lib/blather/core/streams/session.rb
69
- - lib/blather/core/streams/tls.rb
70
- - lib/blather/core/sugar.rb
71
- - lib/blather/core/xmpp_node.rb
72
- - lib/blather/extensions/last_activity.rb
73
- - lib/blather/extensions/version.rb
47
+ - ext/extconf.rb
48
+ - ext/push_parser.c
49
+ - lib/autotest/discover.rb
50
+ - lib/autotest/spec.rb
74
51
  - lib/blather.rb
52
+ - lib/blather/client.rb
53
+ - lib/blather/core_ext/active_support.rb
54
+ - lib/blather/core_ext/libxml.rb
55
+ - lib/blather/errors.rb
56
+ - lib/blather/errors/sasl_error.rb
57
+ - lib/blather/errors/stanza_error.rb
58
+ - lib/blather/errors/stream_error.rb
59
+ - lib/blather/jid.rb
60
+ - lib/blather/roster.rb
61
+ - lib/blather/roster_item.rb
62
+ - lib/blather/stanza.rb
63
+ - lib/blather/stanza/iq.rb
64
+ - lib/blather/stanza/iq/disco.rb
65
+ - lib/blather/stanza/iq/discos/disco_info.rb
66
+ - lib/blather/stanza/iq/discos/disco_items.rb
67
+ - lib/blather/stanza/iq/query.rb
68
+ - lib/blather/stanza/iq/roster.rb
69
+ - lib/blather/stanza/message.rb
70
+ - lib/blather/stanza/presence.rb
71
+ - lib/blather/stanza/presence/status.rb
72
+ - lib/blather/stanza/presence/subscription.rb
73
+ - lib/blather/stream.rb
74
+ - lib/blather/stream/client.rb
75
+ - lib/blather/stream/component.rb
76
+ - lib/blather/stream/parser.rb
77
+ - lib/blather/stream/resource.rb
78
+ - lib/blather/stream/sasl.rb
79
+ - lib/blather/stream/session.rb
80
+ - lib/blather/stream/stream_handler.rb
81
+ - lib/blather/stream/tls.rb
82
+ - lib/blather/xmpp_node.rb
75
83
  - LICENSE
84
+ - README.rdoc
76
85
  has_rdoc: true
77
- homepage:
86
+ homepage: http://github.com/sprsquish/blather
78
87
  post_install_message:
79
88
  rdoc_options:
80
- - --line-numbers
81
- - --inline-source
82
- - --title
83
- - Blather
84
- - --main
85
- - README
89
+ - --charset=UTF-8
86
90
  require_paths:
87
91
  - lib
88
92
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -102,15 +106,31 @@ requirements: []
102
106
  rubyforge_project: squishtech
103
107
  rubygems_version: 1.2.0
104
108
  signing_key:
105
- specification_version: 2
106
- summary: Evented XMPP library
109
+ specification_version: 3
110
+ summary: An evented XMPP library written on EventMachine and libxml-ruby
107
111
  test_files:
108
- - lib/autotest/discover.rb
109
- - lib/autotest/spec.rb
110
- - spec/blather/core/jid_spec.rb
111
- - spec/blather/core/roster_item_spec.rb
112
- - spec/blather/core/roster_spec.rb
113
- - spec/blather/core/stanza_spec.rb
114
- - spec/blather/core/stream_spec.rb
115
- - spec/blather/core/xmpp_node_spec.rb
112
+ - spec/blather/core_ext/libxml_spec.rb
113
+ - spec/blather/errors/sasl_error_spec.rb
114
+ - spec/blather/errors/stanza_error_spec.rb
115
+ - spec/blather/errors/stream_error_spec.rb
116
+ - spec/blather/errors_spec.rb
117
+ - spec/blather/jid_spec.rb
118
+ - spec/blather/roster_item_spec.rb
119
+ - spec/blather/roster_spec.rb
120
+ - spec/blather/stanza/iq/discos/disco_info_spec.rb
121
+ - spec/blather/stanza/iq/discos/disco_items_spec.rb
122
+ - spec/blather/stanza/iq/query_spec.rb
123
+ - spec/blather/stanza/iq/roster_spec.rb
124
+ - spec/blather/stanza/iq_spec.rb
125
+ - spec/blather/stanza/message_spec.rb
126
+ - spec/blather/stanza/presence/status_spec.rb
127
+ - spec/blather/stanza/presence/subscription_spec.rb
128
+ - spec/blather/stanza/presence_spec.rb
129
+ - spec/blather/stanza_spec.rb
130
+ - spec/blather/stream/client_spec.rb
131
+ - spec/blather/stream/component_spec.rb
132
+ - spec/blather/xmpp_node_spec.rb
133
+ - spec/build_safe.rb
116
134
  - spec/spec_helper.rb
135
+ - examples/drb_client.rb
136
+ - examples/echo.rb
data/CHANGELOG DELETED
@@ -1 +0,0 @@
1
- v0.1 Initial release (birth!)
data/blather.gemspec DELETED
@@ -1,73 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.rubyforge_project = 'squishtech'
5
-
6
- s.name = 'blather'
7
- s.description = 'An evented XMPP library written on EventMachine and libxml-ruby'
8
- s.summary = 'Evented XMPP library'
9
- s.version = '0.1'
10
- s.date = '2008-11-17'
11
-
12
- s.authors = ['Jeff Smick']
13
- s.email = 'jeff.smick@squishtech.com'
14
-
15
- s.files = %w[
16
- README.rdoc
17
- CHANGELOG
18
- blather.gemspec
19
- examples/echo.rb
20
- examples/shell_client.rb
21
- lib/blather/callback.rb
22
- lib/blather/client.rb
23
- lib/blather/core/errors.rb
24
- lib/blather/core/jid.rb
25
- lib/blather/core/roster.rb
26
- lib/blather/core/roster_item.rb
27
- lib/blather/core/stanza.rb
28
- lib/blather/core/stanzas/error.rb
29
- lib/blather/core/stanzas/iq.rb
30
- lib/blather/core/stanzas/iqs/queries/roster.rb
31
- lib/blather/core/stanzas/iqs/query.rb
32
- lib/blather/core/stanzas/message.rb
33
- lib/blather/core/stanzas/presence.rb
34
- lib/blather/core/stanzas/presences/status.rb
35
- lib/blather/core/stanzas/presences/subscription.rb
36
- lib/blather/core/stream.rb
37
- lib/blather/core/streams/parser.rb
38
- lib/blather/core/streams/resource.rb
39
- lib/blather/core/streams/sasl.rb
40
- lib/blather/core/streams/session.rb
41
- lib/blather/core/streams/tls.rb
42
- lib/blather/core/sugar.rb
43
- lib/blather/core/xmpp_node.rb
44
- lib/blather/extensions/last_activity.rb
45
- lib/blather/extensions/version.rb
46
- lib/blather.rb
47
- LICENSE
48
- ]
49
-
50
- s.test_files = %w[
51
- lib/autotest/discover.rb
52
- lib/autotest/spec.rb
53
- spec/blather/core/jid_spec.rb
54
- spec/blather/core/roster_item_spec.rb
55
- spec/blather/core/roster_spec.rb
56
- spec/blather/core/stanza_spec.rb
57
- spec/blather/core/stream_spec.rb
58
- spec/blather/core/xmpp_node_spec.rb
59
- spec/spec_helper.rb
60
- ]
61
-
62
- s.extra_rdoc_files = %w[
63
- README.rdoc
64
- CHANGELOG
65
- LICENSE
66
- ]
67
-
68
- s.has_rdoc = true
69
- s.rdoc_options = %w[--line-numbers --inline-source --title Blather --main README]
70
-
71
- s.add_dependency('eventmachine', ['> 0.0.0'])
72
- s.add_dependency('libxml', ['> 0.0.0'])
73
- end
@@ -1,24 +0,0 @@
1
- module Blather
2
-
3
- class Callback
4
- include Comparable
5
-
6
- attr_accessor :priority
7
-
8
- def initialize(priority = 0, &callback)
9
- @priority = priority
10
- @callback = callback
11
- end
12
-
13
- def call(*args)
14
- @callback.call(*args)
15
- end
16
-
17
- # Favor higher numbers
18
- def <=>(o)
19
- self.priority <=> o.priority
20
- end
21
-
22
- end #Callback
23
-
24
- end
@@ -1,24 +0,0 @@
1
- module Blather
2
- # Main error class
3
- class BlatherError < StandardError; end
4
-
5
- # Stream errors
6
- class StreamError < BlatherError
7
- attr_accessor :type, :text
8
-
9
- def initialize(node)
10
- @type = node.detect { |n| n.name != 'text' && n['xmlns'] == 'urn:ietf:params:xml:ns:xmpp-streams' }
11
- @text = node.detect { |n| n.name == 'text' }
12
-
13
- @extra = node.detect { |n| n['xmlns'] != 'urn:ietf:params:xml:ns:xmpp-streams' }
14
- end
15
-
16
- def to_s
17
- "Stream Error (#{type.name}) #{"[#{@extra.name}]" if @extra}: #{text.content if text}"
18
- end
19
- end
20
-
21
- # Stanza errors
22
- class StanzaError < StandardError; end
23
- class ArgumentError < StanzaError; end
24
- end