ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-XMPP2/lib/Net/XMPP2/Namespaces.pm
Revision: 1.7
Committed: Mon Jun 25 07:56:52 2007 UTC (19 years, 3 months ago) by elmex
Branch: MAIN
Changes since 1.6: +1 -0 lines
Log Message:
sime fixes and changes

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