Class Jabber::Roster
In: lib/jabber4r/roster.rb
Parent: Object

The Roster class encapsulates the runtime roster of the session instance. The Roster contains all subscriptions in a Jabber::Roster::RosterItem hash.

Methods
[]    add    add_listener    delete    delete_listener    each_item    new    notify_listeners    to_s   
Attributes
:session  [R] 

The Jabber::Session instance

Classes and Modules
Class Jabber::Roster::RosterItem
  ::Class Jabber::Roster::RosterItem::Resource
Public Class methods
new(session)

Creates a Roster for the session

session:[Jabber::Session] The session instance
Public Instance methods
add_listener(&block)

Adds a listener to the roster to process roster changes

&block:[Block |event, rosteritem|] The block to process roster changes
return:[String] The listener id to use to deregister
delete_listener(id)

Deletes a listener for processing roster messages

id:[String] A listener id (given by add_listener)
add(jid, subscription, name, group=nil)

Adds a subscription to be tracked in the Roster

jid:[JID | String] The Jabber ID
subscription:[String] The subscription type (both)
name:[String] The nickname
group:[String = nil] The name of the group of the roster item.
[](jid)

Returns a Jabber::Roster::RosterItem based on the JID

jid:[Jabber::JID | String] The Jabber ID
return:[Jabber::Roster::RosterItem] The roster item
delete(jid)

Deletes a roster item based on the supplied Jabber ID

jid:[Jabber::JID | String]
each_item() {|item}| ...}

Iterates over each RosterItem

yield:[Jabber::Roster::RosterItem] The roster item.
to_s()

Dumps the Roster state as a string

return:[String] The roster state
notify_listeners(event, object)

Notifies listeners of a roster change event

event:[Integer] The roster event
object:[RosterItem] The modified item