NAME

Net::Jabber::IQ::Auth - Jabber IQ Authentication Module

SYNOPSIS

Net::Jabber::IQ::Auth is a companion to the Net::Jabber::IQ module.
It provides the user a simple interface to set and retrieve all parts
of a Jabber IQ Authentication query.

DESCRIPTION

To initialize the IQ with a Jabber <iq/> and then access the auth
query you must pass it the XML::Parser Tree array from the 
Net::Jabber::Client module.  In the callback function for the iq:

  use Net::Jabber;

  sub iq {
    my $iq = new Net::Jabber::IQ(@_);
    my $auth = $iq->GetQuery();
    .
    .
    .
  }

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

To create a new IQ auth to send to the server:

  use Net::Jabber;

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

  $IQ = new Net::Jabber::IQ();
  $Auth = $IQ->NewQuery("auth");
  ...

  $Client->Send($IQ);

Using $Auth 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

$username = $Auth->GetUsername();
$password = $Auth->GetPassword();
$resource = $Auth->GetResource();

@auth     = $Auth->GetTree();
$str      = $Auth->GetXML();

Creation functions

$Auth->SetAuth(resource=>'Anonymous');
$Auth->SetAuth(username=>'test',
               password=>'user',
               resource=>'Test Account');

$Auth->SetUsername('bob');
$Auth->SetPassword('bobrulez');
$Auth->SetResource('Bob the Great');

METHODS

Retrieval functions

GetUsername() - returns a string with the username in the <query/>.

GetPassword() - returns a string with the password in the <query/>.

GetResource() - returns a string with the resource in the <query/>.

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

SetAuth(username=>string, - set multiple fields in the <iq/> at one
        password=>string,   time.  This is a cumulative and over
        resource=>string)   writing action.  If you set the "username" 
                            twice, the second setting is what is
                            used.  If you set the password, and then
                            set the resource then both will be in the
                            <query/> tag.  For valid settings read 
                            the specific Set functions below.

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

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

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

AUTHOR

By Ryan Eatmon in December of 1999 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.