Sha256: 79a4fc78d1df0c465225f2b58d9f43c371d8f29c29d592ba3a7f740265e0362f

Contents?: true

Size: 957 Bytes

Versions: 32

Compression:

Stored size: 957 Bytes

Contents

#!/usr/bin/env ruby

$:.unshift '../../../../../lib'

require 'xmpp4r'
require 'xmpp4r/muc/helper/mucbrowser'

if ARGV.size != 3
  puts "Usage: #{$0} <jid> <password> <muc-jid>"
  exit
end

jid, password, muc_jid = Jabber::JID.new(ARGV.shift), ARGV.shift, Jabber::JID.new(ARGV.shift)

cl = Jabber::Client.new(jid)
cl.connect
cl.auth(password)

browser = Jabber::MUC::MUCBrowser.new(cl)

print "Querying #{muc_jid} for identity..."; $stdout.flush
name = browser.muc_name(muc_jid)

if name.nil?
  puts " Sorry, but the queried MUC component doesn't seem to support MUC or Groupchat."
else
  puts " #{name}"

  print "Querying #{muc_jid} for its rooms..."; $stdout.flush
  rooms = browser.muc_rooms(muc_jid)
  puts " #{rooms.size} rooms found"

  max_room_length = 0
  rooms.each_key { |jid| max_room_length = jid.to_s.size if jid.to_s.size > max_room_length }

  rooms.each { |jid,name|
    puts "#{jid.to_s.ljust(max_room_length)} #{name}"
  }
end

cl.close

Version data entries

32 entries across 32 versions & 11 rubygems

Version Path
brontes3d-xmpp4r-0.4 data/doc/xmpp4r/examples/basic/mucinfo.rb
edavey-xmpp4r-0.4.1 data/doc/xmpp4r/examples/basic/mucinfo.rb
edavey-xmpp4r-0.4.2 data/doc/xmpp4r/examples/basic/mucinfo.rb
edavey-xmpp4r-0.4 data/doc/xmpp4r/examples/basic/mucinfo.rb
ln-xmpp4r-0.5 data/doc/xmpp4r/examples/basic/mucinfo.rb
mojodna-xmpp4r-0.4.0.2 data/doc/xmpp4r/examples/basic/mucinfo.rb
mojodna-xmpp4r-0.4.0.3 data/doc/xmpp4r/examples/basic/mucinfo.rb
seanohalpin-xmpp4r-0.4.1 data/doc/xmpp4r/examples/basic/mucinfo.rb
xmpp4r-0.5.6 data/doc/xmpp4r/examples/basic/mucinfo.rb
xmpp4r-0.5.5 data/doc/xmpp4r/examples/basic/mucinfo.rb
gmcmillan-xmpp4r-0.6.2 data/doc/xmpp4r/examples/basic/mucinfo.rb
gmcmillan-xmpp4r-0.6.1 data/doc/xmpp4r/examples/basic/mucinfo.rb
gmcmillan-xmpp4r-0.6 data/doc/xmpp4r/examples/basic/mucinfo.rb
gmcmillan-xmpp4r-0.5 data/doc/xmpp4r/examples/basic/mucinfo.rb
mad-p-xmpp4r-0.6.3 data/doc/xmpp4r/examples/basic/mucinfo.rb
mad-p-xmpp4r-0.6.2 data/doc/xmpp4r/examples/basic/mucinfo.rb
mad-p-xmpp4r-0.6.1 data/doc/xmpp4r/examples/basic/mucinfo.rb
mad-p-xmpp4r-0.6.0 data/doc/xmpp4r/examples/basic/mucinfo.rb
cerberus-0.8.0 lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb
cerberus-0.7.9 lib/vendor/xmpp4r/data/doc/xmpp4r/examples/basic/mucinfo.rb