This is Info file pm.info, produced by Makeinfo version 1.68 from the input file bigpm.texi.  File: pm.info, Node: Net/Jabber/Dialback/Result, Next: Net/Jabber/Dialback/Verify, Prev: Net/Jabber/Dialback, Up: Module List Jabber Dialback Result Module ***************************** NAME ==== Net::Jabber::Dialback::Result - Jabber Dialback Result Module SYNOPSIS ======== Net::Jabber::Dialback::Result is a companion to the Net::Jabber::Dialback module. It provides the user a simple interface to set and retrieve all parts of a Jabber Dialback Result. DESCRIPTION =========== To initialize the Result with a Jabber you must pass it the XML::Parse::Tree array. For example: my $dialback = new Net::Jabber::Dialback::Result(@tree); There has been a change from the old way of handling the callbacks. You no longer have to do the above, a Net::Jabber::Dialback::Result object is passed to the callback function for the dialback: use Net::Jabber; sub dialback { my ($Result) = @_; . . . } You now have access to all of the retrieval functions available. To create a new dialback to send to the server: use Net::Jabber; $Result = new Net::Jabber::Dialback::Result(); Now 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. Retrieval functions ------------------- $to = $Result->GetTo(); $from = $Result->GetFrom(); $type = $Result->GetType(); $data = $Result->GetData(); $str = $Result->GetXML(); @dialback = $Result->GetTree(); Creation functions ------------------ $Result->SetResult(from=>"jabber.org", to=>"jabber.com", data=>key); $Result->SetTo("jabber.org"); $Result->SetFrom("jabber.com"); $Result->SetType("valid"); $Result->SetData(key); Test functions -------------- $test = $Result->DefinedTo(); $test = $Result->DefinedFrom(); $test = $Result->DefinedType(); METHODS ======= Retrieval functions ------------------- GetTo() - returns a string with server that the is being sent to. GetFrom() - returns a string with server that the is being sent from. GetType() - returns a string with the type this is. GetData() - returns a string with the cdata of the . GetXML() - returns the XML string that represents the . This is used by the Send() function in Server.pm to send this object as a Jabber Dialback Result. GetTree() - returns an array that contains the tag in XML::Parser::Tree format. Creation functions ------------------ SetResult(to=>string, - set multiple fields in the from=>string, at one time. This is a cumulative type=>string, and over writing action. If you set data=>string) the "from" attribute twice, the second setting is what is used. If you set the type, and then set the data then both will be in the tag. For valid settings read the specific Set functions below. SetTo(string) - sets the to attribute. SetFrom(string) - sets the from attribute. SetType(string) - sets the type attribute. Valid settings are: valid invalid SetData(string) - sets the cdata of the . Test functions -------------- DefinedTo() - returns 1 if the to attribute is defined in the , 0 otherwise. DefinedFrom() - returns 1 if the from attribute is defined in the , 0 otherwise. DefinedType() - returns 1 if the type attribute is defined in the , 0 otherwise. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/Dialback/Verify, Next: Net/Jabber/IQ, Prev: Net/Jabber/Dialback/Result, Up: Module List Jabber Dialback Verify Module ***************************** NAME ==== Net::Jabber::Dialback::Verify - Jabber Dialback Verify Module SYNOPSIS ======== Net::Jabber::Dialback::Verify is a companion to the Net::Jabber::Dialback module. It provides the user a simple interface to set and retrieve all parts of a Jabber Dialback Verify. DESCRIPTION =========== To initialize the Verify with a Jabber you must pass it the XML::Parse::Tree array. For example: my $dialback = new Net::Jabber::Dialback::Verify(@tree); There has been a change from the old way of handling the callbacks. You no longer have to do the above, a Net::Jabber::Dialback::Verify object is passed to the callback function for the dialback: use Net::Jabber; sub dialback { my ($Verify) = @_; . . . } You now have access to all of the retrieval functions available. To create a new dialback to send to the server: use Net::Jabber; $Verify = new Net::Jabber::Dialback::Verify(); Now 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. Retrieval functions ------------------- $to = $Verify->GetTo(); $from = $Verify->GetFrom(); $type = $Verify->GetType(); $id = $Verify->GetID(); $data = $Verify->GetData(); $str = $Verify->GetXML(); @dialback = $Verify->GetTree(); Creation functions ------------------ $Verify->SetVerify(from=>"jabber.org", to=>"jabber.com", id=>id, data=>key); $Verify->SetTo("jabber.org"); $Verify->SetFrom("jabber.com"); $Verify->SetType("valid"); $Verify->SetID(id); $Verify->SetData(key); Test functions -------------- $test = $Verify->DefinedTo(); $test = $Verify->DefinedFrom(); $test = $Verify->DefinedType(); $test = $Verify->DefinedID(); METHODS ======= Retrieval functions ------------------- GetTo() - returns a string with server that the is being sent to. GetFrom() - returns a string with server that the is being sent from. GetType() - returns a string with the type this is. GetID() - returns a string with the id this is. GetData() - returns a string with the cdata of the . GetXML() - returns the XML string that represents the . This is used by the Send() function in Server.pm to send this object as a Jabber Dialback Verify. GetTree() - returns an array that contains the tag in XML::Parser::Tree format. Creation functions ------------------ SetVerify(to=>string, - set multiple fields in the from=>string, at one time. This is a cumulative type=>string, and over writing action. If you set id=>string, the "from" attribute twice, the second data=>string) setting is what is used. If you set the type, and then set the data then both will be in the tag. For valid settings read the specific Set functions below. SetTo(string) - sets the to attribute. SetFrom(string) - sets the from attribute. SetType(string) - sets the type attribute. Valid settings are: valid invalid SetID(string) - sets the id attribute. SetData(string) - sets the cdata of the . Test functions -------------- DefinedTo() - returns 1 if the to attribute is defined in the , 0 otherwise. DefinedFrom() - returns 1 if the from attribute is defined in the , 0 otherwise. DefinedType() - returns 1 if the type attribute is defined in the , 0 otherwise. DefinedID() - returns 1 if the id attribute is defined in the , 0 otherwise. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/IQ, Next: Net/Jabber/JID, Prev: Net/Jabber/Dialback/Verify, Up: Module List Jabber Info/Query Library ************************* NAME ==== Net::Jabber::IQ - Jabber Info/Query Library SYNOPSIS ======== Net::Jabber::IQ is a companion to the Net::Jabber module. It provides the user a simple interface to set and retrieve all {iq}-> parts of a Jabber IQ. DESCRIPTION =========== Net::Jabber::IQ differs from the other Net::Jabber::* modules in that the XMLNS of the query is split out into more submodules under IQ. For specifics on each module please view the documentation for each Net::Jabber::Query::* module. To see the list of avilable namspaces and modules see Net::Jabber::Query. To initialize the IQ with a Jabber you must pass it the XML::Parser Tree array. For example: my $iq = new Net::Jabber::IQ(@tree); There has been a change from the old way of handling the callbacks. You no longer have to do the above, a Net::Jabber::IQ object is passed to the callback function for the iq: use Net::Jabber; sub iq { my ($IQ) = @_; . . . } You now have access to all of the retrieval functions available. To create a new iq to send to the server: use Net::Jabber; $IQ = new Net::Jabber::IQ(); $IQType = $IQ->NewQuery( type ); $IQType->SetXXXXX("yyyyy"); Now you can call the creation functions for the IQ, and for the on the new Query object itself. See below for the 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. Retrieval functions ------------------- $to = $IQ->GetTo(); $toJID = $IQ->GetTo("jid"); $from = $IQ->GetFrom(); $fromJID = $IQ->GetFrom("jid"); $id = $IQ->GetID(); $type = $IQ->GetType(); $error = $IQ->GetError(); $errorCode = $IQ->GetErrorCode(); $queryTag = $IQ->GetQuery(); $queryTree = $IQ->GetQueryTree(); $str = $IQ->GetXML(); @iq = $IQ->GetTree(); Creation functions ------------------ $IQ->SetIQ(tYpE=>"get", tO=>"bob@jabber.org", query=>"info"); $IQ->SetTo("bob@jabber.org"); $IQ->SetFrom("me\@jabber.org"); $IQ->SetType("set"); $IQ->SetIQ(to=>"bob\@jabber.org", errorcode=>403, error=>"Permission Denied"); $IQ->SetErrorCode(403); $IQ->SetError("Permission Denied"); $IQObject = $IQ->NewQuery("jabber:iq:auth"); $IQObject = $IQ->NewQuery("jabber:iq:roster"); $iqReply = $IQ->Reply(); $iqReply = $IQ->Reply("client"); $iqReply = $IQ->Reply("transport"); Test functions -------------- $test = $IQ->DefinedTo(); $test = $IQ->DefinedFrom(); $test = $IQ->DefinedID(); $test = $IQ->DefinedType(); $test = $IQ->DefinedError(); $test = $IQ->DefinedErrorCode(); METHODS ======= Retrieval functions ------------------- GetTo() - returns either a string with the Jabber Identifier, GetTo("jid") or a Net::Jabber::JID object for the person who is going to receive the . To get the JID object set the string to "jid", otherwise leave blank for the text string. GetFrom() - returns either a string with the Jabber Identifier, GetFrom("jid") or a Net::Jabber::JID object for the person who sent the . To get the JID object set the string to "jid", otherwise leave blank for the text string. GetType() - returns a string with the type this is. GetID() - returns an integer with the id of the . GetError() - returns a string with the text description of the error. GetErrorCode() - returns a string with the code of error. GetQuery() - returns a Net::Jabber::Query object that contains the data in the of the . GetQueryTree() - returns an XML::Parser::Tree object that contains the data in the of the . GetXML() - returns the XML string that represents the . This is used by the Send() function in Client.pm to send this object as a Jabber IQ. GetTree() - returns an array that contains the tag in XML::Parser Tree format. Creation functions ------------------ SetIQ(to=>string|JID, - set multiple fields in the at one from=>string|JID, time. This is a cumulative and over id=>string, writing action. If you set the "to" type=>string, attribute twice, the second setting is errorcode=>string, what is used. If you set the status, and error=>string) then set the priority then both will be in the tag. For valid settings read the specific Set functions below. SetTo(string) - sets the to attribute. You can either pass a string SetTo(JID) or a JID object. They must be a valid Jabber Identifiers or the server will return an error message. (ie. jabber:bob@jabber.org, etc...) SetFrom(string) - sets the from attribute. You can either pass a string SetFrom(JID) or a JID object. They must be a valid Jabber Identifiers or the server will return an error message. (ie. jabber:bob@jabber.org, etc...) SetType(string) - sets the type attribute. Valid settings are: get request information set set information result results of a get SetErrorCode(string) - sets the error code of the . SetError(string) - sets the error string of the . NewQuery(string) - creates a new Net::Jabber::Query object with the namespace in the string. In order for this function to work with a custom namespace, you must define and register that namespace with the IQ module. For more information please read the documentation for Net::Jabber::Query. NOTE: Jabber does not support custom IQs at the time of this writing. This was just including in case they do at some point. Reply(type=>string) - creates a new IQ object and populates the to/from fields. The type will be set in the . Test functions -------------- DefinedTo() - returns 1 if the to attribute is defined in the , 0 otherwise. DefinedFrom() - returns 1 if the from attribute is defined in the , 0 otherwise. DefinedID() - returns 1 if the id attribute is defined in the , 0 otherwise. DefinedType() - returns 1 if the type attribute is defined in the , 0 otherwise. DefinedError() - returns 1 if is defined in the , 0 otherwise. DefinedErrorCode() - returns 1 if the code attribute is defined in , 0 otherwise. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/JID, Next: Net/Jabber/Key, Prev: Net/Jabber/IQ, Up: Module List Jabber JID Module ***************** NAME ==== Net::Jabber::JID - Jabber JID Module SYNOPSIS ======== Net::Jabber::JID is a companion to the Net::Jabber module. It provides the user a simple interface to set and retrieve all parts of a Jabber JID (userid on a server). DESCRIPTION =========== To initialize the JID you must pass it the string that represents the jid from the Jabber XML packet. Inside the Jabber modules this is done automatically and the JID object is returned instead of a string. For example, in the callback function for the Jabber object foo: use Net::Jabber; sub foo { my $foo = new Net::Jabber::Foo(@_); my $from = $foo->GetFrom(); my $JID = new Net::Jabber::JID($from); . . . } You now have access to all of the retrieval functions available. To create a new JID to send to the server: use Net::Jabber; $JID = new Net::Jabber::JID(); Now you can call the creation functions below to populate the tag before sending it. Retrieval functions ------------------- $userid = $JID->GetUserID(); $server = $JID->GetServer(); $resource = $JID->GetResource(); $JID = $JID->GetJID(); $fullJID = $JID->GetJID("full"); Creation functions ------------------ $JID->SetJID(userid=>"bob", server=>"jabber.org", resource=>"Work"); $JID->SetJID("blue@moon.org/Home"); $JID->SetUserID("foo"); $JID->SetServer("bar.net"); $JID->SetResource("Foo Bar"); METHODS ======= Retrieval functions ------------------- GetUserID() - returns a string with the Jabber userid of the JID. If the string is an address (bob%jabber.org) then the function will return it as an address (bob@jabber.org). GetServer() - returns a string with the Jabber server of the JID. GetResource() - returns a string with the Jabber resource of the JID. GetJID() - returns a string that represents the JID stored GetJID("full") within. If the "full" string is specified, then you get the full JID, including Resource, which should be used to send to the server. Creation functions ------------------ SetJID(userid=>string, - set multiple fields in the jid at server=>string, one time. This is a cumulative resource=>string) and over writing action. If you set SetJID(string) the "userid" attribute twice, the second setting is what is used. If you set the server, and then set the resource then both will be in the jid. If all you pass is a string, then that string is used as the JID. For valid settings read the specific Set functions below. SetUserID(string) - sets the userid. Must be a valid userid or the server will complain if you try to use this JID to talk to the server. If the string is an address then it will be converted to the % form suitable for using as a Jabber User ID. SetServer(string) - sets the server. Must be a valid host on the network or the server will not be able to talk to it. SetResource(string) - sets the resource of the userid to talk to. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/Key, Next: Net/Jabber/Log, Prev: Net/Jabber/JID, Up: Module List Jabber Key Library ****************** NAME ==== Net::Jabber::Key - Jabber Key Library SYNOPSIS ======== Net::Jabber::Key is a module that provides a developer easy access to generating, caching, and comparing keys. DESCRIPTION =========== Key.pm is a helper module for the Net::Jabber::Transport. When the Transport talks to a Client it sends a key and expects to get that key back from the Client. This module provides an API to generate, cache, and then compare the key send from the Client. Basic Functions --------------- $Key = new Net::Jabber::Key(); $key = $Key->Generate(); $key = $Key->Create("bob\@jabber.org"); $test = $Key->Compare("bob\@jabber.org","some key"); METHODS ======= Basic Functions --------------- new(debug=>string, - creates the Key object. debug should debugfh=>FileHandle, be set to the path for the debug debuglevel=>integer) log to be written. If set to "stdout" then the debug will go there. Also, you can specify a filehandle that already exists and use that. debuglevel controls the amount of debug. 0 is none, 1 is normal, 2 is all. Generate() - returns a key in Digest SHA1 form based on the current time and the PID. Create(cacheString) - generates a key and caches it with the key of cacheString. Create returns the key. Compare(cacheString, - compares the key stored in the cache under keyString) cacheString with the keyString. Returns 1 if they match, and 0 otherwise. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/Log, Next: Net/Jabber/Message, Prev: Net/Jabber/Key, Up: Module List Jabber Log Module ***************** NAME ==== Net::Jabber::Log - Jabber Log Module SYNOPSIS ======== Net::Jabber::Log is a companion to the Net::Jabber module. It provides the user a simple interface to set and retrieve all parts of a Jabber Log. DESCRIPTION =========== To initialize the Log with a Jabber you must pass it the XML::Parser Tree array. For example: my $log = new Net::Jabber::Log(@tree); There has been a change from the old way of handling the callbacks. You no longer have to do the above, a Net::Jabber::Log object is passed to the callback function for the log: use Net::Jabber; sub log { my ($Log) = @_; . . . } You now have access to all of the retrieval functions available. To create a new log to send to the server: use Net::Jabber; $Log = new Net::Jabber::Log(); Now 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. Retrieval functions ------------------- $from = $Log->GetFrom(); $fromJID = $Log->GetFrom("jid"); $type = $Log->GetType(); $data = $Log->GetData(); $str = $Log->GetXML(); @log = $Log->GetTree(); Creation functions ------------------ $Log->SetLog(type=>"error", from=>"users.jabber.org", data=>"The moon is full... I can't run anymore."); $Log->SetFrom("foo.jabber.org"); $Log->SetType("warn"); $Log->SetData("I can't find a config file. Using defaults."); Test functions -------------- $test = $Log->DefinedFrom(); $test = $Log->DefinedType(); METHODS ======= Retrieval functions ------------------- GetFrom() - returns either a string with the Jabber Identifier, GetFrom("jid") or a Net::Jabber::JID object for the person who sent the . To get the JID object set the string to "jid", otherwise leave blank for the text string. GetType() - returns a string with the type this is. GetData() - returns a string with the cdata of the . GetXML() - returns the XML string that represents the . This is used by the Send() function in Client.pm to send this object as a Jabber Log. GetTree() - returns an array that contains the tag in XML::Parser Tree format. Creation functions ------------------ SetLog(from=>string|JID, - set multiple fields in the type=>string, at one time. This is a cumulative data=>string) and over writing action. If you set the "from" attribute twice, the second setting is what is used. If you set the type, and then set the data then both will be in the tag. For valid settings read the specific Set functions below. SetFrom(string) - sets the from attribute. You can either pass a string SetFrom(JID) or a JID object. They must be valid Jabber Identifiers or the server will return an error log. (ie. jabber:bob@jabber.org/Silent Bob, etc...) SetType(string) - sets the type attribute. Valid settings are: notice general logging warn warning alert critical error (can still run but not correctly) error fatal error (cannot run anymore) SetData(string) - sets the cdata of the . Test functions -------------- DefinedFrom() - returns 1 if the from attribute is defined in the , 0 otherwise. DefinedType() - returns 1 if the type attribute is defined in the , 0 otherwise. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/Message, Next: Net/Jabber/Presence, Prev: Net/Jabber/Log, Up: Module List Jabber Message Module ********************* NAME ==== Net::Jabber::Message - Jabber Message Module SYNOPSIS ======== Net::Jabber::Message is a companion to the Net::Jabber module. It provides the user a simple interface to set and retrieve all parts of a Jabber Message. DESCRIPTION =========== To initialize the Message with a Jabber you must pass it the XML::Parser Tree array. For example: my $message = new Net::Jabber::Message(@tree); There has been a change from the old way of handling the callbacks. You no longer have to do the above, a Net::Jabber::Message object is passed to the callback function for the message: use Net::Jabber; sub message { my ($Mess) = @_; . . . } You now have access to all of the retrieval functions available. To create a new message to send to the server: use Net::Jabber; $Mess = new Net::Jabber::Message(); Now 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. Retrieval functions ------------------- $to = $Mess->GetTo(); $toJID = $Mess->GetTo("jid"); $from = $Mess->GetFrom(); $fromJID = $Mess->GetFrom("jid"); $resource = $Mess->GetResource(); $type = $Mess->GetType(); $subject = $Mess->GetSubject(); $body = $Mess->GetBody(); @body = $Mess->GetBody("full"); $thread = $Mess->GetThread(); $priority = $Mess->GetPriority(); $error = $Mess->GetError(); $errCode = $Mess->GetErrorCode(); @xTags = $Mess->GetX(); @xTags = $Mess->GetX("my:namespace"); @xTrees = $Mess->GetXTrees(); @xTrees = $Mess->GetXTrees("my:namespace"); $str = $Mess->GetXML(); @message = $Mess->GetTree(); $date = $Mess->GetTimeStamp(); Creation functions ------------------ $Mess->SetMessage(TO=>"bob\@jabber.org/Working Bob", Subject=>"Lunch", BoDy=>"Let's go grab some lunch!", priority=>100); $Mess->SetTo("test\@jabber.org"); $Mess->SetFrom("me\@jabber.org"); $Mess->SetType("groupchat"); $Mess->SetSubject("This is a test"); $Mess->SetBody("This is a test of the emergency broadcast system..."); $Mess->SetThread("AE912B3"); $Mess->SetPriority(1); $Mess->SetMessage(to=>"bob\@jabber.org", errorcode=>403, error=>"Permission Denied"); $Mess->SetErrorCode(403); $Mess->SetError("Permission Denied"); $X = $Mess->NewX("jabber:x:delay"); $X = $Mess->NewX("my:namespace"); $X = $Mess->NewX(Net::Jabber::X::XXXXX); $Reply = $Mess->Reply(); $Reply = $Mess->Reply(template=>"transport-filter"); Test functions -------------- $test = $Mess->DefinedTo(); $test = $Mess->DefinedFrom(); $test = $Mess->DefinedType(); $test = $Mess->DefinedSubject(); $test = $Mess->DefinedBody(); $test = $Mess->DefinedThread(); $test = $Mess->DefinedPriority(); $test = $Mess->DefinedErrorCode(); $test = $Mess->DefinedError(); METHODS ======= Retrieval functions ------------------- GetTo() - returns either a string with the Jabber Identifier, GetTo("jid") or a Net::Jabber::JID object for the person who is going to receive the . To get the JID object set the string to "jid", otherwise leave blank for the text string. GetFrom() - returns either a string with the Jabber Identifier, GetFrom("jid") or a Net::Jabber::JID object for the person who sent the . To get the JID object set the string to "jid", otherwise leave blank for the text string. GetResource() - returns a string with the Jabber Resource of the person who sent the . GetType() - returns a string with the type this is. GetSubject() - returns a string with the subject of the . GetBody(string) - returns the data in the tag depending on the value of the string passed to it. The string represents the mark up level to return. none returns a string with just the text of the (default) full returns an XML::Paser::Tree with everything in the GetThread() - returns a string that represents the thread this belongs to. GetPriority() - returns an integer with the priority of the . GetError() - returns a string with the data of the tag. GetErrorCode() - returns a string with the code of the tag. GetX(string) - returns an array of Net::Jabber::X objects. The string can either be empty or the XML Namespace you are looking for. If empty then GetX returns every tag in the . If an XML Namespace is sent then GetX returns every tag with that Namespace. GetXTrees(string) - returns an array of XML::Parser::Tree objects. The string can either be empty or the XML Namespace you are looking for. If empty then GetXTrees returns every tag in the . If an XML Namespace is sent then GetXTrees returns every tag with that Namespace. GetXML() - returns the XML string that represents the . This is used by the Send() function in Client.pm to send this object as a Jabber Message. GetTree() - returns an array that contains the tag in XML::Parser Tree format. GetTimeStamp() - returns a string that represents the time this message object was created (and probably received) for sending to the client. If there is an delay tag then that time is used to show when the message was sent. Creation functions ------------------ SetMessage(to=>string|JID, - set multiple fields in the from=>string|JID, at one time. This is a cumulative type=>string, and over writing action. If you set subject=>string, the "to" attribute twice, the second body=>string, setting is what is used. If you set thread=>string, the subject, and then set the body priority=>integer, then both will be in the errorcode=>string, tag. For valid settings read the error=>string) specific Set functions below. SetTo(string) - sets the to attribute. You can either pass a string SetTo(JID) or a JID object. They must be valid Jabber Identifiers or the server will return an error message. (ie. jabber:bob@jabber.org/Silent Bob, etc...) SetFrom(string) - sets the from attribute. You can either pass a string SetFrom(JID) or a JID object. They must be valid Jabber Identifiers or the server will return an error message. (ie. jabber:bob@jabber.org/Silent Bob, etc...) SetType(string) - sets the type attribute. Valid settings are: chat defines a chat style message error defines an error message groupchat defines a chatroom message normal defines a normal message (default) SetSubject(string) - sets the subject of the . SetBody(string) - sets the body of the . SetThread(string) - sets the thread of the . You should copy this out of the message being replied to so that the thread is maintained. SetPriority(integer) - sets the priority of this . The higher the priority the more likely the client will deliver the message, even if the user has specified no messages. SetErrorCode(string) - sets the error code of the . SetError(string) - sets the error string of the . NewX(string) - creates a new Net::Jabber::X object with the namespace in the string. In order for this function to work with a custom namespace, you must define and register that namespace with the X module. For more information please read the documentation for Net::Jabber::X. Reply(template=>string, - creates a new Message object and replytransport=>string) populates the to/from based on the value of template. The following templates are available: normal: (default) just sets the to/from transport-filter: the transport will send the reply to the address from the to. ie( bob%j.org@transport.j.org would send to bob@j.org) transport-filter-reply: the transport will send the reply to the address from the to. ie( bob%j.org@transport.j.org would send to bob@j.org) and set the from to be sender@replytransport. That way a two way filter can occur. Test functions -------------- DefinedTo() - returns 1 if the to attribute is defined in the , 0 otherwise. DefinedFrom() - returns 1 if the from attribute is defined in the , 0 otherwise. DefinedType() - returns 1 if the type attribute is defined in the , 0 otherwise. DefinedSubject() - returns 1 if is defined in the , 0 otherwise. DefinedBody() - returns 1 if is defined in the , 0 otherwise. DefinedThread() - returns 1 if is defined in the , 0 otherwise. DefinedPriority() - returns 1 if is defined in the , 0 otherwise. DefinedErrorCode() - returns 1 if is defined in the , 0 otherwise. DefinedError() - returns 1 if the code attribute is defined in the , 0 otherwise. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/Presence, Next: Net/Jabber/Protocol, Prev: Net/Jabber/Message, Up: Module List Jabber Presence Module ********************** NAME ==== Net::Jabber::Presence - Jabber Presence Module SYNOPSIS ======== Net::Jabber::Presence is a companion to the Net::Jabber module. It provides the user a simple interface to set and retrieve all parts of a Jabber Presence. DESCRIPTION =========== To initialize the Presence with a Jabber you must pass it the XML::Parser Tree array. For example: my $presence = new Net::Jabber::Presence(@tree); There has been a change from the old way of handling the callbacks. You no longer have to do the above, a Net::Jabber::Presence object is passed to the callback function for the presence: use Net::Jabber; sub presence { my ($Pres) = @_; . . . } You now have access to all of the retrieval functions available. To create a new presence to send to the server: use Net::Jabber; $Pres = new Net::Jabber::Presence(); Now 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. Retrieval functions ------------------- $to = $Pres->GetTo(); $toJID = $Pres->GetTo("jid"); $from = $Pres->GetFrom(); $fromJID = $Pres->GetFrom("jid"); $type = $Pres->GetType(); $status = $Pres->GetStatus(); $priority = $Pres->GetPriority(); $show = $Pres->GetShow(); @xTags = $Pres->GetX(); @xTags = $Pres->GetX("my:namespace"); @xTrees = $Pres->GetXTrees(); @xTrees = $Pres->GetXTrees("my:namespace"); $str = $Pres->GetXML(); @presence = $Pres->GetTree(); Creation functions ------------------ $Pres->SetPresence(TYPE=>"online", StatuS=>"Open for Business", iCoN=>"normal"); $Pres->SetTo("bob\@jabber.org"); $Pres->SetFrom("jojo\@jabber.org"); $Pres->SetType("unavailable"); $Pres->SetStatus("Taking a nap"); $Pres->SetPriority(10); $Pres->SetShow("away"); $X = $Pres->NewX("jabber:x:delay"); $X = $Pres->NewX("my:namespace"); $Reply = $Pres->Reply(); $Reply = $Pres->Reply(type=>"subscribed"); Test functions -------------- $test = $Pres->DefinedTo(); $test = $Pres->DefinedFrom(); $test = $Pres->DefinedType(); $test = $Pres->DefinedStatus(); $test = $Pres->DefinedPriority(); $test = $Pres->DefinedShow(); METHODS ======= Retrieval functions ------------------- GetTo() - returns either a string with the Jabber Identifier, GetTo("jid") or a Net::Jabber::JID object for the person who is going to receive the . To get the JID object set the string to "jid", otherwise leave blank for the text string. GetFrom() - returns either a string with the Jabber Identifier, GetFrom("jid") or a Net::Jabber::JID object for the person who sent the . To get the JID object set the string to "jid", otherwise leave blank for the text string. GetType() - returns a string with the type this is. GetStatus() - returns a string with the current status of the resource. GetPriority() - returns an integer with the priority of the resource The default is 0 if there is no priority in this presence. GetShow() - returns a string with the state the client should show. GetX(string) - returns an array of Net::Jabber::X objects. The string can either be empty or the XML Namespace you are looking for. If empty then GetX returns every tag in the . If an XML Namespace is sent then GetX returns every tag with that Namespace. GetXTrees(string) - returns an array of XML::Parser::Tree objects. The string can either be empty or the XML Namespace you are looking for. If empty then GetXTrees returns every tag in the . If an XML Namespace is sent then GetXTrees returns every tag with that Namespace. GetXML() - returns the XML string that represents the . This is used by the Send() function in Client.pm to send this object as a Jabber Presence. GetTree() - returns an array that contains the tag in XML::Parser Tree format. Creation functions ------------------ SetPresence(to=>string|JID - set multiple fields in the from=>string|JID, at one time. This is a cumulative type=>string, and over writing action. If you set status=>string, the "to" attribute twice, the second priority=>integer, setting is what is used. If you set meta=>string, the status, and then set the priority icon=>string, then both will be in the show=>string, tag. For valid settings read the loc=>string) specific Set functions below. SetTo(string) - sets the to attribute. You can either pass a string SetTo(JID) or a JID object. They must be valid Jabber Identifiers or the server will return an error message. (ie. jabber:bob@jabber.org/Silent Bob, etc...) SetFrom(string) - sets the from attribute. You can either pass a string SetFrom(JID) or a JID object. They must be valid Jabber Identifiers or the server will return an error message. (ie. jabber:bob@jabber.org/Silent Bob, etc...) SetType(string) - sets the type attribute. Valid settings are: available available to receive messages; default unavailable unavailable to receive anything subscribe ask the recipient to subscribe you subscribed tell the sender they are subscribed unsubscribe ask the recipient to unsubscribe you unsubscribed tell the sender they are unsubscribed probe probe SetStatus(string) - sets the status tag to be whatever string the user wants associated with that resource. SetPriority(integer) - sets the priority of this resource. The highest resource attached to the jabber account is the one that receives the messages. SetShow(string) - sets the name of the default symbol to display for this resource. NewX(string) - creates a new Net::Jabber::X object with the namespace in the string. In order for this function to work with a custom namespace, you must define and register that namespace with the X module. For more information please read the documentation for Net::Jabber::X. Reply(type=>string) - creates a new Presence object and populates the to/from fields. The type will be set in the . Test functions -------------- DefinedTo() - returns 1 if the to attribute is defined in the , 0 otherwise. DefinedFrom() - returns 1 if the from attribute is defined in the , 0 otherwise. DefinedType() - returns 1 if the type attribute is defined in the , 0 otherwise. DefinedStatus() - returns 1 if is defined in the , 0 otherwise. DefinedPriority() - returns 1 if is defined in the , 0 otherwise. DefinedShow() - returns 1 if is defined in the , 0 otherwise. AUTHOR ====== By Ryan Eatmon in May of 2000 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.  File: pm.info, Node: Net/Jabber/Protocol, Next: Net/Jabber/Query, Prev: Net/Jabber/Presence, Up: Module List Jabber Protocol Library *********************** NAME ==== Net::Jabber::Protocol - Jabber Protocol Library SYNOPSIS ======== Net::Jabber::Protocol is a module that provides a developer easy access to the Jabber Instant Messaging protocol. It provides high level functions to both Net::Jabber::Client and Net::Jabber::Transport. These functions are automatically indluded in those modules through AUTOLOAD and delegates. DESCRIPTION =========== Protocol.pm seeks to provide enough high level APIs and automation of the low level APIs that writing a Jabber Client/Transport in Perl is trivial. For those that wish to work with the low level you can do that too, but those functions are covered in the documentation for each module. Net::Jabber::Protocol provides functions to login, send and receive messages, set personal information, create a new user account, manage the roster, and disconnect. You can use all or none of the functions, there is no requirement. For more information on how the details for how Net::Jabber is written please see the help for Net::Jabber itself. For more information on writing a Client see Net::Jabber::Client. For more information on writing a Transport see Net::Jabber::Transport. Basic Functions --------------- use Net::Jabber; $Con = new Net::Jabber::Client(); # From Net::Jabber::Client $status = $Con->Connect(name=>"jabber.org"); # or $Con = new Net::Jabber::Transport(); # $status = $Con->Connect(name=>"jabber.org", # From Net::Jabber::Transport secret=>"bob"); # $Con->SetCallBacks(send=>\&sendCallBack, receive=>\&receiveCallBack, message=>\&messageCallBack, iq=>\&handleTheIQTag); $error = $Con->GetErrorCode(); $Con->SetErrorCode("Timeout limit reached"); $Con->Process(); $Con->Process(5); $Con->Send($object); $Con->Send("XML"); $Con->Disconnect(); ID Functions ------------ $id = $Con->SendWithID($sendObj); $id = $Con->SendWithID("XML"); $receiveObj = $Con->SendAndReceiveWithID($sendObj); $receiveObj = $Con->SendAndReceiveWithID("XML"); $yesno = $Con->ReceivedID($id); $receiveObj = $Con->GetID($id); $receiveObj = $Con->WaitForID($id); Namespace Functions ------------------- $Con->AddDelegate(parentttype=>"query", namespace=>"foo::bar", parent=>"Foo::Bar"); $Con->AddDelegate(parenttype=>"x", namespace=>"foo::bar::bob", parent=>"Foo::Bar", delegate=>"Foo::Bar::Bob"); Message Functions ----------------- $Con->MessageSend(to=>"bob@jabber.org", subject=>"Lunch", body=>"Let's go grab some...\n"; thread=>"ABC123", priority=>10); Presence Functions ------------------ $Con->PresenceSend(); Subscription Functions ---------------------- $Con->Subscription(type=>"subscribe", to=>"bob@jabber.org"); $Con->Subscription(type=>"unsubscribe", to=>"bob@jabber.org"); $Con->Subscription(type=>"subscribed", to=>"bob@jabber.org"); $Con->Subscription(type=>"unsubscribed", to=>"bob@jabber.org"); PresenceDB Functions -------------------- $Con->PresenceDBParse(Net::Jabber::Presence); $Con->PresenceDBDelete("bob\@jabber.org"); $Con->PresenceDBDelete(Net::Jabber::JID); $presence = $Con->PresenceDBQuery("bob\@jabber.org"); $presence = $Con->PresenceDBQuery(Net::Jabber::JID); @resources = $Con->PresenceDBResources("bob\@jabber.org"); @resources = $Con->PresenceDBResources(Net::Jabber::JID); IQ Functions ------------- IQ::Agents Functions -------------------- %agents = $Con->AgentsGet(); %agents = $Con->AgentsGet(to=>"transport.jabber.org"); IQ::Auth Functions ------------------ @result = $Con->AuthSend(); @result = $Con->AuthSend(username=>"bob", password=>"bobrulez", resource=>"Bob"); IQ::Register Functions ---------------------- %hash = $Con->RegisterRequest(); %hash = $Con->RegisterRequest(to=>"transport.jabber.org"); @result = $Con->RegisterSend(usersname=>"newuser", resource=>"New User", password=>"imanewbie", email=>"newguy@new.com", key=>"some key"); IQ::Roster Functions -------------------- %roster = $Con->RosterParse($iq); %roster = $Con->RosterGet(); $Con->RosterAdd(jid=>"bob\@jabber.org", name=>"Bob"); $Con->RosterRemove(jid=>"bob@jabber.org"); IQ::Search Functions -------------------- %fields = $Con->SearchRequest(); %fields = $Con->SearchRequest(to=>"users.jabber.org"); $Con->SearchSend(name=>"", first=>"Bob", last=>"", nick=>"bob", email=>"", key=>"som key"); IQ::Time Functions ------------------ $Con->TimeQuery(); $Con->TimeQuery(to=>"bob@jabber.org"); %result = $Con->TimeQuery(waitforid=>1); %result = $Con->TimeQuery(to=>"bob@jabber.org", waitforid=>1); $Con->TimeSend(to=>"bob@jabber.org"); IQ::Version Functions --------------------- $Con->VersionQuery(); $Con->VersionQuery(to=>"bob@jabber.org"); %result = $Con->VersionQuery(waitforid=>1); %result = $Con->VersionQuery(to=>"bob@jabber.org", waitforid=>1); $Con->VersionSend(to=>"bob@jabber.org", name=>"Net::Jabber", ver=>"1.0a", os=>"Perl"); X Functions ----------- $Con->SXPMSend(to=>'bob@jabber.org', type=>'chat', boardheight=>400, boardwidth=>400, map=>{ '#'=>'', ' '=>'None', 'a'=>'#FFFFFF', 'b'=>'#FF0000', ... } data=>"4 .3 . 2 .2 .3 .4 ", datawidth=>5 ); METHODS ======= Basic Functions --------------- GetErrorCode() - returns a string that will hopefully contain some useful information about why a function returned an undef to you. SetErrorCode(string) - set a useful error message before you return an undef to the caller. SetCallBacks(message=>function, - sets the callback functions for presence=>function, the top level tags listed. The iq=>function, available tags to look for are send=>function, , , and receive=>function) . If a packet is received with an ID which is found in the registerd ID list (see RegisterID below) then it is not sent to these functions, instead it is inserted into a LIST and can be retrieved by some functions we will mention later. Process(integer) - takes the timeout period as an argument. If no timeout is listed then the function blocks until a packet is received. Otherwise it waits that number of seconds and then exits so your program can continue doing useful things. NOTE: This is important for GUIs. You need to leave time to process GUI commands even if you are waiting for packets. IMPORTANT: You need to check the output of every Process. If you get an undef or "" then the connection died and you should behave accordingly. Send(object) - takes either a Net::Jabber::xxxxx object or an XML Send(string) string as an argument and sends it to the server. ID Functions ------------ SendWithID(object) - takes either a Net::Jabber::xxxxx object or an SendWithID(string) XML string as an argument, adds the next available ID number and sends that packet to the server. Returns the ID number assigned. SendAndReceiveWithID(object) - uses SendWithID and WaitForID to SendAndReceiveWithID(string) provide a complete way to send and receive packets with IDs. Can take either a Net::Jabber::xxxxx object or an XML string. Returns the proper Net::Jabber::xxxxx object based on the type of packet received. ReceivedID(integer) - returns 1 if a packet has been received with specified ID, 0 otherwise. GetID(integer) - returns the proper Net::Jabber::xxxxx object based on the type of packet received with the specified ID. If the ID has been received the GetID returns 0. WaitForID(integer) - blocks until a packet with the ID is received. Returns the proper Net::Jabber::xxxxx object based on the type of packet received NOTE: Only officially support ids, so sending a , or with an id is a risk. Both clients must support this for these functions to work. Namespace Functions ------------------- AddDelegate(parenttype=>string, - this tells the Net::Jabber modules namespace=>string, about the new namespace. The parent=>string, namespaces determines how the xmlns delegate=>string) looks in the tag. The parent is the name of the module to create when you use this namespace. The delegate is only needed if the parent module uses delegates to distinguish between namespaces (like the Net::Jabber::IQ and Net::Jabber::X modules do). The delegate must be a valid Perl Module. The parenttype specifies the type of namespace this is in the Jabber world. (Added to allow namespaces to be reused between Query, X, and Data.) The current valid settings for parenttype are: query for queries x for packets data for data The way to determine which one to use is figure out which one of the above best fits the mode that you are using this namespace in. Message Functions ----------------- MessageSend(hash) - takes the hash and passes it to SetMessage in Net::Jabber::Message (refer there for valid settings). Then it sends the message to the server. Presence Functions ------------------ PresenceSend() - sends an empty Presence to the server to tell it that you are available Subscription Functions ---------------------- Subscription(hash) - taks the hash and passes it to SetPresence in Net::Jabber::Presence (refer there for valid settings). Then it sends the subscription to server. The valid types of subscription are: subscribe - subscribe to JID's presence unsubscribe - unsubscribe from JID's presence subscribed - response to a subscribe unsubscribed - response to an unsubscribe PresenceDB Functions -------------------- PresenceDBParse(Net::Jabber::Presence) - for every presence that you receive pass the Presence object to the DB so that it can track the resources and priorities for you. Returns either the presence passed in, if it not able to parsed for the DB, or the current presence as found by the PresenceDBQuery function. PresenceDBDelete(string|Net::Jabber::JID) - delete thes JID entry from the DB. PresenceDBQuery(string|Net::Jabber::JID) - returns the NJ::Presence that was last received for the highest priority of this JID. You can pass it a string or a NJ::JID object. PresenceDBResources(string|Net::Jabber::JID) - returns an array of resources in order from highest priority to lowest. IQ Functions ------------ IQ::Agents Functions -------------------- AgentsGet(to=>string, - takes all of the information and AgentsGet() builds a Net::Jabber::IQ::Agents packet. It then sends that packet either to the server, or to the specified transport, with an ID and waits for that ID to return. Then it looks in the resulting packet and builds a hash that contains the values of the agent list. The hash is layed out like this: (NOTE: the jid is the key to distinguish the various agents) $hash{}->{order} = 4 ->{name} = "ICQ Transport" ->{transport} = "ICQ #" ->{description} = "ICQ...blah..." ->{service} = "icq" ->{register} = 1 ->{search} = 1 etc... The order field determines the order that it came from the server in... in case you care. For more info on the valid fields see the Net::Jabber::Query::Agent module. IQ::Auth Functions ------------------ AuthSend(username=>string, - takes all of the information and password=>string, builds a Net::Jabber::IQ::Auth packet. resource=>string) It then sends that packet to the server with an ID and waits for that ID to return. Then it looks in resulting packet and determines if authentication was successful for not. The array returned from AuthSend looks like this: [ type , message ] If type is "ok" then authentication was successful, otherwise message contains a little more detail about the error. IQ::Register Functions ---------------------- RegisterRequest(to=>string) - send an request to the specified RegisterRequest() server/transport, if not specified it sends to the current active server. The function returns a hash that contains the required fields. Here is an example of the hash: $hash{old} - The old way of doing registers. $hash{isntructions} - How to fill out the form. $hash{form} - The new dynamic forms that replace the old way of doing things. In $hash{form}, the fields that are present are the required fields the server needs. RegisterSend(hash) - takes the contents of the hash and passes it to the SetRegister function in the module Net::Jabber::Query::Register. This function returns an array that looks like this: [ type , message ] If type is "ok" then registration was successful, otherwise message contains a little more detail about the error. IQ::Roster Functions -------------------- RosterParse(IQ object) - returns a hash that contains the roster parsed into the following data structure: $roster{'bob@jabber.org'}->{name} - Name you stored in the roster $roster{'bob@jabber.org'}->{subscription} - Subscription status (to, from, both, none) $roster{'bob@jabber.org'}->{ask} - The ask status from this user (subscribe, unsubscribe) $roster{'bob@jabber.org'}->{groups} - Array of groups that bob@jabber.org is in RosterGet() - sends an empty Net::Jabber::IQ::Roster tag to the server so the server will send the Roster to the client. Returns the above hash from RosterParse. RosterAdd(hash) - sends a packet asking that the jid be added to the roster. The hash format is defined in the SetItem function in the Net::Jabber::Query::Roster::Item module. RosterRemove(hash) - sends a packet asking that the jid be removed from the roster. The hash format is defined in the SetItem function in the Net::Jabber::Query::Roster::Item module. IQ::Search Functions -------------------- SearchRequest(to=>string) - send an request to the specified SearchRequest() server/transport, if not specified it sends to the current active server. The function returns a hash that contains the required fields. Here is an example of the hash: $fields{intructions} = "do this..." $fields{key} = "some key" $fields{name} = "" ... The fields that are present are the required fields the server needs. If the hash is undefined then there was an error with the request. SearchSend(to=>string|JID, - takes the contents of the hash and hash) passes it to the SetSearch function in the module Net::Jabber::Query::Search. And then send the packet. IQ::Time Functions ------------------ TimeQuery(to=>string, - asks the jid specified for its local time. waitforid=>0|1) If the to is blank, then it queries the TimeQuery() server. Returns a hash with the various items set if waitforid is set to 1: $time{utc} - Time in UTC $time{tz} - Timezone $time{display} - Display string TimeSend(to=>string) - sends the current UTC time to the specified jid. IQ::Version Functions --------------------- VersionQuery(to=>string, - asks the jid specified for its waitforid=>0|1) client version information. If the VersionQuery() to is blank, then it queries the server. Returns ahash with the various items set if waitforid is set to 1: $version{name} - Name $version{ver} - Version $version{os} - Operating System/ Platform VersionSend(to=>string, - sends the specified version information name=>string, to the jid specified in the to. ver=>string, os=>string) X Functions ----------- SXPMSend(to=>string, - sends the specified sxpm information to the type=>string, jid in the to with the message type being hash) set in the type. See the Net::Jabber::SXPM module for valid values for the hash. This function returns the Net::Jabber::Message object sent to the jid. AUTHOR ====== Revised by Ryan Eatmon in December 1999. By Thomas Charron in July of 1999 for http://jabber.org.. Based on a screenplay by Jeremie Miller in May of 1999 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.