1Net::XMPP::JID(3)     User Contributed Perl Documentation    Net::XMPP::JID(3)
2
3
4

NAME

6       Net::XMPP::JID - XMPP JID Module
7

SYNOPSIS

9         Net::XMPP::JID is a companion to the Net::XMPP module.
10         It provides the user a simple interface to set and retrieve all
11         parts of a Jabber ID (userid on a server).
12

DESCRIPTION

14         To initialize the JID you must pass it the string that represents the
15         jid from the XML packet.  Inside the XMPP modules this is done
16         automatically and the JID object is returned instead of a string.
17         For example, in the callback function for the XMPP object foo:
18
19           use Net::XMPP;
20
21           sub foo {
22             my $foo = new Net::XMPP::Foo(@_);
23             my $from = $foo->GetFrom();
24             my $JID = new Net::XMPP::JID($from);
25             .
26             .
27             .
28           }
29
30         You now have access to all of the retrieval functions available.
31
32         To create a new JID to send to the server:
33
34           use Net::XMPP;
35
36           $JID = new Net::XMPP::JID();
37
38         Now you can call the creation functions below to populate the tag
39         before sending it.
40
41   Retrieval functions
42           $userid   = $JID->GetUserID();
43           $server   = $JID->GetServer();
44           $resource = $JID->GetResource();
45
46           $JID      = $JID->GetJID();
47           $fullJID  = $JID->GetJID("full");
48           $baseJID  = $JID->GetJID("base");
49
50   Creation functions
51           $JID->SetJID(userid=>"bob",
52                        server=>"jabber.org",
53                        resource=>"Work");
54
55           $JID->SetJID('blue@moon.org/Home');
56
57           $JID->SetUserID("foo");
58           $JID->SetServer("bar.net");
59           $JID->SetResource("Foo Bar");
60

METHODS

62   Retrieval functions
63         GetUserID() - returns a string with the userid of the JID.
64                       If the string is an address (bob%jabber.org) then
65                       the function will return it as an address
66                       (bob@jabber.org).
67
68         GetServer() - returns a string with the server of the JID.
69
70         GetResource() - returns a string with the resource of the JID.
71
72         GetJID()       - returns a string that represents the JID stored
73         GetJID("full")   within.  If the "full" string is specified, then
74         GetJID("base")   you get the full JID, including Resource, which
75                          should be used to send to the server.  If the "base",
76                          string is specified, then you will just get
77                          user@server, or the base JID.
78
79   Creation functions
80         SetJID(userid=>string,   - set multiple fields in the jid at
81                server=>string,     one time.  This is a cumulative
82                resource=>string)   and over writing action.  If you set
83         SetJID(string)             the "userid" attribute twice, the second
84                                    setting is what is used.  If you set
85                                    the server, and then set the resource
86                                    then both will be in the jid.  If all
87                                    you pass is a string, then that string
88                                    is used as the JID.  For valid settings
89                                    read the specific Set functions below.
90
91         SetUserID(string) - sets the userid.  Must be a valid userid or the
92                             server will complain if you try to use this JID
93                             to talk to the server.  If the string is an
94                             address then it will be converted to the %
95                             form suitable for using as a User ID.
96
97         SetServer(string) - sets the server.  Must be a valid host on the
98                             network or the server will not be able to talk
99                             to it.
100
101         SetResource(string) - sets the resource of the userid to talk to.
102

AUTHOR

104       Ryan Eatmon
105
107       This module is free software, you can redistribute it and/or modify it
108       under the LGPL.
109
110
111
112perl v5.12.0                      2010-05-04                 Net::XMPP::JID(3)
Impressum