| 1 |
elmex |
1.1 |
package Net::XMPP2; |
| 2 |
|
|
use warnings; |
| 3 |
|
|
use strict; |
| 4 |
|
|
|
| 5 |
|
|
=head1 NAME |
| 6 |
|
|
|
| 7 |
|
|
Net::XMPP2 - An implementation of the XMPP Protocol |
| 8 |
|
|
|
| 9 |
|
|
=head1 VERSION |
| 10 |
|
|
|
| 11 |
|
|
Version 0.01 |
| 12 |
|
|
|
| 13 |
|
|
=cut |
| 14 |
|
|
|
| 15 |
|
|
our $VERSION = '0.01'; |
| 16 |
|
|
|
| 17 |
|
|
=head1 SYNOPSIS |
| 18 |
|
|
|
| 19 |
elmex |
1.2 |
use Net::XMPP2::Connection; |
| 20 |
elmex |
1.1 |
|
| 21 |
elmex |
1.2 |
or: |
| 22 |
elmex |
1.1 |
|
| 23 |
elmex |
1.2 |
use Net::XMPP2::IM::Connection; |
| 24 |
elmex |
1.1 |
|
| 25 |
elmex |
1.11 |
or: |
| 26 |
|
|
|
| 27 |
|
|
use Net::XMPP2::Client; |
| 28 |
|
|
|
| 29 |
elmex |
1.2 |
=head1 DESCRIPTION |
| 30 |
|
|
|
| 31 |
|
|
This is the head module of the L<Net::XMPP2> XMPP client protocol (as described in |
| 32 |
elmex |
1.4 |
RFC 3920 and RFC 3921) framework. |
| 33 |
elmex |
1.2 |
|
| 34 |
elmex |
1.4 |
L<Net::XMPP2::Connection> is a RFC 3920 conformant "XML" stream implementation |
| 35 |
elmex |
1.5 |
for clients, which handles tcp connect up to the resource binding. And provides |
| 36 |
|
|
low-level access to the XML nodes on the XML stream along with some high |
| 37 |
|
|
level methods to send the predefined XML stanzas. |
| 38 |
elmex |
1.2 |
|
| 39 |
elmex |
1.4 |
L<Net::XMPP2::IM::Connection> is a more highlevel module, which is derived |
| 40 |
|
|
from L<Net::XMPP2::Connection>. It handles all the instant messaging client |
| 41 |
elmex |
1.5 |
functionality described in RFC 3921. |
| 42 |
|
|
|
| 43 |
elmex |
1.11 |
L<Net::XMPP2::Client> is a multi account client class. It manages connections |
| 44 |
|
|
to multiple XMPP accounts and tries to offer a nice highlevel interface |
| 45 |
|
|
to XMPP communication. |
| 46 |
|
|
|
| 47 |
elmex |
1.9 |
For a list of L<Supportet extensions> see below. |
| 48 |
elmex |
1.2 |
|
| 49 |
|
|
There are also other modules in this distribution, for example: |
| 50 |
elmex |
1.11 |
L<Net::XMPP2::Util>, L<Net::XMPP2::Writer>, L<Net::XMPP2::Parser> and those I |
| 51 |
elmex |
1.2 |
forgot :-) Those modules might be helpful and/or required if you want to use |
| 52 |
|
|
this framework for XMPP. |
| 53 |
|
|
|
| 54 |
|
|
See also L<Net::XMPP2::Writer> for a discussion about the brokeness of XML in the XMPP |
| 55 |
|
|
specification. |
| 56 |
|
|
|
| 57 |
elmex |
1.12 |
=head1 REQUIREMENTS |
| 58 |
|
|
|
| 59 |
|
|
One of the major drawbacks I see for Net::XMPP2 is the long list of required |
| 60 |
|
|
modules to make it work. |
| 61 |
|
|
|
| 62 |
|
|
=over 4 |
| 63 |
|
|
|
| 64 |
|
|
=item AnyEvent |
| 65 |
|
|
|
| 66 |
|
|
For the I/O events and timers. |
| 67 |
|
|
|
| 68 |
|
|
=item XML::Writer |
| 69 |
|
|
|
| 70 |
|
|
For writing "XML". |
| 71 |
|
|
|
| 72 |
|
|
=item XML::Parser::Expat |
| 73 |
|
|
|
| 74 |
|
|
For parsing partial "XML" stuff. |
| 75 |
|
|
|
| 76 |
|
|
=item MIME::Base64 |
| 77 |
|
|
|
| 78 |
|
|
For SASL authentication |
| 79 |
|
|
|
| 80 |
|
|
=item Authen::SASL |
| 81 |
|
|
|
| 82 |
|
|
For SASL authentication |
| 83 |
|
|
|
| 84 |
|
|
=item Net::LibIDN |
| 85 |
|
|
|
| 86 |
|
|
For stringprep profiles to handle JIDs. |
| 87 |
|
|
|
| 88 |
|
|
=item Net::SSLeay |
| 89 |
|
|
|
| 90 |
|
|
For SSL connections. |
| 91 |
|
|
|
| 92 |
|
|
=item Net::DNS |
| 93 |
|
|
|
| 94 |
|
|
For SRV RR lookups. |
| 95 |
|
|
|
| 96 |
|
|
=back |
| 97 |
|
|
|
| 98 |
|
|
And yes, all these are essential for XMPP communication. Even thought 'instant |
| 99 |
|
|
messaging' and 'presence' is a quite simple problem XMPP somehow was successful |
| 100 |
|
|
at complicating the task enough to keep me busy for a long time. But all that |
| 101 |
|
|
time wasn't only for the technology required to get it started, mostly it |
| 102 |
|
|
was for all the quirks, hacks and badly applied "XML" in the protocol which |
| 103 |
|
|
complicated the matter. |
| 104 |
|
|
|
| 105 |
elmex |
1.11 |
=head1 RELEASE NOTES |
| 106 |
|
|
|
| 107 |
|
|
Here are some notes to the releases (release of this version is at top): |
| 108 |
|
|
|
| 109 |
|
|
=head2 Version |
| 110 |
|
|
|
| 111 |
|
|
=over 4 |
| 112 |
|
|
|
| 113 |
|
|
=item 0.01 |
| 114 |
|
|
|
| 115 |
|
|
This release has beta status. The code is already used daily in my client |
| 116 |
|
|
and I keep looking out for bugs. If you find undocumented, missing or faulty |
| 117 |
|
|
code/methods please drop me a mail! See also L<BUGS> below. |
| 118 |
|
|
|
| 119 |
elmex |
1.14 |
Potential edges when using this module: sparely documented methods, missing |
| 120 |
elmex |
1.11 |
functionality and generally bugs bugs and bugs. Even thought this module is in |
| 121 |
|
|
daily usage there are still lots of cases I might have missed. |
| 122 |
|
|
|
| 123 |
|
|
For the next release I'm planning to provide more examples in the documentation |
| 124 |
elmex |
1.14 |
and/or samples/ directory, along with bugfixes and enhancements along with some |
| 125 |
elmex |
1.11 |
todo items killed from the TODO file. |
| 126 |
|
|
|
| 127 |
|
|
=back |
| 128 |
|
|
|
| 129 |
|
|
=head2 TODO |
| 130 |
|
|
|
| 131 |
|
|
There are still lots of items on the TODO list (see also the TODO file |
| 132 |
elmex |
1.14 |
in the distribution of Net::XMPP2). |
| 133 |
elmex |
1.11 |
|
| 134 |
elmex |
1.2 |
=head1 Why (yet) another XMPP module? |
| 135 |
|
|
|
| 136 |
|
|
The main outstanding feature of this module in comparsion to the other XMPP |
| 137 |
|
|
(aka Jabber) modules out there is the support for L<AnyEvent>. L<AnyEvent> |
| 138 |
|
|
permits you to use this module together with other I/O event based programs and |
| 139 |
|
|
libraries (ie. L<Gtk2> or L<Event>). |
| 140 |
|
|
|
| 141 |
|
|
The other modules could often only be integrated in those applications or librarys |
| 142 |
elmex |
1.11 |
by using threads. I decided to write this module because I think CPAN lacks |
| 143 |
elmex |
1.4 |
an event based XMPP module. Threads are unfortunately not an alternative in Perl |
| 144 |
|
|
at the moment due the limited threading functionality they provide and the global |
| 145 |
|
|
speed hit. I also think that a simple event based I/O framework might be a bit easier |
| 146 |
|
|
to handle than threads. |
| 147 |
elmex |
1.2 |
|
| 148 |
|
|
Another thing was that I didn't like the APIs of the other modules. In L<Net::XMPP2> |
| 149 |
elmex |
1.9 |
I try to provide low level modules for speaking XMPP as defined in RFC 3920 and RFC 3921 |
| 150 |
|
|
(see also L<Net::XMPP2::Connection> and L<Net::XMPP2::IM::Connection>). But I also |
| 151 |
elmex |
1.11 |
try to provide a high level API for easier usage for instant messaging tasks |
| 152 |
|
|
and clients (eg. L<Net::XMPP2::IM::Client>). |
| 153 |
elmex |
1.2 |
|
| 154 |
|
|
=head1 A note about TLS |
| 155 |
|
|
|
| 156 |
|
|
This module also supports TLS, as the specification of XMPP requires an |
| 157 |
elmex |
1.7 |
implementation to support TLS. |
| 158 |
elmex |
1.2 |
|
| 159 |
|
|
There are maybe still some bugs in the handling of TLS in L<Net::XMPP2::Connection>. |
| 160 |
elmex |
1.7 |
So keep an eye on TLS with this module. If you encounter any problems it would be |
| 161 |
|
|
very helpful if you could debug them or at least send me a detailed report on how |
| 162 |
|
|
to reproduce the problem. |
| 163 |
|
|
|
| 164 |
|
|
(As I use this module myself I don't expect TLS to be completly broken, but it |
| 165 |
|
|
might break under different circumstances than I have here. Those |
| 166 |
|
|
circumstances might be a different load of data pumped through the TLS |
| 167 |
|
|
connection.) |
| 168 |
elmex |
1.1 |
|
| 169 |
elmex |
1.2 |
I mainly expect problems where aviable data isn't properly read from the socket |
| 170 |
|
|
or written to it. You might want to take a look at the C<debug_send> and C<debug_recv> |
| 171 |
|
|
events in L<Net::XMPP2::Connection>. |
| 172 |
elmex |
1.1 |
|
| 173 |
elmex |
1.4 |
=head1 Supportet extensions |
| 174 |
elmex |
1.3 |
|
| 175 |
elmex |
1.10 |
See L<Net::XMPP2::Ext> for a list. |
| 176 |
elmex |
1.3 |
|
| 177 |
elmex |
1.1 |
=head1 AUTHOR |
| 178 |
|
|
|
| 179 |
elmex |
1.11 |
Robin Redeker, C<< <elmex at ta-sa.org> >>, JID: C<< <elmex at jabber.org> >> |
| 180 |
elmex |
1.1 |
|
| 181 |
|
|
=head1 BUGS |
| 182 |
|
|
|
| 183 |
elmex |
1.12 |
Please note that I'm currently (July 2007) the only developer on this project |
| 184 |
|
|
and I'm very busy with my studies in Computer Science in Summer 2007. If you |
| 185 |
|
|
want to ease my workload or want timely releases please send me patches instead |
| 186 |
|
|
only bug reports or feature requests. I won't forget the reports or requests if |
| 187 |
|
|
you can't or didn't send patches but it can take a long time until I get enough |
| 188 |
|
|
time to fix/implement them. |
| 189 |
|
|
|
| 190 |
|
|
Also try to be as precise as possible with bugreports and best, if you can't |
| 191 |
|
|
send a patch, would be if you find out which code doesn't work and tell me why. |
| 192 |
|
|
|
| 193 |
elmex |
1.1 |
Please report any bugs or feature requests to |
| 194 |
|
|
C<bug-net-xmpp2 at rt.cpan.org>, or through the web interface at |
| 195 |
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-XMPP2>. |
| 196 |
|
|
I will be notified, and then you'll automatically be notified of progress on |
| 197 |
|
|
your bug as I make changes. |
| 198 |
|
|
|
| 199 |
|
|
=head1 SUPPORT |
| 200 |
|
|
|
| 201 |
|
|
You can find documentation for this module with the perldoc command. |
| 202 |
|
|
|
| 203 |
|
|
perldoc Net::XMPP2 |
| 204 |
|
|
|
| 205 |
|
|
You can also look for information at: |
| 206 |
|
|
|
| 207 |
|
|
=over 4 |
| 208 |
|
|
|
| 209 |
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
| 210 |
|
|
|
| 211 |
|
|
L<http://annocpan.org/dist/Net-XMPP2> |
| 212 |
|
|
|
| 213 |
|
|
=item * CPAN Ratings |
| 214 |
|
|
|
| 215 |
|
|
L<http://cpanratings.perl.org/d/Net-XMPP2> |
| 216 |
|
|
|
| 217 |
|
|
=item * RT: CPAN's request tracker |
| 218 |
|
|
|
| 219 |
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-XMPP2> |
| 220 |
|
|
|
| 221 |
|
|
=item * Search CPAN |
| 222 |
|
|
|
| 223 |
|
|
L<http://search.cpan.org/dist/Net-XMPP2> |
| 224 |
|
|
|
| 225 |
|
|
=back |
| 226 |
|
|
|
| 227 |
|
|
=head1 ACKNOWLEDGEMENTS |
| 228 |
|
|
|
| 229 |
elmex |
1.13 |
Thanks to the XSF for the effords of messing around with XMPP. |
| 230 |
|
|
|
| 231 |
|
|
And thanks to all people who had to listen to my desperate curses about the |
| 232 |
|
|
brokeness/braindeadness of XMPP, without you I would've never brought this |
| 233 |
|
|
module to a usable state. |
| 234 |
elmex |
1.12 |
|
| 235 |
elmex |
1.1 |
=head1 COPYRIGHT & LICENSE |
| 236 |
|
|
|
| 237 |
|
|
Copyright 2007 Robin Redeker, all rights reserved. |
| 238 |
|
|
|
| 239 |
|
|
This program is free software; you can redistribute it and/or modify it |
| 240 |
|
|
under the same terms as Perl itself. |
| 241 |
|
|
|
| 242 |
|
|
=cut |
| 243 |
|
|
|
| 244 |
|
|
1; # End of Net::XMPP2 |