Net::XMPP::Message(3pm) User Contributed Perl Documentation
NAME
Net::XMPP::Message - XMPP Message Module
SYNOPSIS
Net::XMPP::Message is a companion to the Net::XMPP module.
It provides the user a simple interface to set and retrieve all
parts of an XMPP Message.
DESCRIPTION
A Net::XMPP::Message object is passed to the callback function for
the message. Also, the first argument to the callback functions is
the session ID from XML::Stream. There are some cases where you
might want thisinformation, like if you created a Client that
connects to two servers at once, or for writing a mini server.
use Net::XMPP;
sub message {
my ($sid,$Mess) = @_;
.
.
.
}
You now have access to all of the retrieval functions available.
To create a new message to send to the server:
use Net::XMPP;
$Mess = Net::XMPP::Message->new();
Now you can call the creation functions below to populate the tag
before sending it.
METHODS
Retrieval functions
GetTo() - returns the value in the to='' attribute for the
GetTo("jid") . If you specify "jid" as an argument
then a Net::XMPP::JID object is returned and
you can easily parse the parts of the JID.
$to = $Mess->GetTo();
$toJID = $Mess->GetTo("jid");
GetFrom() - returns the value in the from='' attribute for the
GetFrom("jid") . If you specify "jid" as an argument
then a Net::XMPP::JID object is returned and
you can easily parse the parts of the JID.
$from = $Mess->GetFrom();
$fromJID = $Mess->GetFrom("jid");
GetType() - returns the type='' attribute of the . Each
message is one of four types:
normal regular message (default if type is blank)
chat one on one chat
groupchat multi-person chat
headline headline
error error message
$type = $Mess->GetType();
GetSubject() - returns the data in the tag.
$subject = $Mess->GetSubject();
GetBody() - returns the data in the