Sha256: 376a4b252808ebd49daaa5e14e012aa790b5852a8ce4727fd765e3c74c4b6a48
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
#!/usr/bin/ruby # Basic console client that does nothing, but easy to modify to test things. # to test, start, then type : # connect login@server/resource password # auth require 'xmpp4r/client' include Jabber Jabber::debug = true class BasicClient 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.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 def do_help puts <<-EOF # exit - exits # connect user@server/resource password - connects # auth - sends authentification EOF end ## # connect <jid> <password> def do_connect(args) @jid, @password = args.split(' ', 3) @jid = JID::new(@jid) @cl = Client::new(@jid) @cl.connect end ## # auth def do_auth @cl.auth(@password, false) end end BasicClient::new
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xmpp4r-0.3 | data/doc/xmpp4r/examples/basic/client.rb |