##############################################################################
#
# 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.
#
# Jabber
# Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
#
##############################################################################
package Net::Jabber::Message;
=head1 NAME
Net::Jabber::Message - Jabber Message Module
=head1 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.
=head1 DESCRIPTION
To initialize the Message with a Jabber you must pass it
the XML::Stream hash. For example:
my $message = new Net::Jabber::Message(%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::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::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 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::Jabber qw(Client);
$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.
=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::Jabber::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::Jabber::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