1 | NAME |
1 | NAME |
2 | Net::XMPP2 - An implementation of the XMPP Protocol |
2 | Net::XMPP2 - An implementation of the XMPP Protocol |
3 | |
3 | |
4 | VERSION |
4 | VERSION |
5 | Version 0.01 |
5 | Version 0.02 |
6 | |
6 | |
7 | SYNOPSIS |
7 | SYNOPSIS |
|
|
8 | use Net::XMPP2::Connection; |
|
|
9 | |
|
|
10 | or: |
|
|
11 | |
|
|
12 | use Net::XMPP2::IM::Connection; |
|
|
13 | |
|
|
14 | or: |
|
|
15 | |
8 | use Net::XMPP2; |
16 | use Net::XMPP2::Client; |
9 | ... |
|
|
10 | |
17 | |
11 | FUNCTIONS |
18 | DESCRIPTION |
12 | init |
19 | This is the head module of the Net::XMPP2 XMPP client protocol (as |
|
|
20 | described in RFC 3920 and RFC 3921) framework. |
|
|
21 | |
|
|
22 | Net::XMPP2::Connection is a RFC 3920 conformant "XML" stream |
|
|
23 | implementation for clients, which handles TCP connect up to the resource |
|
|
24 | binding. And provides low level access to the XML nodes on the XML |
|
|
25 | stream along with some high level methods to send the predefined XML |
|
|
26 | stanzas. |
|
|
27 | |
|
|
28 | Net::XMPP2::IM::Connection is a more high level module, which is derived |
|
|
29 | from Net::XMPP2::Connection. It handles all the instant messaging client |
|
|
30 | functionality described in RFC 3921. |
|
|
31 | |
|
|
32 | Net::XMPP2::Client is a multi account client class. It manages |
|
|
33 | connections to multiple XMPP accounts and tries to offer a nice high |
|
|
34 | level interface to XMPP communication. |
|
|
35 | |
|
|
36 | For a list of "Supported extensions" see below. |
|
|
37 | |
|
|
38 | There are also other modules in this distribution, for example: |
|
|
39 | Net::XMPP2::Util, Net::XMPP2::Writer, Net::XMPP2::Parser and those I |
|
|
40 | forgot :-) Those modules might be helpful and/or required if you want to |
|
|
41 | use this framework for XMPP. |
|
|
42 | |
|
|
43 | See also Net::XMPP2::Writer for a discussion about the brokeness of XML |
|
|
44 | in the XMPP specification. |
|
|
45 | |
|
|
46 | If you have any questions or seek for help look below under "SUPPORT". |
|
|
47 | |
|
|
48 | REQUIREMENTS |
|
|
49 | One of the major drawbacks I see for Net::XMPP2 is the long list of |
|
|
50 | required modules to make it work. |
|
|
51 | |
|
|
52 | AnyEvent |
|
|
53 | For the I/O events and timers. |
|
|
54 | |
|
|
55 | XML::Writer |
|
|
56 | For writing "XML". |
|
|
57 | |
|
|
58 | XML::Parser::Expat |
|
|
59 | For parsing partial "XML" stuff. |
|
|
60 | |
|
|
61 | MIME::Base64 |
|
|
62 | For SASL authentication |
|
|
63 | |
|
|
64 | Authen::SASL |
|
|
65 | For SASL authentication |
|
|
66 | |
|
|
67 | Net::LibIDN |
|
|
68 | For stringprep profiles to handle JIDs. |
|
|
69 | |
|
|
70 | Net::SSLeay |
|
|
71 | For SSL connections. |
|
|
72 | |
|
|
73 | Net::DNS |
|
|
74 | For SRV RR lookups. |
|
|
75 | |
|
|
76 | And yes, all these are essential for XMPP communication. Even though |
|
|
77 | 'instant messaging' and 'presence' is a quite simple problem XMPP |
|
|
78 | somehow was successful at making the task complicated enough to keep me |
|
|
79 | busy for a long time. But all of that time wasn't only for the |
|
|
80 | technology required to get it started, mostly it was for all the quirks, |
|
|
81 | hacks and badly applied "XML" in the protocol which complicated the |
|
|
82 | matter. |
|
|
83 | |
|
|
84 | RELEASE NOTES |
|
|
85 | Here are some notes to the releases (release of this version is at top): |
|
|
86 | |
|
|
87 | Version |
|
|
88 | * 0.02 |
|
|
89 | This release adds lots of small improvements on the API (mostly new |
|
|
90 | events), and also some bugfixes here and there. The release also |
|
|
91 | comes with some new examples, you might want to take a look at the |
|
|
92 | "EXAMPLES" section. |
|
|
93 | |
|
|
94 | As a highlight I also present the implementation of XEP-0004 (Data |
|
|
95 | Forms), see also Net::XMPP2::Ext for a description. |
|
|
96 | |
|
|
97 | I also added some convenience functions to Net::XMPP2::Util, for |
|
|
98 | example "simxml" which simplifies the generation of XMPP-like "XML". |
|
|
99 | |
|
|
100 | * 0.01 |
|
|
101 | This release has beta status. The code is already used daily in my |
|
|
102 | client and I keep looking out for bugs. If you find undocumented, |
|
|
103 | missing or faulty code/methods please drop me a mail! See also |
|
|
104 | "BUGS" below. |
|
|
105 | |
|
|
106 | Potential edges when using this module: sparely documented methods, |
|
|
107 | missing functionality and generally bugs bugs and bugs. Even though |
|
|
108 | this module is in daily usage there are still lots of cases I might |
|
|
109 | have missed. |
|
|
110 | |
|
|
111 | For the next release I'm planning to provide more examples in the |
|
|
112 | documentation and/or samples/ directory, along with bugfixes and |
|
|
113 | enhancements along with some todo items killed from the TODO file. |
|
|
114 | |
|
|
115 | TODO |
|
|
116 | There are still lots of items on the TODO list (see also the TODO file |
|
|
117 | in the distribution of Net::XMPP2). |
|
|
118 | |
|
|
119 | Sadly this module still misses some decent DOM implementation. Do you |
|
|
120 | know some decent DOM Level 2 implementation for Perl? (I considered |
|
|
121 | switchting to XML::LibXML but I somehow have more trust in the "expat" |
|
|
122 | XML parser, maybe someone wants to implement XML::LibXML based parsing |
|
|
123 | for me (and of course a DOM interface for Net::XMPP2::Node?) |
|
|
124 | |
|
|
125 | Why (yet) another XMPP module? |
|
|
126 | The main outstanding feature of this module in comparison to the other |
|
|
127 | XMPP (aka Jabber) modules out there is the support for AnyEvent. |
|
|
128 | AnyEvent permits you to use this module together with other I/O event |
|
|
129 | based programs and libraries (ie. Gtk2 or Event). |
|
|
130 | |
|
|
131 | The other modules could often only be integrated in those applications |
|
|
132 | or libraries by using threads. I decided to write this module because I |
|
|
133 | think CPAN lacks an event based XMPP module. Threads are unfortunately |
|
|
134 | not an alternative in Perl at the moment due the limited threading |
|
|
135 | functionality they provide and the global speed hit. I also think that a |
|
|
136 | simple event based I/O framework might be a bit easier to handle than |
|
|
137 | threads. |
|
|
138 | |
|
|
139 | Another thing was that I didn't like the APIs of the other modules. In |
|
|
140 | Net::XMPP2 I try to provide low level modules for speaking XMPP as |
|
|
141 | defined in RFC 3920 and RFC 3921 (see also Net::XMPP2::Connection and |
|
|
142 | Net::XMPP2::IM::Connection). But I also try to provide a high level API |
|
|
143 | for easier usage for instant messaging tasks and clients (eg. |
|
|
144 | Net::XMPP2::Client). |
|
|
145 | |
|
|
146 | A note about TLS |
|
|
147 | This module also supports TLS, as the specification of XMPP requires an |
|
|
148 | implementation to support TLS. |
|
|
149 | |
|
|
150 | Maybe there are still some bugs in the handling of TLS in |
|
|
151 | Net::XMPP2::Connection. So keep an eye on TLS with this module. If you |
|
|
152 | encounter any problems it would be very helpful if you could debug them |
|
|
153 | or at least send me a detailed report on how to reproduce the problem. |
|
|
154 | |
|
|
155 | (As I use this module myself I don't expect TLS to be completly broken, |
|
|
156 | but it might break under different circumstances than I have here. Those |
|
|
157 | circumstances might be a different load of data pumped through the TLS |
|
|
158 | connection.) |
|
|
159 | |
|
|
160 | I mainly expect problems where available data isn't properly read from |
|
|
161 | the socket or written to it. You might want to take a look at the |
|
|
162 | "debug_send" and "debug_recv" events in Net::XMPP2::Connection. |
|
|
163 | |
|
|
164 | Supported extensions |
|
|
165 | See Net::XMPP2::Ext for a list. |
|
|
166 | |
|
|
167 | EXAMPLES |
|
|
168 | Following examples are included in this distribution: |
|
|
169 | |
|
|
170 | samples/simple_example_1 |
|
|
171 | This example script just connects to a server and sends a message |
|
|
172 | and also displays incoming messages on stdout. |
|
|
173 | |
|
|
174 | samples/devcl/devcl |
|
|
175 | This is a more advanced 'example'. It requires you to have Gtk2 |
|
|
176 | installed. It's mostly used by the author to implement |
|
|
177 | proof-of-concepts. Currently you start the client like this: |
|
|
178 | |
|
|
179 | ../Net-XMPP2/samples/devcl/# perl ./devcl <jid> <password> |
|
|
180 | |
|
|
181 | The client's main window displays a protocol dump and there is |
|
|
182 | currently a service discovery browser implemented. |
|
|
183 | |
|
|
184 | This might be a valuable source if you look for more real-world |
|
|
185 | applications of Net::XMPP2. |
|
|
186 | |
|
|
187 | samples/conference_lister |
|
|
188 | See below. |
|
|
189 | |
|
|
190 | samples/room_lister |
|
|
191 | See below. |
|
|
192 | |
|
|
193 | samples/room_lister_stat |
|
|
194 | These three scripts implements a global room scan. |
|
|
195 | "conference_lister" takes a list of servers (the file is called |
|
|
196 | "servers.xml" which has the same format as the xml file at |
|
|
197 | <http://www.jabber.org/servers.xml>). It then scans all servers for |
|
|
198 | chat room services and lists them into a file "conferences.stor", |
|
|
199 | which is a Storable dump. |
|
|
200 | |
|
|
201 | "room_lister" then reads that file and queries all services for |
|
|
202 | rooms, and then all rooms for their occupants. The output file is |
|
|
203 | "room_data.stor", also a Storable dump, which in turn can be read |
|
|
204 | with "room_lister_stat", which transform the data structures into |
|
|
205 | something human readable. |
|
|
206 | |
|
|
207 | These scripts are a bit hacky and quite complicated, but maybe it's |
|
|
208 | of any value for someone. You might note "EVQ.pm" in samples which |
|
|
209 | is a module that handles request-throttling (You don't want to flood |
|
|
210 | the server and risk getting the admins attention :). |
|
|
211 | |
|
|
212 | For others, which the author might forgot or didn't want to list here |
|
|
213 | see the "samples/" directory. |
|
|
214 | |
|
|
215 | More examples will be included in later releases, please feel free to |
|
|
216 | ask the "AUTHOR" if you have any questions about the API. There is also |
|
|
217 | an IRC channel, see "SUPPORT". |
|
|
218 | |
13 | AUTHOR |
219 | AUTHOR |
14 | Robin Redeker, "<elmex at ta-sa.org>" |
220 | Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>" |
15 | |
221 | |
16 | BUGS |
222 | BUGS |
|
|
223 | Please note that I'm currently (July 2007) the only developer on this |
|
|
224 | project and I'm very busy with my studies in Computer Science in Summer |
|
|
225 | 2007. If you want to ease my workload or want timely releases, please |
|
|
226 | send me patches instead of bug reports or feature requests. I won't |
|
|
227 | forget the reports or requests if you can't or didn't send patches, but |
|
|
228 | it can take a long time until I get enough time to fix/implement them. |
|
|
229 | |
|
|
230 | Also try to be as precise as possible with bug reports, if you can't |
|
|
231 | send a patch, it would be best if you find out which code doesn't work |
|
|
232 | and tell me why. |
|
|
233 | |
17 | Please report any bugs or feature requests to "bug-net-xmpp2 at |
234 | Please report any bugs or feature requests to "bug-net-xmpp2 at |
18 | rt.cpan.org", or through the web interface at |
235 | rt.cpan.org", or through the web interface at |
19 | <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-XMPP2>. I will be |
236 | <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-XMPP2>. I will be |
20 | notified, and then you'll automatically be notified of progress on your |
237 | notified and then you'll automatically be notified of progress on your |
21 | bug as I make changes. |
238 | bug as I make changes. |
22 | |
239 | |
23 | SUPPORT |
240 | SUPPORT |
24 | You can find documentation for this module with the perldoc command. |
241 | You can find documentation for this module with the perldoc command. |
25 | |
242 | |
26 | perldoc Net::XMPP2 |
243 | perldoc Net::XMPP2 |
27 | |
244 | |
28 | You can also look for information at: |
245 | You can also look for information at: |
29 | |
246 | |
|
|
247 | * IRC: Net::XMPP2 IRC Channel |
|
|
248 | IRC Network: http://freenode.net/ |
|
|
249 | Server : chat.freenode.net |
|
|
250 | Channel : #net_xmpp2 |
|
|
251 | |
|
|
252 | Feel free to join and ask questions! |
|
|
253 | |
|
|
254 | * Net::XMPP2 Project Site |
|
|
255 | <http://www.ta-sa.org/> |
|
|
256 | |
30 | * AnnoCPAN: Annotated CPAN documentation |
257 | * AnnoCPAN: Annotated CPAN documentation |
31 | <http://annocpan.org/dist/Net-XMPP2> |
258 | <http://annocpan.org/dist/Net-XMPP2> |
32 | |
259 | |
33 | * CPAN Ratings |
260 | * CPAN Ratings |
34 | <http://cpanratings.perl.org/d/Net-XMPP2> |
261 | <http://cpanratings.perl.org/d/Net-XMPP2> |
… | |
… | |
38 | |
265 | |
39 | * Search CPAN |
266 | * Search CPAN |
40 | <http://search.cpan.org/dist/Net-XMPP2> |
267 | <http://search.cpan.org/dist/Net-XMPP2> |
41 | |
268 | |
42 | ACKNOWLEDGEMENTS |
269 | ACKNOWLEDGEMENTS |
|
|
270 | Thanks to the XSF for the development of an open instant messaging |
|
|
271 | protocol (even though it uses "XML"). |
|
|
272 | |
|
|
273 | And thanks to all people who had to listen to my desperate curses about |
|
|
274 | the brokenness/braindeadness of XMPP. Without you I would've never |
|
|
275 | brought this module to a usable state. |
|
|
276 | |
|
|
277 | Thanks to: |
|
|
278 | |
|
|
279 | * Carlo von Loesch (aka lynX) <http://www.psyced.org/> |
|
|
280 | For pointing out some typos. |
|
|
281 | |
43 | COPYRIGHT & LICENSE |
282 | COPYRIGHT & LICENSE |
44 | Copyright 2007 Robin Redeker, all rights reserved. |
283 | Copyright 2007 Robin Redeker, all rights reserved. |
45 | |
284 | |
46 | This program is free software; you can redistribute it and/or modify it |
285 | This program is free software; you can redistribute it and/or modify it |
47 | under the same terms as Perl itself. |
286 | under the same terms as Perl itself. |