Merge remote-tracking branch 'sourceforge/master'
[emacs-jabber.git] / jabber.texi
blobd11533ae8b31819e558451165e75beffaa88de3f
1 \input texinfo          @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename jabber.info
4 @settitle jabber.el manual 0.8.0
5 @c %**end of header
7 @dircategory Emacs
8 @direntry
9 * jabber.el: (jabber).             Emacs Jabber client
10 @end direntry
12 @copying
13 This manual is for jabber.el, version 0.8.0.
15 Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Magnus Henoch, Tom Berger.
17 @quotation
18 Permission is granted to make and distribute verbatim copies or
19 modified versions of this manual, provided the copyright notice and
20 this permission notice are preserved on all copies.
21 @end quotation
22 @end copying
24 @titlepage
25 @title jabber.el
26 @subtitle instant messaging for Jabber
27 @author by Magnus Henoch and Tom Berger
29 @page
30 @vskip 0pt plus 1filll
31 @insertcopying
32 @end titlepage
34 @contents
36 @ifnottex
37 @node Top, Introduction, (dir), (dir)
38 @top jabber.el manual
40 @insertcopying
42 @end ifnottex
44 @menu
45 * Introduction::
46 * Basic operation::
47 * Groupchat::
48 * Composing messages::
49 * File transfer::
50 * Services::
51 * Personal information::
52 * Avatars::
53 * Time queries::
54 * Useful features::
55 * Message history::
56 * Typing notifications::
57 * Roster import and export::
58 * XMPP URIs::
59 * Customization::
60 * Hacking and extending::
61 * Protocol support::
62 * Concept index::
63 * Function index::
64 * Variable index::
65 @end menu
68 @node Introduction, Basic operation, Top, Top
69 @chapter Introduction
71 jabber.el is a Jabber client running under Emacs.  For more
72 information on the open-protocol instant messaging network Jabber,
73 please visit @uref{http://www.jabber.org}.
75 As a Jabber client, jabber.el is mostly just a face in the crowd,
76 except that it uses buffers where GUI clients have windows.  There is
77 a roster buffer, and to chat with someone you open a chat buffer, and
78 there are buffers for
79 interaction with servers and services.  Then again, jabber.el delivers
80 excellent console performance and customizable hooks (if you have
81 speech synthesizer software, hook it up to your presence alerts).
83 jabber.el does not yet support PGP encryption, sending and receiving
84 roster items, and various other things.
86 @menu
87 * Contacts::
88 @end menu
90 @node Contacts,  , , Introduction
91 @section Contacts
93 @itemize @bullet
94 @item
95 There is a web page at
96 @uref{http://emacs-jabber.sf.net/}.
98 @item
99 There is a Sourceforge
100 project page at @uref{http://sourceforge.net/projects/emacs-jabber},
101 with bug and patch trackers.
103 @item
104 There is a mailing list:
105 @email{emacs-jabber-general@@lists.sourceforge.net},
106 @uref{https://lists.sourceforge.net/lists/listinfo/emacs-jabber-general},
107 @uref{http://dir.gmane.org/gmane.emacs.jabber.general}
109 @item
110 There is a chat room, @code{jabber.el@@conference.jabber.se}.  If you
111 have successfully connected, you can join it by typing @kbd{M-x
112 jabber-muc-join} and entering the address.
114 @end itemize
116 @node Basic operation, Groupchat, Introduction, Top
117 @chapter Basic operation
119 This chapter is intended as an introduction to basic usage of
120 jabber.el.  If you have used Jabber before and are familiar with the
121 terminology, you might find it a bit too basic---in that case, just
122 skim it, making sure to pick up the commands mentioned.
124 I'll assume that you have already successfully installed jabber.el; if
125 not, consult the @file{README} file.  Also, make sure you have
126 @code{(require 'jabber)} or @code{(load "jabber-autoloads")} in your
127 @file{.emacs}.
129 There are a handful of global keybindings for common commands.  They
130 start with @kbd{C-x C-j}, and you can get a list of them by typing
131 @kbd{C-x C-j C-h}.
133 @menu
134 * Do you have a Jabber account?::
135 * Registering an account::
136 * Connecting::
137 * Chatting::
138 * Presence::
139 * Presence subscription::
140 * Roster buffer::
141 @end menu
143 @node Do you have a Jabber account?, Registering an account, , Basic operation
144 @section Do you have a Jabber account?
146 Jabber has become rather popular as an instant messaging technology.
147 Several sites use it, but often not under the names ``Jabber'' or
148 ``XMPP''.  Examples:
150 @itemize @bullet
151 @item
152 Google Talk uses Jabber.  If you have a Gmail address, you can use it as
153 a Jabber ID.  @xref{Account settings}, for Google-specific configuration.
155 @item
156 LJ Talk (of Livejournal) uses Jabber.  Your Jabber ID is
157 @samp{@var{ljusername}@@livejournal.com}.
158 @end itemize
160 @node Registering an account, Connecting, Do you have a Jabber account?, Basic operation
161 @section Registering an account
163 @cindex Registering an account
165 If you do not yet have a Jabber account, you can register one.  The
166 registration processes for various servers differ, but many servers
167 support so-called ``in-band registration'', which is described in this
168 section.
170 To register an account, type @kbd{C-u M-x jabber-connect} and enter your
171 desired JID in the form @samp{@var{username}@@@var{server}}.  You will
172 be presented with a registration form to fill out and send.  There the
173 username you chose will be prefilled.  After registration, you can
174 connect to the server as usual.
176 @node Connecting, Chatting, Registering an account, Basic operation
177 @section Connecting
179 @findex jabber-connect-all
180 @findex jabber-connect
181 @findex jabber-disconnect-one
182 @findex jabber-disconnect
184 @cindex Connecting
186 Now, type @kbd{C-x C-j C-c} and enter your JID and password.  If you
187 successfully connect, jabber.el will download your roster and display it
188 in a buffer called @code{*-jabber-roster-*}.
190 By default, you will appear as ``online'' to your contacts.  To change
191 this to e.g. ``away'', type @kbd{M-x jabber-send-presence} or @kbd{C-x
192 C-j C-p}.  @xref{Presence}, for more information.
194 To disconnect, type @kbd{M-x jabber-disconnect} or @kbd{C-x C-j C-d}.
195 Use @kbd{M-x jabber-disconnect-one} to disconnect just one account (or just type @kbd{C-u C-x C-j C-d}).
197 If you don't want to type your JID every time you connect, you can save
198 it in the variable @code{jabber-account-list}.  @xref{Account
199 settings}.  If you configure more than one account, all of them will be
200 connected when you type @kbd{C-x C-j C-c}, as that key is bound to
201 @code{jabber-connect-all}.  To connect only one account, possibly one
202 that's not in your list, type @kbd{M-x jabber-connect} or @kbd{C-u C-x
203 C-j C-c}.
205 @node Chatting, Presence, Connecting, Basic operation
206 @section Chatting
208 @cindex Chatting
209 @findex jabber-chat-with
211 There are several ways to open a chat buffer.  The shortest way is to
212 put point over the person you want to chat with in the roster display
213 and hit RET.
215 You can also use the function @code{jabber-chat-with}.  This function is
216 bound to @kbd{C-x C-j C-j} in the global keymap.  You will be asked to
217 enter a JID in the minibuffer.  You can also enter the roster name of
218 one of your contacts.  All JIDs and names in your roster can be
219 tab-completed.
221 You can also use menus to access commands.  In the roster display, you
222 can access several menus through keystrokes or mouse clicks.  You can
223 bring one big menu up by pressing the second mouse button, or you can
224 bring up the ``chat menu'' by typing @kbd{C-c C-c}.  If you do the
225 latter while point is on a roster entry, that entry will be the
226 default value when you are asked for whom to chat with.
228 Now, try opening a chat with someone.  A buffer named
229 @code{*-jabber-chat-:-@var{person}-*} will be created and selected.
230 Type your message at the end of the buffer, and hit @kbd{RET} to send
231 it.  To include a newline in your message, use @kbd{C-j}.
233 When you receive a message from someone, you will see a red indicator in
234 the mode line.  You can click this indicator with the mouse, or type
235 @kbd{C-x C-j C-l} to switch to the relevant buffer.  @xref{Tracking
236 activity}.
238 @node Presence, Presence subscription, Chatting, Basic operation
239 @section Presence
241 @cindex Presence
242 @cindex Sending presence
243 @findex jabber-send-presence
244 @findex jabber-send-default-presence
245 @vindex jabber-default-show
246 @vindex jabber-default-status
247 @vindex jabber-default-priority
249 @dfn{Presence} is the Jabber term for letting other people know that you
250 are online, and additionally how ``available'' you are.  There are
251 three elements to presence: availability state (called ``show''),
252 status message, and priority.
254 Your show state may either be empty (meaning simply ``online''), or
255 one of @code{away}, @code{xa}, @code{dnd} and @code{chat}, meaning
256 ``away'', ``extended away'' (i.e. away for an extended period), ``do
257 not disturb'', and ``free for chat'', respectively.  This information
258 is available to everyone subscribing to your presence, but technically
259 it does not restrict anyone's actions.  You can chat with people even
260 if you claim to be away.
262 The status message is a short text complementing your show status,
263 such as ``at home'', ``working'', ``phone'', ``playing games'' or
264 whatever you want.  It is sent to everyone subscribing to your
265 presence, but not all clients prominently display it to the user.
267 The priority is only interesting if you are running more than one Jabber
268 client at a time accessing the same account.  @xref{Resources and
269 priority}.
271 To set your presence, use the function @code{jabber-send-presence}
272 (bound to @kbd{C-x C-j C-p}).
273 It can be called both interactively and in Lisp code.  For the latter
274 case, use something like @code{(jabber-send-presence "away" "idle for
275 10 minutes" 10)}.  There are a few shortcuts:
276 @table @kbd
277 @item C-x C-j C-a
278 Send ``away'' presence (with prefix argument, specify status text)
279 @item C-x C-j C-x
280 Send ``extended away'' presence (with prefix argument, specify status
281 text)
282 @item C-x C-j C-o
283 Send default presence (see below)
284 @end table
286 By default, jabber.el sets your presence when you connect.  If you
287 want it not to do that, remove @code{jabber-send-current-presence}
288 from @code{jabber-post-connect-hooks}.  If you want to change the
289 presence that is sent, change the variables
290 @code{jabber-default-show}, @code{jabber-default-status} and
291 @code{jabber-default-priority}.
293 With jabber.el, you can set your presence remotely.  @xref{Ad-Hoc Commands}.
295 @menu
296 * Resources and priority::
297 * Directed presence::
298 @end menu
300 @node Resources and priority, Directed presence, , Presence
301 @subsection Resources and priority
303 @cindex Resource
304 @cindex Priority
306 Every connection to an account has a specific name, a @dfn{resource}.
307 The account itself has a JID of the form
308 @samp{@var{username}@@@var{server}} (a @dfn{bare JID}), but the
309 connections have JIDs of the form
310 @samp{@var{username}@@@var{server}/@var{resource}} (a @dfn{full JID}).
311 You can choose the resource name yourself by entering a JID of the
312 latter form at the connection prompt (@pxref{Connecting}), or by
313 configuring it in @code{jabber-account-list} (@pxref{Account settings})
315 Each session has a @dfn{priority}.  The priority determines what happens
316 when a message is sent to the bare JID (i.e. without specifying what
317 connection should receive message).  Such messages are delivered to the
318 connection with the highest non-negative priority value.  If there are
319 no connections, or if all connections have negative priority, the
320 message is either stored on the server for later delivery or bounced to
321 the sender, depending on the server configuration.
323 If there are several connections with the same priority, the behaviour
324 depends on the server.  Some server implementations deliver the message
325 to all such connections, while others choose one connection depending on
326 certain rules.
328 Note that these rules do not apply when a message is sent to a full
329 JID.  Such messages are sent to the specified resource, if it is still
330 connected, and otherwise treated as messages to the bare JID.  In the
331 chat buffers of jabber.el, messages are sent to whatever JID the last
332 message came from (usually a full JID), or to the bare JID if no message
333 has been received yet.  Other clients may have different behaviour.
335 @node Directed presence,  , Resources and priority, Presence
336 @subsection Directed presence
338 @cindex directed presence
339 @cindex send directed presence
340 @findex jabber-send-directed-presence
341 You can send ``directed presence'' with @kbd{M-x
342 jabber-send-directed-presence}.  This is mostly useful to manage
343 transports---sending directed presence is a way to turn them on and
344 off.  You can also send directed presence to an annoying contact to
345 appear as away or offline to that contact.  Note, however, that in both
346 of these cases, all subscribed entities will get your next global
347 presence update.
349 @node Presence subscription, Roster buffer, Presence, Basic operation
350 @section Presence subscription
352 @cindex Presence subscription
353 @cindex Subscribing to someone's presence
354 @findex jabber-send-subscription-request
356 Having permission to view the presence status of a person is called
357 @dfn{subscribing to his presence}.  Presence subscription between two
358 persons can be asymmetric.  Subscription state is shown in the roster
359 display by arrows (@pxref{Customizing the roster buffer}).  A
360 left-pointing arrow means that the contact can see your presence
361 (``from'').  A right-pointing arrow means that you can see the contact's
362 presence (``to'').  The most common case is mutual subscription, a
363 double-ended arrow (``both'').
365 When jabber.el receives a presence subscription request, it will present
366 it to you in a chat buffer, and offer you to choose subscription mode
367 and send a subscription request back to that person.  The ``Mutual''
368 button accepts the request and sends a reciprocal request.@footnote{If this
369 request is superfluous, the server will drop it without bothering the
370 contact.}  The ``One-way'' button accepts the request, but doesn't ask
371 for a subscription in return.  The ``Decline'' button declines the
372 request.
374 To request subscription to someone, type @kbd{M-x
375 jabber-send-subscription-request}.  You will be prompted for the JID
376 to send it to.  This command can also be accessed through the Roster
377 menu, by typing @kbd{C-c C-r} in the roster buffer.  After that, you
378 will probably want to give the contact a more readable name.  The
379 command for that is @code{jabber-roster-change}, which is also
380 available in the Roster menu or by typing @kbd{e} on a person in the
381 roster buffer.
383 @node Roster buffer,  , Presence subscription, Basic operation
384 @section The roster buffer
386 @cindex Roster buffer, basics
387 @cindex Menus
388 @cindex Key bindings
390 The roster buffer is called @code{*-jabber-roster-*}.  It simply
391 contains a list of the contacts on your roster.  If you have several
392 accounts connected, contacts will be grouped by account.
394 In the roster buffer, any command which requires a JID will default to
395 the JID under point when called.  These commands can be called through
396 either keyboard menus or mouse menus.  To open a menu with the mouse,
397 simply press the second mouse button over the JID in
398 question.@footnote{For some reason, mouse menus don't work in XEmacs.
399 Patches are welcome.}  This will bring up a menu with all available
400 actions.  The keyboard menus are split into categories: Chat, Roster,
401 Information, MUC (Multi-User Chat, or groupchat) and Services, opened
402 by @kbd{C-c C-c}, @kbd{C-c C-r}, @kbd{C-c C-i}, @kbd{C-c C-m} and
403 @kbd{C-c C-s}, respectively.
405 @vindex jabber-roster-show-bindings
406 A list of keybindings is displayed at the top of the roster buffer.
407 You can turn it off by setting @code{jabber-roster-show-bindings} to
408 nil.
410 @findex jabber-display-roster
411 You can call @code{jabber-display-roster} (bound to @kbd{g}) to
412 redisplay your roster according to changed preferences
413 (@pxref{Customizing the roster buffer}).  This will not refetch your
414 roster from the server.  Refetching the roster is usually not needed,
415 since updates are pushed to clients automatically.
417 You can choose not to have the roster updated automatically on
418 presence changes (@pxref{Presence alerts}).  In that case, you need to
419 call @code{jabber-display-roster} manually.
421 @vindex jabber-show-offline-contacts
422 @cindex Hiding offline contacts
423 @cindex Offline contacts, hiding
424 Please note, that by default offline contacts showed in roster as any
425 others. To hide them, you can use @kbd{o} in roster buffer. To
426 permanently hide them, customize @code{jabber-show-offline-contacts}
427 variable.
429 @node Groupchat, Composing messages, Basic operation, Top
430 @chapter Groupchat
432 @cindex Groupchat
433 @cindex MUC
434 @cindex Chatrooms
436 The groupchat menu can be accessed by typing @kbd{C-c C-m} in the
437 roster buffer.  You can also type the commands directly, as will be
438 shown here.
440 @findex jabber-muc-join
441 @cindex Joining a groupchat
442 @cindex Changing nickname
443 @cindex Nickname, changing
444 To join a groupchat, type @kbd{M-x jabber-muc-join}.  You will
445 be prompted for the groupchat to join, and your nickname in the
446 groupchat.  This nickname doesn't need to have any correlation to your
447 JID; in fact, groupchats are usually (but not always) configured such
448 that only moderators can see your JID.  You can change your nickname
449 with @kbd{M-x jabber-muc-nick}.  @xref{Configuration}, for setting default
450 nicknames.
452 @cindex Query groupchat
453 @vindex jabber-muc-disable-disco-check
454 When trying to join a room, jabber.el first sends a service discovery
455 info request to the room, to find out whether it exists and what
456 features are enabled (in particular whether the room is
457 password-protected).  However, this can cause problems with some buggy
458 MUC services (or services that respond in a way that jabber.el doesn't
459 expect).  A workaround for that is to set
460 @code{jabber-muc-disable-disco-check} to @code{t}; however, the bug should be
461 unearthed and fixed.
463 Groupchat messages will be displayed in a buffer called
464 @code{*-jabber-groupchat-:-@var{groupchat}-*}.  By default, the buffer
465 name is based on the JID of the chat room.  If you want a shorter name,
466 you can add the chat room to your roster and give it a name, using the
467 command @kbd{M-x jabber-roster-change}.  The groupchat buffer works much
468 like the chat buffer.  It has its own class of alerts
469 (@pxref{Customizing alerts}), and uses activity tracking
470 (@pxref{Tracking activity}).
472 @vindex jabber-muc-completion-delimiter
473 @vindex jabber-muc-looks-personaling-symbols
474 @cindex Groupchat completion
475 @cindex Nick completion in groupchat
476 Also, to save from repeating unnesesary typing you can press @kbd{Tab}
477 key to complete nick of a groupchat member that you are talking with.
478 You can customize your form of personal talking in MUC
479 (@code{jabber-muc-completion-delimiter}) and form of personal talking to
480 you (@code{jabber-muc-looks-personaling-symbols})---see ``jabber-chat''
481 customization group. Defaults are sane, so it is unlikely that you would
482 want to change this, but... it is Emacs!
484 @cindex Topic, MUC
485 @findex jabber-muc-set-topic
486 To change the topic of a groupchat, type @kbd{M-x jabber-muc-set-topic}.
487 The current topic is shown in the header line.
489 @findex jabber-muc-leave
490 To leave a groupchat, type @kbd{M-x jabber-muc-leave}.
492 @findex jabber-muc-get-config
493 If you are the owner of a groupchat, you can change its configuration
494 by typing @kbd{M-x jabber-muc-get-config}.  A configuration form
495 will be rendered in new buffer.
497 @findex jabber-muc-names
498 @vindex jabber-muc-print-names-format
499 To see which people are in a groupchat, type @kbd{M-x
500 jabber-muc-names}.  This gives a list of nicknames,
501 ``affiliations'', and possibly JIDs according @code{jabber-muc-print-names-format}, sorted by ``roles''.
502 @xref{MUC Administration}, for the meaning of roles and affiliations.
505 @menu
506 * Configuration::
507 * Invitations::
508 * Private messages::
509 * MUC Administration::
510 @end menu
512 @node Configuration, Invitations, , Groupchat
513 @section Configuration
515 @vindex jabber-muc-default-nicknames
516 @vindex jabber-muc-autojoin
517 @findex jabber-muc-autojoin
518 @cindex Default MUC nickname
519 @cindex Autojoin chat rooms
520 @cindex Bookmarks, MUC
521 @findex jabber-edit-bookmarks
523 You can configure jabber.el to use a certain nickname for a certain
524 room, or to automatically join a certain room when you connect.  You can
525 do this either by storing bookmarks on the server or by setting Emacs
526 variables.
528 Type @kbd{M-x jabber-edit-bookmarks} to add bookmarks.  You can specify
529 the JID of the conference, the name of the conference (not used by
530 jabber.el), whether to automatically join the room, your desired
531 nickname (or leave empty), and the room password (or leave empty).
533 The default nickname for groupchats is the username part of your JID.
534 If you don't use bookmarks, you can set different nicknames for
535 different groups by customizing @code{jabber-muc-default-nicknames}.
536 There you specify the JID of the group, and your preferred nickname.
538 Automatically joining certain rooms when connecting can be accomplished
539 by setting @code{jabber-muc-autojoin} to a list containing the JIDs of
540 the rooms you want to enter.  To disable this feature, remove
541 @code{jabber-muc-autojoin} from @code{jabber-post-connect-hooks}.
543 Please note, that @code{jabber-muc-default-nicknames} and
544 @code{jabber-muc-autojoin} are machine-local, but apply to @emph{all}
545 accounts---if you connect several accounts, both will try to connect to
546 the same chat rooms, or use the same nickname.  This will lead to
547 confusion.
549 @node Invitations, Private messages, Configuration, Groupchat
550 @section Invitations
552 @cindex Invitations
553 @findex jabber-muc-invite
555 You can invite someone to a groupchat with @kbd{M-x jabber-muc-invite}
556 (also available in the MUC menu).  Pay attention to the order of the
557 arguments---as both users and rooms are just JIDs, it is technically
558 possible to invite a room to a user, but that's probably not what you
559 want.
561 When you receive an invitation, it appears in the chat buffer along
562 with two buttons, ``Accept'' and ``Decline''.  Pressing ``Accept''
563 enters the room, as you would expect.  Pressing ``Decline'' gives you
564 an opportunity to state the reason why you're not joining.
566 @node Private messages, MUC Administration, Invitations, Groupchat
567 @section Private messages
569 @cindex Private MUC messages
570 @findex jabber-muc-private
572 You can open a private chat with a participant in a chat room with
573 @kbd{M-x jabber-muc-private} (or by using the MUC menu).  This creates
574 a buffer with the name
575 @code{*-jabber-muc-priv-@var{group}-@var{nickname}-*} (customizable by
576 @code{jabber-muc-private-buffer-format}), which behaves mostly like an
577 ordinary chat buffer.  This buffer will also be created if someone
578 sends a private message to you.
580 Private MUC messages use the same alerts as normal chat messages.
581 @xref{Message alerts}.
583 @node MUC Administration,  , Private messages, Groupchat
584 @section Administration
586 Administration of a MUC room mostly consists of managing roles and
587 affiliations.  Roles are temporary, and apply until the user leaves the
588 room.  Affiliations are permanent, and based on JIDs.
590 @subsection Roles
592 @findex jabber-muc-set-role
593 @cindex Kicking, MUC
594 @cindex Voice, MUC
595 @cindex Moderator, MUC
596 @cindex Roles, MUC
597 If you have moderator privileges, you can change the role of a
598 participant with @kbd{M-x jabber-muc-set-role}.  Kicking means setting
599 the role to ``none''.  Granting and revoking voice are ``participant''
600 and ``visitor'', respectively.  ``moderator'' gives moderator
601 privileges, obviously.
603 The possible roles are:
605 @table @samp
606 @item moderator
607 Has voice, can change other people's roles.
609 @item participant
610 Has voice.
612 @item visitor
613 Doesn't have voice (can't send messages to everyone, but can send
614 private messages)
616 @item none
617 Not in room.
618 @end table
620 @subsection Affiliations
622 @findex jabber-muc-set-affiliation
623 @cindex Affiliations, MUC
624 @cindex Banning, MUC
625 If you have admin or owner privileges, you can change the affiliation of
626 a user with @kbd{M-x jabber-muc-set-affiliation}.  Affiliation is
627 persistent, and based on JIDs.  Depending of your affiliation and the
628 MUC implementation, you might not be allowed to perform all kinds of
629 changes, and maybe not in one step.
631 Affiliations are:
633 @table @samp
634 @item owner
635 Can destroy room, appoint admins, make people members, ban people.
637 @item admin
638 Can make people members or ban people.
640 @item member
641 Can enter the room, and has voice by default.
643 @item none
644 Rights depend on room configuration.  The room might be members-only, or
645 grant voice only to members.
647 @item outcast
648 Banned from the room.
649 @end table
652 @node Composing messages, File transfer, Groupchat, Top
653 @chapter Composing messages
655 @findex jabber-compose
656 @cindex composing messages
657 @cindex message composition
659 The chat buffer interface can be inconvenient for some purposes.  As you
660 can't use @kbd{RET} to insert a newline (use @kbd{C-j} for that),
661 writing a longer message can be painful.  Also, it is not possible to
662 include a subject in the message, or send the message to multiple
663 recipients.
665 These features are implemented by the message composing tool.  Type
666 @kbd{M-x jabber-compose} to start it.  In the buffer that comes up, you
667 can specify recipients, enter a subject, and type your message.
669 @node File transfer, Services, Composing messages, Top
670 @chapter File transfer
672 @cindex File transfer
673 @cindex Sending files
675 jabber.el has limited support for file transfer.  The most important
676 limit is that files sent and received are kept in buffers, so Emacs must
677 be able to allocate enough memory for the entire file, and the file size
678 must be smaller than the maximum buffer size.@footnote{The maximum
679 buffer size depends on in the variable @code{most-positive-fixnum}.  On
680 32-bit systems, this is 128 or 256 megabytes, depending on your
681 Emacs version.}
683 jabber.el is able to exchange files with most Jabber clients (and also
684 some MSN transports), but notably not with the official Google Talk
685 client.  The Google Talk client uses a different file transfer protocol
686 which, at the time of this release, has not been published.
688 @menu
689 * Receiving files::
690 * Sending files::
691 @end menu
693 @node Receiving files, Sending files, , File transfer
694 @section Receiving files
696 Receiving files requires no configuration.  When someone wants to send a
697 file to you, you are asked (through @code{yes-or-no-p}) whether you want
698 to accept the file.  If you answer yes, you get to choose where to save
699 the file.
701 If the sender's client is correctly configured (this is often not the
702 case; see below), the file transfer will start.  Currently, the only way
703 to watch the progress is to inspect the buffer of the file being
704 transfered; @kbd{C-x C-b} is one way of doing that.  @xref{List Buffers,
705 , Listing Existing Buffers, emacs, GNU Emacs Manual}.  When the transfer
706 is done, the message ``@var{file} downloaded'' appears in the echo area,
707 and the buffer is killed.
709 @c This truly sucks...
710 If this doesn't happen, it is most likely the sender's fault.  The
711 sender needs to have a public IP address, either directly, through port
712 forwarding (in which case the client needs to be configured with the
713 real public IP address), or through an XEP-0065 proxy.  If you have
714 activated XML logging (@pxref{Debug options}), you can see the IP
715 address that the other client is asking you to connect to there.  Often
716 you will find that this is an internal IP address (often starts with
717 @code{192.168}).  See the documentation of the sender's client for
718 setting this up.
720 @node Sending files,  , Receiving files, File transfer
721 @section Sending files
723 @cindex proxy, file transfer
724 @cindex file transfer proxy
725 @cindex XEP-0065 proxy
727 To send a file to someone, you need an XEP-0065 proxy.@footnote{This
728 requirement is not inherent in the protocol, only in the current file
729 transfer implementation of jabber.el, and in Emacs versions earlier than
730 22.}  If your Jabber server hosts such a proxy, it will be found
731 automatically, otherwise it needs to be manually configured.
733 You can check whether your Jabber server has a proxy with @kbd{M-x
734 jabber-get-disco-items}; see @ref{Service discovery}.
736 @vindex jabber-socks5-proxies
737 @findex jabber-socks5-query-all-proxies
738 To configure a proxy manually, customize the variable
739 @code{jabber-socks5-proxies}.  Putting @code{proxy.jabber.se} there
740 should work.  Type @kbd{M-x jabber-socks5-query-all-proxies} to see if
741 the proxies answer.
743 @findex jabber-ft-send
744 Now, you can type @kbd{M-x jabber-ft-send} to send a file to someone.
745 You need to enter the correct full JID, including resource, to get this
746 right.  If the contact is logged in with only one client, and you can
747 see it online, just typing the JID or roster name is enough.  If you run
748 the command from a chat buffer, the JID of the contact is given as
749 the default value.
751 If the contact has several clients online, you probably want to send the
752 file to a particular one.  If you run this command from within a chat
753 buffer, the default target will be the one that last sent a message to
754 you.  If you just type a bare JID or a roster name, the client with the
755 highest priority will get the file.
757 If the contact accepts the file, and the contact's client succeeds in
758 connecting to the proxy, jabber.el will send the file through the
759 proxy.  During this time, your Emacs will be blocked, so you might want
760 to avoid sending large files over slow connections.
762 @node Services, Personal information, File transfer, Top
763 @chapter Services
765 @cindex Browse buffers
767 Not every Jabber entity is a physical person.  There are many
768 automatic entities, called servers, services, components, agents,
769 transports and other names.  The use of these is described here.
771 The functions described in this chapter use @dfn{browse buffers}.
772 Browse buffers are named @code{*-jabber-browse-:-@var{service}-*},
773 sometimes with a numerical suffix.  The different menus have the same
774 keybindings as in the roster buffer, and if you call a function
775 operating on a JID while point is over a JID, that JID will be the
776 default value, so you don't have to type it or copy it yourself.
778 You can change the buffer name template by customizing
779 the variable @code{jabber-browse-buffer-format}.
781 @menu
782 * Commands::
783 * Your home server::
784 * Transports::
785 * User directories::
786 * MUC services::
787 @end menu
789 @node Commands, Your home server, , Services
790 @section Commands
792 A small number of commands is used for almost all interaction with
793 Jabber services.  Essentially, they are all the same: you request a form
794 from the server, fill it in, and send it back.
796 Most of these commands are available under the Service menu, which is
797 opened by typing @kbd{C-c C-s}.  Service discovery is under the Info
798 menu instead, which is available under @kbd{C-c C-i}.
800 @menu
801 * Registration::
802 * Search::
803 * Ad-Hoc Commands::
804 * Service discovery::
805 * Browsing::
806 @end menu
808 @node Registration, Search, , Commands
809 @subsection Registration
811 @cindex Registration
812 @findex jabber-get-register
814 You can get a registration form for a service by typing @kbd{M-x
815 jabber-get-register} and entering the JID of the service.  On success,
816 you get a single-stage form to fill in.
818 There are two buttons at the bottom of the form, ``Submit'' and ``Cancel
819 registration''.  ``Submit'' does what you would expect it to, but
820 ``Cancel registration'' cancels any existing registration with the
821 service.  Whichever of them you choose, you get a message in the echo
822 area informing whether the operation succeeded.
824 @node Search, Ad-Hoc Commands, Registration, Commands
825 @subsection Search
827 @cindex Search
828 @findex jabber-get-search
830 You can get a search form for a service by typing @kbd{M-x
831 jabber-get-search}.  This gives you a single-stage form to fill in.
832 After you press the ``Submit'' button at the bottom, the search results
833 will be displayed in the same buffer.
835 @node Ad-Hoc Commands, Service discovery, Search, Commands
836 @subsection Ad-Hoc Commands
838 @cindex Ad-Hoc Commands
839 @findex jabber-ahc-get-list
840 @findex jabber-ahc-execute-command
842 jabber.el supports a subset of XEP-0050, the standard for Ad-Hoc
843 Commands.  As the name implies, this can be used for just about
844 anything.  In particular, it is used not only by services, but also by
845 clients (e.g. Psi, and jabber.el itself).
847 To find which commands are available, run ``Request command list''
848 (@code{jabber-ahc-get-list}).@footnote{This is the same thing as a
849 disco items request to the node
850 @code{http://jabber.org/protocol/commands}.}
852 To run a command from the list, put point over it and run ``Execute
853 command'' (@code{jabber-ahc-execute-command}), accepting the defaults
854 for JID and node.  (If you already know those, you could of course
855 enter them yourself.)
857 What happens next depends on the command and the service.  In some
858 cases, the service just responds that the command has been run.  You may
859 also get a form to fill out.  This form may have multiple stages, in
860 which case there are ``Next'' and ``Previous'' buttons for navigating
861 between stages.  You may also see ``Complete'', which runs the command
862 skipping any remaining stages of the form, and ``Cancel'', which cancels
863 the command.
865 Currently, jabber.el uses ad-hoc commands for setting presence remotely.
866 If you realize that you forgot to set your client to ``away'' with a low
867 priority, you can do it remotely from any JID from
868 @code{jabber-account-list}. So, you can add disabled JIDs in
869 @code{jabber-account-list} to allow them control your
870 presence.@footnote{Most Jabber servers also support kicking a client off
871 the net by logging in with another client with exactly the same
872 resource.}
874 @node Service discovery, Browsing, Ad-Hoc Commands, Commands
875 @subsection Service discovery
877 @cindex Service discovery
878 @findex jabber-get-disco-items
879 @findex jabber-get-disco-info
881 Service discovery is used to find information about servers, services
882 and clients.  There are two kinds of requests: find @dfn{info} about a
883 Jabber entity---i.e. its identity and supported features---and find
884 @dfn{items} related to an entity, where the definition of ``related'' is
885 left to the entity itself.
887 The commands to execute such requests are @code{jabber-get-disco-info}
888 and @code{jabber-get-disco-items}, respectively.  These commands can be
889 accessed from the Info menu, which is opened by typing @kbd{C-c C-i}.
890 The commands accept a JID and optionally a ``node''.
892 The result of such a command is displayed in a browse buffer.  For an
893 info request, the result just lists the identities and features of the
894 entity.  For an item request, the related items are listed.  The items
895 may be JIDs, or JIDs with a node.  If you put point on one of the items,
896 its JID and node will be the default value for any Jabber command.
898 If you think that the interface to service discovery is awkward and
899 should be replaced with something better, you are completely right.
901 @node Browsing,  , Service discovery, Commands
902 @subsection Browsing
904 @cindex Browsing
905 @findex jabber-get-browse
907 Before service discovery, browsing was the way to find information about
908 Jabber entities.  Nowadays it is all but superseded, but jabber.el still
909 supports it.  You can use it by typing @kbd{M-x jabber-get-browse}.  It
910 works much like service discovery.
912 @node Your home server, Transports, Commands, Services
913 @section Your home server
915 @cindex Password change
916 @cindex Changing password
917 @cindex Account removal
918 @cindex Removing an account
920 You can interact with your Jabber server to change your password or
921 remove your account.  Both of these can be accomplished by typing
922 @kbd{M-x jabber-get-register} and typing the JID of your server;
923 @pxref{Registration}.
926 @node Transports, User directories, Your home server, Services
927 @section Transports to other IM networks
929 @cindex Gateways
930 @cindex Transports
931 @cindex MSN transport
932 @cindex ICQ transport
933 @cindex AIM transport
935 Some Jabber services make it possible to communicate with users on other
936 instant messaging networks (e.g. MSN, ICQ, AIM), in effect turning your
937 Jabber client into a multi-protocol client.  These are called
938 @dfn{gateways} or @dfn{transports}.  They work by impersonating you on
939 the legacy network; therefore you need to provide your username and
940 password through registration.
942 @subsection Finding a transport
944 To use such a transport, you first need to find one, obviously.
945 Sometimes your home server provides the transports you need, but you are
946 not limited to those; in principle you can use any transport on the
947 Jabber network.  Some transports only accept local users, though.
949 Transports are generally mentioned on the web page of the Jabber server
950 in question.  You can also find transports from within the client;
951 @pxref{Service discovery}.
953 @subsection Registering with a transport
955 To register with a transport, type @kbd{M-x jabber-get-register} and
956 enter the JID of the transport.  This will open a registration form
957 where you get to fill in your login information; @pxref{Registration}.
958 You can later use this same form to change the information or cancel
959 your registration.
961 After you have registered, the transport will request presence
962 subscription.  It needs that to know when you are online, and
963 synchronize your presence on the legacy network.
965 @subsection Contact list
967 Once you are registered, the transport will transfer the contact list
968 from the legacy service.  From the Jabber side, it appears as if lots of
969 people suddenly request presence subscription to you.  This is somewhat
970 inconvenient, but it is currently the only way that the transport can
971 influence your Jabber contact list, as it is an entity external to your
972 server.@footnote{Of course, jabber.el could do more to alleviate this
973 inconvenience.}
975 When you have accepted these presence subscriptions, the contacts from
976 legacy networks appear as if they were Jabber contacts.
978 @subsection Finding users
980 Some legacy networks have a global database of users, and some
981 transports support searching that database.  In that case, you can
982 search for other users with @kbd{M-x jabber-get-search};
983 @pxref{Search}.
985 @node User directories, MUC services, Transports, Services
986 @section User directories
988 There are some Jabber user directories, usually abbreviated JUDs.  The
989 most well-known one is @samp{users.jabber.org}.  You can register with
990 such a directory to let other people find you (@pxref{Registration}),
991 and you can search the directory (@pxref{Search}).
993 @node MUC services,  , User directories, Services
994 @section MUC services
996 MUC services (Multi-User Chat, chat rooms) are usually not operated by
997 these commands, but by commands specific to the MUC protocol;
998 @pxref{Groupchat}.  However, some MUC services offer nickname
999 registration through the registration protocol (@pxref{Registration}),
1000 and other commands; @pxref{Ad-Hoc Commands}.
1002 @node Personal information, Avatars, Services, Top
1003 @chapter Personal information
1005 @cindex vCard
1006 @cindex Personal information
1007 @findex jabber-vcard-get
1008 @findex jabber-vcard-edit
1010 The Jabber way of handling personal information (name, addresses, phone
1011 numbers, etc) is ``vCards'' encoded in XML.@footnote{@xref{XEP-0054}.}
1012 You can get information about a user by running @kbd{M-x
1013 jabber-vcard-get}, @kbd{M-x jabber-muc-vcard-get} if you in MUC (also
1014 available in the MUC menu), and you can edit your own information by
1015 running @kbd{M-x jabber-vcard-edit}.
1017 The form for editing your information can be slightly confusing---you
1018 are allowed to enter any number of addresses, phone numbers and e-mail
1019 addresses, each of which has a set of orthogonal properties.  You can
1020 add and remove items with the @samp{[INS]} and @samp{[DEL]} buttons,
1021 respectively.
1023 This is also where you set your avatar (@pxref{Avatars}).  The size of
1024 your avatar file is limited to 8 kilobytes.
1026 @node Avatars, Time queries, Personal information, Top
1027 @chapter Avatars
1029 @cindex avatars
1030 @vindex jabber-vcard-avatars-retrieve
1031 @vindex jabber-vcard-avatars-publish
1032 @vindex jabber-avatar-cache-directory
1033 @vindex jabber-chat-buffer-show-avatar
1035 jabber.el supports viewing and publishing avatars according to XEP-0153,
1036 vCard-Based Avatars.  By default, if you have an avatar in your vCard
1037 (@pxref{Personal information}), it will be published for others to see,
1038 and if other people publish their avatars, they will be displayed in the
1039 roster buffer and in the header line of chat buffers, if your Emacs can
1040 display images.  Otherwise, jabber.el will not fetch avatars at all.
1042 To disable retrieval of other people's avatars, set
1043 @code{jabber-vcard-avatars-retrieve} to nil.  To disable publishing of
1044 your own avatar, set @code{jabber-vcard-avatars-publish} to nil.  To
1045 disable avatars in chat buffer header lines, set
1046 @code{jabber-chat-buffer-show-avatar} to nil.
1048 There are a number of restrictions on avatar images in the
1049 specification.  Most of them are not enforced by jabber.el.
1050 @itemize @bullet
1051 @item
1052 The image should be smaller than 8 kilobytes; this is enforced by
1053 jabber.el.
1054 @item
1055 The image height and width should be between 32 and 96 pixels; the
1056 recommended size is 64 by 64 pixels.
1057 @item
1058 The image should be square.
1059 @item
1060 The image should be in either PNG, GIF, or JPEG format.  (jabber.el will
1061 behave incorrectly if the image is not in a format supported by Emacs.)
1062 @end itemize
1064 Avatars are cached in the directory specified by
1065 @code{jabber-avatar-cache-directory}, by default
1066 @file{~/.jabber-avatars/}.  The cache is never cleaned, so you might
1067 want to do that yourself from time to time.
1069 @node Time queries, Useful features, Avatars, Top
1070 @chapter Time queries
1072 @cindex time query
1073 @findex jabber-get-time
1074 With @kbd{M-x jabber-get-time}, you can ask what time an entity (client,
1075 server or component) thinks it is, and what time zone it thinks it is
1078 @cindex last online
1079 @findex jabber-get-last-online
1080 You can query a server about when a certain user was last seen online.
1081 Use @kbd{M-x jabber-get-last-online} for that.
1083 @cindex uptime, query
1084 @cindex idle time, query
1085 @findex jabber-get-idle-time
1086 You can also ask a client about how long a user has been idle with
1087 @kbd{M-x jabber-get-idle-time}.  Not all clients answer such queries,
1088 e.g. jabber.el doesn't.  This command can also tell the uptime of a
1089 server or component.
1091 The first of these commands uses the old Entity Time protocol
1092 (@pxref{XEP-0090}).  It has been superseded by XEP-0202, but jabber.el
1093 doesn't implement the newer protocol yet.  The latter two commands use
1094 the Last Activity protocol (@pxref{XEP-0012}).
1096 @node Useful features, Message history, Time queries, Top
1097 @chapter Useful features
1099 jabber.el includes a number of features meant to improve the user
1100 interface and do other useful things.
1102 @menu
1103 * Autoaway::
1104 * Modeline status::
1105 * Keepalive::
1106 * Reconnecting::
1107 * Tracking activity::
1108 * Watch buddies::
1109 * Spell checking::
1110 * Gmail notifications::
1111 @end menu
1113 @node Autoaway, Modeline status, , Useful features
1114 @section Autoaway
1116 @cindex autoaway
1117 @cindex idle
1118 @cindex xprintidle
1119 @vindex jabber-autoaway-method
1120 @vindex jabber-autoaway-methods
1121 @findex jabber-current-idle-time
1122 @findex jabber-xprintidle-program
1123 @findex jabber-termatime-get-idle-time
1124 @vindex jabber-autoaway-timeout
1125 @vindex jabber-autoaway-xa-timeout
1126 @vindex jabber-autoaway-status
1127 @vindex jabber-autoaway-xa-status
1128 @vindex jabber-autoaway-priority
1129 @vindex jabber-autoaway-xa-priority
1131 It is possible to automatically set your status to ``away'' or ``xa''
1132 when you haven't used your computer for a while. This lets your
1133 contacts know that you might not answer immediately. You can customize
1134 timeouts (@code{jabber-autoaway-timeout},
1135 @code{jabber-autoaway-xa-timeout}), statuses
1136 (@code{jabber-autoaway-status}, @code{jabber-autoaway-xa-status}) and
1137 priorityes (@code{jabber-autoaway-priority},
1138 @code{jabber-autoaway-xa-priority}) to set.
1140 To activate this feature, add @code{jabber-autoaway-start} to
1141 @code{jabber-post-connect-hooks}, e.g:
1142 @example
1143 (add-hook 'jabber-post-connect-hooks 'jabber-autoaway-start)
1144 @end example
1146 There are different methods to find how long you have been ``idle''.
1147 The method(s) to use is specified by @code{jabber-autoaway-methods}
1148 (obsoleted @code{jabber-autoaway--method} will also work). The value
1149 of this variable should be a list functions that returns the number of
1150 seconds you have been idle (or nil on error). Minimum of values,
1151 returned by these functions, is used as ``idle'' time, so default
1152 should works well. Three functions are provided (all used by default).
1154 @itemize @bullet
1155 @item
1156 @code{jabber-current-idle-time} is used if your Emacs has the
1157 @code{current-idle-time} function (which was introduced in Emacs 22).
1158 Note that this method only measures the time since you last interacted
1159 with Emacs, and thus disregards activity in other programs.
1161 @item
1162 @code{jabber-xprintidle-get-idle-time} uses xprintidle
1163 @footnote{@uref{http://www.dtek.chalmers.se/~henoch/text/xprintidle.html}}
1164 program, if found. You can also manually set
1165 @code{jabber-xprintidle-program} to the correct file path. This method
1166 uses the same method as
1167 @uref{http://www.jwz.org/xscreensaver,XScreensaver} to find your idle
1168 time.
1170 @item
1171 @code{jabber-termatime-get-idle-time} used on GNU/Linux terminals. It
1172 uses the access time of the terminal device as a measure of idle time.
1174 @end itemize
1176 @node Modeline status, Keepalive, Autoaway, Useful features
1177 @section Modeline status
1179 @cindex Modeline
1180 @findex jabber-mode-line-mode
1181 @vindex jabber-mode-line-mode
1182 @vindex jabber-mode-line-compact
1184 By typing @kbd{M-x jabber-mode-line-mode} you toggle display of some
1185 status in mode lines.  The information is your own presence status,
1186 and some numbers showing the status of your roster contacts.  By
1187 default, there are three numbers, for ``online'' (chatty and online),
1188 ``away'' (away, extended away and do not disturb) and offline
1189 contacts.
1191 If you set @code{jabber-mode-line-compact} to nil, you get a complete
1192 breakdown of presence status.  That gives you six numbers indicating
1193 the number of chatty, online, away, extended away, dnd, and offline
1194 contacts, respectively.
1196 @node Keepalive, Reconnecting, Modeline status, Useful features
1197 @section Keepalive
1199 @cindex Keepalive
1200 @cindex Detecting lost connections
1202 Sometimes network connections are lost without you noticing.  This is
1203 especially true with Jabber, as it is quite reasonable to keep the
1204 connection open for a long time without either sending or receiving
1205 any data.
1207 On the other hand, the server may want to do the same kind of
1208 detection, and may expect the client to send something at regular
1209 intervals.
1211 If you want to detect a lost connection earlier, or make sure that the
1212 server doesn't drop your connection, you can use the
1213 keepalive functions.  These come in two flavours: whitespace pings and
1214 XMPP pings.
1216 @subsection Whitespace pings
1217 @cindex Whitespace pings
1219 A @dfn{whitespace ping} is a single space character sent to the server.
1220 This is often enough to make NAT devices consider the connection
1221 ``alive'', and likewise for certain Jabber servers, e.g. Openfire.  It
1222 may also make the OS detect a lost connection faster---a TCP connection
1223 on which no data is sent or received is indistinguishable from a lost
1224 connection.
1226 @findex jabber-whitespace-ping-start
1227 @findex jabber-whitespace-ping-stop
1228 Type @kbd{M-x jabber-whitespace-ping-start} to start it, and @kbd{M-x
1229 jabber-whitespace-ping-stop} to stop it.  The former is in
1230 @code{jabber-post-connect-hooks} by default; @pxref{Hooks}.
1232 @vindex jabber-whitespace-ping-interval
1233 The frequency of whitespace pings is controlled by the variable
1234 @code{jabber-whitespace-ping-interval}.  The default value is once every
1235 30 seconds.
1237 @subsection XMPP pings
1239 These functions work by sending a ping request to your server once in a
1240 while (by default every ten minutes), and considering the connection
1241 lost if the server doesn't answer within reasonable time (by default
1242 20 seconds).
1244 @findex jabber-keepalive-start
1245 @findex jabber-keepalive-stop
1246 Type @kbd{M-x jabber-keepalive-start} to start
1247 it, and @kbd{M-x jabber-keepalive-stop} to stop it.  You may want to add
1248 @code{jabber-keepalive-start} to @code{jabber-post-connect-hooks};
1249 @pxref{Hooks}.
1251 @vindex jabber-keepalive-interval
1252 @vindex jabber-keepalive-timeout
1253 You can customize the interval and the timeout with the variables
1254 @code{jabber-keepalive-interval} and @code{jabber-keepalive-timeout},
1255 respectively.
1257 @findex jabber-ping
1258 You can also manually ping some client/server by using @kbd{M-x
1259 jabber-ping}. Note that pong will be displayed according
1260 @code{jabber-alerts-info-messages-hooks} (default is echo in
1261 minibuffer).
1263 @node Reconnecting, Tracking activity, Keepalive, Useful features
1264 @section Reconnecting
1266 @cindex Reconnect
1267 @cindex Automatic reconnection
1268 @vindex jabber-auto-reconnect
1270 jabber.el supports automatic reconnection to Jabber server(s) upon lost
1271 connection.  By default it is off.  To turn on, customize
1272 the @code{jabber-auto-reconnect} variable.
1274 This is of limited use if you have to type your password every time
1275 jabber.el reconnects.  There are two ways to save your password: you can
1276 set it in @code{jabber-account-alist} (@pxref{Account settings}), and
1277 you can use @file{password-cache.el}, which is available in
1278 recent versions of Gnus and in Emacs 23.  Note that you probably want to
1279 customize @code{password-cache-expiry} if you use the latter.
1281 @node Tracking activity, Watch buddies, Reconnecting, Useful features
1282 @section Tracking activity
1284 @cindex Activity
1285 @findex jabber-activity-mode
1286 @vindex jabber-activity-make-strings
1287 @vindex jabber-activity-query-unread
1288 @vindex jabber-activity-count-in-title
1289 @vindex jabber-activity-count-in-title-format
1291 When you're working on something important you might want to delay
1292 responding to incoming messages.  However, when you're done working,
1293 will you remember them?  If you're anything like me, you'll have a lot
1294 of buffers in your Emacs session, and a Jabber chat buffer can easily
1295 get lost.
1297 When @code{jabber-activity-mode} is enabled (by default, it is), Emacs keeps
1298 track of the buddies which have messaged you since last you visited
1299 their buffer, and will display them in mode line.  As soon as you
1300 visit their buffer they disappear from the mode line, indicating that
1301 you've read their message.
1303 If your mode line fills over because of these notifications, you can
1304 customize @code{jabber-activity-make-strings} to shorten them to the
1305 shortest possibly unambiguous form.
1307 If you try to exit Emacs while you still have unread messages, you
1308 will be notified and asked about this.  If you don't like that, set
1309 @code{jabber-activity-query-unread} to nil.
1311 If you want to display the number of unread buffers in the frame title,
1312 set @code{jabber-activity-count-in-title} to t.  The format of the
1313 number can be changed through
1314 @code{jabber-activity-count-in-title-format}.
1316 To hide activity notifications for some contacts, use
1317 @code{jabber-activity-banned} variable - just add boring JIDs (as
1318 regexps) here.
1320 For complete customizability, write a hook function for
1321 @code{jabber-activity-update-hook}.  From that function, you can take
1322 action based on @code{jabber-activity-jids},
1323 @code{jabber-activity-mode-string}, and
1324 @code{jabber-activity-count-string}.
1326 @node Watch buddies, Spell checking, Tracking activity, Useful features
1327 @section Watch buddies
1329 @cindex Watch
1330 @cindex Online notifications
1331 @findex jabber-watch-add
1332 @findex jabber-watch-remove
1334 Sometimes you might be waiting for a certain person to come online,
1335 and you don't want that occasion to get lost in the noise.  To get an
1336 obtrusive message when that happens, type @kbd{M-x jabber-watch-add}
1337 and select the person in question.  You can enter a comment, to
1338 remember why you added the watch.
1340 You will get a message whenever that person goes from offline to
1341 online.  jabber.el will remember this for the rest of your Emacs
1342 session (it's not saved to disk, though), but if you want to get rid
1343 of it, type @kbd{M-x jabber-watch-remove}.
1345 @node Spell checking, Gmail notifications, Watch buddies, Useful features
1346 @section Spell checking
1348 @cindex flyspell
1349 @cindex Spell checking
1351 You can activate spell checking in a chat buffer with @kbd{M-x
1352 flyspell-mode}.  It will check only what you are currently writing, not
1353 what you receive or what you have already sent.  You may want to add
1354 @code{flyspell-mode} to @code{jabber-chat-mode-hook}.
1356 For more information about Emacs spell checking, @pxref{Spelling, ,
1357 Checking and Correcting Spelling, emacs, GNU Emacs Manual}.
1359 @node Gmail notifications, , Spell checking, Useful features
1360 @section Gmail notifications
1362 @cindex Gmail notifications
1364 If you are connected to a Google Talk account, you can receive
1365 notifications when a new Gmail message arrives. Gmail notifications
1366 are enabled by adding the following line to your @file{.emacs}:
1368 @example
1369 (add-hook 'jabber-post-connect-hooks 'jabber-gmail-subscribe)
1370 @end example
1372 Default behavior is to display a message that mentions the number of
1373 received gmails.  You can customize this behavior by providing your
1374 own @code{jabber-gmail-dothreads} function.
1376 Example:
1378 @example
1379 (eval-after-load "jabber-gmail"
1380   '(defun jabber-gmail-dothreads (threads)
1381      "Process <mail-thread-info/> elements.
1382 THREADS is a list of XML sexps corresponding to <mail-thread-info/>
1383 elements.
1384 See http://code.google.com/apis/talk/jep_extensions/gmail.html#response"
1385      (osd "gmail: %d" (length threads))))
1387 ;;; It's usually a good idea to have a shortcut for querying GTalk server.
1388 (global-set-key (kbd "<f9> g") 'jabber-gmail-query)
1390 ;;; The definition of `osd' function used by `jabber-gmail-dothreads'.
1391 ;;; `osd_cat' is shipped with the X OSD library
1392 ;;; [http://www.ignavus.net/software.html].
1393 (if (and (display-graphic-p) (file-executable-p "/usr/bin/osd_cat"))
1394     (defun osd (fmt &rest args)
1395       "Display message on X screen."
1396       (let ((opts "-p bottom -A center -l 1 \
1397 -f '-adobe-helvetica-bold-r-*-*-24-*-*-*-*-*-iso10646-1'")
1398             (msg (apply 'format (concat fmt "\n") args)))
1399         (start-process "osd" nil shell-file-name shell-command-switch
1400                        (format "echo %s | osd_cat %s"
1401                                (shell-quote-argument msg) opts))))
1402   (defalias 'osd 'message))
1403 @end example
1405 @node Message history, Typing notifications, Useful features, Top
1406 @chapter Message history
1408 @cindex History
1409 @cindex Backlog
1410 @findex jabber-truncate-top
1411 @findex jabber-truncate-muc
1412 @findex jabber-truncate-chat
1413 @vindex jabber-history-enabled
1414 @vindex jabber-history-muc-enabled
1415 @vindex jabber-global-history-filename
1416 @vindex jabber-use-global-history
1417 @vindex jabber-history-dir
1418 @vindex jabber-history-enable-rotation
1419 @vindex jabber-history-size-limit
1420 @vindex jabber-backlog-number
1421 @vindex jabber-backlog-days
1422 @vindex jabber-log-lines-to-keep
1424 If you want a record of messages sent and received, set
1425 @code{jabber-history-enabled} to t.  If you also want record MUC groupchat
1426 messages, set @code{jabber-history-muc-enabled} to t. By default all messages will
1427 be saved to a global history file specified by
1428 @code{jabber-global-history-filename}
1429 (@file{~/.jabber_global_message_log} by default).  If you prefer to
1430 store your chats' history in per-contact files, you can set
1431 @code{jabber-use-global-history} to @code{nil}.  When using
1432 per-contact history, files are named by the contact JID and saved
1433 under the directory specified by the variable
1434 @code{jabber-history-dir} (default is @file{~/.emacs-jabber}).
1436 When you open a new chat buffer and have entries in your history file,
1437 the last few messages you recently exchanged with the contact in
1438 question will be inserted.  You can control how many messages with
1439 @code{jabber-backlog-number} (by default 10), and how old messages
1440 with @code{jabber-backlog-days} (by default 3 days).
1442 @findex jabber-chat-display-more-backlog
1443 If you want to see more messages, use the function
1444 @code{jabber-chat-display-more-backlog}, available in the Chat menu.
1445 This is currently the only way to view the message history, apart from
1446 opening the history files manually.
1448 @cindex Rotation of history files
1449 @cindex History file rotation
1450 If you worry about your history file(s) size, you can enable history
1451 rotation feature by setting the variable
1452 @code{jabber-history-enable-rotation} to @code{t} (default is
1453 @code{nil}).  This feature ``rotates'' your history files according to
1454 the following rule: When @code{jabber-history-size-limit} (in
1455 kilobytes) is reached, the @var{history-file} is renamed to
1456 @file{@var{history-file}-@var{number}}, where @var{number} is 1 or the smallest number
1457 after the last rotation.
1459 For example, suppose you set the
1460 @code{jabber-history-size-limit} variable to 512 and you chat with
1461 your buddy @samp{foo@@jabber.server} using the per-contact strategy to store
1462 history files.  So, when the history file (@file{foo@@jabber-server})
1463 reaches 512K bytes, it will be renamed to @file{foo@@jabber-server-1}
1464 and @file{foo@@jabber-server} will be set empty. Next time
1465 @file{foo@@jabber-server} grows to 512K bytes, it will be saved as
1466 @file{foo@@jabber-server-2} and so on.  Although the example was
1467 presented with the per-contact history file strategy, history rotation
1468 works for both per-contact and global history logging strategies.
1470 @cindex Truncate
1471 @cindex Truncation
1472 If you also want to keep chat and groupchat buffers from growing too
1473 much, you can customize @code{jabber-alert-message-hooks} and
1474 @code{jabber-alert-muc-hooks} by adding truncation upon receiving
1475 message (@code{jabber-truncate-chat} and @code{jabber-truncate-muc}, respectively).
1476 The truncation limit may be set by customizing the variable
1477 @code{jabber-log-lines-to-keep}.
1479 @node Typing notifications, Roster import and export, Message history, Top
1480 @chapter Typing notifications
1482 There are two protocols for ``contact is typing'' notifications in
1483 Jabber.  jabber.el supports both of them, displaying various information
1484 in the header line of chat buffers.
1486 @section Message events
1488 @cindex Composing
1489 @cindex Delivered
1490 @cindex Displayed
1491 @vindex jabber-events-request-these
1492 @vindex jabber-events-confirm-delivered
1493 @vindex jabber-events-confirm-displayed
1494 @vindex jabber-events-confirm-composing
1496 The older protocol is called Message Events (@pxref{XEP-0022}).  Besides
1497 typing notification, it lets you know what happens to the messages you send.
1498 These states are possible:
1500 @itemize @bullet
1501 @item
1502 @samp{In offline storage} (the user will receive it on next logon)
1504 @item
1505 @samp{Delivered} to user's client (but not necessarily displayed)
1507 @item
1508 @samp{Displayed} to user
1510 @item
1511 User is @samp{typing a message}
1513 @end itemize
1515 The first state is only reported by servers; the other three are
1516 reported by clients.  jabber.el can report all three of them, and can
1517 display all four; not all clients support all states, though.
1519 If you don't want jabber.el to send out this information about you, set
1520 the variables @code{jabber-events-confirm-delivered},
1521 @code{jabber-events-confirm-displayed}, and/or
1522 @code{jabber-events-confirm-composing} to nil.  You can make jabber.el
1523 not to request such information by customizing
1524 @code{jabber-events-request-these}.
1526 @section Chat states
1528 @vindex jabber-chatstates-confirm
1530 The newer protocol is called Chat States (@pxref{XEP-0085}).  Rather
1531 than dealing with individual messages, it describes the state of the
1532 chat session between two people.  The following states are possible:
1534 @itemize @bullet
1535 @item
1536 Active (the default state, not displayed)
1538 @item
1539 Inactive
1541 @item
1542 Composing
1544 @item
1545 Paused (i.e., taking a short pause in composing)
1547 @item
1548 Gone
1550 @end itemize
1552 jabber.el can display all five states, but only ever sends ``active''
1553 and ``composing'' itself.
1555 To customize sending of chat states, customize the variable
1556 @code{jabber-chatstates-confirm}.
1559 @node Roster import and export, XMPP URIs, Typing notifications, Top
1560 @chapter Roster import and export
1562 @findex jabber-export-roster
1563 @findex jabber-import-roster
1564 @cindex Export roster
1565 @cindex Import roster
1567 Your roster is saved on the Jabber server, and usually not in the
1568 client.  However, you might want to save the roster to a file anyway.
1569 The most common reason for this is probably to copy it to another
1570 account.
1572 To export your roster to a file, type @kbd{M-x jabber-export-roster}.
1573 A buffer will appear in which you can edit the data to be exported.
1574 Changes done in that buffer will not affect your real roster.
1576 To import your roster from a file, type @kbd{M-x jabber-import-roster}.
1577 You will be able to edit the data before importing it.  Items not in the
1578 roster will be added; items in the roster will be modified to match
1579 imported data.  Subscriptions will be updated.
1581 The format of the roster files is the XML used by roster pushes in the
1582 XMPP protocol, in UTF-8 encoding.
1584 @node XMPP URIs, Customization, Roster import and export, Top
1585 @chapter XMPP URIs
1587 @cindex URIs
1588 @cindex URLs
1589 @cindex links
1590 @cindex xmpp: links
1591 @cindex Mozilla integration
1592 @cindex web browser integration
1593 @cindex browser integration
1594 @findex jabber-handle-uri
1596 Many web page authors use links starting with @samp{xmpp:} for JIDs.
1597 Your web browser could be made to pass such links to jabber.el, so that
1598 such links are actually useful and not just decoration.  How to do that
1599 depends on your operating system and web browser.
1601 For any of these methods, you need to make sure that you are running
1602 the Emacs server.  @xref{Emacs Server, , Using Emacs as a Server,
1603 emacs, GNU Emacs Manual}, though the simplest way to start it is to
1604 customize the variable @code{server-mode}.
1606 @section GNOME
1608 The jabber.el distribution contains a GConf schema which tries to set
1609 up handling of @samp{xmpp:} URIs.  It is installed by @samp{make
1610 install}.  This may or may not work, depending on your GConf
1611 configuration and other installed applications.  To check, try
1612 running:
1614 @example
1615 gconftool --get /desktop/gnome/url-handlers/xmpp/command
1616 @end example
1618 This should print something like:
1620 @example
1621 /usr/local/libexec/emacs-jabber-uri-handler "%s"
1622 @end example
1624 This setting is picked up by most GNOME or GTK based web browsers,
1625 including Firefox.
1627 @section Mozilla and Unix
1629 If you use a Mozilla-based web browser on a Unix-like operating
1630 system, and the GConf method above doesn't work, you can set it up
1631 manually by following these steps:
1633 @enumerate
1635 @item
1636 Note the path of the @file{emacs-jabber-uri-handler} file in the jabber.el
1637 distribution, and make sure it is executable.
1639 @item
1640 Set the Mozilla preference @samp{network.protocol-handler.app.xmpp} to
1641 the path of @file{emacs-jabber-uri-handler}.  There are two ways to do this:
1643 @itemize
1644 @item
1645 Go to the URL @samp{about:config}, right-click in the list, choose ``New
1646 string'', and enter @samp{network.protocol-handler.app.xmpp} and the
1647 path in the following dialogs.
1649 @item
1650 Open or create the file @file{user.js} in your Mozilla profile directory
1651 (in the same directory as @file{prefs.js}), and add the following line:
1653 @example
1654 user_pref("network.protocol-handler.app.xmpp",
1655   "@var{/path/to}/emacs-jabber-uri-handler");
1656 @end example
1658 Restart Mozilla for this change to take effect.
1659 @end itemize
1660 @end enumerate
1662 @section Other systems
1664 If you know how to pass an XMPP URI from your browser to the function
1665 @code{jabber-handle-uri}, your contribution for this section would be
1666 appreciated.
1668 @node Customization, Hacking and extending, XMPP URIs, Top
1669 @chapter Customization
1671 @findex jabber-customize
1672 @cindex Customization
1674 jabber.el is intended to be customizable for many tastes.  After all,
1675 this is Emacs.  To open a customization buffer for jabber.el, type
1676 @kbd{M-x jabber-customize}.
1678 @menu
1679 * Account settings::
1680 * Menu::
1681 * Customizing the roster buffer::
1682 * Customizing the chat buffer::
1683 * Customizing alerts::
1684 * Hooks::
1685 * Debug options::
1686 @end menu
1688 @node Account settings, Menu, , Customization
1689 @section Account settings
1691 @cindex Username
1692 @cindex Resource
1693 @cindex Password
1694 @cindex JID
1695 @cindex Network server
1697 @vindex jabber-account-list
1698 All account settings reside in the variable @code{jabber-account-list}.
1699 Usually you only need to set the JID, in the form
1700 @samp{username@@server} (or @samp{username@@server/resource} to use a
1701 specific resource name).  These are the other account options:
1703 @table @asis
1704 @item Disabled
1705 If the account is disabled, @code{jabber-connect-all} will not attempt
1706 to connect it.  You can still connect it manually with
1707 @code{jabber-connect}.
1709 @item Password
1710 You can set the password of the account, so you don't have to enter it
1711 when you connect.  Note that it will be stored unencrypted in your
1712 customization file.
1714 @item Network server
1715 If the JID of the Jabber server is not also its DNS name, you may have
1716 to enter the real DNS name or IP address of the server here.
1718 @item Connection type
1719 This option specifies whether to use an encrypted connection to the
1720 server.  Usually you want ``STARTTLS'' (@code{starttls}), which means
1721 that encryption is activated if the server supports it.  The other
1722 possibilities are ``unencrypted'' (@code{network}), which means just
1723 that, and ``legacy SSL/TLS'' (@code{ssl}), which means that encryption
1724 is activated on connection.
1726 @item Port
1727 If the Jabber server uses a nonstandard port, specify it here.  The
1728 default is 5222 for STARTTLS and unencrypted connections, and 5223 for
1729 legacy SSL connections.
1730 @end table
1732 @subsection For Google Talk
1734 @cindex Google Talk
1736 If you have a very new version of @file{dns.el},@footnote{Specifically,
1737 you need Emacs 23, or No Gnus 0.3.} you can connect to
1738 Google Talk just by specifying your Gmail address as JID.  Otherwise,
1739 you also need to set
1740 ``network server'' to @kbd{talk.google.com} and ``connection type'' to
1741 ``legacy SSL''.
1743 See also @ref{Gmail notifications}.
1745 @subsection Upgrade note
1747 Previous versions of jabber.el had the variables @code{jabber-username},
1748 @code{jabber-server}, @code{jabber-resource} and
1749 @code{jabber-password}.  These are now obsolete and not used.
1751 @node Menu, Customizing the roster buffer, Account settings, Customization
1752 @section Menu
1754 @vindex jabber-display-menu
1755 @cindex Menus
1756 There is a Jabber menu on the menu bar with some common commands.  By
1757 default, it is displayed only if you are connected, or if you have
1758 configured any accounts.  You can set the variable
1759 @code{jabber-display-menu} to @code{t} or @code{nil}, to have the menu
1760 displayed always or never, respectively.  The default behaviour
1761 corresponds to the setting @code{maybe}.
1763 @findex jabber-menu
1764 Earlier, the way to have the menu appear was to call the function
1765 @code{jabber-menu}.  It still works, but is considered obsolete.
1767 @node Customizing the roster buffer, Customizing the chat buffer, Menu, Customization
1768 @section Customizing the roster buffer
1770 @cindex Roster buffer, customizing
1772 @cindex Sorting the roster
1773 @vindex jabber-roster-sort-functions
1774 @code{jabber-roster-sort-functions} controls how roster items are
1775 sorted.  By default, contacts are sorted first by presence, and then
1776 alphabetically by displayed name.
1778 @vindex jabber-sort-order
1779 @code{jabber-sort-order} controls how roster items are sorted by
1780 presence.  It is a list containing strings corresponding to show
1781 status (@pxref{Presence}) or @code{nil}, which represents offline.
1783 @vindex jabber-show-resources
1784 @code{jabber-show-resources} controls when your contacts' resources
1785 are shown in the roster buffer.  The default is to show resources when
1786 a contact has more than one connected resource.
1788 @vindex jabber-roster-line-format
1789 @code{jabber-roster-line-format} specifies how the entry for each
1790 contact looks.  It is a string where some characters are special if
1791 preceded by a percent sign:
1793 @table @code
1794 @item %a
1795 Avatar of contact, if any
1796 @item %c
1797 @samp{*} if the contact is connected, or @samp{ } if not
1798 @item %u
1799 Subscription state---see below
1800 @item %n
1801 Nickname of contact, or JID if no nickname
1802 @item %j
1803 Bare JID of contact (without resource)
1804 @item %r
1805 Highest-priority resource of contact
1806 @item %s
1807 Availability of contact as a string ("Online", "Away" etc)
1808 @item %S
1809 Status string specified by contact
1810 @end table
1812 @code{jabber-roster-show-title} controls whether to show a "Jabber
1813 roster" string at the top of the roster buffer.  You need to run
1814 @kbd{M-x jabber-display-roster} after changing this variable to update
1815 the display.
1817 @code{%u} is replaced by one of the strings given by
1818 `jabber-roster-subscription-display'.
1820 @vindex jabber-resource-line-format
1821 @code{jabber-resource-line-format} is nearly identical, except that
1822 the values correspond to the values of the resource in question, and
1823 that the @code{%p} escape is available, which inserts the priority of
1824 the resource.
1826 @vindex jabber-roster-buffer
1827 @code{jabber-roster-buffer} specifies the name of the roster buffer.
1828 If you change this, the new name will be used the next time the roster
1829 is redisplayed.
1831 @vindex jabber-roster-show-bindings
1832 @code{jabber-roster-show-bindings} controls whether to show a list of
1833 keybindings at the top of the roster buffer.  You need to run @kbd{M-x
1834 jabber-display-roster} after changing this variable to update the display.
1836 @node Customizing the chat buffer, Customizing alerts, Customizing the roster buffer, Customization
1837 @section Customizing the chat buffer
1839 @cindex Chat buffer
1840 @cindex Timestamps
1841 @cindex Faces, chat buffer
1843 You can customize the look of the prompts in the chat buffer.  There
1844 are separate settings for local text (i.e. what you write) and foreign text
1845 (i.e. what other people write).
1847 @vindex jabber-chat-text-local
1848 @vindex jabber-chat-text-foreign
1849 @code{jabber-chat-text-local} and @code{jabber-chat-text-foreign}
1850 determine the faces used for chat messages.
1852 @vindex jabber-chat-prompt-local
1853 @vindex jabber-chat-prompt-foreign
1854 @vindex jabber-muc-colorize-local
1855 @vindex jabber-muc-colorize-foreign
1856 @vindex jabber-muc-nick-saturation
1857 @vindex jabber-muc-nick-value
1858 @vindex jabber-muc-participant-colors
1859 @cindex Nick coloring
1860 @code{jabber-chat-prompt-local} and @code{jabber-chat-prompt-foreign}
1861 determine the faces used for the prompts. You can also turn on
1862 automatic colorization of local (@code{jabber-muc-colorize-local})
1863 and/or foreign (@code{jabber-muc-colorize-foreign}) prompts. By
1864 default it is off. You can correct and save for future use auto-generated colors by
1865 customizing @code{jabber-muc-participant-colors}, @code{jabber-muc-nick-saturation} and
1866 @code{jabber-muc-nick-value}, if you wish.
1868 @vindex jabber-chat-local-prompt-format
1869 @vindex jabber-chat-foreign-prompt-format
1870 @code{jabber-chat-local-prompt-format} and
1871 @code{jabber-chat-foreign-prompt-format} determine what text is
1872 displayed in the prompts.  They are format strings, with the following
1873 special sequences defined:
1875 @table @code
1876 @item %t
1877 The time when the message was sent or received
1878 @item %n
1879 The nickname of the user.  For the foreign prompt, this is the name of
1880 the contact in the roster, or the JID if no name set.  For the local
1881 prompt, this is the username part of your JID.
1882 @item %u
1883 The username of the user (i.e. the first part of the JID).
1884 @item %r
1885 The resource.
1886 @item %j
1887 The bare JID of the user
1888 @end table
1890 @cindex Timestamp format
1891 @vindex jabber-chat-time-format
1892 @code{jabber-chat-time-format} defines how @code{%t} shows time.  Its
1893 format is identical to that passed to @code{format-time-string}.
1894 @xref{Time Conversion, , Time Conversion, elisp, GNU Emacs Lisp
1895 Reference Manual}.
1897 @vindex jabber-chat-delayed-time-format
1898 @code{jabber-chat-delayed-time-format} is used instead of
1899 @code{jabber-chat-time-format} for delayed messages (messages sent while
1900 you were offline, or fetched from history).  This way you can have short
1901 timestamps everywhere except where you need long ones.  You can always
1902 see the complete timestamp in a tooltip by hovering over the prompt with
1903 the mouse.
1905 @cindex Rare timestamps
1906 @vindex jabber-print-rare-time
1907 @vindex jabber-rare-time-format
1908 @vindex jabber-chat-text-local
1909 By default, timestamps are printed in the chat buffer every hour (at
1910 ``rare'' times).  This can be toggled with
1911 @code{jabber-print-rare-time}.  You can customize the displayed time by
1912 setting @code{jabber-rare-time-format}.  Rare timestamps will be printed
1913 whenever time formatted by that format string would change.
1915 @cindex Header line of chat buffers
1916 @vindex jabber-chat-header-line-format
1917 @vindex jabber-muc-header-line-format
1918 You can also customize the header line of chat buffers, by modifying
1919 the variable @code{jabber-chat-header-line-format}.  The format of
1920 that variable is the same as that of @code{mode-line-format} and
1921 @code{header-line-format}.  @xref{Mode Line Format, , Mode-Line
1922 Format, elisp, GNU Emacs Lisp Reference Manual}.  For MUC buffers,
1923 @code{jabber-muc-header-line-format} is used instead.
1925 @vindex jabber-chat-fill-long-lines
1926 @cindex Filling long lines in chat buffer
1927 The variable @code{jabber-chat-fill-long-lines} controls whether long
1928 lines in the chat buffer are wrapped.
1930 @node Customizing alerts, Hooks, Customizing the chat buffer, Customization
1931 @section Customizing alerts
1933 @cindex Alert hooks
1934 @findex define-jabber-alert
1936 When an event happens (currently including presence changes, incoming
1937 messages, and completed queries) you will usually want to be
1938 notified.  Since tastes in this area vary wildly, these alerts are
1939 implemented as hooks, so you can choose which ones you want, or write
1940 your own if none fit.
1942 Actually, if you don't want to write your own, stop reading this
1943 section and just read @ref{Standard alerts}.
1945 Many kinds of alerts consist in displaying a text message through a
1946 certain mechanism.  This text message is provided by a function which
1947 you can rewrite or replace.  If this function returns @code{nil}, no
1948 message is displayed, and non-textual alerts refrain from action.
1950 If you want to write alert hooks that do nothing except displaying the
1951 supplied message in some way, use the macro
1952 @code{define-jabber-alert}.  For example, if @var{foo} is a function
1953 that takes a string as an argument, write
1954 @example
1955 (define-jabber-alert foo
1956   "Display a message in a fooish way"
1957   'foo)
1958 @end example
1959 @noindent
1960 and all details will be taken care of for you.
1962 The hooks take different arguments depending on category.  However,
1963 they all have in common that the last argument is the result of the
1964 message function.  The message function for each category takes the
1965 same arguments as the corresponding hooks, except for that last
1966 argument.
1968 Alert hook contributions are very welcome.  You can send them to the
1969 mailing list, or to the Sourceforge patch tracker. @xref{Contacts}.
1971 Alert hooks are meant for optional UI things, that are subject to
1972 varying user tastes, and that can be toggled by simply adding or
1973 removing the function to and from the hook.  For other purposes, there
1974 are corresponding general hooks, that are defvars instead of
1975 defcustoms, and that are meant to be managed by Lisp code.  They have the
1976 same name as the alert hooks minus the @code{-alert} part,
1977 e.g. @code{jabber-message-hooks} vs @code{jabber-alert-message-hooks},
1978 etc.
1980 @menu
1981 * Standard alerts::
1982 * Presence alerts::
1983 * Message alerts::
1984 * MUC alerts::
1985 * Info alerts::
1986 @end menu
1988 @node Standard alerts, Presence alerts, , Customizing alerts
1989 @subsection Standard alerts
1991 @cindex Alerts
1992 @cindex Scroll
1994 Thirteen alerts are already written for all four alert categories.  These
1995 all obey the result from the corresponding message function.
1997 The @code{beep} alerts simply sound the terminal bell by calling
1998 @code{ding}.  They are disabled by default.
2000 The @code{echo} alerts display a message in the echo area by calling
2001 @code{message}.  They are enabled by default.
2003 The @code{switch} alerts switch to the buffer where the event occurred
2004 (chat buffer for incoming messages, roster buffer for presence
2005 changes, browse buffer for completed queries).  They are disabled by
2006 default.  Take care when using them, as they may interrupt your
2007 editing.
2009 The @code{display} alerts display but do not select the buffer in
2010 question, using the function @code{display-buffer}.  @xref{Choosing
2011 Window, , Choosing a Window for Display, elisp, GNU Emacs Lisp
2012 Reference Manual}, for information about customizing its behaviour.
2013 This is enabled by default for info requests.
2015 @cindex Sound effects
2016 The @code{wave} alerts play a sound file by calling
2017 @code{play-sound-file}.  No sound files are provided.  To use this,
2018 enter the names of the sound files in
2019 @code{jabber-alert-message-wave}, @code{jabber-alert-presence-wave}
2020 and @code{jabber-alert-info-wave}, respectively.  You can specify
2021 specific sound files for contacts matching a regexp in the variables
2022 @code{jabber-alert-message-wave-alist} and
2023 @code{jabber-alert-presence-wave-alist}.
2025 @cindex Screen terminal manager
2026 The @code{screen} alerts send a message through the Screen terminal
2027 manager@footnote{See @uref{http://www.gnu.org/software/screen/}.}.  They do no
2028 harm if called when you don't use Screen.
2030 @cindex Ratpoison window manager
2031 @cindex Window manager, Ratpoison
2032 The @code{ratpoison} alerts send a message through the Ratpoison
2033 window manager@footnote{See @uref{http://ratpoison.sourceforge.net/}.}.  They
2034 do no harm if used when you're not running X, but if you are running X
2035 with another window manager, the ratpoison processes will never exit.
2036 Emacs doesn't hold on to them, though.
2038 @cindex Sawfish window manager
2039 @cindex Window manager, Sawfish
2040 The @code{sawfish} alerts send a message through the Sawfish window
2041 manager.
2043 @cindex wmii window manager
2044 @cindex Window manager, wmii
2045 The @code{wmii} alerts display a message through the wmii window
2046 manager.
2048 @cindex awesome window manager
2049 @cindex Window manager, awesome
2050 The @code{awesome} alerts display a message through the awesome window
2051 manager. However, to work it needs naughty (i.e.
2052 @code{require("naughty")} in rc.lua).
2054 @cindex xmessage
2055 @vindex jabber-xmessage-timeout
2056 The @code{xmessage} alerts send a message through the standard
2057 @code{xmessage} tool.  The variable @code{jabber-xmessage-timeout}
2058 controls how long the alert appears.
2060 @cindex OSD
2061 The @code{osd} alerts send a message onto your screen using
2062 XOSD.@footnote{XOSD can be found at
2063 @uref{http://www.ignavus.net/software.html}.  You also need
2064 @file{osd.el} from @uref{http://www.brockman.se/software/osd.el}.}
2066 @cindex libnotify
2067 @cindex notification-daemon
2068 The @code{libnotify} alerts send a message onto your screen using
2069 @code{notification-daemon}.
2071 @cindex Festival speech synthesis
2072 @cindex Speech synthesis, Festival
2073 The @code{festival} alerts speak the message using the Emacs interface
2074 of the Festival speech synthesis system@footnote{See
2075 @uref{http://www.cstr.ed.ac.uk/projects/festival/}.}.
2077 @cindex Autoanswerer
2078 The @code{autoanswer} alert is kind of special: it will not show you
2079 message/muc alert, but instead will automaticaly answer to sender. See
2080 variable `jabber-autoanswer-alist' description for details.
2082 @cindex Scroll chat buffers
2083 Additionally, for one-to-one and MUC messages, there are @code{scroll}
2084 alerts (enabled by default), that aim to do the right thing with chat
2085 buffers that are visible but not active.  Sometimes you want point to
2086 scroll down, and sometimes not.  These functions should do what you
2087 mean; if they don't, it's a bug.
2089 Also, in MUC you can use a family of so-called ``personal'' alerts.
2090 They are like other MUC alerts, but fire only on incoming messages
2091 addresed directly to you (also known as ``private messages'').  One
2092 example of such an alert is @code{jabber-muc-echo-personal}, which shows
2093 a note for an MUC message only if it was addressed to you.
2095 Some of these functions are in the @file{jabber-alert.el} file, and the
2096 others are in their own files.  You can use them as templates or
2097 inspiration for your own alerts.
2099 @node Presence alerts, Message alerts, Standard alerts, Customizing alerts
2100 @subsection Presence alerts
2102 @vindex jabber-alert-presence-message-function
2103 @findex jabber-presence-default-message
2105 Set @code{jabber-alert-presence-message-function} to your desired
2106 function.  This function should look like:
2108 @example
2109 (defun @var{function} (@var{who} @var{oldstatus} @var{newstatus} @var{statustext})
2110    ...
2111    )
2112 @end example
2114 @var{who} is the JID symbol (@pxref{JID symbols}),
2115 @var{oldstatus} and @var{newstatus} are the previous and current
2116 stati, respectively, and @var{statustext} is the status message if
2117 provided, otherwise nil.
2119 @var{oldstatus} and @var{newstatus} can be one of @code{""}
2120 (i.e. online), @code{"away"}, @code{"xa"}, @code{"dnd"}, @code{"chat"},
2121 @code{"error"} and @code{nil} (i.e. offline).
2123 @var{newstatus} can also be one of @code{"subscribe"},
2124 @code{"subscribed"}, @code{"unsubscribe"} and @code{"unsubscribed"}.
2126 The default function, @code{jabber-presence-default-message}, returns
2127 @code{nil} if @var{oldstatus} and @var{newstatus} are the same, and in
2128 other cases constructs a message from the given data.
2130 Another function, @code{jabber-presence-only-chat-open-message},
2131 behave just like @code{jabber-presence-default-message}, but only if
2132 conversation buffer for according JID is already open. Use it to show
2133 presence notifications only for ``interesting'' contacts.
2135 All presence alert hooks take the same arguments plus the additional
2136 @var{proposed-alert}, which is the result of the specified message
2137 function.  This last argument is usually the only one they use.
2139 @node Message alerts, MUC alerts, Presence alerts, Customizing alerts
2140 @subsection Message alerts
2142 @vindex jabber-alert-message-function
2143 @findex jabber-message-default-message
2145 Set @code{jabber-alert-message-function} to your desired
2146 function.@footnote{Logically it should be
2147 @code{jabber-alert-message-message-function}, but that would be
2148 really ugly.}  This function should look like:
2150 @example
2151 (defun @var{function} (@var{from} @var{buffer} @var{text})
2152    ...
2153    )
2154 @end example
2156 @var{from} is the JID symbol (@pxref{JID symbols}), @var{buffer}
2157 is the buffer where the message is displayed, and @var{text} is the
2158 text of the message.
2160 The default function, @code{jabber-message-default-message}, returns
2161 ``Message from @var{person}'', where @var{person} is the name of the
2162 person if specified in the roster, otherwise the JID.
2164 All message alert hooks take the same arguments plus the additional
2165 @var{proposed-alert}, which is the result of the specified message
2166 function.
2168 @vindex jabber-message-alert-same-buffer
2169 If you don't want message alerts when the chat buffer in question is
2170 already the current buffer, set @code{jabber-message-alert-same-buffer}
2171 to nil.  This affects the behaviour of the default message function, so
2172 you'll have to reimplement this functionality if you write your own
2173 message function.
2175 @node MUC alerts, Info alerts, Message alerts, Customizing alerts
2176 @subsection MUC alerts
2178 @vindex jabber-alert-muc-function
2179 @vindex jabber-muc-alert-self
2180 @findex jabber-muc-default-message
2182 Set @code{jabber-alert-muc-function} to your desired
2183 function.  This function should look like:
2185 @example
2186 (defun @var{function} (@var{nick} @var{group} @var{buffer} @var{text})
2187    ...
2188    )
2189 @end example
2191 @var{nick} is the nickname, @var{group} is the JID of the group,
2192 @var{buffer} is the buffer where the message is displayed, and
2193 @var{text} is the text of the message.
2195 The default function, @code{jabber-muc-default-message}, returns
2196 ``Message from @var{nick} in @var{group}'' or ``Message in
2197 @var{group}'', the latter for messages from the room itself.
2199 All MUC alert hooks take the same arguments plus the additional
2200 @var{proposed-alert}, which is the result of the specified message
2201 function.
2203 By default, no alert is made for messages from yourself.  To change
2204 that, customize the variable @code{jabber-muc-alert-self}.
2206 @node Info alerts,  , MUC alerts, Customizing alerts
2207 @subsection Info alerts
2209 @vindex jabber-alert-info-message-function
2210 @findex jabber-info-default-message
2212 Info alerts are sadly underdeveloped.  The message function,
2213 @code{jabber-alert-info-message-function}, takes two arguments,
2214 @var{infotype} and @var{buffer}.  @var{buffer} is the buffer where
2215 something happened, and @var{infotype} is either @code{'roster} for
2216 roster updates, or @code{'browse} for anything that uses the browse
2217 buffer (basically anything except chatting).
2219 The info alert hooks take an extra argument, as could be expected.
2221 @node Hooks, Debug options, Customizing alerts, Customization
2222 @section Hooks
2224 jabber.el provides various hooks that you can use for whatever
2225 purpose.
2227 @table @code
2228 @vindex jabber-post-connect-hooks
2229 @item jabber-post-connect-hooks
2230 This hook is called after successful connection and authentication.
2231 By default it contains @code{jabber-send-current-presence}
2232 (@pxref{Presence}).  The hook functions get the connection object as
2233 argument.
2235 @vindex jabber-lost-connection-hooks
2236 @item jabber-lost-connection-hooks
2237 This hook is called when you have been disconnected for unknown
2238 reasons.  Usually this isn't noticed for quite a long time.
2240 The hook is called with one argument: the connection object.
2242 @vindex jabber-pre-disconnect-hook
2243 @item jabber-pre-disconnect-hook
2244 This hook is called just before voluntary disconnection, i.e. in
2245 @code{jabber-disconnect}, the command to disconnect all accounts.  There
2246 is currently no hook for disconnection of a single account.
2248 @vindex jabber-post-disconnect-hook
2249 @item jabber-post-disconnect-hook
2250 This hook is called after disconnection of any kind, possibly just
2251 after @code{jabber-lost-connection-hook}.
2253 @vindex jabber-chat-mode-hook
2254 @item jabber-chat-mode-hook
2255 This hook is called when a new chat buffer is created.
2257 @vindex jabber-browse-mode-hook
2258 @item jabber-browse-mode-hook
2259 This hook is called when a new browse buffer is created.
2261 @vindex jabber-roster-mode-hook
2262 @item jabber-roster-mode-hook
2263 This hook is called when the roster buffer is created.
2265 @end table
2267 @node Debug options,  , Hooks, Customization
2268 @section Debug options
2270 These settings provide a lot of information which is usually not very
2271 interesting, but can be useful for debugging various things.
2273 @vindex jabber-debug-log-xml
2274 @cindex XML console
2275 @code{jabber-debug-log-xml} activates XML console.  All XML stanzas
2276 sent and received are logged in the buffer @code{*-jabber-console-@var{jid}-*}
2277 (and to specified file if value is string).
2278 Also this buffer can be used to send XML stanzas manually.
2280 @vindex jabber-console-name-format
2281 Format for console buffer name. %s mean connection jid. Default value is
2282 @code{*-jabber-console-%s-*}.
2284 @vindex jabber-console-truncate-lines
2285 Maximum number of lines in console buffer. Use this option to prevent
2286 over bloating size of buffer.
2287 Set value to 0 if you want to keep all stanzas in buffer, but
2288 it's not recommended and may be unsafe.
2290 @vindex jabber-debug-keep-process-buffers
2291 Usually, the process buffers for Jabber connections are killed when the
2292 connection is closed, as they would otherwise just fill up memory.
2293 However, they might contain information about why the connection was
2294 lost.  To keep process buffers, set
2295 @code{jabber-debug-keep-process-buffers} to @code{t}.
2297 @node Hacking and extending, Protocol support, Customization, Top
2298 @chapter Hacking and extending
2300 This part of the manual is an attempt to explain parts of the source
2301 code.  It is not meant to discourage you from reading the code
2302 yourself and trying to figure it out, but as a guide on where to
2303 look.  Knowledge of Jabber protocols is assumed.
2305 @menu
2306 * Connection object::
2307 * XML representation::
2308 * JID symbols::
2309 * Listening for new requests::
2310 * Sending new requests::
2311 * Extending service discovery::
2312 * Chat printers::
2313 * Stanza chains::
2314 @end menu
2316 @node Connection object, XML representation, , Hacking and extending
2317 @section Connection object
2318 @cindex connection object
2319 @cindex account object
2320 @cindex FSM
2322 Each Jabber connection is represented by a ``connection object''.  This
2323 object has the form of a finite state machine, and is realized by the
2324 library @code{fsm}.@footnote{So far, this library is only distributed
2325 with jabber.el.  The author hopes that it could be useful for other
2326 projects, too.}
2328 The various states of this object are defined in @file{jabber-core.el}.
2329 They describe the way of the connection through the establishing of a
2330 network connection and authentication, and finally comes to the
2331 @code{:session-established} state where ordinary traffic takes place.
2333 These details are normally opaque to an extension author.  As will be
2334 noted, many functions expect to receive a connection object, and
2335 functions at extension points generally receive such an object in order
2336 to pass it on.  The following functions simply query the internal state
2337 of the connection:
2339 @defun jabber-connection-jid connection
2340 The @code{jabber-connection-jid} function returns the full JID of
2341 @var{connection}, i.e. a string of the form
2342 @code{"username@@server/resource"}.
2343 @end defun
2345 @defun jabber-connection-bare-jid connection
2346 The @code{jabber-connection-bare-jid} function returns the bare JID of
2347 @var{connection}, i.e. a string of the form @code{"username@@server"}.
2348 @end defun
2350 @node XML representation, JID symbols, Connection object, Hacking and extending
2351 @section XML representation
2353 @cindex XML representation
2355 The XML representation is the one generated by @file{xml.el} in Emacs,
2356 namely the following.  Each tag is a list.  The first element of the
2357 list is a symbol, the name of which is the name of the tag.  The
2358 second element is an alist of attributes, where the keys are the
2359 attribute names in symbol form, and the values are strings.  The
2360 remaining elements are the tags and data contained within the tag.
2362 For example,
2363 @example
2364 <foo bar='baz'>
2365 <frobozz/>Fnord
2366 </foo>
2367 @end example
2368 is represented as
2369 @example
2370 (foo ((bar . "baz")) (frobozz nil "") "Fnord
2372 @end example
2374 Note the empty string as the third element of the @code{frobozz}
2375 list.  It is not present in newer (post-21.3) versions of
2376 @file{xml.el}, but it's probably best to assume it might be there.
2378 @defun jabber-sexp2xml xml-sexp
2379 This function takes a tag in list representation, and returns its XML
2380 representation as a string.  You will normally not need to use this
2381 function directly, but it can be useful to see how your sexps will look
2382 when sent to the outer, non-Lisp, world.
2383 @end defun
2385 @defun jabber-send-sexp connection sexp
2386 This function sends @var{sexp}, an XMPP stanza in list representation,
2387 and sends it over @var{connection}.
2389 You will normally use the functions @code{jabber-send-presence},
2390 @code{jabber-send-message} and @code{jabber-send-iq} instead of this
2391 function.
2392 @end defun
2394 @node JID symbols, Listening for new requests, XML representation, Hacking and extending
2395 @section JID symbols
2397 @vindex jabber-jid-obarray
2398 JIDs are sometimes represented as symbols.  Its name is the JID, and it is interned
2399 in @code{jabber-jid-obarray}.  A roster entry can have the following
2400 properties:
2402 @table @code
2403 @item xml
2404 The XML tag received from the server on roster update
2406 @item name
2407 The name of the roster item (just like the XML attribute)
2409 @item subscription
2410 The subscription state; a string, one of @code{"none"}, @code{"from"},
2411 @code{"to"} and @code{"both"}
2413 @item ask
2414 The ask state; either @code{nil} or @code{"subscribe"}
2416 @item groups
2417 A list of strings (possibly empty) containing all the groups the
2418 contact is in
2420 @item connected
2421 Boolean, true if any resource is connected
2423 @item show
2424 Presence show value for highest-priority connected resource; a string,
2425 one of @code{""} (i.e. online), @code{"away"}, @code{"xa"},
2426 @code{"dnd"}, @code{"chat"}, @code{"error"} and @code{nil}
2427 (i.e. offline)
2429 @item status
2430 Presence status message for highest-priority connected resource
2432 @item resources
2433 Alist.  Keys are strings (resource names), values are plists with
2434 properties @code{connected}, @code{show}, @code{status} and
2435 @code{priority}.
2437 @end table
2439 Incoming presence information is inserted in @code{resources}, and the
2440 information from the resource with the highest priority is inserted in
2441 @code{show} and @code{status} by the function
2442 @code{jabber-prioritize-resources}.
2444 @node Listening for new requests, Sending new requests, JID symbols, Hacking and extending
2445 @section Listening for new requests
2447 @findex jabber-send-iq
2448 @findex jabber-process-iq
2449 @findex jabber-signal-error
2450 @vindex jabber-iq-get-xmlns-alist
2451 @vindex jabber-iq-set-xmlns-alist
2453 To listen for new IQ requests, add the appropriate entry in
2454 @code{jabber-iq-get-xmlns-alist} or @code{jabber-iq-set-xmlns-alist}.
2455 The key is the namespace of the request, and the value is a function
2456 that takes two arguments, the connection object, and
2457 the entire IQ stanza in list format.
2458 @code{jabber-process-iq} reads these alists to determine which
2459 function to call on incoming packets.
2461 For example, the Ad-Hoc Commands module contains the following:
2463 @example
2464 (add-to-list 'jabber-iq-set-xmlns-alist
2465              (cons "http://jabber.org/protocol/commands"
2466                    'jabber-ahc-process))
2467 @end example
2469 To send a response to an IQ request, use @samp{(jabber-send-iq
2470 @var{connection} @var{sender} "result" @var{query} nil nil nil nil
2471 @var{id})}, where @var{query} is the query in list format.
2472 @code{jabber-send-iq} will encapsulate the query in an IQ packet with
2473 the specified id.
2475 To return an error to the Jabber entity that sent the query, use
2476 @code{jabber-signal-error}.  The signal is caught by
2477 @code{jabber-process-iq}, which takes care of sending the error.
2478 You can also use @code{jabber-send-iq-error}.
2480 @node Sending new requests, Extending service discovery, Listening for new requests, Hacking and extending
2481 @section Sending new requests
2483 @findex jabber-send-iq
2484 @findex jabber-process-iq
2486 To send an IQ request, use @code{jabber-send-iq}.  It will generate an
2487 id, and create a mapping for it for use when the response comes.  The
2488 syntax is:
2490 @example
2491 (jabber-send-iq @var{connection} @var{to} @var{type} @var{query}
2492                 @var{success-callback} @var{success-closure}
2493                 @var{failure-callback} @var{failure-closure})
2494 @end example
2496 @var{success-callback} will be called if the response is of type
2497 @samp{result}, and @var{failure-callback} will be called if the response
2498 is of type @samp{error}.  Both callbacks take three arguments, the
2499 connection object, the IQ stanza of the response, and the corresponding
2500 closure item earlier passed to @code{jabber-send-iq}.
2502 @findex jabber-report-success
2503 @findex jabber-process-data
2504 Two standard callbacks are provided.  @code{jabber-report-success} takes
2505 a string as closure item, and reports success or failure in the echo
2506 area by appending either @samp{succeeded} or @samp{failed} to the
2507 string.  @code{jabber-process-data} prepares a browse buffer.  If its
2508 closure argument is a function, it calls that function with point in
2509 this browse buffer.  If it's a string, it prints that string along with
2510 the error message in the IQ response.  If it's anything else
2511 (e.g. @code{nil}), it just dumps the XML in the browse buffer.
2513 Examples follow.  This is the hypothetical Jabber protocol ``frob'',
2514 for which only success report is needed:
2515 @example
2516 (jabber-send-iq connection
2517                 "someone@@somewhere.org" "set"
2518                 '(query ((xmlns . "frob")))
2519                 'jabber-report-success "Frobbing"
2520                 'jabber-report-success "Frobbing")
2521 @end example
2522 This will print ``Frobbing succeeded'' or ``Frobbing failed: @var{reason}'',
2523 respectively, in the echo area.
2525 The protocol ``investigate'' needs to parse results and show them in a
2526 browse buffer:
2527 @example
2528 (jabber-send-iq connection
2529                 "someone@@somewhere.org" "get"
2530                 '(query ((xmlns . "investigate")))
2531                 'jabber-process-data 'jabber-process-investigate
2532                 'jabber-process-data "Investigation failed")
2533 @end example
2534 Of course, the previous example could have used
2535 @code{jabber-report-success} for the error message.  It's a matter of
2536 UI taste.
2538 @node Extending service discovery, Chat printers, Sending new requests, Hacking and extending
2539 @section Service discovery
2541 Service discovery (XEP-0030) is a Jabber protocol for communicating
2542 features supported by a certain entity, and items affiliated with an
2543 entity.  jabber.el has APIs for both providing and requesting such
2544 information.
2547 @menu
2548 * Providing info::
2549 * Requesting info::
2550 @end menu
2552 @node Providing info, Requesting info, , Extending service discovery
2553 @subsection Providing info
2555 Your new IQ request handlers will likely want to advertise their
2556 existence through service discovery.
2558 @vindex jabber-advertised-features
2559 To have an additional feature reported in response to disco info
2560 requests, add a string to @code{jabber-advertised-features}.
2562 @vindex jabber-disco-items-nodes
2563 @vindex jabber-disco-info-nodes
2564 By default, the service discovery functions reject all requests
2565 containing a node identifier with an ``Item not found'' error.  To
2566 make them respond, add the appropriate entries to
2567 @code{jabber-disco-items-nodes} and @code{jabber-disco-info-nodes}.
2568 Both variables work in the same way.  They are alists, where the keys
2569 are the node names, and the values are lists of two items.
2571 The first item is the data to return --- either a list, or a function
2572 taking the connection object and the entire IQ stanza and returning a
2573 list; in either case this list contains the XML nodes to include in the
2574 @code{<query/>} node in the response.
2576 @findex jabber-my-jid-p
2577 The second item is the access control function.  An access control
2578 function receives the connection object and a JID as arguments, and
2579 returns non-nil if access is to be granted.  If nil is specified
2580 instead of a function, access is always granted.  One such function is
2581 provided, @code{jabber-my-jid-p}, which grants access for JIDs where
2582 the username and server (not necessarily resource) are equal to those
2583 of the user, or one of the user's configured accounts.
2585 @node Requesting info,  , Providing info, Extending service discovery
2586 @subsection Requesting info
2588 jabber.el has a facility for requesting disco items and info.  All
2589 positive responses are cached.
2591 To request disco items or info from an entity, user one of these
2592 functions:
2594 @defun jabber-disco-get-info jc jid node callback closure-data &optional force
2595 Get disco information for @var{jid} and @var{node}.  A request is sent
2596 asynchronously on the connection @var{jc}.  When the response arrives,
2597 @var{callback} is called with three arguments: @var{jc},
2598 @var{closure-data}, and the result.  The result may be retrieved from
2599 the cache, unless @var{force} is non-nil.
2601 If the request was successful, or retrieved from cache, it looks like
2602 @code{(@var{identities} @var{features})}, where @var{identities} and
2603 @var{features} are lists.  Each identity is @code{["@var{name}"
2604 "@var{category}" "@var{type}"]}, and each feature is a string denoting
2605 the namespace of the feature.
2607 If the request failed, the result is an @code{<error/>} node.
2608 @end defun
2610 @defun jabber-disco-get-items jc jid node callback closure-data &optional force
2611 Get disco information for @var{jid} and @var{node}.  A request is sent
2612 asynchronously on the connection @var{jc}.  When the response arrives,
2613 @var{callback} is called with three arguments: @var{jc},
2614 @var{closure-data}, and the result.  The result may be retrieved from
2615 the cache, unless @var{force} is non-nil.
2617 If the request was successful, or retrieved from cache, the result is
2618 a list of items, where each item is @code{["@var{name}" "@var{jid}"
2619 "@var{node}"]}.  The values are either strings or nil.
2621 If the request failed, the result is an @code{<error/>} node.
2622 @end defun
2624 If you only want to see what is in the cache, use one of the following
2625 functions.  They don't use a callback, but return the result directly.
2627 @defun jabber-disco-get-info-immediately jid node
2628 Return cached disco information for @var{jid} and @var{node}, or nil
2629 if the cache doesn't contain this information.  The result is the same
2630 as for @code{jabber-disco-get-info}.
2631 @end defun
2633 @defun jabber-disco-get-items-immediately jid node
2634 Return cached disco items for @var{jid} and @var{node}, or nil
2635 if the cache doesn't contain this information.  The result is the same
2636 as for @code{jabber-disco-get-items}.
2637 @end defun
2639 In the future, this facility will be expanded to provide information
2640 acquired through XEP-0115, Entity capabilities, which is a protocol
2641 for sending disco information in @code{<presence/>} stanzas.
2643 @node Chat printers, Stanza chains, Extending service discovery, Hacking and extending
2644 @section Chat printers
2646 @vindex jabber-chat-printers
2647 @vindex jabber-muc-printers
2648 @vindex jabber-body-printers
2649 @cindex Chat printers
2650 @cindex Body printers
2652 Chat printers are functions that print a certain aspect of an incoming
2653 message in a chat buffer.  Included are functions for printing subjects
2654 (@code{jabber-chat-print-subject}), bodies
2655 (@code{jabber-chat-print-body}, and @code{jabber:x:oob}-style URLs
2656 (@code{jabber-chat-print-url}).  The functions in
2657 @code{jabber-chat-printers} are called in order, with the entire
2658 @code{<message/>} stanza as argument.  As described in the docstring
2659 of @code{jabber-chat-printers}, these functions are run in one of two
2660 modes: @code{printp}, in which they are supposed to return true if
2661 they would print anything, and @code{insert}, in which they are
2662 supposed to actually print something, if appropriate, using the
2663 function @code{insert}.
2665 For MUC, the functions in @code{jabber-muc-printers} are prepended to
2666 those in @code{jabber-chat-printers}.
2668 Body printers are a subgroup of chat printers.  They are exclusive; only
2669 one of them applies to any given message.  The idea is that
2670 ``higher-quality'' parts of the message override pieces included for
2671 backwards compatibility.  Included are @code{jabber-muc-print-invite}
2672 and @code{jabber-chat-normal-body}; functions for XHTML-IM and PGP
2673 encrypted messages may be written in the future.  The functions in
2674 @code{jabber-body-printers} are called in order until one of them
2675 returns non-nil.
2677 @node Stanza chains,  , Chat printers, Hacking and extending
2678 @section Stanza chains
2680 @vindex jabber-message-chain
2681 @vindex jabber-iq-chain
2682 @vindex jabber-presence-chain
2684 If you really need to get under the skin of jabber.el, you can add
2685 functions to the lists @code{jabber-message-chain},
2686 @code{jabber-iq-chain} and @code{jabber-presence-chain}.  The
2687 functions in these lists will be called in order when an XML stanza of
2688 the corresponding type arrives, with the connection object and the
2689 entire XML stanza passed as arguments.  Earlier functions can modify
2690 the stanza to change the behaviour of downstream functions, but
2691 remember: with great power comes great responsibility.
2693 @node Protocol support, Concept index, Hacking and extending, Top
2694 @appendix Protocol support
2696 @cindex Supported protocols
2698 These are the protocols currently supported (in full or partially) by
2699 jabber.el.
2701 @menu
2702 * RFC 3920::                    XMPP-CORE
2703 * RFC 3921::                    XMPP-IM
2704 * XEP-0004::                    Data Forms
2705 * XEP-0012::                    Last Activity
2706 * XEP-0020::                    Feature Negotiation
2707 * XEP-0022::                    Message Events
2708 * XEP-0030::                    Service Discovery
2709 * XEP-0045::                    Multi-User Chat
2710 * XEP-0049::                    Private XML Storage
2711 * XEP-0050::                    Ad-Hoc Commands
2712 * XEP-0054::                    vcard-temp
2713 * XEP-0055::                    Jabber Search
2714 * XEP-0065::                    SOCKS5 Bytestreams
2715 * XEP-0066::                    Out of Band Data
2716 * XEP-0068::                    Field Standardization for Data Forms
2717 * XEP-0077::                    In-Band Registration
2718 * XEP-0078::                    Non-SASL Authentication
2719 * XEP-0082::                    Jabber Date and Time Profiles
2720 * XEP-0085::                    Chat State Notifications
2721 * XEP-0086::                    Error Condition Mappings
2722 * XEP-0090::                    Entity Time
2723 * XEP-0091::                    Delayed Delivery
2724 * XEP-0092::                    Software Version
2725 * XEP-0095::                    Stream Initiation
2726 * XEP-0096::                    File Transfer
2727 * XEP-0146::                    Remote Controlling Clients
2728 * XEP-0153::                    vCard-Based Avatars
2729 * XEP-0199::                    XMPP Ping
2730 * XEP-0245::                    The /me Command
2731 @end menu
2733 @node RFC 3920, RFC 3921, , Protocol support
2734 @section RFC 3920 (XMPP-CORE)
2736 Most of RFC 3920 is supported, with the following exceptions.
2738 SASL is supported only when an external SASL library from FLIM or Gnus
2739 is present.  As SASL is an essential part to XMPP, jabber.el will send
2740 pre-XMPP stream headers if it is not available.
2742 None of the stringprep profiles are implemented.  jabber.el changes
2743 JIDs to lowercase internally; that's all.
2745 jabber.el doesn't interpret namespace prefixes.
2747 The @code{xml:lang} attribute is neither interpreted nor generated.
2749 SRV records are used if a modern version of @code{dns.el} is installed.
2751 @node RFC 3921, XEP-0004, RFC 3920, Protocol support
2752 @section RFC 3921 (XMPP-IM)
2754 Most of RFC 3921 is supported, with the following exceptions.
2756 Messages of type ``headline'' are not treated in any special way.
2758 The @code{<thread/>} element is not used or generated.
2760 Sending ``directed presence'' is supported; however, presence stanzas
2761 received from contacts not in roster are ignored.
2763 Privacy lists are not supported at all.
2765 jabber.el doesn't support XMPP-E2E or ``im:'' CPIM URIs.
2767 @node XEP-0004, XEP-0012, RFC 3921, Protocol support
2768 @section XEP-0004 (Data Forms)
2770 XEP-0004 support is good enough for many purposes.  Limitations are
2771 the following.
2773 Forms in incoming messages are not interpreted.  See each specific
2774 protocol for whether forms are accepted in that context.
2776 ``Cancel'' messages are probably not consistently generated when they
2777 should be.  This is partly a paradigm clash, as jabber.el doesn't use
2778 modal dialog boxes but buffers which can easily be buried.
2780 @code{<required/>} elements are not enforced.
2782 The field types ``jid-single'', ``jid-multi'' and ``list-multi'' are
2783 not implemented, due to programmer laziness.  Let us know if you need
2784 them.
2786 @node XEP-0012, XEP-0020, XEP-0004, Protocol support
2787 @section XEP-0012 (Last Activity)
2789 jabber.el can generate all three query types described in the protocol.
2790 However, it does not answer to such requests.
2792 @node XEP-0020, XEP-0022, XEP-0012, Protocol support
2793 @section XEP-0020 (Feature Negotiation)
2795 There are no known limitations or bugs in XEP-0020 support.
2797 @node XEP-0022, XEP-0030, XEP-0020, Protocol support
2798 @section XEP-0022 (Message Events)
2800 jabber.el understands all four specified kinds of message events
2801 (offline, delivered, displayed, and composing) and by default requests
2802 all of them.  It also reports those three events that make sense for
2803 clients.
2805 @node XEP-0030, XEP-0045, XEP-0022, Protocol support
2806 @section XEP-0030 (Service Discovery)
2808 Service discovery is supported, both as client and server.  When used in
2809 the code, service discovery results are cached indefinitely.
2811 @node XEP-0045, XEP-0049, XEP-0030, Protocol support
2812 @section XEP-0045 (Multi-User Chat)
2814 jabber.el supports parts of XEP-0045.  Entering, leaving and chatting
2815 work.  So do invitations and private messages.  Room configuration is
2816 supported.  Changing roles of participants (basic moderation) is
2817 implemented, as is changing affiliations, but requesting affiliation
2818 lists is not yet supported.
2820 @node XEP-0049, XEP-0050, XEP-0045, Protocol support
2821 @section XEP-0049 (Private XML Storage)
2823 jabber.el contains an implementation of XEP-0049; however it is not used
2824 for anything right now.
2826 @node XEP-0050, XEP-0054, XEP-0049, Protocol support
2827 @section XEP-0050 (Ad-Hoc Commands)
2829 jabber.el is probably the first implementation of XEP-0050 (see
2830 @uref{http://article.gmane.org/gmane.network.jabber.devel/21413, post
2831 on jdev from 2004-03-10}).  Both the client and server parts are
2832 supported.
2834 @node XEP-0054, XEP-0055, XEP-0050, Protocol support
2835 @section XEP-0054 (vcard-temp)
2837 Both displaying other users' vCards and editing your own vCard are
2838 supported.  The implementation tries to follow the schema in the XEP
2839 accurately.
2841 @node XEP-0055, XEP-0065, XEP-0054, Protocol support
2842 @section XEP-0055 (Jabber Search)
2844 XEP-0055 is supported, both with traditional fields and with Data Forms
2845 (@pxref{XEP-0004}).  As the traditional fields specified by the XEP is a
2846 subset of those allowed in XEP-0077, handling of those two form types
2847 are merged.  @xref{XEP-0077}.
2849 @node XEP-0065, XEP-0066, XEP-0055, Protocol support
2850 @section XEP-0065 (SOCKS5 Bytestreams)
2852 XEP-0065 is supported.  Currently jabber.el cannot act as a server, not
2853 even on on Emacsen that support server sockets (GNU Emacs 22 and up).
2854 Therefore it relies on proxies.  Proxies have to be entered and queried
2855 manually.
2857 Psi's ``fast mode''
2858 (@uref{http://delta.affinix.com/specs/stream.html}), which gives
2859 greater flexibility with regards to NAT, is not implemented.
2861 @node XEP-0066, XEP-0068, XEP-0065, Protocol support
2862 @section XEP-0066 (Out of Band Data)
2864 jabber.el will display URLs sent in message stanzas qualified by
2865 the @code{jabber:x:oob} namespace, as described in this XEP.  Sending
2866 such URLs or doing anything with iq stanzas (using the
2867 @code{jabber:iq:oob} namespace) is not supported.
2869 @node XEP-0068, XEP-0077, XEP-0066, Protocol support
2870 @section XEP-0068 (Field Standardization for Data Forms)
2872 XEP-0068 is only used in the context of creating a new Jabber account,
2873 to prefill the username field of the registration form.
2875 @node XEP-0077, XEP-0078, XEP-0068, Protocol support
2876 @section XEP-0077 (In-Band Registration)
2878 In-band registration is supported for all purposes.  That means
2879 registering a new Jabber account, changing Jabber password, removing a
2880 Jabber account, registering with a service, and cancelling
2881 registration to a service.  Data forms are supported as well.  URL
2882 redirections are not.
2884 jabber.el will not prevent or alert a user trying to change a password
2885 over an unencrypted connection.
2887 @node XEP-0078, XEP-0082, XEP-0077, Protocol support
2888 @section XEP-0078 (Non-SASL Authentication)
2890 Non-SASL authentication is supported, both plaintext and digest.
2891 Digest is preferred, and a warning is displayed to the user if only
2892 plaintext is available.
2894 @node XEP-0082, XEP-0085, XEP-0078, Protocol support
2895 @section XEP-0082 (Jabber Date and Time Profiles)
2897 The DateTime profile of XEP-0082 is supported.  Currently this is only
2898 used for file transfer.
2900 @node XEP-0085, XEP-0086, XEP-0082, Protocol support
2901 @section XEP-0085 (Chat State Notifications)
2903 XEP-0085 is partially supported. Currently only active/composing
2904 notifications are @emph{sent} though all five notifications are handled on
2905 receipt.
2907 @node XEP-0086, XEP-0090, XEP-0085, Protocol support
2908 @section XEP-0086 (Error Condition Mappings)
2910 Legacy errors are interpreted, but never generated.  XMPP style error
2911 messages take precedence when errors are reported to the user.
2913 @node XEP-0090, XEP-0091, XEP-0086, Protocol support
2914 @section XEP-0090 (Entity Time)
2916 jabber.el can query other entities for their time, and return the
2917 current time to those who ask.
2919 @node XEP-0091, XEP-0092, XEP-0090, Protocol support
2920 @section XEP-0091 (Delayed Delivery)
2922 The time specified on delayed incoming messages is interpreted, and
2923 displayed in chat buffers instead of the current time.
2925 @node XEP-0092, XEP-0095, XEP-0091, Protocol support
2926 @section XEP-0092 (Software Version)
2928 The user can request the version of any entity.  jabber.el answers
2929 version requests to anyone, giving ``jabber.el'' as name, and the
2930 Emacs version as OS.
2932 @node XEP-0095, XEP-0096, XEP-0092, Protocol support
2933 @section XEP-0095 (Stream Initiation)
2935 XEP-0095 is supported, both incoming and outgoing, except that jabber.el
2936 doesn't check service discovery results before sending a stream
2937 initiation request.
2939 @node XEP-0096, XEP-0146, XEP-0095, Protocol support
2940 @section XEP-0096 (File Transfer)
2942 Both sending and receiving files is supported.  If a suitable program is
2943 found, MD5 hashes of outgoing files are calculated and sent.  However,
2944 hashes of received files are not checked.  Ranged transfers are not
2945 supported.  In-band bytestreams are not yet supported, even though
2946 XEP-0096 requires them.
2948 @node XEP-0146, XEP-0153, XEP-0096, Protocol support
2949 @section XEP-0146 (Remote Controlling Clients)
2951 The ``set-status'' command in XEP-0146 is supported.
2953 @node XEP-0153, XEP-0199, XEP-0146, Protocol support
2954 @section XEP-0153 (vCard-Based Avatars)
2956 vCard-based avatars are supported, both publishing and displaying.  The
2957 pixel size limits on avatars are not enforced.
2959 @node XEP-0199, XEP-0245, XEP-0153, Protocol support
2960 @section XEP-0199 (XMPP Ping)
2962 XEP-0199 is fully supported.
2964 @node XEP-0245, ,XEP-0199, Protocol support
2965 @section XEP-0245 (/me Command)
2967 XEP-0245 is partially supported (except XHTML-IM).
2969 @node Concept index, Function index, Protocol support, Top
2970 @unnumbered Concept index
2972 @printindex cp
2974 @node Function index, Variable index, Concept index, Top
2975 @unnumbered Function index
2977 @printindex fn
2979 @node Variable index,  , Function index, Top
2980 @unnumbered Variable index
2982 @printindex vr
2984 @bye
2986 @ignore
2987    arch-tag: 995bf3da-0e87-4b15-895a-1e85fac139a2
2988 @end ignore