Class: Saber::AutoFetcher::Client
- Inherits:
-
Object
- Object
- Saber::AutoFetcher::Client
- Defined in:
- lib/saber/autofetcher/client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#fetcher ⇒ Object
readonly
Returns the value of attribute fetcher.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
19 20 21 |
# File 'lib/saber/autofetcher/client.rb', line 19 def client @client end |
#fetcher ⇒ Object (readonly)
Returns the value of attribute fetcher.
19 20 21 |
# File 'lib/saber/autofetcher/client.rb', line 19 def fetcher @fetcher end |
Class Method Details
Instance Method Details
#start ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/saber/autofetcher/client.rb', line 26 def start client.connect Rc.client.xmpp.host, Rc.client.xmpp.port client.auth Rc.client.xmpp.password at_exit do pd Thread.current begin client.send Jabber::Presence.new.set_type(:unavaliable) rescue IOError # closed stream Saber.ui.error "closed stream (IOError)" end end client. { |msg| if msg.from. == Rc.server.xmpp.jid files = msg.body.split("\n") Saber.ui.debug "RECV #{files}" fetcher.add *files end pd "add done" } client.send Jabber::Iq.new_rosterget client.send Jabber::Presence.new.set_type(:avaliable) Saber.ui.say ">> Connected to xmpp with #{Rc.client.xmpp.jid}" end |
#stop ⇒ Object
53 54 55 |
# File 'lib/saber/autofetcher/client.rb', line 53 def stop @client.close! end |