Class: Switchboard::Commands::Roster::Online
- Inherits:
-
Switchboard::Command
- Object
- Switchboard::Command
- Switchboard::Commands::Roster::Online
- Defined in:
- lib/switchboard/commands/roster/online.rb
Class Method Summary collapse
Methods inherited from Switchboard::Command
description, help, options, to_command, to_command_name
Class Method Details
.run! ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/switchboard/commands/roster/online.rb', line 7 def self.run! switchboard = Switchboard::Client.new do puts "Collecting presences..." sleep 5 roster.items.each do |jid, item| next unless item.online? puts "#{item.jid}:" item.each_presence do |presence| status = [presence.show, presence.status].compact * " - " status = "available" if status == "" puts " /#{presence.from.resource} (#{status}) [#{presence.priority}]" end end end switchboard.plug!(AutoAcceptJack) switchboard.run! end |