Net::Jabber::Query::Auth - Jabber IQ Authentication Module
Net::Jabber::Query::Auth is a companion to the Net::Jabber::Query module. It provides the user a simple interface to set and retrieve all parts of a Jabber Authentication query.
To initialize the Query 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 iqCB { 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 Query auth to send to the server: use Net::Jabber; $client = new Net::Jabber::Client(); ... $iq = new Net::Jabber::IQ(); $auth = $iq->NewQuery("jabber:iq: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.
$username = $auth->GetUsername(); $password = $auth->GetPassword(); $digest = $auth->GetDigest(); $resource = $auth->GetResource();
$auth->SetAuth(resource=>'Anonymous'); $auth->SetAuth(username=>'test', password=>'user', resource=>'Test Account'); $auth->SetUsername('bob'); $auth->SetPassword('bobrulez'); $auth->SetDigest(''); $auth->SetResource('Bob the Great');
$test = $auth->DefinedUsername(); $test = $auth->DefinedPassword(); $test = $auth->DefinedDigest(); $test = $auth->DefinedResource();
GetUsername() - returns a string with the username in the <query/>. GetPassword() - returns a string with the password in the <query/>. GetDigest() - returns a string with the SHA-1 digest in the <query/>. GetResource() - returns a string with the resource in the <query/>.
SetAuth(username=>string, - set multiple fields in the <iq/> at one password=>string, time. This is a cumulative and over digest=>string, writing action. If you set the "username" resource=>string) 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. SetDigest(string) - sets the SHA-1 digest 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.
DefinedUsername() - returns 1 if <username/> exists in the <iq/>, 0 otherwise. DefinedPassword() - returns 1 if <password/> exists in the <iq/>, 0 otherwise. DefinedDigest() - returns 1 if <digest/> exists in the <iq/>, 0 otherwise. DefinedResource() - returns 1 if <resource/> exists in the <iq/>, 0 otherwise.
By Ryan Eatmon in July of 2000 for http://jabber.org..
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::Jabber, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Jabber
CPAN shell
perl -MCPAN -e shell install Net::Jabber
For more information on module installation, please visit the detailed CPAN module installation guide.