blather 0.2.2 → 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.
- data/README.rdoc +2 -2
- data/Rakefile +30 -18
- data/ext/Makefile +149 -0
- data/ext/mkmf.log +30 -0
- data/ext/push_parser.bundle +0 -0
- data/ext/push_parser.c +231 -0
- data/ext/push_parser.o +0 -0
- data/lib/blather.rb +3 -7
- data/lib/blather/client.rb +247 -4
- data/lib/blather/roster.rb +0 -9
- data/lib/blather/stanza/{disco.rb → iq/disco.rb} +3 -1
- data/lib/blather/stanza/{disco → iq/discos}/disco_info.rb +5 -3
- data/lib/blather/stanza/{disco → iq/discos}/disco_items.rb +2 -0
- data/lib/blather/stanza/iq/query.rb +1 -1
- data/lib/blather/stanza/iq/roster.rb +2 -2
- data/lib/blather/xmpp_node.rb +1 -1
- data/spec/blather/stanza/{discos → iq/discos}/disco_info_spec.rb +12 -12
- data/spec/blather/stanza/{discos → iq/discos}/disco_items_spec.rb +1 -1
- data/spec/blather/stanza/iq/query_spec.rb +0 -7
- data/spec/blather/stanza/iq/roster_spec.rb +21 -21
- data/spec/blather/stanza/pubsub/event_spec.rb +13 -0
- data/spec/build_safe.rb +20 -0
- metadata +19 -68
- data/VERSION.yml +0 -4
- data/examples/pubsub/cli.rb +0 -64
- data/examples/pubsub/ping_pong.rb +0 -18
- data/examples/pubsub/pubsub_dsl.rb +0 -52
- data/examples/pubsub_client.rb +0 -39
- data/examples/rosterprint.rb +0 -14
- data/examples/xmpp4r/echo.rb +0 -35
- data/lib/blather/client/client.rb +0 -165
- data/lib/blather/client/dsl.rb +0 -99
- data/lib/blather/client/pubsub.rb +0 -53
- data/lib/blather/client/pubsub/node.rb +0 -27
- data/lib/blather/stanza/pubsub.rb +0 -33
- data/lib/blather/stanza/pubsub/affiliations.rb +0 -52
- data/lib/blather/stanza/pubsub/errors.rb +0 -9
- data/lib/blather/stanza/pubsub/event.rb +0 -21
- data/lib/blather/stanza/pubsub/items.rb +0 -59
- data/lib/blather/stanza/pubsub/owner.rb +0 -9
- data/lib/blather/stanza/pubsub/subscriptions.rb +0 -57
- data/spec/blather/stanza/pubsub/affiliations_spec.rb +0 -46
- data/spec/blather/stanza/pubsub/items_spec.rb +0 -59
- data/spec/blather/stanza/pubsub/subscriptions_spec.rb +0 -63
- data/spec/blather/stanza/pubsub_spec.rb +0 -26
- data/spec/fixtures/pubsub.rb +0 -157
@@ -19,13 +19,6 @@ describe 'Blather::Stanza::Iq::Query' do
|
|
19
19
|
query.children.detect { |n| n.element_name == 'query' }.wont_be_nil
|
20
20
|
end
|
21
21
|
|
22
|
-
[:get, :set, :result, :error].each do |type|
|
23
|
-
it "can be set as \"#{type}\"" do
|
24
|
-
query = Stanza::Iq::Query.new type
|
25
|
-
query.type.must_equal type
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
22
|
it 'sets type to "result" on reply' do
|
30
23
|
query = Stanza::Iq::Query.new
|
31
24
|
query.type.must_equal :get
|
@@ -1,27 +1,27 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), *%w[.. .. .. spec_helper])
|
2
2
|
|
3
3
|
def roster_xml
|
4
|
-
<<-XML
|
5
|
-
<iq to='juliet@example.com/balcony' type='result' id='roster_1'>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
</iq>
|
24
|
-
XML
|
4
|
+
<<-XML
|
5
|
+
<iq to='juliet@example.com/balcony' type='result' id='roster_1'>
|
6
|
+
<query xmlns='jabber:iq:roster'>
|
7
|
+
<item jid='romeo@example.net'
|
8
|
+
name='Romeo'
|
9
|
+
subscription='both'>
|
10
|
+
<group>Friends</group>
|
11
|
+
</item>
|
12
|
+
<item jid='mercutio@example.org'
|
13
|
+
name='Mercutio'
|
14
|
+
subscription='from'>
|
15
|
+
<group>Friends</group>
|
16
|
+
</item>
|
17
|
+
<item jid='benvolio@example.org'
|
18
|
+
name='Benvolio'
|
19
|
+
subscription='both'>
|
20
|
+
<group>Friends</group>
|
21
|
+
</item>
|
22
|
+
</query>
|
23
|
+
</iq>
|
24
|
+
XML
|
25
25
|
end
|
26
26
|
|
27
27
|
describe 'Blather::Stanza::Iq::Roster' do
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), *%w[.. .. .. spec_helper])
|
2
|
+
require File.join(File.dirname(__FILE__), *%w[.. .. .. fixtures pubsub])
|
3
|
+
|
4
|
+
describe 'Blather::Stanza::PubSub::Event' do
|
5
|
+
it 'registers itself' do
|
6
|
+
XMPPNode.class_from_registration(:pubsub_subscriptions, 'http://jabber.org/protocol/pubsub').must_equal Stanza::PubSub::Subscriptions
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'ensures an subscriptions node is present on create' do
|
10
|
+
subscriptions = Stanza::PubSub::Subscriptions.new
|
11
|
+
subscriptions.pubsub.children.detect { |n| n.element_name == 'subscriptions' }.wont_be_nil
|
12
|
+
end
|
13
|
+
end
|
data/spec/build_safe.rb
ADDED
@@ -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"
|
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.2.
|
4
|
+
version: 0.2.3
|
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-05-
|
12
|
+
date: 2009-05-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,36 +32,28 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.1.3
|
34
34
|
version:
|
35
|
-
description:
|
35
|
+
description:
|
36
36
|
email: sprsquish@gmail.com
|
37
37
|
executables: []
|
38
38
|
|
39
39
|
extensions:
|
40
|
-
-
|
40
|
+
- Rakefile
|
41
41
|
extra_rdoc_files:
|
42
42
|
- LICENSE
|
43
43
|
- README.rdoc
|
44
44
|
files:
|
45
|
-
- LICENSE
|
46
|
-
- README.rdoc
|
47
|
-
- Rakefile
|
48
|
-
- VERSION.yml
|
49
45
|
- examples/drb_client.rb
|
50
46
|
- examples/echo.rb
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
47
|
+
- ext/Makefile
|
48
|
+
- ext/extconf.rb
|
49
|
+
- ext/mkmf.log
|
50
|
+
- ext/push_parser.bundle
|
51
|
+
- ext/push_parser.c
|
52
|
+
- ext/push_parser.o
|
57
53
|
- lib/autotest/discover.rb
|
58
54
|
- lib/autotest/spec.rb
|
59
55
|
- lib/blather.rb
|
60
56
|
- lib/blather/client.rb
|
61
|
-
- lib/blather/client/client.rb
|
62
|
-
- lib/blather/client/dsl.rb
|
63
|
-
- lib/blather/client/pubsub.rb
|
64
|
-
- lib/blather/client/pubsub/node.rb
|
65
57
|
- lib/blather/core_ext/active_support.rb
|
66
58
|
- lib/blather/core_ext/libxml.rb
|
67
59
|
- lib/blather/errors.rb
|
@@ -72,23 +64,16 @@ files:
|
|
72
64
|
- lib/blather/roster.rb
|
73
65
|
- lib/blather/roster_item.rb
|
74
66
|
- lib/blather/stanza.rb
|
75
|
-
- lib/blather/stanza/disco.rb
|
76
|
-
- lib/blather/stanza/disco/disco_info.rb
|
77
|
-
- lib/blather/stanza/disco/disco_items.rb
|
78
67
|
- lib/blather/stanza/iq.rb
|
68
|
+
- lib/blather/stanza/iq/disco.rb
|
69
|
+
- lib/blather/stanza/iq/discos/disco_info.rb
|
70
|
+
- lib/blather/stanza/iq/discos/disco_items.rb
|
79
71
|
- lib/blather/stanza/iq/query.rb
|
80
72
|
- lib/blather/stanza/iq/roster.rb
|
81
73
|
- lib/blather/stanza/message.rb
|
82
74
|
- lib/blather/stanza/presence.rb
|
83
75
|
- lib/blather/stanza/presence/status.rb
|
84
76
|
- lib/blather/stanza/presence/subscription.rb
|
85
|
-
- lib/blather/stanza/pubsub.rb
|
86
|
-
- lib/blather/stanza/pubsub/affiliations.rb
|
87
|
-
- lib/blather/stanza/pubsub/errors.rb
|
88
|
-
- lib/blather/stanza/pubsub/event.rb
|
89
|
-
- lib/blather/stanza/pubsub/items.rb
|
90
|
-
- lib/blather/stanza/pubsub/owner.rb
|
91
|
-
- lib/blather/stanza/pubsub/subscriptions.rb
|
92
77
|
- lib/blather/stream.rb
|
93
78
|
- lib/blather/stream/client.rb
|
94
79
|
- lib/blather/stream/component.rb
|
@@ -99,33 +84,8 @@ files:
|
|
99
84
|
- lib/blather/stream/stream_handler.rb
|
100
85
|
- lib/blather/stream/tls.rb
|
101
86
|
- lib/blather/xmpp_node.rb
|
102
|
-
-
|
103
|
-
-
|
104
|
-
- spec/blather/errors/stanza_error_spec.rb
|
105
|
-
- spec/blather/errors/stream_error_spec.rb
|
106
|
-
- spec/blather/errors_spec.rb
|
107
|
-
- spec/blather/jid_spec.rb
|
108
|
-
- spec/blather/roster_item_spec.rb
|
109
|
-
- spec/blather/roster_spec.rb
|
110
|
-
- spec/blather/stanza/discos/disco_info_spec.rb
|
111
|
-
- spec/blather/stanza/discos/disco_items_spec.rb
|
112
|
-
- spec/blather/stanza/iq/query_spec.rb
|
113
|
-
- spec/blather/stanza/iq/roster_spec.rb
|
114
|
-
- spec/blather/stanza/iq_spec.rb
|
115
|
-
- spec/blather/stanza/message_spec.rb
|
116
|
-
- spec/blather/stanza/presence/status_spec.rb
|
117
|
-
- spec/blather/stanza/presence/subscription_spec.rb
|
118
|
-
- spec/blather/stanza/presence_spec.rb
|
119
|
-
- spec/blather/stanza/pubsub/affiliations_spec.rb
|
120
|
-
- spec/blather/stanza/pubsub/items_spec.rb
|
121
|
-
- spec/blather/stanza/pubsub/subscriptions_spec.rb
|
122
|
-
- spec/blather/stanza/pubsub_spec.rb
|
123
|
-
- spec/blather/stanza_spec.rb
|
124
|
-
- spec/blather/stream/client_spec.rb
|
125
|
-
- spec/blather/stream/component_spec.rb
|
126
|
-
- spec/blather/xmpp_node_spec.rb
|
127
|
-
- spec/fixtures/pubsub.rb
|
128
|
-
- spec/spec_helper.rb
|
87
|
+
- LICENSE
|
88
|
+
- README.rdoc
|
129
89
|
has_rdoc: true
|
130
90
|
homepage: http://github.com/sprsquish/blather
|
131
91
|
licenses: []
|
@@ -163,8 +123,8 @@ test_files:
|
|
163
123
|
- spec/blather/jid_spec.rb
|
164
124
|
- spec/blather/roster_item_spec.rb
|
165
125
|
- spec/blather/roster_spec.rb
|
166
|
-
- spec/blather/stanza/discos/disco_info_spec.rb
|
167
|
-
- spec/blather/stanza/discos/disco_items_spec.rb
|
126
|
+
- spec/blather/stanza/iq/discos/disco_info_spec.rb
|
127
|
+
- spec/blather/stanza/iq/discos/disco_items_spec.rb
|
168
128
|
- spec/blather/stanza/iq/query_spec.rb
|
169
129
|
- spec/blather/stanza/iq/roster_spec.rb
|
170
130
|
- spec/blather/stanza/iq_spec.rb
|
@@ -172,21 +132,12 @@ test_files:
|
|
172
132
|
- spec/blather/stanza/presence/status_spec.rb
|
173
133
|
- spec/blather/stanza/presence/subscription_spec.rb
|
174
134
|
- spec/blather/stanza/presence_spec.rb
|
175
|
-
- spec/blather/stanza/pubsub/
|
176
|
-
- spec/blather/stanza/pubsub/items_spec.rb
|
177
|
-
- spec/blather/stanza/pubsub/subscriptions_spec.rb
|
178
|
-
- spec/blather/stanza/pubsub_spec.rb
|
135
|
+
- spec/blather/stanza/pubsub/event_spec.rb
|
179
136
|
- spec/blather/stanza_spec.rb
|
180
137
|
- spec/blather/stream/client_spec.rb
|
181
138
|
- spec/blather/stream/component_spec.rb
|
182
139
|
- spec/blather/xmpp_node_spec.rb
|
183
|
-
- spec/
|
140
|
+
- spec/build_safe.rb
|
184
141
|
- spec/spec_helper.rb
|
185
142
|
- examples/drb_client.rb
|
186
143
|
- examples/echo.rb
|
187
|
-
- examples/pubsub/cli.rb
|
188
|
-
- examples/pubsub/ping_pong.rb
|
189
|
-
- examples/pubsub/pubsub_dsl.rb
|
190
|
-
- examples/pubsub_client.rb
|
191
|
-
- examples/rosterprint.rb
|
192
|
-
- examples/xmpp4r/echo.rb
|
data/VERSION.yml
DELETED
data/examples/pubsub/cli.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'blather/client'
|
4
|
-
|
5
|
-
#ls
|
6
|
-
#cd
|
7
|
-
#cat
|
8
|
-
#Blather::LOG.level = Logger::DEBUG
|
9
|
-
module CliHandler
|
10
|
-
include EM::Protocols::LineText2
|
11
|
-
|
12
|
-
def ls(node)
|
13
|
-
pubsub.node(parse_dir(node)) do |result|
|
14
|
-
cur = node.split('/')
|
15
|
-
puts
|
16
|
-
puts result.items.map { |i| (i.node.split('/') - cur).join('/') }.join("\n")
|
17
|
-
start_line
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def cd(node)
|
22
|
-
@node = parse_dir(node)
|
23
|
-
start_line
|
24
|
-
end
|
25
|
-
|
26
|
-
def cat(item)
|
27
|
-
end
|
28
|
-
|
29
|
-
def connect(who)
|
30
|
-
@who = who
|
31
|
-
puts "connected to '#{who}'"
|
32
|
-
end
|
33
|
-
|
34
|
-
def exit(_)
|
35
|
-
EM.stop
|
36
|
-
end
|
37
|
-
|
38
|
-
def initialize
|
39
|
-
$stdout.sync = true
|
40
|
-
@node = ''
|
41
|
-
@who = ''
|
42
|
-
start_line
|
43
|
-
end
|
44
|
-
|
45
|
-
def start_line
|
46
|
-
puts "\n/#{@node}> "
|
47
|
-
end
|
48
|
-
|
49
|
-
def receive_line(line)
|
50
|
-
return unless line =~ /(connect|exit|ls|cd|cat)\s?(.*)/i
|
51
|
-
__send__ $1, $2
|
52
|
-
end
|
53
|
-
|
54
|
-
def parse_dir(list)
|
55
|
-
return '' if list == '/'
|
56
|
-
cur = @node.split('/')
|
57
|
-
list.split('/').each { |dir| dir == '..' ? cur.pop : (cur << dir) }
|
58
|
-
cur * '/'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
setup 'echo@jabber.local', 'echo'
|
63
|
-
pubsub_host 'pubsub.jabber.local'
|
64
|
-
when_ready { EM.open_keyboard CliHandler }
|
@@ -1,18 +0,0 @@
|
|
1
|
-
setup 'ping-pong@jabber.local', 'ping-pong'
|
2
|
-
|
3
|
-
pubsub.host = 'pubsub.jabber.local'
|
4
|
-
|
5
|
-
pubsub_event :node => 'ping' do |node|
|
6
|
-
pubsub.publish 'pong', node.payload
|
7
|
-
end
|
8
|
-
|
9
|
-
pubsub_event :node => 'pong' do |node|
|
10
|
-
x = node.payload.to_i
|
11
|
-
if x > 0
|
12
|
-
pubsub.publish 'ping', (x - 1)
|
13
|
-
else
|
14
|
-
shutdown
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
when_ready { pubsub.publish 'ping', 3 }
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# Get affiliations
|
2
|
-
pubsub.affiliations do |aff|
|
3
|
-
aff == {
|
4
|
-
:member => [],
|
5
|
-
:none => [],
|
6
|
-
:outcast => [],
|
7
|
-
:owner => [],
|
8
|
-
:publisher => []
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
# Get subscriptions
|
13
|
-
pubsub.subscriptions do |sub|
|
14
|
-
sub == {
|
15
|
-
:none => [],
|
16
|
-
:pending => [],
|
17
|
-
:subscribed => [],
|
18
|
-
:unconfigured => []
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
# Get nodes
|
23
|
-
pubsub.nodes(path = nil) do |nodes|
|
24
|
-
nodes == [
|
25
|
-
DiscoItems::Item
|
26
|
-
.jid
|
27
|
-
.node
|
28
|
-
.name
|
29
|
-
]
|
30
|
-
end
|
31
|
-
|
32
|
-
# Get node
|
33
|
-
pubsub.node(path = nil) do |node|
|
34
|
-
node = Node
|
35
|
-
.attributes = {
|
36
|
-
[form data fields]
|
37
|
-
}
|
38
|
-
.type = '(leaf|collection)'
|
39
|
-
.feature = ''
|
40
|
-
.items(ids = [], :max => nil) { |list_of_items| }
|
41
|
-
end
|
42
|
-
|
43
|
-
# Get node items
|
44
|
-
pubsub.items(path = '' | ids = [], max = nil) do |node_items|
|
45
|
-
node_items = [
|
46
|
-
Item
|
47
|
-
.jid
|
48
|
-
.id
|
49
|
-
.name
|
50
|
-
.payload
|
51
|
-
]
|
52
|
-
end
|
data/examples/pubsub_client.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# For subscribers
|
2
|
-
pubsub.nodes [path]
|
3
|
-
pubsub.node('path')
|
4
|
-
pubsub.node('path').subscribe
|
5
|
-
pubsub.node('path').affiliation
|
6
|
-
# For owners
|
7
|
-
pubsub.node('path').affiliations
|
8
|
-
pubsub.node('path').delete!
|
9
|
-
pubsub.node('path').purge!
|
10
|
-
pubsub.node('path').options
|
11
|
-
pubsub.node('path').defaults
|
12
|
-
pubsub.node('path').configure {}
|
13
|
-
|
14
|
-
pubsub.affiliations
|
15
|
-
|
16
|
-
pubsub.create 'node'
|
17
|
-
|
18
|
-
pubsub.publish 'node', 'content'
|
19
|
-
pubsub.delete 'node', 'item_id'
|
20
|
-
|
21
|
-
pubsub.subscriptions
|
22
|
-
pubsub.subscribe 'node'
|
23
|
-
pubsub.unsubscribe 'node'
|
24
|
-
|
25
|
-
# For subscribers
|
26
|
-
pubsub.subscriptions 'node'
|
27
|
-
pubsub.subscription 'node', [sub_id]
|
28
|
-
pubsub.subscription('node', [sub_id]).unsubscribe!
|
29
|
-
pubsub.subscription('node', [sub_id]).options
|
30
|
-
pubsub.subscription('node', [sub_id]).configure 'node', {}
|
31
|
-
# For owners
|
32
|
-
pubsub.subscriptions.pending
|
33
|
-
pubsub.subscription('sub_id').delete!
|
34
|
-
|
35
|
-
|
36
|
-
Node::Collection
|
37
|
-
nodes
|
38
|
-
Node::Leaf
|
39
|
-
items
|