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
43           $userid   = $JID->GetUserID();
44           $server   = $JID->GetServer();
45           $resource = $JID->GetResource();
46
47           $JID      = $JID->GetJID();
48           $fullJID  = $JID->GetJID("full");
49           $baseJID  = $JID->GetJID("base");
50
51       Creation functions
52
53           $JID->SetJID(userid=>"bob",
54                        server=>"jabber.org",
55                        resource=>"Work");
56
57           $JID->SetJID('blue@moon.org/Home');
58
59           $JID->SetUserID("foo");
60           $JID->SetServer("bar.net");
61           $JID->SetResource("Foo Bar");
62

METHODS

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

AUTHOR

108       Ryan Eatmon
109
111       This module is free software, you can redistribute it and/or modify it
112       under the LGPL.
113
114
115
116perl v5.8.8                       2007-04-02                 Net::XMPP::JID(3)
Impressum