Method: BasicClient#initialize

Defined in:
lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb

#initializeBasicClient

Returns a new instance of BasicClient.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/client.rb', line 16

def initialize
  puts "Welcome to this Basic Console Jabber Client!"
  quit = false
  # main loop
  while not quit do
    print "> "
    $defout.flush
    line = gets
    quit = true if line.nil?
    if not quit
      command, args = line.split(' ', 2)
      args = args.to_s.chomp
      # main case
      case command
      when 'exit'
        quit = true
      when 'connect'
        do_connect(args)
      when 'help'
        do_help
      when 'auth'
        do_auth
      else
        puts "Command \"#{command}\" unknown"
      end
    end
  end
  puts "Goodbye!"
end