Sha256: 9cff894f24961834e39a229205b7a2b59ba691790ad2c9eb781dc143648d807f

Contents?: true

Size: 757 Bytes

Versions: 33

Compression:

Stored size: 757 Bytes

Contents

#!/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

Version data entries

33 entries across 33 versions & 12 rubygems

Version Path
brontes3d-xmpp4r-0.4 data/doc/xmpp4r/examples/basic/rosterprint.rb
bryanl-xmpp4r-0.3.2 data/doc/xmpp4r/examples/basic/rosterprint.rb
edavey-xmpp4r-0.4.1 data/doc/xmpp4r/examples/basic/rosterprint.rb
edavey-xmpp4r-0.4.2 data/doc/xmpp4r/examples/basic/rosterprint.rb
edavey-xmpp4r-0.4 data/doc/xmpp4r/examples/basic/rosterprint.rb
heipei-xmpp4r-0.3.2 data/doc/xmpp4r/examples/basic/rosterprint.rb
ln-xmpp4r-0.5 data/doc/xmpp4r/examples/basic/rosterprint.rb
mojodna-xmpp4r-0.4.0.2 data/doc/xmpp4r/examples/basic/rosterprint.rb
mojodna-xmpp4r-0.4.0.3 data/doc/xmpp4r/examples/basic/rosterprint.rb
seanohalpin-xmpp4r-0.4.1 data/doc/xmpp4r/examples/basic/rosterprint.rb
xmpp4r-0.5.6 data/doc/xmpp4r/examples/basic/rosterprint.rb
xmpp4r-0.5.5 data/doc/xmpp4r/examples/basic/rosterprint.rb
mad-p-xmpp4r-0.6.3 data/doc/xmpp4r/examples/basic/rosterprint.rb
mad-p-xmpp4r-0.6.2 data/doc/xmpp4r/examples/basic/rosterprint.rb
mad-p-xmpp4r-0.6.1 data/doc/xmpp4r/examples/basic/rosterprint.rb
mad-p-xmpp4r-0.6.0 data/doc/xmpp4r/examples/basic/rosterprint.rb
cerberus-0.8.0 lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb
cerberus-0.7.9 lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb
edavis10-cerberus-0.7.8 lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb
cerberus-0.7.8 lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/rosterprint.rb