1Net::Jabber::Data(3)  User Contributed Perl Documentation Net::Jabber::Data(3)
2
3
4

NAME

6       Net::Jabber::Data - Jabber Data Library
7

SYNOPSIS

9         Net::Jabber::Data is a companion to the Net::Jabber::XDB module. It
10         provides the user a simple interface to set and retrieve all
11         parts of a Jabber XDB Data.
12

DESCRIPTION

14         Net::Jabber::Data differs from the other modules in that its behavior
15         and available functions are based off of the XML namespace that is
16         set in it.  The current list of supported namespaces is:
17
18           jabber:iq:auth
19           jabber:iq:auth:0k
20           jabber:iq:register
21           jabber:iq:roster
22
23         For more information on what these namespaces are for, visit
24         http://www.jabber.org and browse the Jabber Programmers Guide.
25
26         Each of these namespaces provide Net::Jabber::Data with the functions
27         to access the data.  By using the AUTOLOAD function the functions for
28         each namespace is used when that namespace is active.
29
30         To access a Data object you must create an XDB object and use the
31         access functions there to get to the Data.  To initialize the XDB with
32         a Jabber <xdb/> you must pass it the XML::Stream hash from the
33         Net::Jabber::Client module.
34
35           my $xdb = new Net::Jabber::XDB(%hash);
36
37         There has been a change from the old way of handling the callbacks.
38         You no longer have to do the above yourself, a Net::Jabber::XDB
39         object is passed to the callback function for the message.  Also,
40         the first argument to the callback functions is the session ID from
41         XML::Streams.  There are some cases where you might want this
42         information, like if you created a Client that connects to two servers
43         at once, or for writing a mini server.
44
45           use Net::Jabber qw(Client);
46
47           sub xdbCB {
48             my ($sid,$XDB) = @_;
49             my $data = $XDB->GetData();
50             .
51             .
52             .
53           }
54
55         You now have access to all of the retrieval functions available for
56         that namespace.
57
58         To create a new xdb to send to the server:
59
60           use Net::Jabber;
61
62           my $xdb = new Net::Jabber::XDB();
63           $data = $xdb->NewData("jabber:iq:auth");
64
65         Now you can call the creation functions for the Data as defined in the
66         proper namespaces.  See below for the general <data/> functions, and
67         in each data module for those functions.
68
69         For more information about the array format being passed to the
70         CallBack please read the Net::Jabber::Client documentation.
71

METHODS

73       Retrieval functions
74
75         GetXMLNS() - returns a string with the namespace of the data that
76                      the <xdb/> contains.
77
78                      $xmlns  = $XDB->GetXMLNS();
79
80         GetData() - since the behavior of this module depends on the
81                      namespace, a Data object may contain Data objects.
82                      This helps to leverage code reuse by making children
83                      behave in the same manner.  More than likely this
84                      function will never be called.
85
86                      @data = GetData()
87
88       Creation functions
89
90         SetXMLNS(string) - sets the xmlns of the <data/> to the string.
91
92                            $data->SetXMLNS("jabber:xdb:roster");
93
94       In an effort to make maintaining this document easier, I am not going
95       to go into full detail on each of these functions.  Rather I will
96       present the functions in a list with a type in the first column to show
97       what they return, or take as arugments.  Here is the list of types I
98       will use:
99
100         string  - just a string
101         array   - array of strings
102         flag    - this means that the specified child exists in the
103                   XML <child/> and acts like a flag.  get will return
104                   0 or 1.
105         JID     - either a string or Net::Jabber::JID object.
106         objects - creates new objects, or returns an array of
107                   objects.
108         special - this is a special case kind of function.  Usually
109                   just by calling Set() with no arguments it will
110                   default the value to a special value, like OS or time.
111                   Sometimes it will modify the value you set, like
112                   in jabber:xdb:version SetVersion() the function
113                   adds on the Net::Jabber version to the string
114                   just for advertisement purposes. =)
115         master  - this desribes a function that behaves like the
116                   SetMessage() function in Net::Jabber::Message.
117                   It takes a hash and sets all of the values defined,
118                   and the Set returns a hash with the values that
119                   are defined in the object.
120

jabber:iq:

122         Type     Get               Set               Defined
123         =======  ================  ================  ==================
124

jabber:iq:

126         Type     Get               Set               Defined
127         =======  ================  ================  ==================
128

jabber:iq:

130         Type     Get               Set               Defined
131         =======  ================  ================  ==================
132

jabber:iq:

134         Type     Get               Set               Defined
135         =======  ================  ================  ==================
136

jabber:iq:

138         Type     Get               Set               Defined
139         =======  ================  ================  ==================
140

CUSTOM NAMESPACES

142         Part of the flexability of this module is that you can define your own
143         namespace.  For more information on this topic, please read the
144         Net::Jabber::Namespaces man page.
145

AUTHOR

147       By Ryan Eatmon in May of 2001 for http://jabber.org..
148
150       This module is free software; you can redistribute it and/or modify it
151       under the same terms as Perl itself.
152
153
154
155perl v5.8.8                       2004-08-16              Net::Jabber::Data(3)
Impressum