/usr/share/perl5/Net/Jabber/Data.pm is in libnet-jabber-perl 2.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | ##############################################################################
#
# 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::Data;
=head1 NAME
Net::Jabber::Data - Jabber Data Library
=head1 SYNOPSIS
Net::Jabber::Data is a companion to the Net::Jabber::XDB module. It
provides the user a simple interface to set and retrieve all
parts of a Jabber XDB Data.
=head1 DESCRIPTION
Net::Jabber::Data differs from the other modules in that its behavior
and available functions are based off of the XML namespace that is
set in it. The current list of supported namespaces is:
jabber:iq:auth
jabber:iq:auth:0k
jabber:iq:register
jabber:iq:roster
For more information on what these namespaces are for, visit
http://www.jabber.org and browse the Jabber Programmers Guide.
Each of these namespaces provide Net::Jabber::Data with the functions
to access the data. By using the AUTOLOAD function the functions for
each namespace is used when that namespace is active.
To access a Data object you must create an XDB object and use the
access functions there to get to the Data. To initialize the XDB with
a Jabber <xdb/> you must pass it the XML::Stream hash from the
Net::Jabber::Client module.
my $xdb = new Net::Jabber::XDB(%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::XDB
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 xdbCB {
my ($sid,$XDB) = @_;
my $data = $XDB->GetData();
.
.
.
}
You now have access to all of the retrieval functions available for
that namespace.
To create a new xdb to send to the server:
use Net::Jabber;
my $xdb = new Net::Jabber::XDB();
$data = $xdb->NewData("jabber:iq:auth");
Now you can call the creation functions for the Data as defined in the
proper namespaces. See below for the general <data/> functions, and
in each data module for those functions.
For more information about the array format being passed to the
CallBack please read the Net::Jabber::Client documentation.
=head1 METHODS
=head2 Retrieval functions
GetXMLNS() - returns a string with the namespace of the data that
the <xdb/> contains.
$xmlns = $XDB->GetXMLNS();
GetData() - since the behavior of this module depends on the
namespace, a Data object may contain Data objects.
This helps to leverage code reuse by making children
behave in the same manner. More than likely this
function will never be called.
@data = GetData()
=head2 Creation functions
SetXMLNS(string) - sets the xmlns of the <data/> to the string.
$data->SetXMLNS("jabber:xdb:roster");
In an effort to make maintaining this document easier, I am not going
to go into full detail on each of these functions. Rather I will
present the functions in a list with a type in the first column to
show what they return, or take as arugments. Here is the list of
types I will use:
string - just a string
array - array of strings
flag - this means that the specified child exists in the
XML <child/> and acts like a flag. get will return
0 or 1.
JID - either a string or Net::Jabber::JID object.
objects - creates new objects, or returns an array of
objects.
special - this is a special case kind of function. Usually
just by calling Set() with no arguments it will
default the value to a special value, like OS or time.
Sometimes it will modify the value you set, like
in jabber:xdb:version SetVersion() the function
adds on the Net::Jabber version to the string
just for advertisement purposes. =)
master - this desribes a function that behaves like the
SetMessage() function in Net::Jabber::Message.
It takes a hash and sets all of the values defined,
and the Set returns a hash with the values that
are defined in the object.
=head1 jabber:iq:
Type Get Set Defined
======= ================ ================ ==================
=head1 jabber:iq:
Type Get Set Defined
======= ================ ================ ==================
=head1 jabber:iq:
Type Get Set Defined
======= ================ ================ ==================
=head1 jabber:iq:
Type Get Set Defined
======= ================ ================ ==================
=head1 jabber:iq:
Type Get Set Defined
======= ================ ================ ==================
=head1 CUSTOM NAMESPACES
Part of the flexability of this module is that you can define your own
namespace. For more information on this topic, please read the
Net::Jabber::Namespaces man page.
=head1 AUTHOR
By Ryan Eatmon in May of 2001 for http://jabber.org..
=head1 COPYRIGHT
This module is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
require 5.003;
use strict;
use Carp;
use vars qw($VERSION $AUTOLOAD %FUNCTIONS %NAMESPACES);
$VERSION = "2.0";
sub new
{
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = { };
$self->{VERSION} = $VERSION;
bless($self, $proto);
$self->{DEBUGHEADER} = "Data";
$self->{DATA} = {};
$self->{CHILDREN} = {};
$self->{TAG} = "data";
if ("@_" ne (""))
{
if (ref($_[0]) eq "Net::Jabber::Data")
{
return $_[0];
}
else
{
$self->{TREE} = shift;
$self->{TAG} = $self->{TREE}->get_tag();
$self->ParseXMLNS();
$self->ParseTree();
}
}
return $self;
}
##############################################################################
#
# AUTOLOAD - This function calls the main AutoLoad function in Jabber.pm
#
##############################################################################
sub AUTOLOAD
{
my $self = shift;
&Net::Jabber::AutoLoad($self,$AUTOLOAD,@_);
}
$FUNCTIONS{XMLNS}->{Get} = "xmlns";
$FUNCTIONS{XMLNS}->{Set} = ["scalar","xmlns"];
$FUNCTIONS{XMLNS}->{Defined} = "xmlns";
$FUNCTIONS{XMLNS}->{Hash} = "att";
$FUNCTIONS{Data}->{Get} = "__netjabber__:children:data";
$FUNCTIONS{Data}->{Defined} = "__netjabber__:children:data";
#-----------------------------------------------------------------------------
# jabber:iq:auth
#-----------------------------------------------------------------------------
$NAMESPACES{"jabber:iq:auth"}->{Password}->{Get} = "password";
$NAMESPACES{"jabber:iq:auth"}->{Password}->{Set} = ["scalar","password"];
$NAMESPACES{"jabber:iq:auth"}->{Password}->{Defined} = "password";
$NAMESPACES{"jabber:iq:auth"}->{Password}->{Hash} = "data";
$NAMESPACES{"jabber:iq:auth"}->{Auth}->{Get} = "__netjabber__:master";
$NAMESPACES{"jabber:iq:auth"}->{Auth}->{Set} = ["master"];
$NAMESPACES{"jabber:iq:auth"}->{"__netjabber__"}->{Tag} = "password";
#-----------------------------------------------------------------------------
# jabber:iq:auth:0k
#-----------------------------------------------------------------------------
$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Get} = "hash";
$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Set} = ["scalar","hash"];
$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Defined} = "hash";
$NAMESPACES{"jabber:iq:auth:0k"}->{Hash}->{Hash} = "child-data";
$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Get} = "sequence";
$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Set} = ["scalar","sequence"];
$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Defined} = "sequence";
$NAMESPACES{"jabber:iq:auth:0k"}->{Sequence}->{Hash} = "child-data";
$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Get} = "token";
$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Set} = ["scalar","token"];
$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Defined} = "token";
$NAMESPACES{"jabber:iq:auth:0k"}->{Token}->{Hash} = "child-data";
$NAMESPACES{"jabber:iq:auth:0k"}->{ZeroK}->{Get} = "__netjabber__:master";
$NAMESPACES{"jabber:iq:auth:0k"}->{ZeroK}->{Set} = ["master"];
$NAMESPACES{"jabber:iq:auth:0k"}->{"__netjabber__"}->{Tag} = "zerok";
#-----------------------------------------------------------------------------
# jabber:iq:last
#-----------------------------------------------------------------------------
$NAMESPACES{"jabber:iq:last"}->{Message}->{Get} = "message";
$NAMESPACES{"jabber:iq:last"}->{Message}->{Set} = ["scalar","message"];
$NAMESPACES{"jabber:iq:last"}->{Message}->{Defined} = "message";
$NAMESPACES{"jabber:iq:last"}->{Message}->{Hash} = "data";
$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Get} = "last";
$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Set} = ["scalar","last"];
$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Defined} = "last";
$NAMESPACES{"jabber:iq:last"}->{Seconds}->{Hash} = "att";
$NAMESPACES{"jabber:iq:last"}->{Last}->{Get} = "__netjabber__:master";
$NAMESPACES{"jabber:iq:last"}->{Last}->{Set} = ["master"];
$NAMESPACES{"jabber:iq:last"}->{"__netjabber__"}->{Tag} = "query";
#-----------------------------------------------------------------------------
# jabber:iq:roster
#-----------------------------------------------------------------------------
$NAMESPACES{"jabber:iq:roster"}->{Item}->{Get} = "";
$NAMESPACES{"jabber:iq:roster"}->{Item}->{Set} = ["add","Data","__netjabber__:iq:roster:item"];
$NAMESPACES{"jabber:iq:roster"}->{Item}->{Defined} = "__netjabber__:children:data";
$NAMESPACES{"jabber:iq:roster"}->{Item}->{Hash} = "child-add";
$NAMESPACES{"jabber:iq:roster"}->{Item}->{Add} = ["Data","__netjabber__:iq:roster:item","Item","item"];
$NAMESPACES{"jabber:iq:roster"}->{Items}->{Get} = ["__netjabber__:children:data","__netjabber__:iq:roster:item"];
$NAMESPACES{"jabber:iq:roster"}->{"__netjabber__"}->{Tag} = "query";
#-----------------------------------------------------------------------------
# __netjabber__:iq:roster:item
#-----------------------------------------------------------------------------
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Get} = "ask";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Set} = ["scalar","ask"];
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Defined} = "ask";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Ask}->{Hash} = "att";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Get} = "group";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Set} = ["array","group"];
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Defined} = "group";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Group}->{Hash} = "child-data";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Get} = "jid";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Set} = ["jid","jid"];
$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Defined} = "jid";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{JID}->{Hash} = "att";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Get} = "name";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Set} = ["scalar","name"];
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Defined} = "name";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Name}->{Hash} = "att";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Get} = "subscription";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Set} = ["scalar","subscription"];
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Defined} = "subscription";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Subscription}->{Hash} = "att";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Item}->{Get} = "__netjabber__:master";
$NAMESPACES{"__netjabber__:iq:roster:item"}->{Item}->{Set} = ["master"];
#-----------------------------------------------------------------------------
# jabber:x:offline
#-----------------------------------------------------------------------------
$NAMESPACES{"jabber:x:offline"}->{Data}->{Get} = "data";
$NAMESPACES{"jabber:x:offline"}->{Data}->{Set} = ["scalar","data"];
$NAMESPACES{"jabber:x:offline"}->{Data}->{Defined} = "data";
$NAMESPACES{"jabber:x:offline"}->{Data}->{Hash} = "data";
$NAMESPACES{"jabber:x:offline"}->{Offline}->{Get} = "__netjabber__:master";
$NAMESPACES{"jabber:x:offline"}->{Offline}->{Set} = ["master"];
$NAMESPACES{"jabber:x:offline"}->{"__netjabber__"}->{Tag} = "foo";
1;
|