Sha256: ed68de5f29311d35feba96faa12df60df13084b88e603c7883a60fcec3a79336
Contents?: true
Size: 914 Bytes
Versions: 2
Compression:
Stored size: 914 Bytes
Contents
#!/usr/bin/ruby # This script can get all roster entries require 'optparse' require 'xmpp4r' require 'xmpp4r/roster/iq/roster' include Jabber jid = JID.new('lucastest@linux.ensimag.fr/rosterget') password = 'lucastest' OptionParser.new do |opts| opts.banner = 'Usage: roster.rb -t get -j jid -p password' opts.separator '' opts.on('-j', '--jid JID', 'sets the jid') { |j| jid = JID.new(j) } opts.on('-p', '--password PASSWORD', 'sets the password') { |p| password = p } opts.on_tail('-h', '--help', 'Show this message') { puts opts exit } opts.parse!(ARGV) end cl = Client.new(jid, false) cl.connect cl.auth(password) cl.send(Iq.new_rosterget) exit = false cl.add_iq_callback { |i| if i.type == :result and i.query.kind_of?(Roster::IqQueryRoster) i.query.each_element { |e| e.text = '' puts e.to_s } exit = true end } while not exit cl.process end cl.close
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
bryanl-xmpp4r-0.3.2 | data/doc/xmpp4r/examples/basic/roster.rb |
heipei-xmpp4r-0.3.2 | data/doc/xmpp4r/examples/basic/roster.rb |