Net::Jabber::Query::Agent - Jabber Query Agent Module
Net::Jabber::Query::Agent 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 Query Agent.
To initialize the Agent with a Jabber <iq/> you must pass it the XML::Parser Tree array from the module trying to access the <iq/>. In the callback function: use Net::Jabber; sub iqCB { my $iq = new Net::Jabber::IQ(@_); my $agent = $iq->GetQuery(); . . . } You now have access to all of the retrieval functions available. To create a new Agent to send to the server: use Net::Jabber; $iq = new Net::Jabber::IQ(); $agent = $iq->NewQuery("jabber:iq:agent"); Now you can call the creation functions below. For more information about the array format being passed to the CallBack please read the Net::Jabber::Client documentation.
$jid = $agent->GetJID(); $name = $agent->GetName(); $description = $agent->GetDescription(); $transport = $agent->GetTransport(); $service = $agent->GetService(); $register = $agent->GetRegister(); $search = $agent->GetSearch(); $groupchat = $agent->GetGroupChat(); $agents = $agent->GetAgents();
$agent->SetAgent(jid=>"users.jabber.org", name=>"Jabber User Directory", description=>"You may register and create a public searchable profile, and search for other registered Jabber users.", service=>"jud", register=>"", search=>""); $agent->SetJID("icq.jabber.org"); $agent->SetName("ICQ Transport"); $agent->SetDescription("This is the ICQ Transport"); $agent->SetTransport("ICQ#"); $agent->SetService("icq"); $agent->SetRegister(); $agent->SetSearch(); $agent->SetGroupChat(); $agent->SetAgents();
$test = $agent->DefinedJID(); $test = $agent->DefinedName(); $test = $agent->DefinedDescription(); $test = $agent->DefinedTransport(); $test = $agent->DefinedService(); $test = $agent->DefinedRegister(); $test = $agent->DefinedSearch(); $test = $agent->DefinedGroupChat(); $test = $agent->DefinedAgents();
GetJID() - returns a string with the JID of the agent to send messages to. GetName() - returns a string with the name of the agent. GetDescription() - returns a string with the description of the agent. GetTransport() - returns a string with the transport of the agent. GetService() - returns a string with the service name of the agent. GetRegister() - returns a 1 if the agent supports registering, 0 if not. GetSearch() - returns a 1 if the agent supports searching, 0 if not. GetGroupChat() - returns a 1 if the agent supports groupchat, 0 if not. GetAgents() - returns a 1 if the agent supports sub-agents, 0 if not.
SetAgent(jid=>string, - set multiple fields in the <iq/> at one name=>string, time. This is a cumulative and over description=>string, writing action. If you set the "jid" transport=>string, attribute twice, the second setting is service=>string, what is used. If you set the name, and register=>string, then set the search then both will be in search=>string, the <iq/> tag. For valid settings read the groupchat=>string) specific Set functions below. agents=>string) SetJID(string) - sets the jid="..." of the agent. SetName(string) - sets the <name/> of the agent. SetDescription(string) - sets the <description/> of the agent. SetTransport(string) - sets the <transport/> of the agent. SetService(string) - sets the <service/> of the agent. SetRegister() - if the function is called then a <search/> is is put in the <query/> to signify searching is available. SetSearch() - if the function is called then a <search/> is is put in the <query/> to signify searching is available. SetGroupChat() - if the function is called then a <groupchat/> is is put in the <query/> to signify groupchat is available. SetAgents() - if the function is called then a <agents/> is is put in the <query/> to signify sub-agents are available.
DefinedJID() - returns 1 if jid is in the parrent tag, 0 otherwise. DefinedName() - returns 1 if <name/> is in the parent tag, 0 otherwise. DefinedDescription() - returns 1 if <description/> is in the parent tag, 0 otherwise. DefinedTransport() - returns 1 if <transport/> is in the parent tag, 0 otherwise. DefinedService() - returns 1 if <service/> is in the parent tag, 0 otherwise. DefinedRegister() - returns 1 if <register/> is in the parent tag, 0 otherwise. DefinedSearch() - returns 1 if <search/> is in the parent tag, 0 otherwise. DefinedGroupChat() - returns 1 if <groupchat/> is in the parent tag, 0 otherwise. DefinedAgents() - returns 1 if <agents/> is in the parent tag, 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.