xmpp-agent 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 577bb2cc12f813639ee3d0b732b0809f26a0acb38fe23d4bcfc7a3b56966adbb
4
- data.tar.gz: 8a35a77d8e4d593d1cda6b7d7d881011bfffef1a323f57a52afb0300c692e06f
3
+ metadata.gz: c7ac6b0566fb1df652deac14e36378de8f6bf6efb94e46fc0e1de29cf69e64ca
4
+ data.tar.gz: a55e6ef11b62a4eae1a16b7465aa39bd09d5ca68abaa1349f5fc879cd0a0b480
5
5
  SHA512:
6
- metadata.gz: 7db481786756250f1dc7b60bb6be95c73d337860db32dc27f120d6b38504b681e68650c77547905df7482b7ce964936a896b9f98a29b354f92f5fe189fc3dfbf
7
- data.tar.gz: 5a25264b3e434b5c30b73f7e1331f0041dfe107d5058e62153f9c5dd319f84b10fc86d6f6439c05608b524a2874e7b33aecd2d3f0df74538749541bd35ac0ef6
6
+ metadata.gz: 6514c797f14f1d0bf0e4902e958f7599cbfcec1cf283a83fc4d800f5ab4af800ccf8ab8b9b1813b4a62c17f146000af2094334db03f42ccac5bb07f5e29ba871
7
+ data.tar.gz: 127d6d4092ad6906bde179c0b63a0742f13621668f7ed95005c0380e0a579838547a5cf6a5a4bef7bf30676460f2d5298f98e11da83832dcb22aeaa02e8ec09c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -11,7 +11,7 @@ class XMPPAgent
11
11
 
12
12
  attr_reader :client
13
13
 
14
- def initialize(jid: '', password: '', port: 5222, host: nil, debug: false, callback: nil)
14
+ def initialize(jid: '', password: '', port: 5222, host: nil, debug: false)
15
15
 
16
16
  @routes = {}; @params = {}; msg = nil
17
17
  @debug = debug
@@ -28,10 +28,10 @@ class XMPPAgent
28
28
 
29
29
  @client = client = Xrc::Client.new(h)
30
30
 
31
- @client.on_private_message do |message|
31
+ @client.on_private_message do |x|
32
32
 
33
- messages(@params, client, message)
34
- run_route message.body.strip
33
+ messages(@params, client, x)
34
+ run_route x.body.strip
35
35
 
36
36
  end
37
37
 
@@ -44,11 +44,11 @@ class XMPPAgent
44
44
  @client.on_event do |e|
45
45
 
46
46
  if e.name.to_s == 'presence' then
47
- on_presence_update(show=e.text('show'), status=e.text('status'), user=e.attributes['from'] )
47
+ self.on_presence_update(show=e.text('show'), status=e.text('status'),
48
+ user=e.attributes['from'] )
48
49
  end
49
50
 
50
51
  end
51
-
52
52
 
53
53
  end
54
54
 
@@ -56,6 +56,10 @@ class XMPPAgent
56
56
  @client.connect
57
57
  end
58
58
 
59
+ def say(body: '', from: @jid, to: '')
60
+ @client.say(body: body, from: from, to: to, type: "chat")
61
+ end
62
+
59
63
  protected
60
64
 
61
65
  def on_connected()
@@ -66,6 +70,7 @@ class XMPPAgent
66
70
 
67
71
  private
68
72
 
73
+ # note: msg contains attributes-> :from, to:, and :body
69
74
  def messages(params, client, msg)
70
75
 
71
76
  message %r{(send_to|send2)\s+([^\s]+)\s+(.*)} do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmpp-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  9Eg9Gbw3IF8iMcIPwTT7WTzb3vLw4+o6hP8oRi2CD1KB4KMDSxn4li5v8VuGdZ1o
36
36
  ZPG6kphiEV/Pdc0QAh4qYhIN
37
37
  -----END CERTIFICATE-----
38
- date: 2019-09-21 00:00:00.000000000 Z
38
+ date: 2019-09-22 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: xrc
metadata.gz.sig CHANGED
Binary file