NAME

Net::Jabber::Query - Jabber Query Library

SYNOPSIS

Net::Jabber::Query 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 Query.

DESCRIPTION

Net::Jabber::Query differs from the other modules in that its behavior
and available functions are based off of the XML namespace that is
set in it.  The current list of supported namespaces is:

  jabber:iq:agent
  jabber:iq:agents
  jabber:iq:auth
  jabber:iq:autoupdate
  jabber:iq:browse
  jabber:iq:conference
  jabber:iq:filter
  jabber:iq:gateway
  jabber:iq:last
  jabber:iq:oob
  jabber:iq:pass
  jabber:iq:register
  jabber:iq:roster
  jabber:iq:search
  jabber:iq:time
  jabber:iq:version

For more information on what these namespaces are for, visit 
http://www.jabber.org and browse the Jabber Programmers Guide.

Each of these namespaces provide Net::Jabber::Query with the functions
to access the data.  By using the AUTOLOAD function the functions for
each namespace is used when that namespace is active.

To access a Query object you must create an IQ object and use the
access functions there to get to the Query.  To initialize the IQ with
a Jabber <iq/> you must pass it the XML::Stream hash from the
Net::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::IQ
object is passed to the callback function for the message.  Also,
the first argument to the callback functions is the session ID from
XML::Streams.  There are some cases where you might want this
information, like if you created a Client that connects to two servers
at 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 for
that 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 the
proper namespaces.  See below for the general <query/> functions, and
in each query module for those functions.

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

METHODS

Retrieval functions

GetXMLNS() - returns a string with the namespace of the query that
             the <iq/> contains.

             $xmlns  = $IQ->GetXMLNS();

GetQuery() - since the behavior of this module depends on the
             namespace, a Query object may contain Query objects.
             This helps to leverage code reuse by making children
             behave in the same manner.  More than likely this
             function 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 string
array   - array of strings
flag    - this means that the specified child exists in the
          XML <child/> and acts like a flag.  get will return
          0 or 1.
JID     - either a string or Net::Jabber::JID object.
objects - creates new objects, or returns an array of
          objects.
special - this is a special case kind of function.  Usually
          just by calling Set() with no arguments it will
          default the value to a special value, like OS or time.
          Sometimes it will modify the value you set, like
          in jabber:iq:version SetVersion() the function
          adds on the Net::Jabber version to the string
          just for advertisement purposes. =)
master  - this desribes a function that behaves like the
          SetMessage() 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 that
          are defined in the object.

jabber:iq:agent

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()

jabber:iq:agents

Type     Get               Set               Defined
=======  ================  ================  ==================
objects                    AddAgent()        DefinedAgent()
master   GetAgents()

jabber:iq:auth

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()

jabber:iq:autoupdate

Type     Get               Set               Defined
=======  ================  ================  ==================
objects  GetReleases()
objects                    AddBeta()
objects                    AddDev()
objects                    AddRelease()

jabber:iq:autoupdate - release objects

Type     Get               Set               Defined
=======  ================  ================  ==================
string   GetDesc()         SetDesc()         DefinedDesc()
string   GetPriority()     SetPriority()     DefinedPriority()
string   GetURL()          SetURL()          DefinedURL()
string   GetVersion()      SetVersion()      DefinedVersion()
master   GetRelease()      SetRelease()

jabber:iq:browse

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()

jabber:iq:browse - item objects

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()

jabber:iq:conference

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()

jabber:iq:filter

Type     Get               Set               Defined
=======  ================  ================  ==================
objects                    AddRule()
objects  GetRules()

jabber:iq:filter - rule objects

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()

jabber:iq:gateway

Type     Get               Set               Defined
=======  ================  ================  ==================
JID      GetJID()          SetJID()          DefinedJID()
string   GetDesc()         SetDesc()         DefinedDesc()
string   GetPrompt()       SetPrompt()       DefinedPrompt()
master   GetGateway()      SetGateway()

jabber:iq:last

Type     Get               Set               Defined
=======  ================  ================  ==================
string   GetMessage()      SetMessage()      DefinedMessage()
string   GetSeconds()      SetSeconds()      DefinedSeconds()
master   GetLast()         SetLast()

jabber:iq:oob

Type     Get               Set               Defined
=======  ================  ================  ==================
string   GetDesc()         SetDesc()         DefinedDesc()
string   GetURL()          SetURL()          DefinedURL()
master   GetOob()          SetOob()

jabber:iq:pass

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()

jabber:iq:register

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()

jabber:iq:roster

Type     Get               Set               Defined
=======  ================  ================  ==================
objects                    AddItem()
objects  GetItems()

jabber:iq:roster - item objects

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()

jabber:iq:search

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()

jabber:iq:search - item objects

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()

jabber:iq:time

Type     Get               Set               Defined
=======  ================  ================  ==================
special  GetDisplay()      SetDisplay()      DefinedDisplay()
special  GetTZ()           SetTZ()           DefinedTZ()
special  GetUTC()          SetUTC()          DefinedUTC()
master   GetTime()         SetTime()

jabber:iq:version

Type     Get               Set               Defined
=======  ================  ================  ==================
string   GetName()         SetName()         DefinedName()
special  GetOS()           SetOS()           DefinedOS()
special  GetVer()          SetVer()          DefinedVer()
master   GetVersion()      SetVersion()

CUSTOM NAMESPACES

Part of the flexability of this module is that you can define your own
namespace.  For more information on this topic, please read the
Net::Jabber::Namespaces man page.

AUTHOR

By Ryan Eatmon in May of 2001 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.