blather 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/blather/roster.rb +2 -2
- data/lib/blather/stanza/iq.rb +1 -3
- data/lib/blather/stanza/message.rb +1 -3
- data/spec/blather/roster_spec.rb +5 -6
- metadata +2 -2
data/lib/blather/roster.rb
CHANGED
@@ -40,7 +40,7 @@ module Blather
|
|
40
40
|
jid = elem.respond_to?(:jid) ? elem.jid : JID.new(elem)
|
41
41
|
@items[key(jid)] = node = RosterItem.new(elem)
|
42
42
|
|
43
|
-
@stream.
|
43
|
+
@stream.write(node.to_stanza(:set)) if send
|
44
44
|
end
|
45
45
|
alias_method :add, :push
|
46
46
|
|
@@ -49,7 +49,7 @@ module Blather
|
|
49
49
|
# Sends a remove query stanza to the server
|
50
50
|
def delete(jid)
|
51
51
|
@items.delete key(jid)
|
52
|
-
@stream.
|
52
|
+
@stream.write Stanza::Iq::Roster.new(:set, Stanza::Iq::Roster::RosterItem.new(jid, nil, :remove))
|
53
53
|
end
|
54
54
|
alias_method :remove, :delete
|
55
55
|
|
data/lib/blather/stanza/iq.rb
CHANGED
@@ -27,9 +27,7 @@ class Stanza
|
|
27
27
|
node
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
define_method("#{valid_type}?") { self.type == valid_type }
|
32
|
-
end
|
30
|
+
attribute_helpers_for :type, VALID_TYPES
|
33
31
|
|
34
32
|
##
|
35
33
|
# Ensures type is :chat, :error, :groupchat, :headline or :normal
|
data/spec/blather/roster_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), *%w[.. spec_helper])
|
|
3
3
|
describe Blather::Roster do
|
4
4
|
before do
|
5
5
|
@stream = mock()
|
6
|
-
@stream.stubs(:
|
6
|
+
@stream.stubs(:write)
|
7
7
|
|
8
8
|
@stanza = mock()
|
9
9
|
items = []; 4.times { |n| items << Blather::JID.new("n@d/#{n}r") }
|
@@ -51,9 +51,8 @@ describe Blather::Roster do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'sends a @roster addition over the wire' do
|
54
|
-
|
55
|
-
|
56
|
-
roster = Blather::Roster.new stream, @stanza
|
54
|
+
client = mock(:write => nil)
|
55
|
+
roster = Blather::Roster.new client, @stanza
|
57
56
|
roster.push('a@b/c')
|
58
57
|
end
|
59
58
|
|
@@ -62,8 +61,8 @@ describe Blather::Roster do
|
|
62
61
|
end
|
63
62
|
|
64
63
|
it 'sends a @roster removal over the wire' do
|
65
|
-
|
66
|
-
roster = Blather::Roster.new
|
64
|
+
client = mock(:write => nil)
|
65
|
+
roster = Blather::Roster.new client, @stanza
|
67
66
|
roster.delete('a@b/c')
|
68
67
|
end
|
69
68
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Smick
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|