xmpp-agent 0.3.0 → 0.3.1
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.
- checksums.yaml +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/lib/xmpp-agent.rb +11 -6
 - metadata +2 -2
 - metadata.gz.sig +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c7ac6b0566fb1df652deac14e36378de8f6bf6efb94e46fc0e1de29cf69e64ca
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a55e6ef11b62a4eae1a16b7465aa39bd09d5ca68abaa1349f5fc879cd0a0b480
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6514c797f14f1d0bf0e4902e958f7599cbfcec1cf283a83fc4d800f5ab4af800ccf8ab8b9b1813b4a62c17f146000af2094334db03f42ccac5bb07f5e29ba871
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 127d6d4092ad6906bde179c0b63a0742f13621668f7ed95005c0380e0a579838547a5cf6a5a4bef7bf30676460f2d5298f98e11da83832dcb22aeaa02e8ec09c
         
     | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/lib/xmpp-agent.rb
    CHANGED
    
    | 
         @@ -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 
     | 
| 
      
 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 | 
     | 
| 
      
 31 
     | 
    
         
            +
                @client.on_private_message do |x|
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                  messages(@params, client,  
     | 
| 
       34 
     | 
    
         
            -
                  run_route  
     | 
| 
      
 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'),  
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 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 
     |