1Net::XMPP::JID(3pm)   User Contributed Perl Documentation  Net::XMPP::JID(3pm)
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.  It provides the
10       user a simple interface to set and retrieve all parts of a Jabber ID
11       (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.  For
17       example, in the callback function for the XMPP object foo:
18
19           use Net::XMPP;
20
21           sub foo {
22             my $foo = Net::XMPP::Foo->new(@_);
23             my $from = $foo->GetFrom();
24             my $JID = Net::XMPP::JID->new($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 = Net::XMPP::JID->new();
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
64             GetUserID()
65
66           returns a string with the userid of the JID.  If the string is an
67           address (bob%jabber.org) then the function will return it as an
68           address (bob@jabber.org).
69
70       GetServer
71             GetServer()
72
73           returns a string with the server of the JID.
74
75       GerResource
76             GetResource()
77
78           returns a string with the resource of the JID.
79
80       GetJID
81             GetJID()
82             GetJID("full")
83             GetJID("base")
84           returns a string that represents the JID stored
85           within.  If the "full" string is specified, then
86           you get the full JID, including Resource, which
87           should be used to send to the server.  If the "base",
88           string is specified, then you will just get
89           user@server, or the base JID.
90
91   Creation functions
92       SetJID
93             SetJID(userid=>string,
94                    server=>string,
95                    resource=>string)
96             SetJID(string)
97
98           set multiple fields in the jid at one time.  This is a cumulative
99           and over writing action.  If you set the "userid" attribute twice,
100           the second setting is what is used.  If you set the server, and
101           then set the resource then both will be in the jid.  If all you
102           pass is a string, then that string is used as the JID.  For valid
103           settings read the specific Set functions below.
104
105       SetUserID
106             SetUserID(string)
107
108           sets the userid.  Must be a valid userid or the server will
109           complain if you try to use this JID to talk to the server.  If the
110           string is an address then it will be converted to the % form
111           suitable for using as a User ID.
112
113       SerServer
114             SetServer(string)
115
116           sets the server.  Must be a valid host on the network or the server
117           will not be able to talk to it.
118
119       SetResource
120             SetResource(string)
121
122           sets the resource of the userid to talk to.
123

AUTHOR

125       Originally authored by Ryan Eatmon.
126
127       Previously maintained by Eric Hacker.
128
129       Currently maintained by Darian Anthony Patrick.
130
132       This module is free software, you can redistribute it and/or modify it
133       under the LGPL 2.1.
134
135
136
137perl v5.38.0                      2023-07-21               Net::XMPP::JID(3pm)
Impressum