blather 0.6.2 → 0.7.0
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.
- data/.rspec +3 -0
- data/.travis.yml +1 -8
- data/CHANGELOG.md +230 -0
- data/Guardfile +4 -4
- data/README.md +2 -8
- data/Rakefile +14 -27
- data/blather.gemspec +8 -18
- data/lib/blather.rb +1 -0
- data/lib/blather/client/client.rb +8 -0
- data/lib/blather/roster.rb +7 -0
- data/lib/blather/stanza/iq/roster.rb +1 -1
- data/lib/blather/stanza/message/muc_user.rb +2 -0
- data/lib/blather/stanza/muc/muc_user_base.rb +4 -3
- data/lib/blather/stanza/presence.rb +12 -14
- data/lib/blather/stanza/presence/c.rb +58 -62
- data/lib/blather/stanza/presence/muc.rb +14 -10
- data/lib/blather/stanza/presence/muc_user.rb +47 -36
- data/lib/blather/stanza/presence/status.rb +106 -101
- data/lib/blather/stanza/presence/subscription.rb +59 -60
- data/lib/blather/stream.rb +1 -3
- data/lib/blather/stream/features/resource.rb +0 -1
- data/lib/blather/version.rb +1 -2
- data/lib/blather/xmpp_node.rb +24 -3
- data/spec/blather/client/client_spec.rb +64 -64
- data/spec/blather/client/dsl/pubsub_spec.rb +127 -127
- data/spec/blather/client/dsl_spec.rb +11 -11
- data/spec/blather/errors/sasl_error_spec.rb +3 -3
- data/spec/blather/errors/stanza_error_spec.rb +26 -26
- data/spec/blather/errors/stream_error_spec.rb +22 -22
- data/spec/blather/errors_spec.rb +7 -7
- data/spec/blather/file_transfer_spec.rb +16 -18
- data/spec/blather/jid_spec.rb +29 -29
- data/spec/blather/roster_item_spec.rb +18 -18
- data/spec/blather/roster_spec.rb +18 -18
- data/spec/blather/stanza/discos/disco_info_spec.rb +56 -57
- data/spec/blather/stanza/discos/disco_items_spec.rb +33 -33
- data/spec/blather/stanza/iq/command_spec.rb +57 -57
- data/spec/blather/stanza/iq/ibb_spec.rb +27 -39
- data/spec/blather/stanza/iq/ping_spec.rb +13 -9
- data/spec/blather/stanza/iq/query_spec.rb +16 -16
- data/spec/blather/stanza/iq/roster_spec.rb +29 -30
- data/spec/blather/stanza/iq/s5b_spec.rb +10 -13
- data/spec/blather/stanza/iq/si_spec.rb +20 -23
- data/spec/blather/stanza/iq/vcard_spec.rb +22 -25
- data/spec/blather/stanza/iq_spec.rb +12 -12
- data/spec/blather/stanza/message/muc_user_spec.rb +36 -36
- data/spec/blather/stanza/message_spec.rb +56 -56
- data/spec/blather/stanza/presence/c_spec.rb +17 -7
- data/spec/blather/stanza/presence/muc_spec.rb +8 -8
- data/spec/blather/stanza/presence/muc_user_spec.rb +23 -23
- data/spec/blather/stanza/presence/status_spec.rb +42 -30
- data/spec/blather/stanza/presence/subscription_spec.rb +22 -23
- data/spec/blather/stanza/presence_spec.rb +72 -34
- data/spec/blather/stanza/pubsub/affiliations_spec.rb +12 -12
- data/spec/blather/stanza/pubsub/create_spec.rb +10 -10
- data/spec/blather/stanza/pubsub/event_spec.rb +31 -31
- data/spec/blather/stanza/pubsub/items_spec.rb +21 -21
- data/spec/blather/stanza/pubsub/publish_spec.rb +21 -21
- data/spec/blather/stanza/pubsub/retract_spec.rb +20 -20
- data/spec/blather/stanza/pubsub/subscribe_spec.rb +17 -17
- data/spec/blather/stanza/pubsub/subscription_spec.rb +28 -28
- data/spec/blather/stanza/pubsub/subscriptions_spec.rb +11 -11
- data/spec/blather/stanza/pubsub/unsubscribe_spec.rb +22 -22
- data/spec/blather/stanza/pubsub_owner/delete_spec.rb +9 -9
- data/spec/blather/stanza/pubsub_owner/purge_spec.rb +9 -9
- data/spec/blather/stanza/pubsub_owner_spec.rb +6 -6
- data/spec/blather/stanza/pubsub_spec.rb +16 -16
- data/spec/blather/stanza/x_spec.rb +53 -53
- data/spec/blather/stanza_spec.rb +39 -39
- data/spec/blather/stream/client_spec.rb +133 -133
- data/spec/blather/stream/component_spec.rb +7 -7
- data/spec/blather/stream/parser_spec.rb +24 -24
- data/spec/blather/stream/ssl_spec.rb +7 -7
- data/spec/blather/xmpp_node_spec.rb +17 -7
- data/spec/blather_spec.rb +4 -4
- data/spec/spec_helper.rb +6 -54
- metadata +53 -68
- data/CHANGELOG +0 -220
data/.rspec
ADDED
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
# develop
|
2
|
+
|
3
|
+
# v0.7.0
|
4
|
+
* Change(benlangfeld): Drop Ruby 1.8.7 compatability
|
5
|
+
* Change(bklang): Remove the wire log, which duplicated the parsed logging
|
6
|
+
* Feature(benlangfeld): Stanza handlers are now executed outside of the EM reactor, so it is not blocked on stanza processing
|
7
|
+
* Bugfix(benlangfeld): MUC user presence and messages now have separate handler names
|
8
|
+
* Feature(benlangfeld): Stanzas may now be imported from a string using `XMPPNode.parse`
|
9
|
+
* Bugfix(benlangfeld): All `Blather::Stanza::Presence::C` attributes are now accessible on importing
|
10
|
+
* Bugfix(benlangfeld): Presence stanzas are now composed on import, including all children
|
11
|
+
* Bugfix(mtrudel): JIDs in roster item stanzas are now stripped of resources
|
12
|
+
|
13
|
+
# v0.6.2
|
14
|
+
* Feature(benlangfeld): Add password support to MUCUser
|
15
|
+
* Feature(benlangfeld): Add support for invitation elements to MUCUser messages
|
16
|
+
* Feature(benlangfeld): Add support for MUC invite declines
|
17
|
+
* Bugfix(benlangfeld): Don't implicitly create an invite node when checking invite status
|
18
|
+
* Bugfix(benlangfeld): Ensure that form nodes are not duplicated on muc/muc_user presence stanzas
|
19
|
+
|
20
|
+
# v0.6.1
|
21
|
+
* Bugfix(benlangfeld): Ensure MUC presence nodes (joining) have a form element on creation
|
22
|
+
|
23
|
+
# v0.6.0
|
24
|
+
* Feature(benlangfeld): Very basic MUC and delayed message support
|
25
|
+
* Bugfix(theozaurus): Disable connection timeout timer if client deliberately disconnects
|
26
|
+
* Bugfix(mtrudel): Fix Roster#each to return roster_items as per documentation
|
27
|
+
|
28
|
+
# v0.5.12
|
29
|
+
* Bugfix(benlangfeld): Allow specifying the connection timeout in DSL setup
|
30
|
+
|
31
|
+
# v0.5.11
|
32
|
+
* Feature(benlangfeld): Allow specifying a connection timeout
|
33
|
+
* Raise Blather::Stream::ConnectionTimeout if timeout is exceeded
|
34
|
+
* Default to 180 seconds
|
35
|
+
|
36
|
+
# v0.5.10
|
37
|
+
* Feature(juandebravo): Allow configuring the wire log level
|
38
|
+
* Bugfix(benlangfeld): Checking connection status before the stream is established
|
39
|
+
|
40
|
+
# v0.5.9
|
41
|
+
* Bugfix(benlangfeld): Failed connections now raise a Blather::Stream::ConnectionFailed exception
|
42
|
+
* Bugfix(crohr): Blather now supports EventMachine 1.0
|
43
|
+
|
44
|
+
# v0.5.8
|
45
|
+
* Bugfix(benlangfeld): JIDs now maintain case, but still compare case insensitively
|
46
|
+
* Bugfix(jmazzi): Development dependencies now resolve correctly on JRuby and Rubinius
|
47
|
+
|
48
|
+
# v0.5.7
|
49
|
+
* Bugfix(benlangfeld): Don't install BlueCloth as a development dependency when on JRuby
|
50
|
+
|
51
|
+
# v0.5.6
|
52
|
+
* Changes from 0.5.5, this time without a bug when using the namespaced DSL approach
|
53
|
+
|
54
|
+
# v0.5.5 (yanked)
|
55
|
+
* Bugfix(benlangfeld/kibs): ActiveSupport was overriding the presence DSL method
|
56
|
+
* Feature(fyafighter): Adds SSL peer verification to TLS
|
57
|
+
|
58
|
+
# v0.5.4
|
59
|
+
* Bugfix(fyafighter): Regression related to earlier refactoring: https://github.com/sprsquish/blather/issues/53
|
60
|
+
* Feature(fyafighter): Make it much easier to allow private network addresses
|
61
|
+
* Bugfix(benlangfeld): Fix the Nokogiri dependency to the 1.4.x series, due to a bug in 1.5.x
|
62
|
+
* Bugfix(zlu): Replace class_inheritable_attribute with class_attribute because it is deprecated in ActiveSupport 3.1
|
63
|
+
|
64
|
+
# v0.5.3
|
65
|
+
* Feature(benlangfeld): Add XMPP Ping (XEP-0199) support
|
66
|
+
|
67
|
+
# v0.5.2
|
68
|
+
* Bugfix(benlangfeld): Remove specs for the Nokogiri extensions which were moved out
|
69
|
+
|
70
|
+
# v0.5.1 - yanked
|
71
|
+
* Feature(benlangfeld): Abstract out Nokogiri extensions and helpers into new Niceogiri gem for better sharing
|
72
|
+
* Documentation(benlangfeld)
|
73
|
+
|
74
|
+
# v0.5.0
|
75
|
+
* Feature(radsaq): Add a #connected? method on Blather::Client
|
76
|
+
* Feature(benlangfeld)[API change]: Allow the removal of child nodes from an IQ reply
|
77
|
+
* Bugfix(zlu): Use rubygems properly in examples
|
78
|
+
* Bugfix(benlangfeld): Remove code borrowed from ActiveSupport and instead depend on it to avoid version conflicts
|
79
|
+
* Documentation(sprsquish)
|
80
|
+
|
81
|
+
# v0.4.16
|
82
|
+
* Feature(benlangfeld): switch from jeweler to bundler
|
83
|
+
* Feature(benlangfeld): add cap support (XEP-0115)
|
84
|
+
* Bugfix(sprsquish): Better equality checking
|
85
|
+
* Bugfix(sprsquish): Fix #to_proc
|
86
|
+
* Bugfix(mironov): Skip private IPs by default
|
87
|
+
|
88
|
+
# v0.4.15
|
89
|
+
* Feature(mironov): Implement XEP-0054: vcard-temp
|
90
|
+
* Feature(benlangfeld): Basic support for PubSub subscription notifications as PubSub events
|
91
|
+
* Feature(mironov): Ability to clear handlers
|
92
|
+
* Feature(mironov): Implement incoming file transfers (XEP-0096, XEP-0065, XEP-0047)
|
93
|
+
* Bugfix(mironov): Fix for importing messages with chat states
|
94
|
+
* Bugfix(mironov): Added Symbol#to_proc method to work on ruby 1.8.6
|
95
|
+
* Bugfix(mironov): Fix roster items .status method to return highest priority presence
|
96
|
+
* Bugfix(mironov): Remove old unavailable presences while adding new one
|
97
|
+
* Bugfix(mironov): Use Nokogiri::XML::ParseOptions::NOENT to prevent double-encoding of entities
|
98
|
+
* Bugfix(benlangfeld): Disco Info Identities should have an xml:lang attribute
|
99
|
+
* Bugfix(mironov): Fix lookup path for ruby 1.9
|
100
|
+
* Bugfix(mironov): stanza_error.to_node must set type of the error
|
101
|
+
* Bugfix(mironov): Allow message to have iq child
|
102
|
+
* Bugfix(mironov): Find xhtml body in messages sent from iChat 5.0.3
|
103
|
+
|
104
|
+
# v0.4.14
|
105
|
+
* Tests: get specs fully passing on rubinius
|
106
|
+
* Feature(mironov): Implement XEP-0085 Chat State Notifications
|
107
|
+
* Bugfix(mironov): send stanzas unformatted
|
108
|
+
* Bugfix(mironov): Message#xhtml uses inner_html so tags aren't escaped
|
109
|
+
* Bugfix(mironov): Message#xhtml= now works with multiple root nodes
|
110
|
+
|
111
|
+
# v0.4.13
|
112
|
+
* Bugfix: Place form child of command inside command element
|
113
|
+
|
114
|
+
# v0.4.12
|
115
|
+
* API Change: Switch order of var and type arguments to X::Field.new since var is always required but type is not
|
116
|
+
* API Change: PubSub payloads can be strings or nodes and can be set nil. PubSub#payload will always return a string
|
117
|
+
* Feature: Add forms to Message stanzas
|
118
|
+
|
119
|
+
# v0.4.11
|
120
|
+
* Bugfix: command nodes where generating the wrong xml
|
121
|
+
* Bugfix: x nodes where generating the wrong xml
|
122
|
+
* Feature: ability to set identities and features on disco info nodes
|
123
|
+
* Feature: ability to set items on disco item nodes
|
124
|
+
|
125
|
+
# v0.4.10
|
126
|
+
* no change
|
127
|
+
|
128
|
+
# v0.4.9
|
129
|
+
* Feature: XEP-0004 x:data (benlangfeld)
|
130
|
+
* Feature: XEP-0050 Ad-Hoc commands (benlangfeld)
|
131
|
+
* Minor bugfixes for the specs
|
132
|
+
|
133
|
+
# v0.4.8
|
134
|
+
* Feature: add xhtml getter/setter to Message stanza
|
135
|
+
* Bugfix: heirarchy -> hierarchy spelling mistake
|
136
|
+
* Hella documentation
|
137
|
+
|
138
|
+
# v0.4.7
|
139
|
+
* Update to work with Nokogiri 1.4.0
|
140
|
+
|
141
|
+
# v0.4.6
|
142
|
+
* Bugfix: prioritize authentication mechanisms
|
143
|
+
|
144
|
+
# v0.4.5
|
145
|
+
* Bugfix: Change DSL#write to DSL#write_to_stream. Previous way was messing with YAML
|
146
|
+
|
147
|
+
# v0.4.4
|
148
|
+
* Add "disconnected" handler type to handle connection termination
|
149
|
+
* Bugfix: Fix error with pubsub using the wrong client connection
|
150
|
+
|
151
|
+
# v0.4.3
|
152
|
+
* Bugfix: status stanza with a blank state will be considered :available (GH-23)
|
153
|
+
* Bugfix: ensure regexp guards try to match against a string (GH-24)
|
154
|
+
* Stream creation is now evented. The stream object will be sent to #post_init
|
155
|
+
* Parser debugging disabled by default
|
156
|
+
* Update parser to work with Nokogiri 1.3.2
|
157
|
+
* Bugfix: discover helper now calls the correct method on client
|
158
|
+
* Bugfix: ensure XMPPNode#inherit properly sets namespaces on inherited nodes
|
159
|
+
* Bugfix: xpath guards with namespaces work properly (GH-25)
|
160
|
+
|
161
|
+
# v0.4.2
|
162
|
+
* Fix -D option to actually put Blather in debug mode
|
163
|
+
* Stanzas over a client connection will either have the full JID or no JID
|
164
|
+
* Regexp guards can be anything that implements #last_match (Regexp or Oniguruma)
|
165
|
+
* Add "halt" and "pass" to allow handlers to either halt the handler chain or pass to the next handler
|
166
|
+
* Fix default status handler so it doesn't eat the stanza
|
167
|
+
* Add before and after filters. Filters, like handlers, can have guards.
|
168
|
+
|
169
|
+
# v0.4.1
|
170
|
+
* Bugfix in roster: trying to call the wrong method on client
|
171
|
+
|
172
|
+
# v0.4.0
|
173
|
+
* Switch from LibXML-Ruby to Nokogiri
|
174
|
+
* Update test suite to run on Ruby 1.9
|
175
|
+
* Add "<<" style writer to the DSL to provide for chaining outbound writes
|
176
|
+
* SRV lookup support
|
177
|
+
* Add XPath type of handler guard
|
178
|
+
* PubSub support
|
179
|
+
|
180
|
+
# v0.3.4
|
181
|
+
* Remove unneeded functions from the push parser.
|
182
|
+
* Create a ParseWarning error that doesn't kill the stream.
|
183
|
+
* When a parse error comes in the reply should let the other side know it screwed up before dying.
|
184
|
+
* Add the LibXML::XML::Error node to the ParseError/ParseWarning objects.
|
185
|
+
|
186
|
+
# v0.3.3
|
187
|
+
* Fix the load error related to not pushing Blather's dir into the load path
|
188
|
+
|
189
|
+
# v0.3.2
|
190
|
+
* Switch the push parser from chunking to streaming.
|
191
|
+
* Don't push Blather's dir into the load paths
|
192
|
+
|
193
|
+
# v0.3.1
|
194
|
+
* Small changes to the DSL due to handler collisions:
|
195
|
+
"status" -> "set_status"
|
196
|
+
"roster" -> "my_roster"
|
197
|
+
* Small changes to the Blather::Client API to keep it feeling more like EM's API:
|
198
|
+
#stream_started -> #post_init
|
199
|
+
#call -> #receive_data
|
200
|
+
#stop -> #close
|
201
|
+
#stopped -> #unbind
|
202
|
+
* Refactored some of the code internal to Blather::Client
|
203
|
+
* Added command line option handler to default use method (see README)
|
204
|
+
* require libxml-ruby >=1.1.2 (1.1.3 has an inconsistent malloc err on OS X 10.5)
|
205
|
+
* complete specs
|
206
|
+
* add single process ping-pong example
|
207
|
+
|
208
|
+
# v0.3.0
|
209
|
+
* Remove autotest discover.rb (created all sorts of conflicts)
|
210
|
+
* Added Hash with Array guard
|
211
|
+
* Added a hirrarchy printer to examples directory
|
212
|
+
* Moved Disco to be in the Stanza namespace (staves off deeply namespaced classes)
|
213
|
+
* Namespaced the DSL methods to Blather::DSL. These can be included in any object you like now. "require 'blather/client'" will still include them directly in Kernel to keep the simple one-file dsl
|
214
|
+
* Stopped doing one class per error type. This created a giant hierarchy tree that was just unnecessary. The error name is now #name. Errors can be matched with a combination of handler and guard.
|
215
|
+
* Fixed XML namespaces. Previous versions weren't actually adding the node to the namespace making xpath queries inconsistent at best.
|
216
|
+
* Added support for anonymous authentication by providing a blank node on the jid ("@[host]")
|
217
|
+
|
218
|
+
# v0.2.3
|
219
|
+
* Go back to using the master branch for gems (stupid mistake)
|
220
|
+
|
221
|
+
# v0.2.2
|
222
|
+
* Switch to Jeweler.
|
223
|
+
* Move from custom libxml to just a custom push parser
|
224
|
+
* Add guards to handlers
|
225
|
+
|
226
|
+
# v0.2.1 Upgrade to libxml 0.9.7
|
227
|
+
|
228
|
+
# v0.2 Overhaul the DSL to look more like Sinatra
|
229
|
+
|
230
|
+
# v0.1 Initial release (birth!)
|
data/Guardfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
guard '
|
2
|
-
watch(%r
|
3
|
-
watch(%r
|
4
|
-
watch(
|
1
|
+
guard 'rspec', :version => 2, :cli => '--format documentation' do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
|
+
watch('spec/spec_helper.rb') { "spec/" }
|
5
5
|
end
|
data/README.md
CHANGED
@@ -162,14 +162,8 @@ than a change set made directly on master.
|
|
162
162
|
|
163
163
|
# Author
|
164
164
|
|
165
|
-
[Jeff Smick](http://github.com/sprsquish)
|
166
|
-
|
167
|
-
### Contributors
|
168
|
-
|
169
|
-
* [Nolan Darilek](http://github.com/thewordnerd)
|
170
|
-
* [Tim Carey-Smith](http://github.com/halorgium)
|
171
|
-
* [Ben Langfeld](http://github.com/benlangfeld)
|
172
|
-
* [Anton Mironov](http://github.com/mironov)
|
165
|
+
* [Jeff Smick](http://github.com/sprsquish)
|
166
|
+
* [Other Contributors](https://github.com/sprsquish/blather/contributors)
|
173
167
|
|
174
168
|
# Copyright
|
175
169
|
|
data/Rakefile
CHANGED
@@ -1,33 +1,20 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# -*- ruby -*-
|
2
|
+
ENV['RUBY_FLAGS'] = "-I#{%w(lib ext bin spec).join(File::PATH_SEPARATOR)}"
|
3
3
|
|
4
|
-
require '
|
5
|
-
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
require 'bundler/setup'
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
test.libs << 'spec'
|
10
|
-
test.pattern = 'spec/**/*_spec.rb'
|
11
|
-
test.verbose = true
|
12
|
-
end
|
8
|
+
task :default => :spec
|
9
|
+
task :test => :spec
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
Rcov::RcovTask.new do |test|
|
17
|
-
test.libs << 'spec'
|
18
|
-
test.pattern = 'spec/**/*_spec.rb'
|
19
|
-
test.rcov_opts += ['--exclude \/Library\/Ruby,spec\/', '--xrefs']
|
20
|
-
test.verbose = true
|
21
|
-
end
|
11
|
+
require 'rspec/core/rake_task'
|
12
|
+
RSpec::Core::RakeTask.new
|
22
13
|
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
require 'yard'
|
15
|
+
YARD::Tags::Library.define_tag 'Blather handler', :handler, :with_name
|
16
|
+
YARD::Templates::Engine.register_template_path 'yard/templates'
|
26
17
|
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
rescue LoadError
|
18
|
+
YARD::Rake::YardocTask.new(:doc) do |t|
|
19
|
+
t.options = ['--no-private', '-m', 'markdown', '-o', './doc/public/yard']
|
31
20
|
end
|
32
|
-
|
33
|
-
task :default => :test
|
data/blather.gemspec
CHANGED
@@ -35,26 +35,16 @@ Gem::Specification.new do |s|
|
|
35
35
|
|
36
36
|
s.add_dependency "eventmachine", [">= 0.12.6"]
|
37
37
|
s.add_dependency "nokogiri", ["~> 1.4.0"]
|
38
|
-
s.add_dependency "niceogiri", ["
|
38
|
+
s.add_dependency "niceogiri", ["~> 1.0.0"]
|
39
39
|
s.add_dependency "activesupport", [">= 3.0.7"]
|
40
|
+
s.add_dependency "girl_friday"
|
40
41
|
|
41
|
-
s.add_development_dependency "
|
42
|
+
s.add_development_dependency "bundler", ["~> 1.0"]
|
43
|
+
s.add_development_dependency "rake"
|
44
|
+
s.add_development_dependency "rspec", ["~> 2.7"]
|
42
45
|
s.add_development_dependency "mocha", ["~> 0.9.12"]
|
43
|
-
s.add_development_dependency "
|
44
|
-
|
45
|
-
s.add_development_dependency "rcov", ["~> 0.9.9"]
|
46
|
-
s.add_development_dependency "yard", ["~> 0.6.1"]
|
47
|
-
end
|
46
|
+
s.add_development_dependency "guard-rspec"
|
47
|
+
s.add_development_dependency "yard", ["~> 0.6.1"]
|
48
48
|
s.add_development_dependency "jruby-openssl", ["~> 0.7.4"] if jruby?
|
49
|
-
s.add_development_dependency "
|
50
|
-
s.add_development_dependency "guard-minitest"
|
51
|
-
|
52
|
-
unless jruby? || rbx?
|
53
|
-
s.add_development_dependency 'bluecloth'
|
54
|
-
end
|
55
|
-
|
56
|
-
if RUBY_PLATFORM =~ /darwin/ && !rbx?
|
57
|
-
s.add_development_dependency 'growl_notify'
|
58
|
-
s.add_development_dependency 'rb-fsevent'
|
59
|
-
end
|
49
|
+
s.add_development_dependency "bluecloth" unless jruby? || rbx?
|
60
50
|
end
|
data/lib/blather.rb
CHANGED
@@ -59,6 +59,10 @@ module Blather
|
|
59
59
|
@roster = Roster.new self
|
60
60
|
@caps = Stanza::Capabilities.new
|
61
61
|
|
62
|
+
@handler_queue = GirlFriday::WorkQueue.new :handle_stanza, :size => 5 do |stanza|
|
63
|
+
handle_data stanza
|
64
|
+
end
|
65
|
+
|
62
66
|
setup_initial_handlers
|
63
67
|
end
|
64
68
|
|
@@ -181,6 +185,10 @@ module Blather
|
|
181
185
|
|
182
186
|
# @private
|
183
187
|
def receive_data(stanza)
|
188
|
+
@handler_queue << stanza
|
189
|
+
end
|
190
|
+
|
191
|
+
def handle_data(stanza)
|
184
192
|
catch(:halt) do
|
185
193
|
run_filters :before, stanza
|
186
194
|
handle_stanza stanza
|
data/lib/blather/roster.rb
CHANGED
@@ -86,6 +86,13 @@ module Blather
|
|
86
86
|
@items.dup
|
87
87
|
end
|
88
88
|
|
89
|
+
# Number of items in the roster
|
90
|
+
#
|
91
|
+
# @return [Integer] the number of items in the roster
|
92
|
+
def length
|
93
|
+
@items.length
|
94
|
+
end
|
95
|
+
|
89
96
|
# A hash of items keyed by group
|
90
97
|
#
|
91
98
|
# @return [Hash<group => Array<RosterItem>>]
|
@@ -3,9 +3,10 @@ class Stanza
|
|
3
3
|
class MUC
|
4
4
|
|
5
5
|
module MUCUserBase
|
6
|
+
MUC_USER_NAMESPACE = "http://jabber.org/protocol/muc#user"
|
7
|
+
|
6
8
|
def self.included(klass)
|
7
9
|
klass.extend ClassMethods
|
8
|
-
klass.register :muc_user, :x, "http://jabber.org/protocol/muc#user"
|
9
10
|
end
|
10
11
|
|
11
12
|
module ClassMethods
|
@@ -29,7 +30,7 @@ class MUC
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def muc_user
|
32
|
-
unless muc_user = find_first('ns:x', :ns =>
|
33
|
+
unless muc_user = find_first('ns:x', :ns => MUC_USER_NAMESPACE)
|
33
34
|
self << (muc_user = XMPPNode.new('x', self.document))
|
34
35
|
muc_user.namespace = self.class.registered_ns
|
35
36
|
end
|
@@ -44,7 +45,7 @@ class MUC
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def find_password_node
|
47
|
-
muc_user.find_first 'ns:password', :ns =>
|
48
|
+
muc_user.find_first 'ns:password', :ns => MUC_USER_NAMESPACE
|
48
49
|
end
|
49
50
|
end # MUCUserBase
|
50
51
|
|