NAME
Net::Jabber::X::SXPM - Jabber X SXPM Delegate
SYNOPSIS
Net::Jabber::X::SXPM is a companion to the Net::Jabber::X module.
It provides the user a simple interface to set and retrieve all
parts of a Jabber X SXPM.
DESCRIPTION
To initialize the SXPM with a Jabber <x/> you must pass it the
XML::Parser Tree array from the module trying to access the <x/>.
In the callback function:
use Net::Jabber;
sub iq {
my $foo = new Net::Jabber::Foo(@_);
my @xTags = $foo->GetX("jabber:x:sxpm");
my $xTag;
foreach $xTag (@xTags) {
$xTag->....
}
.
.
.
}
You now have access to all of the retrieval functions available.
To create a new SXPM to send to the server:
use Net::Jabber;
$foo = new Net::Jabber::Foo();
$xTag = $foo->NewX("jabber:x:sxpm");
Now you can call the creation functions below.
For more information about the array format being passed to the CallBack
please read the Net::Jabber::Client documentation.
Retrieval functions
$data = $xTag->GetData();
$datawidth = $xTag->GetDataWidth();
$datax = $xTag->GetDataX();
$datay = $xTag->GetDataY();
$boardheight = $xTag->GetBoardHeight();
$boardwidth = $xTag->GetBoardWidth();
@maps = $xTag->GetMaps();
Creation functions
$xTag->SetSXPM(boardwidth=>400,
boardheight=>600);
$xTag->SetSXPM(data=>"3 a2 a a2 a3 ",
datawidth=>4,
datax=>100,
datay=>300);
$xTag->SetData(" a aa a");
$xTag->SetDataWidth(2);
$xTag->SetDataX(15);
$xTag->SetDataY(40);
$xTag->SetBoardHeight(200);
$xTag->SetBoardWidth(200);
$map = $xTag->AddMap();
METHODS
Retrieval functions
GetData() - returns a string with the compressed sxpm data in it.
To uncompress it, run through the string and anytime
you encounter a number, replace the number and following
character with that number of that character:
10a5b10a = aaaaaaaaaabbbbbaaaaaaaaaa
The use the GetDataWidth() function to get the width
of a line and break the line to some number of width
wide strings and that becomes the update block for the
sxpm.
GetDataWidth() - how long a row of the block is so that you can
chop up the sxpm block you were sent.
GetDataX() - the x coordinate to overlay the sxpm data at.
GetDataY() - the x coordinate to overlay the sxpm data at.
GetBoardHeight() - returns an integer with the height of the new board
to create, or to resize the current board to.
GetBoardWidth() - returns an integer with the width of the new board
to create, or to resize the current board to.
GetMaps() - returns an array of Net::Jabber::X::SXPM::Map objects.
These can be modified or accessed with the functions
available to them.
Creation functions
SetSXPM(data=>string, - set multiple fields in the <x/> at one
datawidth=>integer, time. This is a cumulative and over
datax=>integer, writing action. If you set the "data"
datay=>integer) value twice, the second setting is
boardheight=>integer, what is used. If you set the boardheight,
boardwidth=>integer) and then set the boardwidth then both
will be in the <x/> tag. For valid
settings read the specific Set functions
below.
SetData(string) - sets the <data/> cdata to the string. The string
must be valid sxpm data.
SetDataWidth(integer) - sets the width so that the other side can
decode the sxpm data correctly.
SetDataX(integer) - sets the x coordinate to anchor the sxpm data at.
SetDataY(integer) - sets the y coordinate to anchor the sxpm data at.
SetBoardHeight(string) - sets the board height when creating a new board,
or resizing the current board.
SetBoardWidth(string) - sets the board width when creating a new board,
or resizing the current board.
AddMap(XML::Parser tree) - creates a new Net::Jabbber::X::SXPM::Map
object and populates it with the tree if one
was passed in. This returns the pointer to
the <map/> so you can modify it with the
creation functions from that module.
Test functions
DefinedData() - returns 1 if the <data/> tag exists in the x,
0 otherwise.
DefinedDataWidth() - returns 1 if the width attribute exists in the
<data/> tag, 0 otherwise.
DefinedDataX() - returns 1 if the x attribute exists in the </data>
tag, 0 otherwise.
DefinedDataY() - returns 1 if the y attribute exists in the </data>
tag, 0 otherwise.
DefinedBoard() - returns 1 if there is a <board/> tag in the <x/>.
DefinedBoardHeight() - returns 1 if the height attribute exists in the
<board/> tag, 0 otherwise.
DefinedBoardWidth() - returns 1 if the width attribute exists in the
<board/> tag, 0 otherwise.
AUTHOR
By Ryan Eatmon in January of 2001 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.