Net::Jabber::Query::Register - Jabber IQ Registration Module
Net::Jabber::Query::Register 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 IQ Registration query.
To initialize the IQ with a Jabber <iq/> and then access the register 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 $register = $iq->GetQuery(); . . . } You now have access to all of the retrieval functions available. To create a new IQ register to send to the server: use Net::Jabber; $client = new Net::Jabber::Client(); ... $iq = new Net::Jabber::IQ(); $register = $iq->NewQuery("jabber:iq:register"); ... $client->Send($iq); Using $register 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.
$instructions = $register->GetInstructions(); $username = $register->GetUsername(); $password = $register->GetPassword(); $name = $register->GetName(); $first = $register->GetFirst(); $last = $register->GetLast(); $nick = $register->GetNick(); $email = $register->GetEmail(); $address = $register->GetAddress(); $city = $register->GetCity(); $state = $register->GetState(); $zip = $register->GetZip(); $phone = $register->GetPhone(); $url = $register->GetURL(); $date = $register->GetDate(); $misc = $register->GetMisc(); $text = $register->GetText(); $key = $register->GetKey(); $remove = $register->GetRemove(); $registered = $register->GetRegistered(); %fields = $register->GetFields();
$register->SetRegister(username=>'test', password=>'user', name=>'Test Account'); $register->SetUsername('bob'); $register->SetPassword('bobrulez'); $register->SetName('Bob the Great'); $register->SetFirst('Bob'); $register->SetLast('Smith'); $register->SetNick('bobocity'); $register->SetEmail('bob\@bob.net'); $register->SetAddress('121 Bob St.'); $register->SetCity('Bobville'); $register->SetState('TX'); $register->SetZip('70000'); $register->SetPhone('(555)555-5555'); $register->SetURL('http://www.bob.net'); $register->SetDate('04/17/2000'); $register->SetMisc('...'); $register->SetText('...'); $register->SetKey('...'); $register->SetRemove();
$register->SetRegister(instructions=>'Fill out the following fields...', username=>'', password=>'', name=>'', email=>''); $register->SetInstructions('Fill out all of the fields...'); $register->SetUsername(); $register->SetPassword(); $register->SetName(); $register->SetFirst(); $register->SetLast(); $register->SetNick(); $register->SetEmail(); $register->SetAddress(); $register->SetCity(); $register->SetState(); $register->SetZip(); $register->SetPhone(); $register->SetURL(); $register->SetDate(); $register->SetMisc(); $register->SetText(); $register->SetKey(); $register->SetRemove(); $register->SetRegistered();
$test = $register->DefinedUsername(); $test = $register->DefinedPassword(); $test = $register->DefinedName(); $test = $register->DefinedFirst(); $test = $register->DefinedLast(); $test = $register->DefinedNick(); $test = $register->DefinedEmail(); $test = $register->DefinedAddress(); $test = $register->DefinedCity(); $test = $register->DefinedState(); $test = $register->DefinedZip(); $test = $register->DefinedPhone(); $test = $register->DefinedURL(); $test = $register->DefinedDate(); $test = $register->DefinedMisc(); $test = $register->DefinedText(); $test = $register->DefinedKey(); $test = $register->DefinedRemove(); $test = $register->DefinedRegistered();
GetInstructions() - returns a string with the instructions in the <query/>. GetUsername() - returns a string with the username in the <query/>. GetPassword() - returns a string with the password in the <query/>. GetName() - returns a string with the name in the <query/>. GetFirst() - returns a string with the fisrt in the <query/>. GetLast() - returns a string with the last in the <query/>. GetNick() - returns a string with the nick in the <query/>. GetEmail() - returns a string with the email in the <query/>. GetAddress() - returns a string with the address in the <query/>. GetCity() - returns a string with the city in the <query/>. GetState() - returns a string with the state in the <query/>. GetZip() - returns a string with the zip in the <query/>. GetPhone() - returns a string with the phone in the <query/>. GetURL() - returns a string with the URL in the <query/>. GetDate() - returns a string with the date in the <query/>. GetMisc() - returns a string with the misc in the <query/>. GetText() - returns a string with the text in the <query/>. GetKey() - returns a string with the key in the <query/>. GetRemove() - returns a string with the remove in the <query/>. GetRegistered() - returns a string with the registered in the <query/>. GetFields() - returns a hash with the keys being the fields contained in the <query/> and the values the contents of the tags.
SetRegister(instructions=>string, - set multiple fields in the <iq/> username=>string, at one time. This is a cumulative password=>string, and over writing action. If you name=>string, set the "username" twice, the second first=>string, setting is what is used. If you set last=>string, the password, and then set the nick=>string, name then both will be in the email=>string, <query/> tag. For valid settings address=>string, read the specific Set functions below. city=>string, state=>string, zip=>string, phone=>string, url=>string, date=>string, misc=>string, text=>string, key=>string, remove=>string, registered=>string) SetUsername(string) - sets the username for the account you are trying to create. Set string to "" to send <username/> for instructions. SetPassword(string) - sets the password for the account you are trying to create. Set string to "" to send <password/> for instructions. SetName(string) - sets the name for the account you are trying to create. Set string to "" to send <name/> for instructions. SetFirst(string) - sets the first for the account you are trying to create. Set string to "" to send <first/> for instructions. SetLast(string) - sets the last for the account you are trying to create. Set string to "" to send <last/> for instructions. SetNick(string) - sets the nick for the account you are trying to create. Set string to "" to send <nick/> for instructions. SetEmail(string) - sets the email for the account you are trying to create. Set string to "" to send <email/> for instructions. SetAddress(string) - sets the addess for the account you are trying to create. Set string to "" to send <address/> for instructions. SetCity(string) - sets the city for the account you are trying to create. Set string to "" to send <city/> for instructions. SetState(string) - sets the state for the account you are trying to create. Set string to "" to send <state/> for instructions. SetZip(string) - sets the zip code for the account you are trying to create. Set string to "" to send <zip/> for instructions. SetPhone(string) - sets the phone for the account you are trying to create. Set string to "" to send <phone/> for instructions. SetURL(string) - sets the url for the account you are trying to create. Set string to "" to send <url/> for instructions. SetDate(string) - sets the date for the account you are trying to create. Set string to "" to send <date/> for instructions. SetMisc(string) - sets the misc for the account you are trying to create. Set string to "" to send <misc/> for instructions. SetText(string) - sets the text for the account you are trying to create. Set string to "" to send <text/> for instructions. SetKey(string) - sets the key for the server/transport you are trying to regsiter to. SetRemove() - sets the remove for the account you are trying to delete so that the account will be removed from the server/transport. SetRegistered() - sets the registered for the account you are trying to create so that the account will know that it is already registered.
DefinedUsername() - returns 1 if there is a <username/> in the query, 0 if not. DefinedPassword() - returns 1 if there is a <password/> in the query, 0 if not. DefinedName() - returns 1 if there is a <name/> in the query, 0 if not. DefinedFirst() - returns 1 if there is a <first/> in the query, 0 if not. DefinedLast() - returns 1 if there is a <last/> in the query, 0 if not. DefinedNick() - returns 1 if there is a <nick/> in the query, 0 if not. DefinedEmail() - returns 1 if there is a <email/> in the query, 0 if not. DefinedAddress() - returns 1 if there is a <address/> in the query, 0 if not. DefinedCity() - returns 1 if there is a <city/> in the query, 0 if not. DefinedState() - returns 1 if there is a <state/> in the query, 0 if not. DefinedZip() - returns 1 if there is a <zip/> in the query, 0 if not. DefinedPhone() - returns 1 if there is a <phone/> in the query, 0 if not. DefinedURL() - returns 1 if there is a <url/> in the query, 0 if not. DefinedDate() - returns 1 if there is a <date/> in the query, 0 if not. DefinedMisc() - returns 1 if there is a <misc/> in the query, 0 if not. DefinedText() - returns 1 if there is a <text/> in the query, 0 if not. DefinedKey() - returns 1 if there is a <key/> in the query, 0 if not. DefinedRemove() - returns 1 if there is a <remove/> in the query, 0 if not. DefinedRegistered() - returns 1 if there is a <registered/> in the query, 0 if not.
By Ryan Eatmon in May 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.