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

jabber:iq:

120         Type     Get               Set               Defined
121         =======  ================  ================  ==================
122

jabber:iq:

124         Type     Get               Set               Defined
125         =======  ================  ================  ==================
126

jabber:iq:

128         Type     Get               Set               Defined
129         =======  ================  ================  ==================
130

jabber:iq:

132         Type     Get               Set               Defined
133         =======  ================  ================  ==================
134

jabber:iq:

136         Type     Get               Set               Defined
137         =======  ================  ================  ==================
138

CUSTOM NAMESPACES

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

AUTHOR

145       By Ryan Eatmon in May of 2001 for http://jabber.org..
146
148       This module is free software; you can redistribute it and/or modify it
149       under the same terms as Perl itself.
150
151
152
153perl v5.32.0                      2020-07-28              Net::Jabber::Data(3)
Impressum