cancer 0.1.0.a1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.autotest +3 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE.txt +22 -0
  4. data/Rakefile +46 -0
  5. data/VERSION +1 -0
  6. data/cancer.gemspec +156 -0
  7. data/documentation/STREAM_INITIATION.markdown +18 -0
  8. data/examples/example.rb +80 -0
  9. data/examples/example_2.rb +20 -0
  10. data/examples/example_em.rb +11 -0
  11. data/examples/example_em_helper.rb +23 -0
  12. data/examples/example_im_roster.rb +26 -0
  13. data/examples/example_xep_0004.rb +124 -0
  14. data/examples/example_xep_0047.rb +35 -0
  15. data/examples/example_xep_0050.rb +78 -0
  16. data/examples/example_xep_0065.rb +66 -0
  17. data/examples/example_xep_0096.dup.rb +40 -0
  18. data/examples/example_xep_0096_xep_0047.rb +42 -0
  19. data/examples/example_xep_0096_xep_0065.rb +40 -0
  20. data/lib/cancer.rb +122 -0
  21. data/lib/cancer/adapter.rb +33 -0
  22. data/lib/cancer/adapters/em.rb +88 -0
  23. data/lib/cancer/adapters/socket.rb +122 -0
  24. data/lib/cancer/builder.rb +28 -0
  25. data/lib/cancer/controller.rb +32 -0
  26. data/lib/cancer/dependencies.rb +187 -0
  27. data/lib/cancer/events/abstract_event.rb +10 -0
  28. data/lib/cancer/events/base_matchers.rb +63 -0
  29. data/lib/cancer/events/binary_matchers.rb +30 -0
  30. data/lib/cancer/events/eventable.rb +92 -0
  31. data/lib/cancer/events/exception_events.rb +28 -0
  32. data/lib/cancer/events/handler.rb +33 -0
  33. data/lib/cancer/events/manager.rb +130 -0
  34. data/lib/cancer/events/named_events.rb +25 -0
  35. data/lib/cancer/events/proc_matcher.rb +16 -0
  36. data/lib/cancer/events/xml_events.rb +44 -0
  37. data/lib/cancer/exceptions.rb +53 -0
  38. data/lib/cancer/jid.rb +215 -0
  39. data/lib/cancer/lock.rb +32 -0
  40. data/lib/cancer/spec.rb +35 -0
  41. data/lib/cancer/spec/error.rb +18 -0
  42. data/lib/cancer/spec/extentions.rb +79 -0
  43. data/lib/cancer/spec/matcher.rb +30 -0
  44. data/lib/cancer/spec/mock_adapter.rb +139 -0
  45. data/lib/cancer/spec/mock_stream.rb +15 -0
  46. data/lib/cancer/spec/transcript.rb +107 -0
  47. data/lib/cancer/stream.rb +182 -0
  48. data/lib/cancer/stream/builder.rb +20 -0
  49. data/lib/cancer/stream/controller.rb +36 -0
  50. data/lib/cancer/stream/event_helper.rb +12 -0
  51. data/lib/cancer/stream/xep.rb +52 -0
  52. data/lib/cancer/stream_parser.rb +144 -0
  53. data/lib/cancer/support.rb +27 -0
  54. data/lib/cancer/support/hash.rb +32 -0
  55. data/lib/cancer/support/string.rb +22 -0
  56. data/lib/cancer/synchronized_stanza.rb +79 -0
  57. data/lib/cancer/thread_pool.rb +118 -0
  58. data/lib/cancer/xep.rb +43 -0
  59. data/lib/cancer/xeps/core.rb +109 -0
  60. data/lib/cancer/xeps/core/bind.rb +33 -0
  61. data/lib/cancer/xeps/core/sasl.rb +113 -0
  62. data/lib/cancer/xeps/core/session.rb +22 -0
  63. data/lib/cancer/xeps/core/stream.rb +18 -0
  64. data/lib/cancer/xeps/core/terminator.rb +21 -0
  65. data/lib/cancer/xeps/core/tls.rb +34 -0
  66. data/lib/cancer/xeps/im.rb +323 -0
  67. data/lib/cancer/xeps/xep_0004_x_data.rb +692 -0
  68. data/lib/cancer/xeps/xep_0020_feature_neg.rb +35 -0
  69. data/lib/cancer/xeps/xep_0030_disco.rb +167 -0
  70. data/lib/cancer/xeps/xep_0047_ibb.rb +322 -0
  71. data/lib/cancer/xeps/xep_0050_commands.rb +256 -0
  72. data/lib/cancer/xeps/xep_0065_bytestreams.rb +306 -0
  73. data/lib/cancer/xeps/xep_0066_oob.rb +69 -0
  74. data/lib/cancer/xeps/xep_0095_si.rb +211 -0
  75. data/lib/cancer/xeps/xep_0096_si_filetransfer.rb +173 -0
  76. data/lib/cancer/xeps/xep_0114_component.rb +73 -0
  77. data/lib/cancer/xeps/xep_0115_caps.rb +180 -0
  78. data/lib/cancer/xeps/xep_0138_compress.rb +134 -0
  79. data/lib/cancer/xeps/xep_0144_rosterx.rb +250 -0
  80. data/lib/cancer/xeps/xep_0184_receipts.rb +40 -0
  81. data/lib/cancer/xeps/xep_0199_ping.rb +41 -0
  82. data/spec/spec.opts +2 -0
  83. data/spec/spec_helper.rb +14 -0
  84. data/spec/stream/stanza_errors_spec.rb +47 -0
  85. data/spec/stream/stream_errors_spec.rb +38 -0
  86. data/spec/stream/stream_initialization_spec.rb +160 -0
  87. data/spec/xep_0050/local_spec.rb +165 -0
  88. data/spec/xep_0050/remote_spec.rb +44 -0
  89. metadata +200 -0
@@ -0,0 +1,44 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Cancer::XEP_0050, '#remote' do
4
+
5
+ it "sends commands" do
6
+ dialog_with(:xeps => %w( xep-0050 )) do |stream|
7
+
8
+ session = stream.command('knave@wonderland.lit', 'config')
9
+ session.execute!
10
+ session.status.should == :completed
11
+
12
+ end.should_produce_transcript do |t|
13
+ t.out %{<iq type="set" to="knave@wonderland.lit" id="cancer-3"><command xmlns='http://jabber.org/protocol/commands' node='config' action='execute'/></iq>}
14
+
15
+ t.in %{<iq type='result' from='knave@wonderland.lit' id='cancer-3'><command xmlns='http://jabber.org/protocol/commands' sessionid='config-1' node='config' status='completed'><note type='info'>Service 'httpd' has been configured.</note></command></iq>}
16
+ end
17
+ end
18
+
19
+ it "sends multistage commands" do
20
+ dialog_with(:xeps => %w( xep-0050 )) do |stream|
21
+
22
+ stream.command('knave@wonderland.lit', 'config') do |session|
23
+
24
+ session.execute!
25
+ session.status.should == :executing
26
+
27
+ session.complete!
28
+ session.status.should == :completed
29
+
30
+ end
31
+
32
+
33
+ end.should_produce_transcript do |t|
34
+ t.out %{<iq type="set" to="knave@wonderland.lit" id="cancer-3"><command xmlns='http://jabber.org/protocol/commands' node='config' action='execute'/></iq>}
35
+
36
+ t.in %{<iq type='result' from='knave@wonderland.lit' id='cancer-3'><command xmlns='http://jabber.org/protocol/commands' sessionid='config-1' node='config' status='executing'><note type='info'>Service 'httpd' has been configured.</note><actions execute="complete"><complete/></actions></command></iq>}
37
+
38
+ t.out %{<iq type="set" to="knave@wonderland.lit" id="cancer-4"><command xmlns='http://jabber.org/protocol/commands' sessionid='config-1' node='config' action='complete'/></iq>}
39
+
40
+ t.in %{<iq type='result' from='knave@wonderland.lit' id='cancer-4'><command xmlns='http://jabber.org/protocol/commands' sessionid='config-1' node='config' status='completed'><note type='info'>Service 'httpd' has been configured.</note></command></iq>}
41
+ end
42
+ end
43
+
44
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cancer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.a1
5
+ platform: ruby
6
+ authors:
7
+ - Simon Menke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-28 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.3.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: astro-ruby-sasl
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.3
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: openssl-nonblock
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.2.0
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: net-dns
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.5.3
54
+ version:
55
+ description: Building XMPP clients should be easy.
56
+ email: simon.menke@gmail.com
57
+ engine_dependencies: {}
58
+
59
+ executables: []
60
+
61
+ extensions: []
62
+
63
+ extra_rdoc_files:
64
+ - LICENSE.txt
65
+ files:
66
+ - .autotest
67
+ - .gitignore
68
+ - LICENSE.txt
69
+ - Rakefile
70
+ - VERSION
71
+ - cancer.gemspec
72
+ - documentation/STREAM_INITIATION.markdown
73
+ - examples/example.rb
74
+ - examples/example_2.rb
75
+ - examples/example_em.rb
76
+ - examples/example_em_helper.rb
77
+ - examples/example_im_roster.rb
78
+ - examples/example_xep_0004.rb
79
+ - examples/example_xep_0047.rb
80
+ - examples/example_xep_0050.rb
81
+ - examples/example_xep_0065.rb
82
+ - examples/example_xep_0096.dup.rb
83
+ - examples/example_xep_0096_xep_0047.rb
84
+ - examples/example_xep_0096_xep_0065.rb
85
+ - lib/cancer.rb
86
+ - lib/cancer/adapter.rb
87
+ - lib/cancer/adapters/em.rb
88
+ - lib/cancer/adapters/socket.rb
89
+ - lib/cancer/builder.rb
90
+ - lib/cancer/controller.rb
91
+ - lib/cancer/dependencies.rb
92
+ - lib/cancer/events/abstract_event.rb
93
+ - lib/cancer/events/base_matchers.rb
94
+ - lib/cancer/events/binary_matchers.rb
95
+ - lib/cancer/events/eventable.rb
96
+ - lib/cancer/events/exception_events.rb
97
+ - lib/cancer/events/handler.rb
98
+ - lib/cancer/events/manager.rb
99
+ - lib/cancer/events/named_events.rb
100
+ - lib/cancer/events/proc_matcher.rb
101
+ - lib/cancer/events/xml_events.rb
102
+ - lib/cancer/exceptions.rb
103
+ - lib/cancer/jid.rb
104
+ - lib/cancer/lock.rb
105
+ - lib/cancer/spec.rb
106
+ - lib/cancer/spec/error.rb
107
+ - lib/cancer/spec/extentions.rb
108
+ - lib/cancer/spec/matcher.rb
109
+ - lib/cancer/spec/mock_adapter.rb
110
+ - lib/cancer/spec/mock_stream.rb
111
+ - lib/cancer/spec/transcript.rb
112
+ - lib/cancer/stream.rb
113
+ - lib/cancer/stream/builder.rb
114
+ - lib/cancer/stream/controller.rb
115
+ - lib/cancer/stream/event_helper.rb
116
+ - lib/cancer/stream/xep.rb
117
+ - lib/cancer/stream_parser.rb
118
+ - lib/cancer/support.rb
119
+ - lib/cancer/support/hash.rb
120
+ - lib/cancer/support/string.rb
121
+ - lib/cancer/synchronized_stanza.rb
122
+ - lib/cancer/thread_pool.rb
123
+ - lib/cancer/xep.rb
124
+ - lib/cancer/xeps/core.rb
125
+ - lib/cancer/xeps/core/bind.rb
126
+ - lib/cancer/xeps/core/sasl.rb
127
+ - lib/cancer/xeps/core/session.rb
128
+ - lib/cancer/xeps/core/stream.rb
129
+ - lib/cancer/xeps/core/terminator.rb
130
+ - lib/cancer/xeps/core/tls.rb
131
+ - lib/cancer/xeps/im.rb
132
+ - lib/cancer/xeps/xep_0004_x_data.rb
133
+ - lib/cancer/xeps/xep_0020_feature_neg.rb
134
+ - lib/cancer/xeps/xep_0030_disco.rb
135
+ - lib/cancer/xeps/xep_0047_ibb.rb
136
+ - lib/cancer/xeps/xep_0050_commands.rb
137
+ - lib/cancer/xeps/xep_0065_bytestreams.rb
138
+ - lib/cancer/xeps/xep_0066_oob.rb
139
+ - lib/cancer/xeps/xep_0095_si.rb
140
+ - lib/cancer/xeps/xep_0096_si_filetransfer.rb
141
+ - lib/cancer/xeps/xep_0114_component.rb
142
+ - lib/cancer/xeps/xep_0115_caps.rb
143
+ - lib/cancer/xeps/xep_0138_compress.rb
144
+ - lib/cancer/xeps/xep_0144_rosterx.rb
145
+ - lib/cancer/xeps/xep_0184_receipts.rb
146
+ - lib/cancer/xeps/xep_0199_ping.rb
147
+ - spec/spec.opts
148
+ - spec/spec_helper.rb
149
+ - spec/stream/stanza_errors_spec.rb
150
+ - spec/stream/stream_errors_spec.rb
151
+ - spec/stream/stream_initialization_spec.rb
152
+ - spec/xep_0050/local_spec.rb
153
+ - spec/xep_0050/remote_spec.rb
154
+ has_rdoc: true
155
+ homepage: http://github.com/simonmenke/cancer
156
+ licenses: []
157
+
158
+ post_install_message:
159
+ rdoc_options:
160
+ - --charset=UTF-8
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: "0"
168
+ version:
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">"
172
+ - !ruby/object:Gem::Version
173
+ version: 1.3.1
174
+ version:
175
+ requirements: []
176
+
177
+ rubyforge_project:
178
+ rubygems_version: 1.3.5
179
+ signing_key:
180
+ specification_version: 3
181
+ summary: A Nokogiri based XMPP client library
182
+ test_files:
183
+ - spec/spec_helper.rb
184
+ - spec/stream/stanza_errors_spec.rb
185
+ - spec/stream/stream_errors_spec.rb
186
+ - spec/stream/stream_initialization_spec.rb
187
+ - spec/xep_0050/local_spec.rb
188
+ - spec/xep_0050/remote_spec.rb
189
+ - examples/example.rb
190
+ - examples/example_2.rb
191
+ - examples/example_em.rb
192
+ - examples/example_em_helper.rb
193
+ - examples/example_im_roster.rb
194
+ - examples/example_xep_0004.rb
195
+ - examples/example_xep_0047.rb
196
+ - examples/example_xep_0050.rb
197
+ - examples/example_xep_0065.rb
198
+ - examples/example_xep_0096.dup.rb
199
+ - examples/example_xep_0096_xep_0047.rb
200
+ - examples/example_xep_0096_xep_0065.rb