ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-XMPP2/lib/Net/XMPP2/Namespaces.pm
Revision: 1.5
Committed: Tue Apr 24 16:13:53 2007 UTC (19 years, 5 months ago) by elmex
Branch: MAIN
Changes since 1.4: +3 -0 lines
Log Message:
further subscription code and in-band-stuff is going to be implemented next

File Contents

# User Rev Content
1 elmex 1.1 package Net::XMPP2::Namespaces;
2     use warnings;
3     use strict;
4     require Exporter;
5     our @EXPORT_OK = qw/xmpp_ns set_xmpp_ns_alias/;
6     our @ISA = qw/Exporter/;
7    
8     our %NAMESPACES = (
9 elmex 1.4 client => 'jabber:client',
10     stream => 'http://etherx.jabber.org/streams',
11     streams => 'urn:ietf:params:xml:ns:xmpp-streams',
12     stanzas => 'urn:ietf:params:xml:ns:xmpp-stanzas',
13     sasl => 'urn:ietf:params:xml:ns:xmpp-sasl',
14     bind => 'urn:ietf:params:xml:ns:xmpp-bind',
15     tls => 'urn:ietf:params:xml:ns:xmpp-tls',
16     roster => 'jabber:iq:roster',
17     version => 'jabber:iq:version',
18     session => 'urn:ietf:params:xml:ns:xmpp-session',
19     xml => 'http://www.w3.org/XML/1998/namespace',
20 elmex 1.3 disco_info => 'http://jabber.org/protocol/disco#info',
21 elmex 1.5 register => 'http://jabber.org/features/iq-register',
22 elmex 1.1 );
23    
24     =head1 NAME
25    
26     Net::XMPP2::Namespaces - A XMPP namespace collection and aliasing class
27    
28     =head1 SYNOPSIS
29    
30     use Net::XMPP2::Namespaces qw/xmpp_ns set_xmpp_ns_alias/;
31    
32     set_xmpp_ns_alias (stanzas => 'urn:ietf:params:xml:ns:xmpp-stanzas');
33     $node->find_all ($p, [xmpp_ns ('stanzas'), 'iq']);
34    
35     =head1 DESCRIPTION
36    
37     This module represents a simple namespaces aliasing mechanism to ease handling
38     of namespaces when traversing Net::XMPP2::Node objects and writing XML
39     with Net::XMPP2::Writer.
40    
41     =head1 XMPP NAMESPACES
42    
43     There are already some aliases defined for the XMPP XML namespaces
44     which make handling of namepsaces a bit easier:
45    
46     stream => http://etherx.jabber.org/streams
47     xml => http://www.w3.org/XML/1998/namespace
48    
49     streams => urn:ietf:params:xml:ns:xmpp-streams
50     session => urn:ietf:params:xml:ns:xmpp-session
51     stanzas => urn:ietf:params:xml:ns:xmpp-stanzas
52     sasl => urn:ietf:params:xml:ns:xmpp-sasl
53     bind => urn:ietf:params:xml:ns:xmpp-bind
54 elmex 1.2 tls => urn:ietf:params:xml:ns:xmpp-tls
55 elmex 1.1
56     client => jabber:client
57     roster => jabber:iq:roster
58     version => jabber:iq:version
59    
60 elmex 1.5 register => http://jabber.org/features/iq-register
61    
62 elmex 1.1 =head1 FUNCTIONS
63    
64     =head2 xmpp_ns ($alias)
65    
66     Returns am uri for the registered C<$alias> or undef if none exists.
67    
68     =cut
69    
70     sub xmpp_ns { return $NAMESPACES{$_[0]} }
71    
72     =head2 set_xmpp_ns_alias ($alias, $namespace_uri)
73    
74     Sets an C<$alias> for the C<$namespace_uri>.
75    
76     =cut
77    
78     sub set_xmpp_ns_alias { return $NAMESPACES{$_[0]} }
79    
80     =head1 AUTHOR
81    
82     Robin Redeker, C<< <elmex at ta-sa.org> >>
83    
84     =head1 COPYRIGHT & LICENSE
85    
86     Copyright 2007 Robin Redeker, all rights reserved.
87    
88     This program is free software; you can redistribute it and/or modify it
89     under the same terms as Perl itself.
90    
91     =cut
92    
93     1; # End of Net::XMPP2