Net::Jabber::Query - Jabber Query Library
Net::Jabber::Query is a companion to the Net::Jabber::IQ module. Itprovides the user a simple interface to set and retrieve allparts of a Jabber IQ Query.
Net::Jabber::Query differs from the other modules in that its behaviorand available functions are based off of the XML namespace that isset in it. The current list of supported namespaces is:
jabber:iq:agentjabber:iq:agentsjabber:iq:authjabber:iq:autoupdatejabber:iq:browsejabber:iq:conferencejabber:iq:filterjabber:iq:gatewayjabber:iq:lastjabber:iq:oobjabber:iq:passjabber:iq:registerjabber:iq:rosterjabber:iq:searchjabber:iq:timejabber:iq:version
For more information on what these namespaces are for, visithttp://www.jabber.org and browse the Jabber Programmers Guide.
Each of these namespaces provide Net::Jabber::Query with the functionsto access the data. By using the AUTOLOAD function the functions foreach namespace is used when that namespace is active.
To access a Query object you must create an IQ object and use theaccess functions there to get to the Query. To initialize the IQ witha Jabber <iq/> you must pass it the XML::Stream hash from theNet::Jabber::Client module.
my $iq = new Net::Jabber::IQ(%hash);
There has been a change from the old way of handling the callbacks.You no longer have to do the above yourself, a Net::Jabber::IQobject is passed to the callback function for the message. Also,the first argument to the callback functions is the session ID fromXML::Streams. There are some cases where you might want thisinformation, like if you created a Client that connects to two serversat once, or for writing a mini server.
use Net::Jabber qw(Client);
sub iqCB {my ($IQ) = @_;my $query = $IQ->GetQuery();...}
You now have access to all of the retrieval functions available forthat namespace.
To create a new iq to send to the server:
use Net::Jabber;
my $iq = new Net::Jabber::IQ();$query = $iq->NewQuery("jabber:iq:register");
Now you can call the creation functions for the Query as defined in theproper namespaces. See below for the general <query/> functions, andin each query module for those functions.
For more information about the array format being passed to theCallBack please read the Net::Jabber::Client documentation.
Retrieval functions
GetXMLNS() - returns a string with the namespace of the query thatthe <iq/> contains.
$xmlns = $IQ->GetXMLNS();
GetQuery() - since the behavior of this module depends on thenamespace, a Query object may contain Query objects.This helps to leverage code reuse by making childrenbehave in the same manner. More than likely thisfunction will never be called.
@query = GetQuery()
Creation functions
SetXMLNS(string) - sets the xmlns of the <query/> to the string.
$query->SetXMLNS("jabber:iq:roster");
In an effort to make maintaining this document easier, I am not going to go into full detail on each of these functions. Rather I will present the functions in a list with a type in the first column to show what they return, or take as arugments. Here is the list of types I will use:
string - just a stringarray - array of stringsflag - this means that the specified child exists in theXML <child/> and acts like a flag. get will return0 or 1.JID - either a string or Net::Jabber::JID object.objects - creates new objects, or returns an array ofobjects.special - this is a special case kind of function. Usuallyjust by calling Set() with no arguments it willdefault the value to a special value, like OS or time.Sometimes it will modify the value you set, likein jabber:iq:version SetVersion() the functionadds on the Net::Jabber version to the stringjust for advertisement purposes. =)master - this desribes a function that behaves like theSetMessage() function in Net::Jabber::Message.It takes a hash and sets all of the values defined,and the Set returns a hash with the values thatare defined in the object.
Type Get Set Defined======= ================ ================ ==================flag GetAgents() SetAgents() DefinedAgents()string GetDescription() SetDescription() DefinedDesrciption()JID GetJID() SetJID() DefinedJID()string GetName() SetName() DefinedName()flag GetGroupChat() SetGroupChat() DefinedGroupChat()flag GetRegister() SetRegister() DefinedRegister()flag GetSearch() SetSearch() DefinedSearch()string GetService() SetService() DefinedService()string GetTransport() SetTransport() DefinedTransport()master GetAgent() SetAgent()
Type Get Set Defined======= ================ ================ ==================objects AddAgent() DefinedAgent()master GetAgents()
Type Get Set Defined======= ================ ================ ==================string GetDigest() SetDigest() DefinedDigest()string GetHash() SetHash() DefiendHash()string GetPassword() SetPassword() DefinedPassword()string GetResource() SetResource() DefinedResource()string GetSequence() SetSequence() DefinedSequence()string GetToken() SetToken() DefinedToken()string GetUsername() SetUsername() DefinedUsername()master GetAuth() SetAuth()
Type Get Set Defined======= ================ ================ ==================objects GetReleases()objects AddBeta()objects AddDev()objects AddRelease()
Type Get Set Defined======= ================ ================ ==================string GetDesc() SetDesc() DefinedDesc()string GetPriority() SetPriority() DefinedPriority()string GetURL() SetURL() DefinedURL()string GetVersion() SetVersion() DefinedVersion()master GetRelease() SetRelease()
Type Get Set Defined======= ================ ================ ==================JID GetJID() SetJID() DefinedJID()string GetName() SetName() DefinedName()string GetType() SetType() DefinedType()array GetNS() SetNS() DefinedNS()master GetBrowse() SetBrowse()objects AddItem()objects GetItems()
Type Get Set Defined======= ================ ================ ==================JID GetJID() SetJID() DefinedJID()string GetName() SetName() DefinedName()string GetType() SetType() DefinedType()array GetNS() SetNS() DefinedNS()master GetBrowse() SetBrowse()objects AddItem()objects GetItems()
Type Get Set Defined======= ================ ================ ==================string GetID() SetID() DefinedID()string GetName() SetName() DefinedName()array GetNick() SetNick() DefinedNick()flag GetPrivacy() SetPrivacy() DefinedPrivacy()string GetSecret() SetSecret() DefinedSecret()master GetConference() SetConference()
Type Get Set Defined======= ================ ================ ==================objects AddRule()objects GetRules()
Type Get Set Defined======= ================ ================ ==================string GetBody() SetBody() DefinedBody()string GetContinued() SetContinued() DefinedContinued()string GetDrop() SetDrop() DefinedDrop()string GetEdit() SetEdit() DefinedEdit()string GetError() SetError() DefinedError()string GetFrom() SetFrom() DefinedFrom()string GetOffline() SetOffline() DefinedOffline()string GetReply() SetReply() DefinedReply()string GetResource() SetResource() DefinedResource()string GetShow() SetShow() DefinedShow()string GetSize() SetSize() DefinedSize()string GetSubject() SetSubject() DefinedSubject()string GetTime() SetTime() DefinedTime()string GetType() SetType() DefinedType()string GetUnavailable() SetUnavailable() DefinedUnavailable()master GetConference() SetConference()
Type Get Set Defined======= ================ ================ ==================JID GetJID() SetJID() DefinedJID()string GetDesc() SetDesc() DefinedDesc()string GetPrompt() SetPrompt() DefinedPrompt()master GetGateway() SetGateway()
Type Get Set Defined======= ================ ================ ==================string GetMessage() SetMessage() DefinedMessage()string GetSeconds() SetSeconds() DefinedSeconds()master GetLast() SetLast()
Type Get Set Defined======= ================ ================ ==================string GetDesc() SetDesc() DefinedDesc()string GetURL() SetURL() DefinedURL()master GetOob() SetOob()
Type Get Set Defined======= ================ ================ ==================string GetClient() SetClient() DefinedClient()string GetClientPort() SetClientPort() DefinedClientPort()string GetClose() SetClose() DefinedClose()string GetExpire() SetExpire() DefinedExpire()string GetOneShot() SetOneShot() DefinedOneShot()string GetProxy() SetProxy() DefinedProxy()string GetProxyPort() SetProxyPort() DefinedProxyPort()string GetServer() SetServer() DefinedServer()string GetServerPort() SetServerPort() DefinedServerPort()master GetPass() SetPass()
Type Get Set Defined======= ================ ================ ==================string GetAddress() SetAddress() DefinedAddress()string GetCity() SetCity() DefinedCity()string GetDate() SetDate() DefinedDate()string GetEmail() SetEmail() DefinedEmail()string GetFirst() SetFirst() DefinedFirst()string GetInstructions() SetInstructions() DefinedInstructions()string GetKey() SetKey() DefinedKey()string GetLast() SetLast() DefinedLast()string GetMisc() SetMisc() DefinedMisc()string GetName() SetName() DefinedName()string GetNick() SetNick() DefinedNick()string GetPassword() SetPassword() DefinedPassword()string GetPhone() SetPhone() DefinedPhone()flag GetRegistered() SetRegistered() DefinedRegistered()flag GetRemove() SetRemove() DefinedRemove()string GetState() SetState() DefinedState()string GetText() SetText() DefinedText()string GetURL() SetURL() DefinedURL()string GetUsername() SetUsername() DefinedUsername()string GetZip() SetZip() DefinedZip()master GetRegister() SetRegister()
Type Get Set Defined======= ================ ================ ==================objects AddItem()objects GetItems()
Type Get Set Defined======= ================ ================ ==================string GetAsk() SetAsk() DefinedAsk()array GetGroup() SetGroup() DefinedGroup()JID GetJID() SetJID() DefinedJID()string GetName() SetName() DefinedName()string GetSubscription() SetSubscription() DefinedSubscription()master GetItem() SetItem()
Type Get Set Defined======= ================ ================ ==================string GetEmail() SetEmail() DefinedEmail()string GetFirst() SetFirst() DefinedFirst()string GetFamily() SetFamily() DefinedFamily()string GetGiven() SetGiven() DefinedGiven()string GetInstructions() SetInstructions() DefinedInstructions()string GetKey() SetKey() DefinedKey()string GetLast() SetLast() DefinedLast()string GetName() SetName() DefinedName()string GetNick() SetNick() DefinedNick()flag GetTruncated() SetTruncated() DefinedTruncated()master GetSearch() SetSearch()objects AddItem()objects GetItems()
Type Get Set Defined======= ================ ================ ==================string GetEmail() SetEmail() DefinedEmail()string GetFirst() SetFirst() DefinedFirst()string GetFamily() SetFamily() DefinedFamily()string GetGiven() SetGiven() DefinedGiven()JID GetJID() SetJID() DefinedJID()string GetKey() SetKey() DefinedKey()string GetLast() SetLast() DefinedLast()string GetName() SetName() DefinedName()string GetNick() SetNick() DefinedNick()master GetSearch() SetSearch()
Type Get Set Defined======= ================ ================ ==================special GetDisplay() SetDisplay() DefinedDisplay()special GetTZ() SetTZ() DefinedTZ()special GetUTC() SetUTC() DefinedUTC()master GetTime() SetTime()
Type Get Set Defined======= ================ ================ ==================string GetName() SetName() DefinedName()special GetOS() SetOS() DefinedOS()special GetVer() SetVer() DefinedVer()master GetVersion() SetVersion()
Part of the flexability of this module is that you can define your ownnamespace. For more information on this topic, please read theNet::Jabber::Namespaces man page.
By Ryan Eatmon in May of 2001 for http://jabber.org.. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.