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.55
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::SHA
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.55
96
97 Bugfixes, see Changes file.
98
99 • 0.54
100
101 Add AnyEvent::XMPP::Ext::Receipts, small bugfixes, see Changes
102 file.
103
104 • 0.53
105
106 Maintenance release. Patches for various small issues, see Changes
107 file.
108
109 • 0.52
110
111 Maintenance release.
112
113 • 0.51
114
115 Maintenance release. Added a patch which fixes Object::Event
116 compatibility and another fix w.r.t. memory leak in the parser. And
117 added the original node to AnyEvent::XMPP::IM::Message (thanks go
118 to mons@cpan.org).
119
120 NOTE: Version 0.6 of AnyEvent::XMPP will be API incompatible! If
121 you are already eager to try the new version out contact me!
122
123 • 0.5
124
125 Maintenance release. Added a patch from Marcus Dubois for
126 Ext::Pubsub. Also fixed some memleaks in AnyEvent::XMPP::Parser.
127
128 Also wanted to note that the next version of AnyEvent::XMPP will
129 have an incompatible API. If you are eager to try out the new
130 complete rewrite of AnyEvent::XMPP contact me.
131
132 • 0.4
133
134 Minor fixes and feature enhancements: Added old_style_ssl option
135 for direct port 5223 SSL connections. Providing 'get_own_contact'
136 for keeping track of own resources.
137
138 The AnyEvent::XMPP::Ext::MUC extension was rewritten and provides a
139 more sane API now.
140
141 For details consult the Changes file in the distribution.
142
143 • 0.3
144
145 Fixed some small bugs and improved documentation a bit, especially
146 w.r.t. parameter passing of host and ports.
147
148 • 0.2
149
150 Renamed module from Net::XMPP2 to AnyEvent::XMPP. Net::XMPP2 is
151 herby deprecated!
152
153 Rewrote the low-level socket stuff to use AnyEvent::Socket and
154 AnyEvent::Handle. Removed blocking write functionality, which
155 can't be supported that easily with AnyEvent::Handle (however, if
156 you want to wait until the send-buffer is empty you best use the
157 "send_buffer_empty" event of AnyEvent::XMPP::Connection).
158
159 For more details consult the Changes file of the AnyEvent::XMPP
160 distribution.
161
162 • older
163
164 For older release notes please have a look at the Changes file or
165 CPAN.
166
167 TODO
168 There are still lots of items on the TODO list (see also the TODO file
169 in the distribution of AnyEvent::XMPP).
170
172 If you are a developer and want to test either a server or maybe just
173 whether this module passes some basic tests you might want to run the
174 developer test suite.
175
176 This test suite is not enabled by default because it requires some
177 human interaction to set it up, please see AnyEvent::XMPP::TestClient
178 for hints about the setup procedure for the test suite.
179
180 I wrote the test suite mostly because I wanted to make sure I didn't
181 break something essential before a release. The tests don't cover
182 everything and I don't plan to write a test for every single function
183 in the API, that would slow down development considerably for me. But I
184 hope that some grave show stopper bugs in releases are prevented with
185 this test suite.
186
187 The tests are also useful if you want to test a server implementation.
188 But there are maybe of course conformance issues with AnyEvent::XMPP
189 itself, so if you find something where AnyEvent::XMPP doesn't conform
190 to the XMPP RFCs or XEPs consult the BUGS section below.
191
192 If you find a server that doesn't handle something correctly but you
193 need to interact with it you are free to implement workarounds and send
194 me a patch, or even ask me whether I might want to look into the issue
195 (I can't guarantee anything here, but I want this module to be as
196 interoperable as possible. But if the implementation of a workaround
197 for some non-conformant software will complicate the code too much I'm
198 probably not going to implement it.).
199
200 Of course, if you find a bug in some server implementation don't forget
201 to file a bugreport to them, one hack less in AnyEvent::XMPP means more
202 time for bug fixing and improvements and new features.
203
205 The main outstanding feature of this module in comparison to the other
206 XMPP (aka Jabber) modules out there is the support for AnyEvent.
207 AnyEvent permits you to use this module together with other I/O event
208 based programs and libraries (ie. Gtk2 or Event).
209
210 The other modules could often only be integrated in those applications
211 or libraries by using threads. I decided to write this module because I
212 think CPAN lacks an event based XMPP module. Threads are unfortunately
213 not an alternative in Perl at the moment due the limited threading
214 functionality they provide and the global speed hit. I also think that
215 a simple event based I/O framework might be a bit easier to handle than
216 threads.
217
218 Another thing was that I didn't like the APIs of the other modules. In
219 AnyEvent::XMPP I try to provide low level modules for speaking XMPP as
220 defined in RFC 3920 and RFC 3921 (see also AnyEvent::XMPP::Connection
221 and AnyEvent::XMPP::IM::Connection). But I also try to provide a high
222 level API for easier usage for instant messaging tasks and clients (eg.
223 AnyEvent::XMPP::Client).
224
226 See AnyEvent::XMPP::Ext for a list.
227
229 Following examples are included in this distribution:
230
231 samples/simple_example_1
232 This example script just connects to a server and sends a message
233 and also displays incoming messages on stdout.
234
235 samples/conference_lister
236 See below.
237
238 samples/room_lister
239 See below.
240
241 samples/room_lister_stat
242 These three scripts implements a global room scan.
243 "conference_lister" takes a list of servers (the file is called
244 "servers.xml" which has the same format as the xml file at
245 <http://www.jabber.org/servers.xml>). It then scans all servers for
246 chat room services and lists them into a file "conferences.stor",
247 which is a Storable dump.
248
249 "room_lister" then reads that file and queries all services for
250 rooms, and then all rooms for their occupants. The output file is
251 "room_data.stor", also a Storable dump, which in turn can be read
252 with "room_lister_stat", which transform the data structures into
253 something human readable.
254
255 These scripts are a bit hacky and quite complicated, but maybe it's
256 of any value for someone. You might note "EVQ.pm" in samples which
257 is a module that handles request-throttling (You don't want to
258 flood the server and risk getting the admins attention :).
259
260 samples/simple_component
261 This is a (basic) skeleton for a jabber component.
262
263 samples/simple_oob_retriever
264 This is a simple out of band file transfer receiver bot. It uses
265 "curl" to fetch the files and also has the sample functionality of
266 sending a file url for someone who sends the bot a 'send
267 <filename>' message.
268
269 samples/simple_register_example
270 This is a example script which allows you to register, unregister
271 and change your password for accounts. Execute it without arguments
272 for more details.
273
274 samples/disco_info
275 This is a small example tool that allows you to fetch the software
276 version, disco info and disco items information about a JID.
277
278 samples/talkbot
279 This is a simple bot that will read lines from a file and recite
280 them when you send it a message. It will also automatically allow
281 you to subscribe to it. Start it without commandline arguments to
282 be informed about the usage.
283
284 samples/retrieve_roster
285 This is a simple example script that will retrieve the roster for
286 an account and print it to stdout. You start it like this:
287
288 samples/# ./retrieve_roster <jid> <password>
289
290 samples/display_avatar
291 This is just a small example which should display the avatar of the
292 account you connect to. It can be used like this:
293
294 samples/# ./display_avatar <jid> <password>
295
296 For others, which the author might forgot or didn't want to list here
297 see the "samples/" directory.
298
299 More examples will be included in later releases, please feel free to
300 ask the "AUTHOR" if you have any questions about the API. There is also
301 an IRC channel, see "SUPPORT".
302
304 Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
305
307 Please note that I'm currently (July 2007) the only developer on this
308 project and I'm very busy with my studies in Computer Science. If you
309 want to ease my workload or want timely releases, please send me
310 patches instead of bug reports or feature requests. I won't forget the
311 reports or requests if you can't or didn't send patches, but I can't
312 gurantee immediate response. But I will of course try to fix/implement
313 them as soon as possible!
314
315 Also try to be as precise as possible with bug reports, if you can't
316 send a patch, it would be best if you find out which code doesn't work
317 and tell me why.
318
319 Please report any bugs or feature requests to "bug-net-xmpp2 at
320 rt.cpan.org", or through the web interface at
321 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-XMPP>. I will
322 be notified and then you'll automatically be notified of progress on
323 your bug as I make changes.
324
326 You can find documentation for this module with the perldoc command.
327
328 perldoc AnyEvent::XMPP
329
330 You can also look for information at:
331
332 • IRC: AnyEvent::XMPP IRC Channel
333
334 IRC Network: http://freenode.net/
335 Server : chat.freenode.net
336 Channel : #ae_xmpp
337
338 Feel free to join and ask questions!
339
340 • AnyEvent::XMPP Project Site
341
342 <http://www.ta-sa.org/net_xmpp2>
343
344 • AnnoCPAN: Annotated CPAN documentation
345
346 <http://annocpan.org/dist/AnyEvent-XMPP>
347
348 • CPAN Ratings
349
350 <http://cpanratings.perl.org/d/AnyEvent-XMPP>
351
352 • RT: CPAN's request tracker
353
354 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-XMPP>
355
356 • Search CPAN
357
358 <http://search.cpan.org/dist/AnyEvent-XMPP>
359
361 Thanks to the XSF for the development of an open instant messaging
362 protocol (even though it uses "XML").
363
364 And thanks to all people who had to listen to my desperate curses about
365 the brokenness/braindeadness of XMPP. Without you I would've never
366 brought this module to a usable state.
367
368 Thanks to:
369
370 • J. Cameijo Cerdeira
371
372 For pointing out a serious bug in "split_jid" in
373 AnyEvent::XMPP::Util and suggesting to add a timeout argument to
374 the "connect" method of AnyEvent::XMPP::SimpleConnection.
375
376 • Carlo von Loesch (aka lynX) <http://www.psyced.org/>
377
378 For pointing out some typos.
379
380 • All other people ..
381
382 ... I mentioned in the CONTRIBUTORS file which comes with the
383 AnyEvent::XMPP distribution.
384
386 Copyright 2007, 2008 Robin Redeker, all rights reserved.
387
388 This program is free software; you can redistribute it and/or modify it
389 under the same terms as Perl itself.
390
391
392
393perl v5.34.0 2021-07-22 AnyEvent::XMPP(3)