Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 51 lines (34 sloc) 0.757 kb
#!/usr/bin/ruby
$:.unshift '../../../../../lib/'
require 'xmpp4r'
require 'xmpp4r/roster/helper/roster'
# Command line argument checking
if ARGV.size != 2
puts("Usage: ./rosterprint.rb <jid> <password>")
exit
end
# Building up the connection
#Jabber::debug = true
jid = Jabber::JID.new(ARGV[0])
cl = Jabber::Client.new(jid)
cl.connect
cl.auth(ARGV[1])
# The roster instance
roster = Jabber::Roster::Helper.new(cl)
mainthread = Thread.current
roster.add_query_callback { |iq|
mainthread.wakeup
}
Thread.stop
roster.groups.each { |group|
if group.nil?
puts "*** Ungrouped ***"
else
puts "*** #{group} ***"
end
roster.find_by_group(group).each { |item|
puts "- #{item.iname} (#{item.jid})"
}
print "\n"
}
cl.close
Jump to Line
Something went wrong with that request. Please try again.