1AnyEvent::XMPP(3) User Contributed Perl Documentation AnyEvent::XMPP(3)
2
3
4
6 AnyEvent::XMPP - An implementation of the XMPP Protocol
7
9 Version 0.51
10
12 use AnyEvent::XMPP::Connection;
13
14 or:
15
16 use AnyEvent::XMPP::IM::Connection;
17
18 or:
19
20 use AnyEvent::XMPP::Client;
21
23 This is the head module of the AnyEvent::XMPP XMPP client protocol (as
24 described in RFC 3920 and RFC 3921) framework.
25
26 AnyEvent::XMPP::Connection is a RFC 3920 conforming "XML" stream
27 implementation for clients, which handles TCP connect up to the
28 resource binding. And provides low level access to the XML nodes on the
29 XML stream along with some high level methods to send the predefined
30 XML stanzas.
31
32 AnyEvent::XMPP::IM::Connection is a more high level module, which is
33 derived from AnyEvent::XMPP::Connection. It handles all the instant
34 messaging client functionality described in RFC 3921.
35
36 AnyEvent::XMPP::Client is a multi account client class. It manages
37 connections to multiple XMPP accounts and tries to offer a nice high
38 level interface to XMPP communication.
39
40 For a list of "Supported extensions" see below.
41
42 There are also other modules in this distribution, for example:
43 AnyEvent::XMPP::Util, AnyEvent::XMPP::Writer, AnyEvent::XMPP::Parser
44 and those I forgot :-) Those modules might be helpful and/or required
45 if you want to use this framework for XMPP.
46
47 See also AnyEvent::XMPP::Writer for a discussion about the brokenness
48 of XML in the XMPP specification.
49
50 If you have any questions or seek for help look below under "SUPPORT".
51
53 One of the major drawbacks I see for AnyEvent::XMPP is the long list of
54 required modules to make it work.
55
56 AnyEvent
57 For the I/O events, timers, TCP, TLS, DNS and I/O buffering.
58
59 Object::Event
60 The former AnyEvent::XMPP::Event module has been outsourced to the
61 Object::Event module to provide a more generic way for more other
62 modules to register and call event callbacks.
63
64 XML::Writer
65 For writing "XML".
66
67 XML::Parser::Expat
68 For parsing partial "XML" stuff.
69
70 MIME::Base64
71 For SASL authentication
72
73 Authen::SASL
74 For SASL authentication
75
76 Net::LibIDN
77 For stringprep profiles to handle JIDs.
78
79 Digest::SHA1
80 For component authentication and old-style authentication.
81
82 And yes, all these are essential for XMPP communication. Even though
83 'instant messaging' and 'presence' is a quite simple problem XMPP
84 somehow was successful at making the task complicated enough to keep me
85 busy for a long time. But all of that time wasn't only for the
86 technology required to get it started, mostly it was for all the
87 quirks, hacks and badly applied "XML" in the protocol which complicated
88 the matter.
89
91 Here are some notes to the last releases (release of this version is at
92 top):
93
94 Version
95 · 0.51
96
97 Maintenance release. Added a patch which fixes Object::Event
98 compatibility and another fix w.r.t. memory leak in the parser. And
99 added the original node to AnyEvent::XMPP::IM::Message (thanks go
100 to mons@cpan.org).
101
102 NOTE: Version 0.6 of AnyEvent::XMPP will be API incompatible! If
103 you are already eager to try the new version out contact me!
104
105 · 0.5
106
107 Maintenance release. Added a patch from Marcus Dubois for
108 Ext::Pubsub. Also fixed some memleaks in AnyEvent::XMPP::Parser.
109
110 Also wanted to note that the next version of AnyEvent::XMPP will
111 have an incompatible API. If you are eager to try out the new
112 complete rewrite of AnyEvent::XMPP contact me.
113
114 · 0.4
115
116 Minor fixes and feature enhancements: Added old_style_ssl option
117 for direct port 5223 SSL connections. Providing 'get_own_contact'
118 for keeping track of own resources.
119
120 The AnyEvent::XMPP::Ext::MUC extension was rewritten and provides a
121 more sane API now.
122
123 For details consult the Changes file in the distribution.
124
125 · 0.3
126
127 Fixed some small bugs and improved documentation a bit, especially
128 w.r.t. parameter passing of host and ports.
129
130 · 0.2
131
132 Renamed module from Net::XMPP2 to AnyEvent::XMPP. Net::XMPP2 is
133 herby deprecated!
134
135 Rewrote the low-level socket stuff to use AnyEvent::Socket and
136 AnyEvent::Handle. Removed blocking write functionality, which
137 can't be supported that easily with AnyEvent::Handle (however, if
138 you want to wait until the send-buffer is empty you best use the
139 "send_buffer_empty" event of AnyEvent::XMPP::Connection).
140
141 For more details consult the Changes file of the AnyEvent::XMPP
142 distribution.
143
144 · older
145
146 For older release notes please have a look at the Changes file or
147 CPAN.
148
149 TODO
150 There are still lots of items on the TODO list (see also the TODO file
151 in the distribution of AnyEvent::XMPP).
152
154 If you are a developer and want to test either a server or maybe just
155 whether this module passes some basic tests you might want to run the
156 developer test suite.
157
158 This test suite is not enabled by default because it requires some
159 human interaction to set it up, please see AnyEvent::XMPP::TestClient
160 for hints about the setup procedure for the test suite.
161
162 I wrote the test suite mostly because I wanted to make sure I didn't
163 break something essential before a release. The tests don't cover
164 everything and I don't plan to write a test for every single function
165 in the API, that would slow down development considerably for me. But I
166 hope that some grave show stopper bugs in releases are prevented with
167 this test suite.
168
169 The tests are also useful if you want to test a server implementation.
170 But there are maybe of course conformance issues with AnyEvent::XMPP
171 itself, so if you find something where AnyEvent::XMPP doesn't conform
172 to the XMPP RFCs or XEPs consult the BUGS section below.
173
174 If you find a server that doesn't handle something correctly but you
175 need to interact with it you are free to implement workarounds and send
176 me a patch, or even ask me whether I might want to look into the issue
177 (I can't guarantee anything here, but I want this module to be as
178 interoperable as possible. But if the implementation of a workaround
179 for some non-conformant software will complicate the code too much I'm
180 probably not going to implement it.).
181
182 Of course, if you find a bug in some server implementation don't forget
183 to file a bugreport to them, one hack less in AnyEvent::XMPP means more
184 time for bug fixing and improvements and new features.
185
187 The main outstanding feature of this module in comparison to the other
188 XMPP (aka Jabber) modules out there is the support for AnyEvent.
189 AnyEvent permits you to use this module together with other I/O event
190 based programs and libraries (ie. Gtk2 or Event).
191
192 The other modules could often only be integrated in those applications
193 or libraries by using threads. I decided to write this module because I
194 think CPAN lacks an event based XMPP module. Threads are unfortunately
195 not an alternative in Perl at the moment due the limited threading
196 functionality they provide and the global speed hit. I also think that
197 a simple event based I/O framework might be a bit easier to handle than
198 threads.
199
200 Another thing was that I didn't like the APIs of the other modules. In
201 AnyEvent::XMPP I try to provide low level modules for speaking XMPP as
202 defined in RFC 3920 and RFC 3921 (see also AnyEvent::XMPP::Connection
203 and AnyEvent::XMPP::IM::Connection). But I also try to provide a high
204 level API for easier usage for instant messaging tasks and clients (eg.
205 AnyEvent::XMPP::Client).
206
208 See AnyEvent::XMPP::Ext for a list.
209
211 Following examples are included in this distribution:
212
213 samples/simple_example_1
214 This example script just connects to a server and sends a message
215 and also displays incoming messages on stdout.
216
217 samples/conference_lister
218 See below.
219
220 samples/room_lister
221 See below.
222
223 samples/room_lister_stat
224 These three scripts implements a global room scan.
225 "conference_lister" takes a list of servers (the file is called
226 "servers.xml" which has the same format as the xml file at
227 <http://www.jabber.org/servers.xml>). It then scans all servers for
228 chat room services and lists them into a file "conferences.stor",
229 which is a Storable dump.
230
231 "room_lister" then reads that file and queries all services for
232 rooms, and then all rooms for their occupants. The output file is
233 "room_data.stor", also a Storable dump, which in turn can be read
234 with "room_lister_stat", which transform the data structures into
235 something human readable.
236
237 These scripts are a bit hacky and quite complicated, but maybe it's
238 of any value for someone. You might note "EVQ.pm" in samples which
239 is a module that handles request-throttling (You don't want to
240 flood the server and risk getting the admins attention :).
241
242 samples/simple_component
243 This is a (basic) skeleton for a jabber component.
244
245 samples/simple_oob_retriever
246 This is a simple out of band file transfer receiver bot. It uses
247 "curl" to fetch the files and also has the sample functionality of
248 sending a file url for someone who sends the bot a 'send
249 <filename>' message.
250
251 samples/simple_register_example
252 This is a example script which allows you to register, unregister
253 and change your password for accounts. Execute it without arguments
254 for more details.
255
256 samples/disco_info
257 This is a small example tool that allows you to fetch the software
258 version, disco info and disco items information about a JID.
259
260 samples/talkbot
261 This is a simple bot that will read lines from a file and recite
262 them when you send it a message. It will also automatically allow
263 you to subscribe to it. Start it without commandline arguments to
264 be informed about the usage.
265
266 samples/retrieve_roster
267 This is a simple example script that will retrieve the roster for
268 an account and print it to stdout. You start it like this:
269
270 samples/# ./retrieve_roster <jid> <password>
271
272 samples/display_avatar
273 This is just a small example which should display the avatar of the
274 account you connect to. It can be used like this:
275
276 samples/# ./display_avatar <jid> <password>
277
278 For others, which the author might forgot or didn't want to list here
279 see the "samples/" directory.
280
281 More examples will be included in later releases, please feel free to
282 ask the "AUTHOR" if you have any questions about the API. There is also
283 an IRC channel, see "SUPPORT".
284
286 Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
287
289 Please note that I'm currently (July 2007) the only developer on this
290 project and I'm very busy with my studies in Computer Science. If you
291 want to ease my workload or want timely releases, please send me
292 patches instead of bug reports or feature requests. I won't forget the
293 reports or requests if you can't or didn't send patches, but I can't
294 gurantee immediate response. But I will of course try to fix/implement
295 them as soon as possible!
296
297 Also try to be as precise as possible with bug reports, if you can't
298 send a patch, it would be best if you find out which code doesn't work
299 and tell me why.
300
301 Please report any bugs or feature requests to "bug-net-xmpp2 at
302 rt.cpan.org", or through the web interface at
303 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-XMPP
304 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-XMPP>. I will
305 be notified and then you'll automatically be notified of progress on
306 your bug as I make changes.
307
309 You can find documentation for this module with the perldoc command.
310
311 perldoc AnyEvent::XMPP
312
313 You can also look for information at:
314
315 · IRC: AnyEvent::XMPP IRC Channel
316
317 IRC Network: http://freenode.net/
318 Server : chat.freenode.net
319 Channel : #ae_xmpp
320
321 Feel free to join and ask questions!
322
323 · AnyEvent::XMPP Project Site
324
325 http://www.ta-sa.org/net_xmpp2 <http://www.ta-sa.org/net_xmpp2>
326
327 · AnnoCPAN: Annotated CPAN documentation
328
329 http://annocpan.org/dist/AnyEvent-XMPP
330 <http://annocpan.org/dist/AnyEvent-XMPP>
331
332 · CPAN Ratings
333
334 http://cpanratings.perl.org/d/AnyEvent-XMPP
335 <http://cpanratings.perl.org/d/AnyEvent-XMPP>
336
337 · RT: CPAN's request tracker
338
339 http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-XMPP
340 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-XMPP>
341
342 · Search CPAN
343
344 http://search.cpan.org/dist/AnyEvent-XMPP
345 <http://search.cpan.org/dist/AnyEvent-XMPP>
346
348 Thanks to the XSF for the development of an open instant messaging
349 protocol (even though it uses "XML").
350
351 And thanks to all people who had to listen to my desperate curses about
352 the brokenness/braindeadness of XMPP. Without you I would've never
353 brought this module to a usable state.
354
355 Thanks to:
356
357 · J. Cameijo Cerdeira
358
359 For pointing out a serious bug in "split_jid" in
360 AnyEvent::XMPP::Util and suggesting to add a timeout argument to
361 the "connect" method of AnyEvent::XMPP::SimpleConnection.
362
363 · Carlo von Loesch (aka lynX) <http://www.psyced.org/>
364
365 For pointing out some typos.
366
367 · All other people ..
368
369 ... I mentioned in the CONTRIBUTORS file which comes with the
370 AnyEvent::XMPP distribution.
371
373 Copyright 2007, 2008 Robin Redeker, all rights reserved.
374
375 This program is free software; you can redistribute it and/or modify it
376 under the same terms as Perl itself.
377
378
379
380perl v5.12.0 2009-08-14 AnyEvent::XMPP(3)