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

NAME

6       Net::Jabber::XDB - Jabber XDB Library
7

SYNOPSIS

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

DESCRIPTION

14         Net::Jabber::XDB differs from the other Net::Jabber::* modules in that
15         the XMLNS of the data is split out into more submodules under
16         XDB.  For specifics on each module please view the documentation
17         for each Net::Jabber::Data::* module.  To see the list of avilable
18         namspaces and modules see Net::Jabber::Data.
19
20         To initialize the XDB with a Jabber <xdb/> you must pass it the
21         XML::Parser Tree array.  For example:
22
23           my $xdb = new Net::Jabber::XDB(@tree);
24
25         There has been a change from the old way of handling the callbacks.
26         You no longer have to do the above, a Net::Jabber::XDB object is passed
27         to the callback function for the xdb:
28
29           use Net::Jabber qw(Component);
30
31           sub xdb {
32             my ($XDB) = @_;
33             .
34             .
35             .
36           }
37
38         You now have access to all of the retrieval functions available.
39
40         To create a new xdb to send to the server:
41
42           use Net::Jabber;
43
44           $XDB = new Net::Jabber::XDB();
45           $XDBType = $XDB->NewData( type );
46           $XDBType->SetXXXXX("yyyyy");
47
48         Now you can call the creation functions for the XDB, and for the <data/>
49         on the new Data object itself.  See below for the <xdb/> functions, and
50         in each data module for those functions.
51
52         For more information about the array format being passed to the CallBack
53         please read the Net::Jabber::Client documentation.
54

METHODS

56       Retrieval functions
57
58         GetTo()      - returns either a string with the Jabber Identifier,
59         GetTo("jid")   or a Net::Jabber::JID object for the person who is
60                        going to receive the <xdb/>.  To get the JID
61                        object set the string to "jid", otherwise leave
62                        blank for the text string.
63
64                        $to    = $XDB->GetTo();
65                        $toJID = $XDB->GetTo("jid");
66
67         GetFrom()      -  returns either a string with the Jabber Identifier,
68         GetFrom("jid")    or a Net::Jabber::JID object for the person who
69                           sent the <xdb/>.  To get the JID object set
70                           the string to "jid", otherwise leave blank for the
71                           text string.
72
73                           $from    = $XDB->GetFrom();
74                           $fromJID = $XDB->GetFrom("jid");
75
76         GetType() - returns a string with the type <xdb/> this is.
77
78                     $type = $XDB->GetType();
79
80         GetID() - returns an integer with the id of the <xdb/>.
81
82                   $id = $XDB->GetID();
83
84         GetAction() - returns a string with the action <xdb/> this is.
85
86                     $action = $XDB->GetAction();
87
88         GetMatch() - returns a string with the match <xdb/> this is.
89
90                     $match = $XDB->GetMatch();
91
92         GetError() - returns a string with the text description of the error.
93
94                      $error = $XDB->GetError();
95
96         GetErrorCode() - returns a string with the code of error.
97
98                          $errorCode = $XDB->GetErrorCode();
99
100         GetData() - returns a Net::Jabber::Data object that contains the data
101                     in the <data/> of the <xdb/>.
102
103                     $dataTag = $XDB->GetData();
104
105         GetDataXMLNS() - returns a string with the namespace of the data
106                          for this <xdb/>, if one exists.
107
108                          $xmlns = $XDB->GetDataXMLNS();
109
110       Creation functions
111
112         SetXDB(to=>string⎪JID,    - set multiple fields in the <xdb/> at one
113               from=>string⎪JID,     time.  This is a cumulative and over
114               id=>string,           writing action.  If you set the "to"
115               type=>string,         attribute twice, the second setting is
116               action=>string,       what is used.  If you set the status, and
117               match=>string)        then set the priority then both will be in
118               errorcode=>string,    the <xdb/> tag.  For valid settings read the
119               error=>string)        specific Set functions below.
120
121                                     $XDB->SetXDB(type=>"get",
122                                                  to=>"bob\@jabber.org",
123                                                  data=>"info");
124
125                                     $XDB->SetXDB(to=>"bob\@jabber.org",
126                                                  errorcode=>403,
127                                                  error=>"Permission Denied");
128
129         SetTo(string) - sets the to attribute.  You can either pass a string
130         SetTo(JID)      or a JID object.  They must be a valid Jabber
131                         Identifiers or the server will return an error message.
132                         (ie.  jabber:bob@jabber.org, etc...)
133
134                        $XDB->SetTo("bob\@jabber.org");
135
136         SetFrom(string) - sets the from attribute.  You can either pass a string
137         SetFrom(JID)      or a JID object.  They must be a valid Jabber
138                           Identifiers or the server will return an error message.
139                           (ie.  jabber:bob@jabber.org, etc...)
140
141                           $XDB->SetFrom("me\@jabber.org");
142
143         SetType(string) - sets the type attribute.  Valid settings are:
144
145                           get      request information
146                           set      set information
147                           result   results of a get
148                           error    there was an error
149
150                           $XDB->SetType("set");
151
152         SetAction(string) - sets the error code of the <xdb/>.
153
154                             $XDB->SetAction("foo");
155
156         SetMatch(string) - sets the error code of the <xdb/>.
157
158                            $XDB->SetMatch("foo");
159
160         SetErrorCode(string) - sets the error code of the <xdb/>.
161
162                                $XDB->SetErrorCode(403);
163
164         SetError(string) - sets the error string of the <xdb/>.
165
166                            $XDB->SetError("Permission Denied");
167
168         NewData(string) - creates a new Net::Jabber::Data object with the
169                            namespace in the string.  In order for this function
170                            to work with a custom namespace, you must define and
171                            register that namespace with the XDB module.  For more
172                            information please read the documentation for
173                            Net::Jabber::Data.
174
175                            $dataObj = $XDB->NewData("jabber:xdb:auth");
176                            $dataObj = $XDB->NewData("jabber:xdb:roster");
177
178         Reply(hash) - creates a new XDB object and populates the to/from
179                       fields.  If you specify a hash the same as with SetXDB
180                       then those values will override the Reply values.
181
182                       $xdbReply = $XDB->Reply();
183                       $xdbReply = $XDB->Reply(type=>"result");
184
185       Test functions
186
187         DefinedTo() - returns 1 if the to attribute is defined in the <xdb/>,
188                       0 otherwise.
189
190                       $test = $XDB->DefinedTo();
191
192         DefinedFrom() - returns 1 if the from attribute is defined in the <xdb/>,
193                         0 otherwise.
194
195                         $test = $XDB->DefinedFrom();
196
197         DefinedID() - returns 1 if the id attribute is defined in the <xdb/>,
198                       0 otherwise.
199
200                       $test = $XDB->DefinedID();
201
202         DefinedType() - returns 1 if the type attribute is defined in the <xdb/>,
203                         0 otherwise.
204
205                         $test = $XDB->DefinedType();
206
207         DefinedAction() - returns 1 if the action attribute is defined in the <xdb/>,
208                          0 otherwise.
209
210                          $test = $XDB->DefinedAction();
211
212         DefinedMatch() - returns 1 if the match attribute is defined in the <xdb/>,
213                          0 otherwise.
214
215                          $test = $XDB->DefinedMatch();
216
217         DefinedError() - returns 1 if <error/> is defined in the <xdb/>,
218                          0 otherwise.
219
220                          $test = $XDB->DefinedError();
221
222         DefinedErrorCode() - returns 1 if the code attribute is defined in
223                              <error/>, 0 otherwise.
224
225                              $test = $XDB->DefinedErrorCode();
226

AUTHOR

228       By Ryan Eatmon in May of 2001 for http://jabber.org..
229
231       This module is free software; you can redistribute it and/or modify it
232       under the same terms as Perl itself.
233
234
235
236perl v5.8.8                       2004-08-16               Net::Jabber::XDB(3)
Impressum