Sha256: 64012b4efbd301dfb29f11853eb8a48c81bc18d03479cc48bc0ebba81279c792

Contents?: true

Size: 702 Bytes

Versions: 4

Compression:

Stored size: 702 Bytes

Contents

#!/usr/bin/env ruby

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

require 'xmpp4r'
require 'xmpp4r/roster/iq/roster'

# Command line argument checking

if ARGV.size < 4
  puts("Usage: ./rosterrename.rb <your jid> <password> <jid to rename> <new name> [<group1> ... <groupn>]")
  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 iq stanza
iq = Jabber::Iq.new(:set)
# The new roster instance and item element
iq.add(Jabber::Roster::IqQueryRoster.new).add(Jabber::Roster::RosterItem.new(ARGV[2], ARGV[3])).groups = ARGV[4..ARGV.size]

# Sending the stanza
cl.send(iq)

# Don't look at the results:
cl.close

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gmcmillan-xmpp4r-0.6.2 data/doc/xmpp4r/examples/basic/rosterrename.rb
gmcmillan-xmpp4r-0.6.1 data/doc/xmpp4r/examples/basic/rosterrename.rb
gmcmillan-xmpp4r-0.6 data/doc/xmpp4r/examples/basic/rosterrename.rb
gmcmillan-xmpp4r-0.5 data/doc/xmpp4r/examples/basic/rosterrename.rb