Class: Switchboard::Commands::Roster::List

Inherits:
Switchboard::Command show all
Defined in:
lib/switchboard/commands/roster/list.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
# File 'lib/switchboard/commands/roster/list.rb', line 7

def self.run!
  # TODO override settings with values from the command line
  switchboard = Switchboard::Client.new(Switchboard::Settings.new, false)

  switchboard.on_roster_loaded do
    if roster.items.any?
      puts "#{settings["jid"]}'s roster:"
      puts roster.items.keys.map { |jid| jid.to_s } * "\n"
    else
      puts "#{settings["jid"]}'s roster is empty."
    end
  end

  switchboard.plug!(AutoAcceptJack)
  switchboard.run!
end