Piers Harding

NAME

Jabber::pkt - Perl wrapper for Jabber pkt for management of XML nodes

SYNOPSIS

   Jabber::pkt is a helper class - you do not directly invoke it.  

DESCRIPTION

Jabber::pkt is a wrapper for the jabberd session manager (sm) packet object. It provides a framework to access characteristics of the packet such as the to and from addresses, the nad object, an dto construct new packets.

METHODS

error()

Generate an error pkt, based on an existing pkt.

 my $epkt = pkt->error($code, $message);

to()

get the packets 'to' address.

 my $to = $pkt->to();

from()

get a packets 'from' address.

 my $from = $pkt->from();

type()

get a packets 'type' eg. message, presence, or iq.

 my $type = $pkt->type();

nad()

get a reference to a packets nad object

 my $nad = $pkt->nad();

tofrom()

swap a packets to and from address, and return the object for convenience

 $pkt = $pkt->tofrom();

dup()

Duplicate the packet

 my $newpkt = $pkt->dup();

create()

Create a new packet in the context of the current session (session that the current packet is attached to).

 my $newpkt = $pkt->create("<message|iq|presence>", $type, $to, $from);

Once the packet skeleton has been created - access the nad ($newpkt->nad) and modify the XML fragment as necessary, before delivering the packet with $newpkt->router().

router()

Send a packet on it's way

 $pkt->router();

free()

Free a packet.

 $pkt->free();

id()

Copy the current packets ID to another packet.

 $pkt->id( $otherpkt );