##############################################################################
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/
#
##############################################################################
package Net::XMPP::Message;
=head1 NAME
Net::XMPP::Message - XMPP Message Module
=head1 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.
=head1 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.
=head1 METHODS
=head2 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