em-xmpp 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,43 +29,59 @@ module EM::Xmpp
29
29
 
30
30
  def stack_decorators
31
31
  on_presence_decorator do |ctx|
32
- ctx = ctx.with(:presence)
33
- ctx = ctx.with(:error) if ctx.error?
32
+ presence = ctx.bit!(:presence)
33
+ ctx.bit!(:error) if presence.error?
34
34
  ctx
35
35
  end
36
36
  on_message_decorator do |ctx|
37
- ctx = ctx.with(:message)
38
- ctx = ctx.with(:error) if ctx.error?
37
+ msg = ctx.bit!(:message)
38
+ ctx.bit!(:error) if msg.error?
39
39
  ctx
40
40
  end
41
41
  on_iq_decorator do |ctx|
42
- ctx = ctx.with(:iq)
43
- ctx = ctx.with(:error) if ctx.error?
42
+ iq = ctx.bit!(:iq)
43
+ ctx.bit!(:error) if iq.error?
44
44
  ctx
45
45
  end
46
46
  on_decorator('//xmlns:delay', 'xmlns' => Delay) do |ctx|
47
- ctx.with(:delay)
47
+ ctx.bit!(:delay)
48
+ ctx
48
49
  end
49
50
  on_decorator('//xmlns:query', 'xmlns' => DiscoverInfos) do |ctx|
50
- ctx.with(:discoinfos)
51
+ ctx.bit!(:discoinfos)
52
+ ctx
51
53
  end
52
54
  on_decorator('//xmlns:query', 'xmlns' => DiscoverItems) do |ctx|
53
- ctx.with(:discoitems)
55
+ ctx.bit!(:discoitems)
56
+ ctx
54
57
  end
55
58
  on_decorator('//xmlns:query', 'xmlns' => Roster) do |ctx|
56
- ctx.with(:roster)
59
+ ctx.bit!(:roster)
60
+ ctx
57
61
  end
58
62
  on_decorator('//xmlns:command', 'xmlns' => Commands) do |ctx|
59
- ctx.with(:command)
63
+ ctx.bit!(:command)
64
+ ctx
60
65
  end
61
66
  on_decorator('//xmlns:x', 'xmlns' => DataForms) do |ctx|
62
- ctx.with(:dataforms)
67
+ ctx.bit!(:dataforms)
68
+ ctx
63
69
  end
64
70
  on_decorator('//xmlns:nick', 'xmlns' => Nick) do |ctx|
65
- ctx.with(:nickname)
71
+ ctx.bit!(:nickname)
72
+ ctx
66
73
  end
67
74
  on_decorator('//xmlns:x', 'xmlns' => MucUser) do |ctx|
68
- ctx.with(:mucuser)
75
+ ctx.bit!(:mucuser)
76
+ ctx
77
+ end
78
+ on_decorator('//xmlns:si', 'xmlns' => StreamInitiation) do |ctx|
79
+ ctx.bit!(:streaminitiation)
80
+ ctx
81
+ end
82
+ on_decorator('//xmlns:query', 'xmlns' => ByteStreams) do |ctx|
83
+ ctx.bit!(:bytestreams)
84
+ ctx
69
85
  end
70
86
  end
71
87
 
@@ -326,7 +342,7 @@ module EM::Xmpp
326
342
  end
327
343
 
328
344
  c.send_stanza(session_request) do |ctx|
329
- if ctx.type == 'result'
345
+ if ctx.bit!(:stanza).type == 'result'
330
346
  @connection.negotiation_finished
331
347
  ctx.delete_xpath_handler!.done!
332
348
  else
@@ -10,8 +10,8 @@ module EM::Xmpp
10
10
  iq.query(:xmlns => Roster)
11
11
  end
12
12
 
13
- send_stanza roster do |rsp|
14
- f.resume rsp.items
13
+ send_stanza(roster) do |response|
14
+ f.resume response.bit!(:roster).items
15
15
  end
16
16
 
17
17
  Fiber.yield
@@ -45,5 +45,15 @@ module EM::Xmpp
45
45
  MucOwner = 'http://jabber.org/protocol/muc#owner'
46
46
  #Multi user chat - roomconfig
47
47
  MucRoomconfig = 'http://jabber.org/protocol/muc#roomconfig'
48
+ #Stream initiation offer
49
+ StreamInitiation = 'http://jabber.org/protocol/si'
50
+ #FileTransfer
51
+ FileTransfer = 'http://jabber.org/protocol/si/profile/file-transfer'
52
+ #Feature Negotiation
53
+ FeatureNeg = 'http://jabber.org/protocol/feature-neg'
54
+ #ByteStreamTransfer
55
+ ByteStreams = 'http://jabber.org/protocol/bytestreams'
56
+ #Extension for Fast byte stream transfers
57
+ FastByteStreams = 'http://affinix.com/jabber/stream'
48
58
  end
49
59
  end
@@ -1,5 +1,5 @@
1
1
  module Em
2
2
  module Xmpp
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.10"
4
4
  end
5
5
  end
@@ -19,22 +19,26 @@ module RosterClient
19
19
  puts "***** #{@jid} ready"
20
20
 
21
21
  on_presence do |ctx|
22
- if ctx.subscription_request?
23
- puts "**** accepting subscription from #{ctx.from}"
24
- send_stanza ctx.reply('type'=>'subscribed')
25
- ctx.from.subscribe
26
- ctx.from.add_to_roster
22
+ presence = ctx.bit(:presence)
23
+
24
+ if presence.subscription_request?
25
+ puts "**** accepting subscription from #{presence.from}"
26
+ send_stanza presence.reply('type'=>'subscribed')
27
+ presence.from.subscribe
28
+ presence.from.add_to_roster
27
29
  else
28
- puts "**** #{ctx.from} is present"
30
+ puts "**** #{presence.from} is present"
29
31
  end
30
32
 
31
33
  ctx #returns a ctx for subsequent handlers if any
32
34
  end
33
35
 
34
36
  on_message do |ctx|
35
- puts "**** message from #{ctx.from}"
36
- puts ctx.body
37
- hello = ctx.reply do |rep|
37
+ msg = ctx.bit :message
38
+
39
+ puts "**** message from #{msg.from}"
40
+ puts msg.body
41
+ hello = msg.reply do |rep|
38
42
  rep.body "hello world"
39
43
  end
40
44
  send_stanza hello
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-xmpp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-22 00:00:00.000000000Z
12
+ date: 2013-01-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
16
- requirement: &2157880740 !ruby/object:Gem::Requirement
16
+ requirement: &2156077160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2157880740
24
+ version_requirements: *2156077160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &2157880320 !ruby/object:Gem::Requirement
27
+ requirement: &2156076480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2157880320
35
+ version_requirements: *2156076480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ruby-sasl
38
- requirement: &2157879900 !ruby/object:Gem::Requirement
38
+ requirement: &2156075840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2157879900
46
+ version_requirements: *2156075840
47
47
  description: XMPP client for event machine
48
48
  email:
49
49
  - crapooze@gmail.com