++ed by:

2 non-PAUSE users.

Ryan Eatmon

NAME

Net::Jabber::X::Roster::Item - Jabber IQ Roster Item Module

SYNOPSIS

  Net::Jabber::X::Roster::Item is a companion to the 
  Net::Jabber::X::Roster module.  It provides the user a simple 
  interface to set and retrieve all parts of a Jabber Roster Item.

DESCRIPTION

  To initialize the Item with a Jabber <x/> and then access the </x>
  you must pass it the XML::Parser Tree array from the 
  Net::Jabber::Client module.  In the callback function for the object
  type foo:

    use Net::Jabber;

    sub foo {
      my $foo = new Net::Jabber::Foo(@_);

      my @xTags = $foo->GetX("jabber:x:roster");

      my $xTag;
      foreach $xTag (@xTags) {
        my @items = $xTag->GetItems();
        my $item;
        foreach $item (@items) {
          $item->GetXXXX();
          .
          .
          .
        }
      }
      .
      .
      .
    }

  You now have access to all of the retrieval functions available below.

  To create a new IQ Roster Item to send to the server:

    use Net::Jabber;

    $Client = new Net::Jabber::Client();
    ...

    $foo = new Net::Jabber::Foo();
    $roster = $foo->NewX("jabber:x:roster");
    $foo = $roster->AddItem();
    ...

    $client->Send($foo);

  Using $item you can call the creation functions below to populate the 
  tag before sending it.

  For more information about the array format being passed to the CallBack
  please read the Net::Jabber::Client documentation.

Retrieval functions

    $jid          = $item->GetJID();
    $jidJID       = $item->GetJID("jid");
    $name         = $item->GetName();
    @groups       = $item->GetGroups();

    @item         = $item->GetTree();
    $str          = $item->GetXML();

Creation functions

    $item->SetItem(jid=>'bob@jabber.org',
                   name=>'Bob',
                   subscription=>'both',
                   groups=>[ 'friends','school' ]);

    $item->SetJID('bob@jabber.org');
    $item->SetName('Bob');
    $item->SetGroups(['friends','school']);

METHODS

Retrieval functions

  GetJID()      - returns either a string with the Jabber Identifier,
  GetJID("jid")   or a Net::Jabber::JID object for the person who is 
                  listed in this <item/>.  To get the JID object set the 
                  string to "jid", otherwise leave blank for the text
                  string.

  GetName() - returns a string with the name of the jabber ID.

  GetGroups() - returns an array of strings with the names of the groups
               that this <item/> belongs to.

  GetXML() - returns the XML string that represents the <presence/>.
             This is used by the Send() function in Client.pm to send
             this object as a Jabber Presence.

  GetTree() - returns an array that contains the <presence/> tag
              in XML::Parser Tree format.

Creation functions

  SetItem(jid=>string|JID, - set multiple fields in the <item/>
          name=>string,      at one time.  This is a cumulative
          groups=>array)     and overwriting action.  If you
                             set the "name" twice, the second
                             setting is what is used.  If you set
                             the name, and then set the
                             jid then both will be in the
                             <item/> tag.  For valid settings
                             read the specific Set functions below.
                             Note: groups does not behave in this
                             manner.  For each group setting a
                             new <group/> tag will be created.

  SetJID(string) - sets the Jabber Identifier.  You can either pass a
  SetJID(JID)      string or a JID object.  They must be valid Jabber 
                   Identifiers or the server will return an error message.
                   (ie.  jabber:bob@jabber.org/Silent Bob, etc...)

  SetName(string) - sets the password for the account you are
                        trying to connect with.  Leave blank for
                        an anonymous account.

  SetGroups(array) - sets the group for each group in the array.

AUTHOR

By Ryan Eatmon in May of 2000 for http://jabber.org..

COPYRIGHT

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.