ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Net-XMPP2/lib/Net/XMPP2.pm
Revision: 1.6
Committed: Tue Feb 6 22:52:45 2007 UTC (19 years, 8 months ago) by elmex
Branch: MAIN
Changes since 1.5: +15 -0 lines
Log Message:
implemented firts parts of roster handling.
added jid handling functions.

File Contents

# User Rev Content
1 elmex 1.1 package Net::XMPP2;
2     use warnings;
3     use strict;
4    
5 elmex 1.3 our %EXTENSION_ENABLED;
6    
7 elmex 1.1 =head1 NAME
8    
9     Net::XMPP2 - An implementation of the XMPP Protocol
10    
11     =head1 VERSION
12    
13     Version 0.01
14    
15     =cut
16    
17     our $VERSION = '0.01';
18    
19     =head1 SYNOPSIS
20    
21 elmex 1.2 use Net::XMPP2::Connection;
22 elmex 1.1
23 elmex 1.2 or:
24 elmex 1.1
25 elmex 1.2 use Net::XMPP2::IM::Connection;
26 elmex 1.1
27 elmex 1.2 =head1 DESCRIPTION
28    
29     This is the head module of the L<Net::XMPP2> XMPP client protocol (as described in
30 elmex 1.4 RFC 3920 and RFC 3921) framework.
31 elmex 1.2
32 elmex 1.4 L<Net::XMPP2::Connection> is a RFC 3920 conformant "XML" stream implementation
33 elmex 1.5 for clients, which handles tcp connect up to the resource binding. And provides
34     low-level access to the XML nodes on the XML stream along with some high
35     level methods to send the predefined XML stanzas.
36 elmex 1.2
37 elmex 1.4 L<Net::XMPP2::IM::Connection> is a more highlevel module, which is derived
38     from L<Net::XMPP2::Connection>. It handles all the instant messaging client
39 elmex 1.5 functionality described in RFC 3921.
40    
41     Some extensions for XMPP are also implemented and can be activated as described
42     below in L<Supportet extensions>.
43 elmex 1.2
44     There are also other modules in this distribution, for example:
45     L<Net::XMPP2::Util>, L<Net::XMPP2::Writer>, L<Net::XMPP2::Parser> and those i
46     forgot :-) Those modules might be helpful and/or required if you want to use
47     this framework for XMPP.
48    
49     See also L<Net::XMPP2::Writer> for a discussion about the brokeness of XML in the XMPP
50     specification.
51    
52     =head1 Why (yet) another XMPP module?
53    
54     The main outstanding feature of this module in comparsion to the other XMPP
55     (aka Jabber) modules out there is the support for L<AnyEvent>. L<AnyEvent>
56     permits you to use this module together with other I/O event based programs and
57     libraries (ie. L<Gtk2> or L<Event>).
58    
59     The other modules could often only be integrated in those applications or librarys
60 elmex 1.4 by using threads. I decided to write this module because i think CPAN lacks
61     an event based XMPP module. Threads are unfortunately not an alternative in Perl
62     at the moment due the limited threading functionality they provide and the global
63     speed hit. I also think that a simple event based I/O framework might be a bit easier
64     to handle than threads.
65 elmex 1.2
66     Another thing was that I didn't like the APIs of the other modules. In L<Net::XMPP2>
67 elmex 1.4 i try to provide low level modules for speaking XMPP as defined in RFC 3920 and RFC 3921
68     (see also L<Net::XMPP2::Connection> and L<Net::XMPP2::IM::Connection>). But i also
69 elmex 1.5 try to provide a high level API.
70 elmex 1.2
71 elmex 1.4 I also try to have all additional features and functionality as optional as possible
72     to give the client writers enough freedom.
73 elmex 1.2
74     =head1 A note about TLS
75    
76     This module also supports TLS, as the specification of XMPP requires an
77     implementation to support TLS. This module also needs a very recent version of
78     L<Net::SSLeay> which has the functions L<Net::SSLeay::write_nb> and
79     L<Net::SSLeay::read_nb>. Those functions are required for non-blocking I/O with TLS.
80    
81     Unfortunately the implementation of TLS with non-blocking sockets was not as easy as i
82     expected. I needed to extend L<Net::SSLeay> to provide read and write functions
83     which supported retries and i also needed some more complicated approach in handling
84     ready states of the sockets.
85    
86     There are maybe still some bugs in the handling of TLS in L<Net::XMPP2::Connection>.
87     So keep an eye on TLS with this module and please inform with a detailed bug report
88     if you run into any problems. As i use this module myself i don't expect TLS to be
89     completly broken, but it might break under different circumstances than i have here.
90     Those circumstances might be a different load of data pumped through the TLS
91     connection.
92 elmex 1.1
93 elmex 1.2 I mainly expect problems where aviable data isn't properly read from the socket
94     or written to it. You might want to take a look at the C<debug_send> and C<debug_recv>
95     events in L<Net::XMPP2::Connection>.
96 elmex 1.1
97 elmex 1.4 =head1 Supportet extensions
98 elmex 1.3
99     You can extend the functionality of this modules either by giving C<use Net::XMPP2>
100     an argument like this:
101    
102     use Net::XMPP2 qw/xep-0086/;
103    
104 elmex 1.6 There are other extensions that don't change the behaviour of the client
105     to the outside, those are implemented silently. They are listed below the
106     list of supported XMPP extensions.
107    
108     =head2 List of supported extensions
109    
110 elmex 1.3 This is the list of supported XMPP extensions:
111    
112     =over 4
113    
114     =item XEP-0086 - Error Condition Mappings
115    
116     "A mapping to enable legacy entities to correctly handle errors from XMPP-aware entities."
117    
118     This extension will enable sending of the old error codes when generating a stanza
119     error with for example: L<Net::XMPP2::Writer::write_error_tag>
120    
121     =back
122    
123 elmex 1.6 =head2 List of silently supported extensions
124    
125     This is the list of silently supported extensions which don'tt
126     change the behaviour of the modules.
127    
128     =over 4
129    
130     =back
131    
132 elmex 1.3 =cut
133    
134     sub import {
135     my ($mod, @exts) = @_;
136     for (@exts) {
137     if (/^xep-(\d+)$/i) {
138     $EXTENSION_ENABLED{''. (1*$1)} = 1;
139     }
140     }
141     }
142    
143 elmex 1.1 =head1 AUTHOR
144    
145     Robin Redeker, C<< <elmex at ta-sa.org> >>
146    
147     =head1 BUGS
148    
149     Please report any bugs or feature requests to
150     C<bug-net-xmpp2 at rt.cpan.org>, or through the web interface at
151     L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-XMPP2>.
152     I will be notified, and then you'll automatically be notified of progress on
153     your bug as I make changes.
154    
155     =head1 SUPPORT
156    
157     You can find documentation for this module with the perldoc command.
158    
159     perldoc Net::XMPP2
160    
161     You can also look for information at:
162    
163     =over 4
164    
165     =item * AnnoCPAN: Annotated CPAN documentation
166    
167     L<http://annocpan.org/dist/Net-XMPP2>
168    
169     =item * CPAN Ratings
170    
171     L<http://cpanratings.perl.org/d/Net-XMPP2>
172    
173     =item * RT: CPAN's request tracker
174    
175     L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-XMPP2>
176    
177     =item * Search CPAN
178    
179     L<http://search.cpan.org/dist/Net-XMPP2>
180    
181     =back
182    
183     =head1 ACKNOWLEDGEMENTS
184    
185     =head1 COPYRIGHT & LICENSE
186    
187     Copyright 2007 Robin Redeker, all rights reserved.
188    
189     This program is free software; you can redistribute it and/or modify it
190     under the same terms as Perl itself.
191    
192     =cut
193    
194     1; # End of Net::XMPP2