jabber.el manual
****************

This manual is for jabber.el, version 0.8.0.

   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Magnus Henoch, Tom
Berger.

     Permission is granted to make and distribute verbatim copies or
     modified versions of this manual, provided the copyright notice and
     this permission notice are preserved on all copies.

1 Introduction
**************

jabber.el is an XMPP (Jabber) client running under Emacs.  For more
information on the open instant messaging protocol, please visit
<http://xmpp.org>.

   As a XMPP client, jabber.el is mostly just a face in the crowd,
except that it uses buffers where GUI clients have windows.  There is a
roster buffer, and to chat with someone you open a chat buffer, and
there are buffers for interaction with servers and services.  Then
again, jabber.el delivers excellent console performance and customizable
hooks (if you have speech synthesizer software, hook it up to your
presence alerts).

   jabber.el does not yet support PGP encryption, sending and receiving
roster items, and various other things.

1.1 Contacts
============

   * There is a web page at <http://emacs-jabber.sf.net/>.

   * There is a Sourceforge project page at
     <http://sourceforge.net/projects/emacs-jabber>, with bug and patch
     trackers.

   * There is a mailing list:
     <emacs-jabber-general@lists.sourceforge.net>,
     <https://lists.sourceforge.net/lists/listinfo/emacs-jabber-general>,
     <http://dir.gmane.org/gmane.emacs.jabber.general>

   * There is a chat room, 'jabber.el@conference.jabber.se'.  If you
     have successfully connected, you can join it by typing 'M-x
     jabber-muc-join' and entering the address.

2 Basic operation
*****************

This chapter is intended as an introduction to basic usage of jabber.el.
If you have used XMPP before and are familiar with the terminology, you
might find it a bit too basic--in that case, just skim it, making sure
to pick up the commands mentioned.

   I'll assume that you have already successfully installed jabber.el;
if not, consult the 'README' file.  Also, make sure you have '(require
'jabber)' or '(load "jabber-autoloads")' in your '.emacs'.

   There are a handful of global keybindings for common commands.  They
start with 'C-x C-j', and you can get a list of them by typing 'C-x C-j
C-h'.

2.1 Do you have a Jabber account?
=================================

Jabber has become rather popular as an instant messaging technology.
Several sites use it, but often not under the names "Jabber" or "XMPP".
Examples:

   * Google Talk uses Jabber.  If you have a Gmail address, you can use
     it as a Jabber ID. See Account settings, for Google-specific
     configuration.

   * LJ Talk (of Livejournal) uses Jabber.  Your Jabber ID is
     'LJUSERNAME@livejournal.com'.

2.2 Registering an account
==========================

If you do not yet have a Jabber account, you can register one.  The
registration processes for various servers differ, but many servers
support so-called "in-band registration", which is described in this
section.

   To register an account, type 'C-u M-x jabber-connect' and enter your
desired JID in the form 'USERNAME@SERVER'.  You will be presented with a
registration form to fill out and send.  There the username you chose
will be prefilled.  After registration, you can connect to the server as
usual.

2.3 Connecting
==============

Now, type 'C-x C-j C-c' and enter your JID and password.  If you
successfully connect, jabber.el will download your roster and display it
in a buffer called '*-jabber-roster-*'.

   By default, you will appear as "online" to your contacts.  To change
this to e.g.  "away", type 'M-x jabber-send-presence' or 'C-x C-j C-p'.
See Presence, for more information.

   To disconnect, type 'M-x jabber-disconnect' or 'C-x C-j C-d'.  Use
'M-x jabber-disconnect-one' to disconnect just one account (or just type
'C-u C-x C-j C-d').

   If you don't want to type your JID every time you connect, you can
save it in the variable 'jabber-account-list'.  See Account settings.
If you configure more than one account, all of them will be
connected when you type 'C-x C-j C-c', as that key is bound to
'jabber-connect-all'.  To connect only one account, possibly one that's
not in your list, type 'M-x jabber-connect' or 'C-u C-x C-j C-c'.

2.4 Chatting
============

There are several ways to open a chat buffer.  The shortest way is to
put point over the person you want to chat with in the roster display
and hit RET.

   You can also use the function 'jabber-chat-with'.  This function is
bound to 'C-x C-j C-j' in the global keymap.  You will be asked to enter
a JID in the minibuffer.  You can also enter the roster name of one of
your contacts.  All JIDs and names in your roster can be tab-completed.

   You can also use menus to access commands.  In the roster display,
you can access several menus through keystrokes or mouse clicks.  You
can bring one big menu up by pressing the second mouse button, or you
can bring up the "chat menu" by typing 'C-c C-c'.  If you do the latter
while point is on a roster entry, that entry will be the default value
when you are asked for whom to chat with.

   Now, try opening a chat with someone.  A buffer named
'*-jabber-chat-:-PERSON-*' will be created and selected.  Type your
message at the end of the buffer, and hit 'RET' to send it.  To include
a newline in your message, use 'C-j'.

   When you receive a message from someone, you will see a red indicator
in the mode line.  You can click this indicator with the mouse, or type
'C-x C-j C-l' to switch to the relevant buffer.  See Tracking activity.

2.5 Presence
============

"Presence" is the Jabber term for letting other people know that you are
online, and additionally how "available" you are.  There are three
elements to presence: availability state (called "show"), status
message, and priority.

   Your show state may either be empty (meaning simply "online"), or one
of 'away', 'xa', 'dnd' and 'chat', meaning "away", "extended away" (i.e.
away for an extended period), "do not disturb", and "free for chat",
respectively.  This information is available to everyone subscribing to
your presence, but technically it does not restrict anyone's actions.
You can chat with people even if you claim to be away.

   The status message is a short text complementing your show status,
such as "at home", "working", "phone", "playing games" or whatever you
want.  It is sent to everyone subscribing to your presence, but not all
clients prominently display it to the user.

   The priority is only interesting if you are running more than one
Jabber client at a time accessing the same account.  See Resources and priority.

   To set your presence, use the function 'jabber-send-presence' (bound
to 'C-x C-j C-p').  It can be called both interactively and in Lisp
code.  For the latter case, use something like '(jabber-send-presence
"away" "idle for 10 minutes" 10)'.  There are a few shortcuts:
'C-x C-j C-a'
     Send "away" presence (with prefix argument, specify status text)
'C-x C-j C-x'
     Send "extended away" presence (with prefix argument, specify status
     text)
'C-x C-j C-o'
     Send default presence (see below)

   By default, jabber.el sets your presence when you connect.  If you
want it not to do that, remove 'jabber-send-current-presence' from
'jabber-post-connect-hooks'.  If you want to change the presence that is
sent, change the variables 'jabber-default-show',
'jabber-default-status' and 'jabber-default-priority'.

   With jabber.el, you can set your presence remotely.  See Ad-Hoc Commands.

2.5.1 Resources and priority
----------------------------

Every connection to an account has a specific name, a "resource".  The
account itself has a JID of the form 'USERNAME@SERVER' (a "bare JID"),
but the connections have JIDs of the form 'USERNAME@SERVER/RESOURCE' (a
"full JID"). You can choose the resource name yourself by entering a JID
of the latter form at the connection prompt (see Connecting), or by
configuring it in 'jabber-account-list' (see Account settings)

   Each session has a "priority".  The priority determines what happens
when a message is sent to the bare JID (i.e.  without specifying what
connection should receive message).  Such messages are delivered to the
connection with the highest non-negative priority value.  If there are
no connections, or if all connections have negative priority, the
message is either stored on the server for later delivery or bounced to
the sender, depending on the server configuration.

   If there are several connections with the same priority, the
behaviour depends on the server.  Some server implementations deliver
the message to all such connections, while others choose one connection
depending on certain rules.

   Note that these rules do not apply when a message is sent to a full
JID. Such messages are sent to the specified resource, if it is still
connected, and otherwise treated as messages to the bare JID. In the
chat buffers of jabber.el, messages are sent to whatever JID the last
message came from (usually a full JID), or to the bare JID if no message
has been received yet.  Other clients may have different behaviour.

2.5.2 Directed presence
-----------------------

You can send "directed presence" with 'M-x
jabber-send-directed-presence'.  This is mostly useful to manage
transports--sending directed presence is a way to turn them on and off.
You can also send directed presence to an annoying contact to appear as
away or offline to that contact.  Note, however, that in both of these
cases, all subscribed entities will get your next global presence
update.

2.6 Presence subscription
=========================

Having permission to view the presence status of a person is called
"subscribing to his presence".  Presence subscription between two
persons can be asymmetric.  Subscription state is shown in the roster
display by arrows (see Customizing the roster buffer).  A
left-pointing arrow means that the contact can see your presence
("from").  A right-pointing arrow means that you can see the contact's
presence ("to").  The most common case is mutual subscription, a
double-ended arrow ("both").

   When jabber.el receives a presence subscription request, it will
present it to you in a chat buffer, and offer you to choose subscription
mode and send a subscription request back to that person.  The "Mutual"
button accepts the request and sends a reciprocal request.(1)  The
"One-way" button accepts the request, but doesn't ask for a subscription
in return.  The "Decline" button declines the request.

   To request subscription to someone, type 'M-x
jabber-send-subscription-request'.  You will be prompted for the JID to
send it to.  This command can also be accessed through the Roster menu,
by typing 'C-c C-r' in the roster buffer.  After that, you will probably
want to give the contact a more readable name.  The command for that is
'jabber-roster-change', which is also available in the Roster menu or by
typing 'e' on a person in the roster buffer.

   ---------- Footnotes ----------

   (1) If this request is superfluous, the server will drop it without
bothering the contact.

2.7 The roster buffer
=====================

The roster buffer is called '*-jabber-roster-*'.  It simply contains a
list of the contacts on your roster.  If you have several accounts
connected, contacts will be grouped by account.

   In the roster buffer, any command which requires a JID will default
to the JID under point when called.  These commands can be called
through either keyboard menus or mouse menus.  To open a menu with the
mouse, simply press the second mouse button over the JID in question.(1)
This will bring up a menu with all available actions.  The keyboard
menus are split into categories: Chat, Roster, Information, MUC
(Multi-User Chat, or groupchat) and Services, opened by 'C-c C-c', 'C-c
C-r', 'C-c C-i', 'C-c C-m' and 'C-c C-s', respectively.

   A list of keybindings is displayed at the top of the roster buffer.
You can turn it off by setting 'jabber-roster-show-bindings' to nil.

   You can call 'jabber-display-roster' (bound to 'g') to redisplay your
roster according to changed preferences (see Customizing the roster buffer).
This will not refetch your roster from the server.
Refetching the roster is usually not needed, since updates are pushed to
clients automatically.

   You can choose not to have the roster updated automatically on
presence changes (see Presence alerts).  In that case, you need to
call 'jabber-display-roster' manually.

   Please note, that by default offline contacts showed in roster as any
others.  To hide them, you can use 'o' in roster buffer.  To permanently
hide them, customize 'jabber-show-offline-contacts' variable.

   ---------- Footnotes ----------

   (1) For some reason, mouse menus don't work in XEmacs.  Patches are
welcome.

3 Groupchat
***********

The groupchat menu can be accessed by typing 'C-c C-m' in the roster
buffer.  You can also type the commands directly, as will be shown here.

   To join a groupchat, type 'M-x jabber-muc-join'.  You will be
prompted for the groupchat to join, and your nickname in the groupchat.
This nickname doesn't need to have any correlation to your JID; in fact,
groupchats are usually (but not always) configured such that only
moderators can see your JID. You can change your nickname with 'M-x
jabber-muc-nick'.  See Configuration, for setting default nicknames.

   When trying to join a room, jabber.el first sends a service discovery
info request to the room, to find out whether it exists and what
features are enabled (in particular whether the room is
password-protected).  However, this can cause problems with some buggy
MUC services (or services that respond in a way that jabber.el doesn't
expect).  A workaround for that is to set
'jabber-muc-disable-disco-check' to 't'; however, the bug should be
unearthed and fixed.

   Groupchat messages will be displayed in a buffer called
'*-jabber-groupchat-:-GROUPCHAT-*'.  By default, the buffer name is
based on the JID of the chat room.  If you want a shorter name, you can
add the chat room to your roster and give it a name, using the command
'M-x jabber-roster-change'.  The groupchat buffer works much like the
chat buffer.  It has its own class of alerts (see Customizing alerts),
and uses activity tracking (see Tracking activity).

   Also, to save from repeating unnesesary typing you can press 'Tab'
key to complete nick of a groupchat member that you are talking with.
You can customize your form of personal talking in MUC
('jabber-muc-completion-delimiter') and form of personal talking to you
('jabber-muc-looks-personaling-symbols')--see "jabber-chat"
customization group.  Defaults are sane, so it is unlikely that you
would want to change this, but...  it is Emacs!

   To change the topic of a groupchat, type 'M-x jabber-muc-set-topic'.
The current topic is shown in the header line.

   To leave a groupchat, type 'M-x jabber-muc-leave'.

   If you are the owner of a groupchat, you can change its configuration
by typing 'M-x jabber-muc-get-config'.  A configuration form will be
rendered in new buffer.

   To see which people are in a groupchat, type 'M-x jabber-muc-names'.
This gives a list of nicknames, "affiliations", and possibly JIDs
according 'jabber-muc-print-names-format', sorted by "roles".  See MUC Administration,
for the meaning of roles and affiliations.

3.1 Configuration
=================

You can configure jabber.el to use a certain nickname for a certain
room, or to automatically join a certain room when you connect.  You can
do this either by storing bookmarks on the server or by setting Emacs
variables.

   Type 'M-x jabber-edit-bookmarks' to add bookmarks.  You can specify
the JID of the conference, the name of the conference (not used by
jabber.el), whether to automatically join the room, your desired
nickname (or leave empty), and the room password (or leave empty).

   The default nickname for groupchats is the username part of your JID.
If you don't use bookmarks, you can set different nicknames for
different groups by customizing 'jabber-muc-default-nicknames'.  There
you specify the JID of the group, and your preferred nickname.

   Automatically joining certain rooms when connecting can be
accomplished by setting 'jabber-muc-autojoin' to a list containing the
JIDs of the rooms you want to enter.  To disable this feature, remove
'jabber-muc-autojoin' from 'jabber-post-connect-hooks'.

   Please note, that 'jabber-muc-default-nicknames' and
'jabber-muc-autojoin' are machine-local, but apply to _all_ accounts--if
you connect several accounts, both will try to connect to the same chat
rooms, or use the same nickname.  This will lead to confusion.

3.2 Invitations
===============

You can invite someone to a groupchat with 'M-x jabber-muc-invite' (also
available in the MUC menu).  Pay attention to the order of the
arguments--as both users and rooms are just JIDs, it is technically
possible to invite a room to a user, but that's probably not what you
want.

   When you receive an invitation, it appears in the chat buffer along
with two buttons, "Accept" and "Decline".  Pressing "Accept" enters the
room, as you would expect.  Pressing "Decline" gives you an opportunity
to state the reason why you're not joining.

3.3 Private messages
====================

You can open a private chat with a participant in a chat room with 'M-x
jabber-muc-private' (or by using the MUC menu).  This creates a buffer
with the name '*-jabber-muc-priv-GROUP-NICKNAME-*' (customizable by
'jabber-muc-private-buffer-format'), which behaves mostly like an
ordinary chat buffer.  This buffer will also be created if someone sends
a private message to you.

   Private MUC messages use the same alerts as normal chat messages.
See Message alerts.

3.4 Administration
==================

Administration of a MUC room mostly consists of managing roles and
affiliations.  Roles are temporary, and apply until the user leaves the
room.  Affiliations are permanent, and based on JIDs.

3.4.1 Roles
-----------

If you have moderator privileges, you can change the role of a
participant with 'M-x jabber-muc-set-role'.  Kicking means setting the
role to "none".  Granting and revoking voice are "participant" and
"visitor", respectively.  "moderator" gives moderator privileges,
obviously.

   The possible roles are:

'moderator'
     Has voice, can change other people's roles.

'participant'
     Has voice.

'visitor'
     Doesn't have voice (can't send messages to everyone, but can send
     private messages)

'none'
     Not in room.

3.4.2 Affiliations
------------------

If you have admin or owner privileges, you can change the affiliation of
a user with 'M-x jabber-muc-set-affiliation'.  Affiliation is
persistent, and based on JIDs.  Depending of your affiliation and the
MUC implementation, you might not be allowed to perform all kinds of
changes, and maybe not in one step.

   Affiliations are:

'owner'
     Can destroy room, appoint admins, make people members, ban people.

'admin'
     Can make people members or ban people.

'member'
     Can enter the room, and has voice by default.

'none'
     Rights depend on room configuration.  The room might be
     members-only, or grant voice only to members.

'outcast'
     Banned from the room.

4 Composing messages
********************

The chat buffer interface can be inconvenient for some purposes.  As you
can't use 'RET' to insert a newline (use 'C-j' for that), writing a
longer message can be painful.  Also, it is not possible to include a
subject in the message, or send the message to multiple recipients.

   These features are implemented by the message composing tool.  Type
'M-x jabber-compose' to start it.  In the buffer that comes up, you can
specify recipients, enter a subject, and type your message.

5 File transfer
***************

jabber.el has limited support for file transfer.  The most important
limit is that files sent and received are kept in buffers, so Emacs must
be able to allocate enough memory for the entire file, and the file size
must be smaller than the maximum buffer size.(1)

   jabber.el is able to exchange files with most Jabber clients (and
also some MSN transports), but notably not with the official Google Talk
client.  The Google Talk client uses a different file transfer protocol
which, at the time of this release, has not been published.

   ---------- Footnotes ----------

   (1) The maximum buffer size depends on in the variable
'most-positive-fixnum'.  On 32-bit systems, this is 128 or 256
megabytes, depending on your Emacs version.

5.1 Receiving files
===================

Receiving files requires no configuration.  When someone wants to send a
file to you, you are asked (through 'yes-or-no-p') whether you want to
accept the file.  If you answer yes, you get to choose where to save the
file.

   If the sender's client is correctly configured (this is often not the
case; see below), the file transfer will start.  Currently, the only way
to watch the progress is to inspect the buffer of the file being
transfered; 'C-x C-b' is one way of doing that.  See Listing Existing Buffers (emacs).
When the transfer is done, the message
"FILE downloaded" appears in the echo area, and the buffer is killed.

   If this doesn't happen, it is most likely the sender's fault.  The
sender needs to have a public IP address, either directly, through port
forwarding (in which case the client needs to be configured with the
real public IP address), or through an XEP-0065 proxy.  If you have
activated XML logging (see Debug options), you can see the IP
address that the other client is asking you to connect to there.  Often
you will find that this is an internal IP address (often starts with
'192.168').  See the documentation of the sender's client for setting
this up.

5.2 Sending files
=================

To send a file to someone, you need an XEP-0065 proxy.(1)  If your
Jabber server hosts such a proxy, it will be found automatically,
otherwise it needs to be manually configured.

   You can check whether your Jabber server has a proxy with 'M-x
jabber-get-disco-items'; see Service discovery.

   To configure a proxy manually, customize the variable
'jabber-socks5-proxies'.  Putting 'proxy.jabber.se' there should work.
Type 'M-x jabber-socks5-query-all-proxies' to see if the proxies answer.

   Now, you can type 'M-x jabber-ft-send' to send a file to someone.
You need to enter the correct full JID, including resource, to get this
right.  If the contact is logged in with only one client, and you can
see it online, just typing the JID or roster name is enough.  If you run
the command from a chat buffer, the JID of the contact is given as the
default value.

   If the contact has several clients online, you probably want to send
the file to a particular one.  If you run this command from within a
chat buffer, the default target will be the one that last sent a message
to you.  If you just type a bare JID or a roster name, the client with
the highest priority will get the file.

   If the contact accepts the file, and the contact's client succeeds in
connecting to the proxy, jabber.el will send the file through the proxy.
During this time, your Emacs will be blocked, so you might want to avoid
sending large files over slow connections.

   ---------- Footnotes ----------

   (1) This requirement is not inherent in the protocol, only in the
current file transfer implementation of jabber.el, and in Emacs versions
earlier than 22.

6 Services
**********

Not every Jabber entity is a physical person.  There are many automatic
entities, called servers, services, components, agents, transports and
other names.  The use of these is described here.

   The functions described in this chapter use "browse buffers".  Browse
buffers are named '*-jabber-browse-:-SERVICE-*', sometimes with a
numerical suffix.  The different menus have the same keybindings as in
the roster buffer, and if you call a function operating on a JID while
point is over a JID, that JID will be the default value, so you don't
have to type it or copy it yourself.

   You can change the buffer name template by customizing the variable
'jabber-browse-buffer-format'.

6.1 Commands
============

A small number of commands is used for almost all interaction with
Jabber services.  Essentially, they are all the same: you request a form
from the server, fill it in, and send it back.

   Most of these commands are available under the Service menu, which is
opened by typing 'C-c C-s'.  Service discovery is under the Info menu
instead, which is available under 'C-c C-i'.

6.1.1 Registration
------------------

You can get a registration form for a service by typing 'M-x
jabber-get-register' and entering the JID of the service.  On success,
you get a single-stage form to fill in.

   There are two buttons at the bottom of the form, "Submit" and "Cancel
registration".  "Submit" does what you would expect it to, but "Cancel
registration" cancels any existing registration with the service.
Whichever of them you choose, you get a message in the echo area
informing whether the operation succeeded.

6.1.2 Search
------------

You can get a search form for a service by typing 'M-x
jabber-get-search'.  This gives you a single-stage form to fill in.
After you press the "Submit" button at the bottom, the search results
will be displayed in the same buffer.

6.1.3 Ad-Hoc Commands
---------------------

jabber.el supports a subset of XEP-0050, the standard for Ad-Hoc
Commands.  As the name implies, this can be used for just about
anything.  In particular, it is used not only by services, but also by
clients (e.g.  Psi, and jabber.el itself).

   To find which commands are available, run "Request command list"
('jabber-ahc-get-list').(1)

   To run a command from the list, put point over it and run "Execute
command" ('jabber-ahc-execute-command'), accepting the defaults for JID
and node.  (If you already know those, you could of course enter them
yourself.)

   What happens next depends on the command and the service.  In some
cases, the service just responds that the command has been run.  You may
also get a form to fill out.  This form may have multiple stages, in
which case there are "Next" and "Previous" buttons for navigating
between stages.  You may also see "Complete", which runs the command
skipping any remaining stages of the form, and "Cancel", which cancels
the command.

   Currently, jabber.el uses ad-hoc commands for setting presence
remotely.  If you realize that you forgot to set your client to "away"
with a low priority, you can do it remotely from any JID from
'jabber-account-list'.  So, you can add disabled JIDs in
'jabber-account-list' to allow them control your presence.(2)

   ---------- Footnotes ----------

   (1) This is the same thing as a disco items request to the node
'http://jabber.org/protocol/commands'.

   (2) Most Jabber servers also support kicking a client off the net by
logging in with another client with exactly the same resource.

6.1.4 Service discovery
-----------------------

Service discovery is used to find information about servers, services
and clients.  There are two kinds of requests: find "info" about a
Jabber entity--i.e.  its identity and supported features--and find
"items" related to an entity, where the definition of "related" is left
to the entity itself.

   The commands to execute such requests are 'jabber-get-disco-info' and
'jabber-get-disco-items', respectively.  These commands can be accessed
from the Info menu, which is opened by typing 'C-c C-i'.  The commands
accept a JID and optionally a "node".

   The result of such a command is displayed in a browse buffer.  For an
info request, the result just lists the identities and features of the
entity.  For an item request, the related items are listed.  The items
may be JIDs, or JIDs with a node.  If you put point on one of the items,
its JID and node will be the default value for any Jabber command.

   If you think that the interface to service discovery is awkward and
should be replaced with something better, you are completely right.

6.1.5 Browsing
--------------

Before service discovery, browsing was the way to find information about
Jabber entities.  Nowadays it is all but superseded, but jabber.el still
supports it.  You can use it by typing 'M-x jabber-get-browse'.  It
works much like service discovery.

6.2 Your home server
====================

You can interact with your Jabber server to change your password or
remove your account.  Both of these can be accomplished by typing 'M-x
jabber-get-register' and typing the JID of your server; see
Registration.

6.3 Transports to other IM networks
===================================

Some Jabber services make it possible to communicate with users on other
instant messaging networks (e.g.  MSN, ICQ, AIM), in effect turning your
Jabber client into a multi-protocol client.  These are called "gateways"
or "transports".  They work by impersonating you on the legacy network;
therefore you need to provide your username and password through
registration.

6.3.1 Finding a transport
-------------------------

To use such a transport, you first need to find one, obviously.
Sometimes your home server provides the transports you need, but you are
not limited to those; in principle you can use any transport on the
Jabber network.  Some transports only accept local users, though.

   Transports are generally mentioned on the web page of the Jabber
server in question.  You can also find transports from within the
client; see Service discovery.

6.3.2 Registering with a transport
----------------------------------

To register with a transport, type 'M-x jabber-get-register' and enter
the JID of the transport.  This will open a registration form where you
get to fill in your login information; see Registration.  You can
later use this same form to change the information or cancel your
registration.

   After you have registered, the transport will request presence
subscription.  It needs that to know when you are online, and
synchronize your presence on the legacy network.

6.3.3 Contact list
------------------

Once you are registered, the transport will transfer the contact list
from the legacy service.  From the Jabber side, it appears as if lots of
people suddenly request presence subscription to you.  This is somewhat
inconvenient, but it is currently the only way that the transport can
influence your Jabber contact list, as it is an entity external to your
server.(1)

   When you have accepted these presence subscriptions, the contacts
from legacy networks appear as if they were Jabber contacts.

6.3.4 Finding users
-------------------

Some legacy networks have a global database of users, and some
transports support searching that database.  In that case, you can
search for other users with 'M-x jabber-get-search'; see Search.

   ---------- Footnotes ----------

   (1) Of course, jabber.el could do more to alleviate this
inconvenience.

6.4 User directories
====================

There are some Jabber user directories, usually abbreviated JUDs.  The
most well-known one is 'users.jabber.org'.  You can register with such a
directory to let other people find you (see Registration), and you
can search the directory (see Search).

6.5 MUC services
================

MUC services (Multi-User Chat, chat rooms) are usually not operated by
these commands, but by commands specific to the MUC protocol; see
Groupchat.  However, some MUC services offer nickname registration
through the registration protocol (see Registration), and other
commands; see Ad-Hoc Commands.

7 Personal information
**********************

The Jabber way of handling personal information (name, addresses, phone
numbers, etc) is "vCards" encoded in XML.(1) You can get information
about a user by running 'M-x jabber-vcard-get', 'M-x
jabber-muc-vcard-get' if you in MUC (also available in the MUC menu),
and you can edit your own information by running 'M-x
jabber-vcard-edit'.

   The form for editing your information can be slightly confusing--you
are allowed to enter any number of addresses, phone numbers and e-mail
addresses, each of which has a set of orthogonal properties.  You can
add and remove items with the '[INS]' and '[DEL]' buttons, respectively.

   This is also where you set your avatar (see Avatars).  The size
of your avatar file is limited to 8 kilobytes.

   ---------- Footnotes ----------

   (1) See XEP-0054.

8 Avatars
*********

jabber.el supports viewing and publishing avatars according to XEP-0153,
vCard-Based Avatars.  By default, if you have an avatar in your vCard
(see Personal information), it will be published for others to see,
and if other people publish their avatars, they will be displayed in the
roster buffer and in the header line of chat buffers, if your Emacs can
display images.  Otherwise, jabber.el will not fetch avatars at all.

   To disable retrieval of other people's avatars, set
'jabber-vcard-avatars-retrieve' to nil.  To disable publishing of your
own avatar, set 'jabber-vcard-avatars-publish' to nil.  To disable
avatars in chat buffer header lines, set
'jabber-chat-buffer-show-avatar' to nil.

   There are a number of restrictions on avatar images in the
specification.  Most of them are not enforced by jabber.el.
   * The image should be smaller than 8 kilobytes; this is enforced by
     jabber.el.
   * The image height and width should be between 32 and 96 pixels; the
     recommended size is 64 by 64 pixels.
   * The image should be square.
   * The image should be in either PNG, GIF, or JPEG format.  (jabber.el
     will behave incorrectly if the image is not in a format supported
     by Emacs.)

   Avatars are cached in the directory specified by
'jabber-avatar-cache-directory', by default
'~/.emacs.d/jabber-avatar-cache/'.(1)  The cache is never cleaned, so
you might want to do that yourself from time to time.

   ---------- Footnotes ----------

   (1) The default directory used to be '~/.jabber-avatars'.  If this
directory already exists, it will be used.

9 Time queries
**************

With 'M-x jabber-get-time', you can ask what time an entity (client,
server or component) thinks it is, and what time zone it thinks it is
in.

   You can query a server about when a certain user was last seen
online.  Use 'M-x jabber-get-last-online' for that.

   You can also ask a client about how long a user has been idle with
'M-x jabber-get-idle-time'.  Not all clients answer such queries, e.g.
jabber.el doesn't.  This command can also tell the uptime of a server or
component.

   The first of these commands uses the old Entity Time protocol (see
XEP-0090).  It has been superseded by XEP-0202, but jabber.el doesn't
implement the newer protocol yet.  The latter two commands use the Last
Activity protocol (see XEP-0012).

10 Useful features
******************

jabber.el includes a number of features meant to improve the user
interface and do other useful things.

10.1 Autoaway
=============

It is possible to automatically set your status to "away" or "xa" when
you haven't used your computer for a while.  This lets your contacts
know that you might not answer immediately.  You can customize timeouts
('jabber-autoaway-timeout', 'jabber-autoaway-xa-timeout'), statuses
('jabber-autoaway-status', 'jabber-autoaway-xa-status') and priorityes
('jabber-autoaway-priority', 'jabber-autoaway-xa-priority') to set.

   To activate this feature, add 'jabber-autoaway-start' to
'jabber-post-connect-hooks', e.g:
     (add-hook 'jabber-post-connect-hooks 'jabber-autoaway-start)

   There are different methods to find how long you have been "idle".
The method(s) to use is specified by 'jabber-autoaway-methods'
(obsoleted 'jabber-autoaway--method' will also work).  The value of this
variable should be a list functions that returns the number of seconds
you have been idle (or nil on error).  Minimum of values, returned by
these functions, is used as "idle" time, so default should works well.
Three functions are provided (all used by default).

   * 'jabber-current-idle-time' is used if your Emacs has the
     'current-idle-time' function (which was introduced in Emacs 22).
     Note that this method only measures the time since you last
     interacted with Emacs, and thus disregards activity in other
     programs.

   * 'jabber-xprintidle-get-idle-time' uses xprintidle (1) program, if
     found.  You can also manually set 'jabber-xprintidle-program' to
     the correct file path.  This method uses the same method as
     XScreensaver (http://www.jwz.org/xscreensaver) to find your idle
     time.

   * 'jabber-termatime-get-idle-time' used on GNU/Linux terminals.  It
     uses the access time of the terminal device as a measure of idle
     time.

   ---------- Footnotes ----------

   (1) <http://www.dtek.chalmers.se/~henoch/text/xprintidle.html>

10.2 Modeline status
====================

By typing 'M-x jabber-mode-line-mode' you toggle display of some status
in mode lines.  The information is your own presence status, and some
numbers showing the status of your roster contacts.  By default, there
are three numbers, for "online" (chatty and online), "away" (away,
extended away and do not disturb) and offline contacts.

   If you set 'jabber-mode-line-compact' to nil, you get a complete
breakdown of presence status.  That gives you six numbers indicating the
number of chatty, online, away, extended away, dnd, and offline
contacts, respectively.

10.3 Keepalive
==============

Sometimes network connections are lost without you noticing.  This is
especially true with Jabber, as it is quite reasonable to keep the
connection open for a long time without either sending or receiving any
data.

   On the other hand, the server may want to do the same kind of
detection, and may expect the client to send something at regular
intervals.

   If you want to detect a lost connection earlier, or make sure that
the server doesn't drop your connection, you can use the keepalive
functions.  These come in two flavours: whitespace pings and XMPP pings.

10.3.1 Whitespace pings
-----------------------

A "whitespace ping" is a single space character sent to the server.
This is often enough to make NAT devices consider the connection
"alive", and likewise for certain Jabber servers, e.g.  Openfire.  It
may also make the OS detect a lost connection faster--a TCP connection
on which no data is sent or received is indistinguishable from a lost
connection.

   Type 'M-x jabber-whitespace-ping-start' to start it, and 'M-x
jabber-whitespace-ping-stop' to stop it.  The former is in
'jabber-post-connect-hooks' by default; see Hooks.

   The frequency of whitespace pings is controlled by the variable
'jabber-whitespace-ping-interval'.  The default value is once every 30
seconds.

10.3.2 XMPP pings
-----------------

These functions work by sending a ping request to your server once in a
while (by default every ten minutes), and considering the connection
lost if the server doesn't answer within reasonable time (by default 20
seconds).

   Type 'M-x jabber-keepalive-start' to start it, and 'M-x
jabber-keepalive-stop' to stop it.  You may want to add
'jabber-keepalive-start' to 'jabber-post-connect-hooks'; see Hooks.

   You can customize the interval and the timeout with the variables
'jabber-keepalive-interval' and 'jabber-keepalive-timeout',
respectively.

   You can also manually ping some client/server by using 'M-x
jabber-ping'.  Note that pong will be displayed according
'jabber-alerts-info-messages-hooks' (default is echo in minibuffer).

10.4 Reconnecting
=================

jabber.el supports automatic reconnection to Jabber server(s) upon lost
connection.  By default it is off.  To turn on, customize the
'jabber-auto-reconnect' variable.

   This is of limited use if you have to type your password every time
jabber.el reconnects.  There are two ways to save your password: you can
set it in 'jabber-account-alist' (see Account settings), and you can
use 'password-cache.el', which is available in recent versions of Gnus
and in Emacs 23.  Note that you probably want to customize
'password-cache-expiry' if you use the latter.

10.5 Tracking activity
======================

When you're working on something important you might want to delay
responding to incoming messages.  However, when you're done working,
will you remember them?  If you're anything like me, you'll have a lot
of buffers in your Emacs session, and a Jabber chat buffer can easily
get lost.

   When 'jabber-activity-mode' is enabled (by default, it is), Emacs
keeps track of the buddies which have messaged you since last you
visited their buffer, and will display them in mode line.  As soon as
you visit their buffer they disappear from the mode line, indicating
that you've read their message.

   If your mode line fills over because of these notifications, you can
customize 'jabber-activity-make-strings' to shorten them to the shortest
possibly unambiguous form.

   If you try to exit Emacs while you still have unread messages, you
will be notified and asked about this.  If you don't like that, set
'jabber-activity-query-unread' to nil.

   If you want to display the number of unread buffers in the frame
title, set 'jabber-activity-count-in-title' to t.  The format of the
number can be changed through 'jabber-activity-count-in-title-format'.

   To hide activity notifications for some contacts, use
'jabber-activity-banned' variable - just add boring JIDs (as regexps)
here.

   For complete customizability, write a hook function for
'jabber-activity-update-hook'.  From that function, you can take action
based on 'jabber-activity-jids', 'jabber-activity-mode-string', and
'jabber-activity-count-string'.

10.6 Watch buddies
==================

Sometimes you might be waiting for a certain person to come online, and
you don't want that occasion to get lost in the noise.  To get an
obtrusive message when that happens, type 'M-x jabber-watch-add' and
select the person in question.  You can enter a comment, to remember why
you added the watch.

   You will get a message whenever that person goes from offline to
online.  jabber.el will remember this for the rest of your Emacs session
(it's not saved to disk, though), but if you want to get rid of it, type
'M-x jabber-watch-remove'.

10.7 Spell checking
===================

You can activate spell checking in a chat buffer with 'M-x
flyspell-mode'.  It will check only what you are currently writing, not
what you receive or what you have already sent.  You may want to add
'flyspell-mode' to 'jabber-chat-mode-hook'.

   For more information about Emacs spell checking, see Checking and Correcting Spelling (emacs).

10.8 Gmail notifications
========================

If you are connected to a Google Talk account, you can receive
notifications when a new Gmail message arrives.  Gmail notifications are
enabled by adding the following line to your '.emacs':

     (add-hook 'jabber-post-connect-hooks 'jabber-gmail-subscribe)

   Default behavior is to display a message that mentions the number of
received gmails.  You can customize this behavior by providing your own
'jabber-gmail-dothreads' function.

   Example:

     (eval-after-load "jabber-gmail"
       '(defun jabber-gmail-dothreads (threads)
          "Process <mail-thread-info/> elements.
     THREADS is a list of XML sexps corresponding to <mail-thread-info/>
     elements.
     See http://code.google.com/apis/talk/jep_extensions/gmail.html#response"
          (osd "gmail: %d" (length threads))))

     ;;; It's usually a good idea to have a shortcut for querying GTalk server.
     (global-set-key (kbd "<f9> g") 'jabber-gmail-query)

     ;;; The definition of `osd' function used by `jabber-gmail-dothreads'.
     ;;; `osd_cat' is shipped with the X OSD library
     ;;; [http://www.ignavus.net/software.html].
     (if (and (display-graphic-p) (file-executable-p "/usr/bin/osd_cat"))
         (defun osd (fmt &rest args)
           "Display message on X screen."
           (let ((opts "-p bottom -A center -l 1 \
     -f '-adobe-helvetica-bold-r-*-*-24-*-*-*-*-*-iso10646-1'")
     	    (msg (apply 'format (concat fmt "\n") args)))
     	(start-process "osd" nil shell-file-name shell-command-switch
     		       (format "echo %s | osd_cat %s"
     			       (shell-quote-argument msg) opts))))
       (defalias 'osd 'message))

10.9 Saving groups roll state
=============================

You can save roster's groups rollup/rolldown state between sessions.  To
do this you need to add 'jabber-roster-save-groups' to
'jabber-pre-disconnect-hook' and 'jabber-roster-restore-groups' to
'jabber-post-connect-hooks', respectively.

   State saved in private storage on server-side (for each account).
Note that state restoring working by rolling up groups, rolled up at
state saving (by default, all groups rolled down).  Also note that at
now, 'jabber-pre-disconnect-hook' run only with 'jabber-disconnect' (not
with 'jabber-disconnect-one').

11 Message history
******************

If you want a record of messages sent and received, set
'jabber-history-enabled' to t.  If you also want record MUC groupchat
messages, set 'jabber-history-muc-enabled' to t.  Messages will be saved
in one file per contact in the directory specified by the variable
'jabber-history-dir' (the default is '~/.emacs.d/jabber-history').  If
you prefer to store messages for all contacts in a single file, set
'jabber-use-global-history' to 't' and set
'jabber-global-history-filename' as required.(1)

   When you open a new chat buffer and have entries in your history
file, the last few messages you recently exchanged with the contact in
question will be inserted.  You can control how many messages with
'jabber-backlog-number' (by default 10), and how old messages with
'jabber-backlog-days' (by default 3 days).

   If you want to see more messages, use the function
'jabber-chat-display-more-backlog', available in the Chat menu.  This is
currently the only way to view the message history, apart from opening
the history files manually.

   If you worry about your history file(s) size, you can enable history
rotation feature by setting the variable
'jabber-history-enable-rotation' to 't' (default is 'nil').  This
feature "rotates" your history files according to the following rule:
When 'jabber-history-size-limit' (in kilobytes) is reached, the
HISTORY-FILE is renamed to 'HISTORY-FILE-NUMBER', where NUMBER is 1 or
the smallest number after the last rotation.

   For example, suppose you set the 'jabber-history-size-limit' variable
to 512 and you chat with your buddy 'foo@jabber.server' using the
per-contact strategy to store history files.  So, when the history file
('foo@jabber-server') reaches 512K bytes, it will be renamed to
'foo@jabber-server-1' and 'foo@jabber-server' will be set empty.  Next
time 'foo@jabber-server' grows to 512K bytes, it will be saved as
'foo@jabber-server-2' and so on.  Although the example was presented
with the per-contact history file strategy, history rotation works for
both per-contact and global history logging strategies.

   If you also want to keep chat and groupchat buffers from growing too
much, you can customize 'jabber-alert-message-hooks' and
'jabber-alert-muc-hooks' by adding truncation upon receiving message
('jabber-truncate-chat' and 'jabber-truncate-muc', respectively).  The
truncation limit may be set by customizing the variable
'jabber-log-lines-to-keep'.

   ---------- Footnotes ----------

   (1) Using a global history file used to be the default.  If the file
specified by 'jabber-global-history-filename' exists,
'jabber-use-global-history' will default to 't' to support existing
installations.

12 Typing notifications
***********************

There are two protocols for "contact is typing" notifications in Jabber.
jabber.el supports both of them, displaying various information in the
header line of chat buffers.

12.1 Message events
===================

The older protocol is called Message Events (see XEP-0022).  Besides
typing notification, it lets you know what happens to the messages you
send.  These states are possible:

   * 'In offline storage' (the user will receive it on next logon)

   * 'Delivered' to user's client (but not necessarily displayed)

   * 'Displayed' to user

   * User is 'typing a message'

   The first state is only reported by servers; the other three are
reported by clients.  jabber.el can report all three of them, and can
display all four; not all clients support all states, though.

   If you don't want jabber.el to send out this information about you,
set the variables 'jabber-events-confirm-delivered',
'jabber-events-confirm-displayed', and/or
'jabber-events-confirm-composing' to nil.  You can make jabber.el not to
request such information by customizing 'jabber-events-request-these'.

12.2 Chat states
================

The newer protocol is called Chat States (see XEP-0085).  Rather
than dealing with individual messages, it describes the state of the
chat session between two people.  The following states are possible:

   * Active (the default state, not displayed)

   * Inactive

   * Composing

   * Paused (i.e., taking a short pause in composing)

   * Gone

   jabber.el can display all five states, but only ever sends "active"
and "composing" itself.

   To customize sending of chat states, customize the variable
'jabber-chatstates-confirm'.

13 Roster import and export
***************************

Your roster is saved on the Jabber server, and usually not in the
client.  However, you might want to save the roster to a file anyway.
The most common reason for this is probably to copy it to another
account.

   To export your roster to a file, type 'M-x jabber-export-roster'.  A
buffer will appear in which you can edit the data to be exported.
Changes done in that buffer will not affect your real roster.

   To import your roster from a file, type 'M-x jabber-import-roster'.
You will be able to edit the data before importing it.  Items not in the
roster will be added; items in the roster will be modified to match
imported data.  Subscriptions will be updated.

   The format of the roster files is the XML used by roster pushes in
the XMPP protocol, in UTF-8 encoding.

14 XMPP URIs
************

Many web page authors use links starting with 'xmpp:' for JIDs.  Your
web browser could be made to pass such links to jabber.el, so that such
links are actually useful and not just decoration.  How to do that
depends on your operating system and web browser.

   For any of these methods, you need to make sure that you are running
the Emacs server.  See Using Emacs as a Server (emacs),
though the simplest way to start it is to customize the variable
'server-mode'.

14.1 GNOME
==========

The jabber.el distribution contains a GConf schema which tries to set up
handling of 'xmpp:' URIs.  It is installed by 'make install'.  This may
or may not work, depending on your GConf configuration and other
installed applications.  To check, try running:

     gconftool --get /desktop/gnome/url-handlers/xmpp/command

   This should print something like:

     /usr/local/libexec/emacs-jabber-uri-handler "%s"

   This setting is picked up by most GNOME or GTK based web browsers,
including Firefox.

14.2 Mozilla and Unix
=====================

If you use a Mozilla-based web browser on a Unix-like operating system,
and the GConf method above doesn't work, you can set it up manually by
following these steps:

  1. Note the path of the 'emacs-jabber-uri-handler' file in the
     jabber.el distribution, and make sure it is executable.

  2. Set the Mozilla preference 'network.protocol-handler.app.xmpp' to
     the path of 'emacs-jabber-uri-handler'.  There are two ways to do
     this:

        * Go to the URL 'about:config', right-click in the list, choose
          "New string", and enter 'network.protocol-handler.app.xmpp'
          and the path in the following dialogs.

        * Open or create the file 'user.js' in your Mozilla profile
          directory (in the same directory as 'prefs.js'), and add the
          following line:

               user_pref("network.protocol-handler.app.xmpp",
                 "/PATH/TO/emacs-jabber-uri-handler");

          Restart Mozilla for this change to take effect.

14.3 Other systems
==================

If you know how to pass an XMPP URI from your browser to the function
'jabber-handle-uri', your contribution for this section would be
appreciated.

15 Customization
****************

jabber.el is intended to be customizable for many tastes.  After all,
this is Emacs.  To open a customization buffer for jabber.el, type 'M-x
jabber-customize'.

15.1 Account settings
=====================

All account settings reside in the variable 'jabber-account-list'.
Usually you only need to set the JID, in the form 'username@server' (or
'username@server/resource' to use a specific resource name).  These are
the other account options:

Disabled
     If the account is disabled, 'jabber-connect-all' will not attempt
     to connect it.  You can still connect it manually with
     'jabber-connect'.

Password
     You can set the password of the account, so you don't have to enter
     it when you connect.  Note that it will be stored unencrypted in
     your customization file.

Network server
     If the JID of the Jabber server is not also its DNS name, you may
     have to enter the real DNS name or IP address of the server here.

Connection type
     This option specifies whether to use an encrypted connection to the
     server.  Usually you want "STARTTLS" ('starttls'), which means that
     encryption is activated if the server supports it.  The other
     possibilities are "unencrypted" ('network'), which means just that,
     and "legacy SSL/TLS" ('ssl'), which means that encryption is
     activated on connection.

Port
     If the Jabber server uses a nonstandard port, specify it here.  The
     default is 5222 for STARTTLS and unencrypted connections, and 5223
     for legacy SSL connections.

15.1.1 For Google Talk
----------------------

If you have a very new version of 'dns.el',(1) you can connect to Google
Talk just by specifying your Gmail address as JID. Otherwise, you also
need to set "network server" to 'talk.google.com' and "connection type"
to "legacy SSL".

   See also Gmail notifications.

15.1.2 Upgrade note
-------------------

Previous versions of jabber.el had the variables 'jabber-username',
'jabber-server', 'jabber-resource' and 'jabber-password'.  These are now
obsolete and not used.

   ---------- Footnotes ----------

   (1) Specifically, you need Emacs 23, or No Gnus 0.3.

15.2 Menu
=========

There is a Jabber menu on the menu bar with some common commands.  By
default, it is displayed only if you are connected, or if you have
configured any accounts.  You can set the variable 'jabber-display-menu'
to 't' or 'nil', to have the menu displayed always or never,
respectively.  The default behaviour corresponds to the setting 'maybe'.

   Earlier, the way to have the menu appear was to call the function
'jabber-menu'.  It still works, but is considered obsolete.

15.3 Customizing the roster buffer
==================================

'jabber-roster-sort-functions' controls how roster items are sorted.  By
default, contacts are sorted first by presence, and then alphabetically
by displayed name.

   'jabber-sort-order' controls how roster items are sorted by presence.
It is a list containing strings corresponding to show status (see
Presence) or 'nil', which represents offline.

   'jabber-show-resources' controls when your contacts' resources are
shown in the roster buffer.  The default is to show resources when a
contact has more than one connected resource.

   'jabber-roster-line-format' specifies how the entry for each contact
looks.  It is a string where some characters are special if preceded by
a percent sign:

'%a'
     Avatar of contact, if any
'%c'
     '*' if the contact is connected, or ' ' if not
'%u'
     Subscription state--see below
'%n'
     Nickname of contact, or JID if no nickname
'%j'
     Bare JID of contact (without resource)
'%r'
     Highest-priority resource of contact
'%s'
     Availability of contact as a string ("Online", "Away" etc)
'%S'
     Status string specified by contact

   'jabber-roster-show-title' controls whether to show a "Jabber roster"
string at the top of the roster buffer.  You need to run 'M-x
jabber-display-roster' after changing this variable to update the
display.

   '%u' is replaced by one of the strings given by
'jabber-roster-subscription-display'.

   'jabber-resource-line-format' is nearly identical, except that the
values correspond to the values of the resource in question, and that
the '%p' escape is available, which inserts the priority of the
resource.

   'jabber-roster-buffer' specifies the name of the roster buffer.  If
you change this, the new name will be used the next time the roster is
redisplayed.

   'jabber-roster-show-bindings' controls whether to show a list of
keybindings at the top of the roster buffer.  You need to run 'M-x
jabber-display-roster' after changing this variable to update the
display.

15.4 Customizing the chat buffer
================================

You can customize the look of the prompts in the chat buffer.  There are
separate settings for local text (i.e.  what you write) and foreign text
(i.e.  what other people write).

   'jabber-chat-text-local' and 'jabber-chat-text-foreign' determine the
faces used for chat messages.

   'jabber-chat-prompt-local' and 'jabber-chat-prompt-foreign' determine
the faces used for the prompts.  You can also turn on automatic
colorization of local ('jabber-muc-colorize-local') and/or foreign
('jabber-muc-colorize-foreign') prompts.  By default it is off.  You can
correct and save for future use auto-generated colors by customizing
'jabber-muc-participant-colors', 'jabber-muc-nick-saturation' and
'jabber-muc-nick-value', if you wish.

   'jabber-chat-local-prompt-format' and
'jabber-chat-foreign-prompt-format' determine what text is displayed in
the prompts.  They are format strings, with the following special
sequences defined:

'%t'
     The time when the message was sent or received
'%n'
     The nickname of the user.  For the foreign prompt, this is the name
     of the contact in the roster, or the JID if no name set.  For the
     local prompt, this is the username part of your JID.
'%u'
     The username of the user (i.e.  the first part of the JID).
'%r'
     The resource.
'%j'
     The bare JID of the user

   'jabber-chat-time-format' defines how '%t' shows time.  Its format is
identical to that passed to 'format-time-string'.  See Time Conversion (elisp).

   'jabber-chat-delayed-time-format' is used instead of
'jabber-chat-time-format' for delayed messages (messages sent while you
were offline, or fetched from history).  This way you can have short
timestamps everywhere except where you need long ones.  You can always
see the complete timestamp in a tooltip by hovering over the prompt with
the mouse.

   By default, timestamps are printed in the chat buffer every hour (at
"rare" times).  This can be toggled with 'jabber-print-rare-time'.  You
can customize the displayed time by setting 'jabber-rare-time-format'.
Rare timestamps will be printed whenever time formatted by that format
string would change.

   You can also customize the header line of chat buffers, by modifying
the variable 'jabber-chat-header-line-format'.  The format of that
variable is the same as that of 'mode-line-format' and
'header-line-format'.  See Mode-Line Format (elisp).
For MUC buffers, 'jabber-muc-header-line-format' is used instead.

   The variable 'jabber-chat-fill-long-lines' controls whether long
lines in the chat buffer are wrapped.

15.5 Customizing alerts
=======================

When an event happens (currently including presence changes, incoming
messages, and completed queries) you will usually want to be notified.
Since tastes in this area vary wildly, these alerts are implemented as
hooks, so you can choose which ones you want, or write your own if none
fit.

   Actually, if you don't want to write your own, stop reading this
section and just read Standard alerts.

   Many kinds of alerts consist in displaying a text message through a
certain mechanism.  This text message is provided by a function which
you can rewrite or replace.  If this function returns 'nil', no message
is displayed, and non-textual alerts refrain from action.

   If you want to write alert hooks that do nothing except displaying
the supplied message in some way, use the macro 'define-jabber-alert'.
For example, if FOO is a function that takes a string as an argument,
write
     (define-jabber-alert foo
       "Display a message in a fooish way"
       'foo)
and all details will be taken care of for you.

   The hooks take different arguments depending on category.  However,
they all have in common that the last argument is the result of the
message function.  The message function for each category takes the same
arguments as the corresponding hooks, except for that last argument.

   Alert hook contributions are very welcome.  You can send them to the
mailing list, or to the Sourceforge patch tracker.  See Contacts.

   Alert hooks are meant for optional UI things, that are subject to
varying user tastes, and that can be toggled by simply adding or
removing the function to and from the hook.  For other purposes, there
are corresponding general hooks, that are defvars instead of defcustoms,
and that are meant to be managed by Lisp code.  They have the same name
as the alert hooks minus the '-alert' part, e.g.  'jabber-message-hooks'
vs 'jabber-alert-message-hooks', etc.

15.5.1 Standard alerts
----------------------

Thirteen alerts are already written for all four alert categories.
These all obey the result from the corresponding message function.

   The 'beep' alerts simply sound the terminal bell by calling 'ding'.
They are disabled by default.

   The 'echo' alerts display a message in the echo area by calling
'message'.  They are enabled by default.

   The 'switch' alerts switch to the buffer where the event occurred
(chat buffer for incoming messages, roster buffer for presence changes,
browse buffer for completed queries).  They are disabled by default.
Take care when using them, as they may interrupt your editing.

   The 'display' alerts display but do not select the buffer in
question, using the function 'display-buffer'.  See Choosing a Window for Display (elisp),
for information about customizing
its behaviour.  This is enabled by default for info requests.

   The 'wave' alerts play a sound file by calling 'play-sound-file'.  No
sound files are provided.  To use this, enter the names of the sound
files in 'jabber-alert-message-wave', 'jabber-alert-presence-wave' and
'jabber-alert-info-wave', respectively.  You can specify specific sound
files for contacts matching a regexp in the variables
'jabber-alert-message-wave-alist' and
'jabber-alert-presence-wave-alist'.

   The 'screen' alerts send a message through the Screen terminal
manager(1).  They do no harm if called when you don't use Screen.

   The 'tmux' alerts send a message through the tmux terminal
manager(2).

   The 'ratpoison' alerts send a message through the Ratpoison window
manager(3).  They do no harm if used when you're not running X, but if
you are running X with another window manager, the ratpoison processes
will never exit.  Emacs doesn't hold on to them, though.

   The 'sawfish' alerts send a message through the Sawfish window
manager.

   The 'wmii' alerts display a message through the wmii window manager.

   The 'awesome' alerts display a message through the awesome window
manager.  However, to work it needs naughty (i.e.  'require("naughty")'
in rc.lua).

   The 'xmessage' alerts send a message through the standard 'xmessage'
tool.  The variable 'jabber-xmessage-timeout' controls how long the
alert appears.

   The 'osd' alerts send a message onto your screen using XOSD.(4)

   The 'notifications' alerts send a message using Emacs built-in
package 'notifications.el'.  Note that 'notifications.el' first appear
in Emacs 24.1, so they are disabled by default.

   The 'libnotify' alerts send a message onto your screen using
'notification-daemon'.

   The 'festival' alerts speak the message using the Emacs interface of
the Festival speech synthesis system(5).

   The 'autoanswer' alert is kind of special: it will not show you
message/muc alert, but instead will automaticaly answer to sender.  See
variable 'jabber-autoanswer-alist' description for details.

   Additionally, for one-to-one and MUC messages, there are 'scroll'
alerts (enabled by default), that aim to do the right thing with chat
buffers that are visible but not active.  Sometimes you want point to
scroll down, and sometimes not.  These functions should do what you
mean; if they don't, it's a bug.

   Also, in MUC you can use a family of so-called "personal" alerts.
They are like other MUC alerts, but fire only on incoming messages
addresed directly to you (also known as "private messages").  One
example of such an alert is 'jabber-muc-echo-personal', which shows a
note for an MUC message only if it was addressed to you.

   Some of these functions are in the 'jabber-alert.el' file, and the
others are in their own files.  You can use them as templates or
inspiration for your own alerts.

   ---------- Footnotes ----------

   (1) See <http://www.gnu.org/software/screen/>.

   (2) See <http://tmux.sourceforge.net/>.

   (3) See <http://ratpoison.sourceforge.net/>.

   (4) XOSD can be found at <http://www.ignavus.net/software.html>.  You
also need 'osd.el' from <http://www.brockman.se/software/osd.el>.

   (5) See <http://www.cstr.ed.ac.uk/projects/festival/>.

15.5.2 Presence alerts
----------------------

Set 'jabber-alert-presence-message-function' to your desired function.
This function should look like:

     (defun FUNCTION (WHO OLDSTATUS NEWSTATUS STATUSTEXT)
        ...
        )

   WHO is the JID symbol (see JID symbols), OLDSTATUS and NEWSTATUS
are the previous and current stati, respectively, and STATUSTEXT is the
status message if provided, otherwise nil.

   OLDSTATUS and NEWSTATUS can be one of '""' (i.e.  online), '"away"',
'"xa"', '"dnd"', '"chat"', '"error"' and 'nil' (i.e.  offline).

   NEWSTATUS can also be one of '"subscribe"', '"subscribed"',
'"unsubscribe"' and '"unsubscribed"'.

   The default function, 'jabber-presence-default-message', returns
'nil' if OLDSTATUS and NEWSTATUS are the same, and in other cases
constructs a message from the given data.

   Another function, 'jabber-presence-only-chat-open-message', behave
just like 'jabber-presence-default-message', but only if conversation
buffer for according JID is already open.  Use it to show presence
notifications only for "interesting" contacts.

   All presence alert hooks take the same arguments plus the additional
PROPOSED-ALERT, which is the result of the specified message function.
This last argument is usually the only one they use.

15.5.3 Message alerts
---------------------

Set 'jabber-alert-message-function' to your desired function.(1)  This
function should look like:

     (defun FUNCTION (FROM BUFFER TEXT)
        ...
        )

   FROM is the JID symbol (see JID symbols), BUFFER is the buffer
where the message is displayed, and TEXT is the text of the message.

   The default function, 'jabber-message-default-message', returns
"Message from PERSON", where PERSON is the name of the person if
specified in the roster, otherwise the JID.

   All message alert hooks take the same arguments plus the additional
PROPOSED-ALERT, which is the result of the specified message function.

   If you don't want message alerts when the chat buffer in question is
already the current buffer, set 'jabber-message-alert-same-buffer' to
nil.  This affects the behaviour of the default message function, so
you'll have to reimplement this functionality if you write your own
message function.

   ---------- Footnotes ----------

   (1) Logically it should be 'jabber-alert-message-message-function',
but that would be really ugly.

15.5.4 MUC alerts
-----------------

Set 'jabber-alert-muc-function' to your desired function.  This function
should look like:

     (defun FUNCTION (NICK GROUP BUFFER TEXT)
        ...
        )

   NICK is the nickname, GROUP is the JID of the group, BUFFER is the
buffer where the message is displayed, and TEXT is the text of the
message.

   The default function, 'jabber-muc-default-message', returns "Message
from NICK in GROUP" or "Message in GROUP", the latter for messages from
the room itself.

   All MUC alert hooks take the same arguments plus the additional
PROPOSED-ALERT, which is the result of the specified message function.

   By default, no alert is made for messages from yourself.  To change
that, customize the variable 'jabber-muc-alert-self'.

15.5.5 Info alerts
------------------

Info alerts are sadly underdeveloped.  The message function,
'jabber-alert-info-message-function', takes two arguments, INFOTYPE and
BUFFER.  BUFFER is the buffer where something happened, and INFOTYPE is
either ''roster' for roster updates, or ''browse' for anything that uses
the browse buffer (basically anything except chatting).

   The info alert hooks take an extra argument, as could be expected.

15.6 Hooks
==========

jabber.el provides various hooks that you can use for whatever purpose.

'jabber-post-connect-hooks'
     This hook is called after successful connection and authentication.
     By default it contains 'jabber-send-current-presence' (see
     Presence).  The hook functions get the connection object as
     argument.

'jabber-lost-connection-hooks'
     This hook is called when you have been disconnected for unknown
     reasons.  Usually this isn't noticed for quite a long time.

     The hook is called with one argument: the connection object.

'jabber-pre-disconnect-hook'
     This hook is called just before voluntary disconnection, i.e.  in
     'jabber-disconnect', the command to disconnect all accounts.  There
     is currently no hook for disconnection of a single account.

'jabber-post-disconnect-hook'
     This hook is called after disconnection of any kind, possibly just
     after 'jabber-lost-connection-hook'.

'jabber-chat-mode-hook'
     This hook is called when a new chat buffer is created.

'jabber-browse-mode-hook'
     This hook is called when a new browse buffer is created.

'jabber-roster-mode-hook'
     This hook is called when the roster buffer is created.

15.7 Debug options
==================

These settings provide a lot of information which is usually not very
interesting, but can be useful for debugging various things.

   'jabber-debug-log-xml' activates XML console.  All XML stanzas sent
and received are logged in the buffer '*-jabber-console-JID-*' (and to
specified file if value is string).  Also this buffer can be used to
send XML stanzas manually.

   Format for console buffer name.  %s mean connection jid.  Default
value is '*-jabber-console-%s-*'.

   Maximum number of lines in console buffer.  Use this option to
prevent over bloating size of buffer.  Set value to 0 if you want to
keep all stanzas in buffer, but it's not recommended and may be unsafe.

   Usually, the process buffers for Jabber connections are killed when
the connection is closed, as they would otherwise just fill up memory.
However, they might contain information about why the connection was
lost.  To keep process buffers, set 'jabber-debug-keep-process-buffers'
to 't'.

16 Hacking and extending
************************

This part of the manual is an attempt to explain parts of the source
code.  It is not meant to discourage you from reading the code yourself
and trying to figure it out, but as a guide on where to look.  Knowledge
of Jabber protocols is assumed.

16.1 Connection object
======================

Each Jabber connection is represented by a "connection object".  This
object has the form of a finite state machine, and is realized by the
library 'fsm'.(1)

   The various states of this object are defined in 'jabber-core.el'.
They describe the way of the connection through the establishing of a
network connection and authentication, and finally comes to the
':session-established' state where ordinary traffic takes place.

   These details are normally opaque to an extension author.  As will be
noted, many functions expect to receive a connection object, and
functions at extension points generally receive such an object in order
to pass it on.  The following functions simply query the internal state
of the connection:

 -- Function: jabber-connection-jid connection
     The 'jabber-connection-jid' function returns the full JID of
     CONNECTION, i.e.  a string of the form
     '"username@server/resource"'.

 -- Function: jabber-connection-bare-jid connection
     The 'jabber-connection-bare-jid' function returns the bare JID of
     CONNECTION, i.e.  a string of the form '"username@server"'.

   ---------- Footnotes ----------

   (1) So far, this library is only distributed with jabber.el.  The
author hopes that it could be useful for other projects, too.

16.2 XML representation
=======================

The XML representation is the one generated by 'xml.el' in Emacs, namely
the following.  Each tag is a list.  The first element of the list is a
symbol, the name of which is the name of the tag.  The second element is
an alist of attributes, where the keys are the attribute names in symbol
form, and the values are strings.  The remaining elements are the tags
and data contained within the tag.

   For example,
     <foo bar='baz'>
     <frobozz/>Fnord
     </foo>
   is represented as
     (foo ((bar . "baz")) (frobozz nil "") "Fnord
     ")

   Note the empty string as the third element of the 'frobozz' list.  It
is not present in newer (post-21.3) versions of 'xml.el', but it's
probably best to assume it might be there.

 -- Function: jabber-sexp2xml xml-sexp
     This function takes a tag in list representation, and returns its
     XML representation as a string.  You will normally not need to use
     this function directly, but it can be useful to see how your sexps
     will look when sent to the outer, non-Lisp, world.

 -- Function: jabber-send-sexp connection sexp
     This function sends SEXP, an XMPP stanza in list representation,
     and sends it over CONNECTION.

     You will normally use the functions 'jabber-send-presence',
     'jabber-send-message' and 'jabber-send-iq' instead of this
     function.

16.3 JID symbols
================

JIDs are sometimes represented as symbols.  Its name is the JID, and it
is interned in 'jabber-jid-obarray'.  A roster entry can have the
following properties:

'xml'
     The XML tag received from the server on roster update

'name'
     The name of the roster item (just like the XML attribute)

'subscription'
     The subscription state; a string, one of '"none"', '"from"', '"to"'
     and '"both"'

'ask'
     The ask state; either 'nil' or '"subscribe"'

'groups'
     A list of strings (possibly empty) containing all the groups the
     contact is in

'connected'
     Boolean, true if any resource is connected

'show'
     Presence show value for highest-priority connected resource; a
     string, one of '""' (i.e.  online), '"away"', '"xa"', '"dnd"',
     '"chat"', '"error"' and 'nil' (i.e.  offline)

'status'
     Presence status message for highest-priority connected resource

'resources'
     Alist.  Keys are strings (resource names), values are plists with
     properties 'connected', 'show', 'status' and 'priority'.

   Incoming presence information is inserted in 'resources', and the
information from the resource with the highest priority is inserted in
'show' and 'status' by the function 'jabber-prioritize-resources'.

16.4 Listening for new requests
===============================

To listen for new IQ requests, add the appropriate entry in
'jabber-iq-get-xmlns-alist' or 'jabber-iq-set-xmlns-alist'.  The key is
the namespace of the request, and the value is a function that takes two
arguments, the connection object, and the entire IQ stanza in list
format.  'jabber-process-iq' reads these alists to determine which
function to call on incoming packets.

   For example, the Ad-Hoc Commands module contains the following:

     (add-to-list 'jabber-iq-set-xmlns-alist
     	     (cons "http://jabber.org/protocol/commands"
                        'jabber-ahc-process))

   To send a response to an IQ request, use '(jabber-send-iq CONNECTION
SENDER "result" QUERY nil nil nil nil ID)', where QUERY is the query in
list format.  'jabber-send-iq' will encapsulate the query in an IQ
packet with the specified id.

   To return an error to the Jabber entity that sent the query, use
'jabber-signal-error'.  The signal is caught by 'jabber-process-iq',
which takes care of sending the error.  You can also use
'jabber-send-iq-error'.

16.5 Sending new requests
=========================

To send an IQ request, use 'jabber-send-iq'.  It will generate an id,
and create a mapping for it for use when the response comes.  The syntax
is:

     (jabber-send-iq CONNECTION TO TYPE QUERY
                     SUCCESS-CALLBACK SUCCESS-CLOSURE
                     FAILURE-CALLBACK FAILURE-CLOSURE)

   SUCCESS-CALLBACK will be called if the response is of type 'result',
and FAILURE-CALLBACK will be called if the response is of type 'error'.
Both callbacks take three arguments, the connection object, the IQ
stanza of the response, and the corresponding closure item earlier
passed to 'jabber-send-iq'.

   Two standard callbacks are provided.  'jabber-report-success' takes a
string as closure item, and reports success or failure in the echo area
by appending either 'succeeded' or 'failed' to the string.
'jabber-process-data' prepares a browse buffer.  If its closure argument
is a function, it calls that function with point in this browse buffer.
If it's a string, it prints that string along with the error message in
the IQ response.  If it's anything else (e.g.  'nil'), it just dumps the
XML in the browse buffer.

   Examples follow.  This is the hypothetical Jabber protocol "frob",
for which only success report is needed:
     (jabber-send-iq connection
                     "someone@somewhere.org" "set"
                     '(query ((xmlns . "frob")))
                     'jabber-report-success "Frobbing"
                     'jabber-report-success "Frobbing")
   This will print "Frobbing succeeded" or "Frobbing failed: REASON",
respectively, in the echo area.

   The protocol "investigate" needs to parse results and show them in a
browse buffer:
     (jabber-send-iq connection
                     "someone@somewhere.org" "get"
                     '(query ((xmlns . "investigate")))
                     'jabber-process-data 'jabber-process-investigate
                     'jabber-process-data "Investigation failed")
   Of course, the previous example could have used
'jabber-report-success' for the error message.  It's a matter of UI
taste.

16.6 Service discovery
======================

Service discovery (XEP-0030) is a Jabber protocol for communicating
features supported by a certain entity, and items affiliated with an
entity.  jabber.el has APIs for both providing and requesting such
information.

16.6.1 Providing info
---------------------

Your new IQ request handlers will likely want to advertise their
existence through service discovery.

   To have an additional feature reported in response to disco info
requests, add a string to 'jabber-advertised-features'.

   By default, the service discovery functions reject all requests
containing a node identifier with an "Item not found" error.  To make
them respond, add the appropriate entries to 'jabber-disco-items-nodes'
and 'jabber-disco-info-nodes'.  Both variables work in the same way.
They are alists, where the keys are the node names, and the values are
lists of two items.

   The first item is the data to return -- either a list, or a function
taking the connection object and the entire IQ stanza and returning a
list; in either case this list contains the XML nodes to include in the
'<query/>' node in the response.

   The second item is the access control function.  An access control
function receives the connection object and a JID as arguments, and
returns non-nil if access is to be granted.  If nil is specified instead
of a function, access is always granted.  One such function is provided,
'jabber-my-jid-p', which grants access for JIDs where the username and
server (not necessarily resource) are equal to those of the user, or one
of the user's configured accounts.

16.6.2 Requesting info
----------------------

jabber.el has a facility for requesting disco items and info.  All
positive responses are cached.

   To request disco items or info from an entity, user one of these
functions:

 -- Function: jabber-disco-get-info jc jid node callback closure-data
          &optional force
     Get disco information for JID and NODE.  A request is sent
     asynchronously on the connection JC.  When the response arrives,
     CALLBACK is called with three arguments: JC, CLOSURE-DATA, and the
     result.  The result may be retrieved from the cache, unless FORCE
     is non-nil.

     If the request was successful, or retrieved from cache, it looks
     like '(IDENTITIES FEATURES)', where IDENTITIES and FEATURES are
     lists.  Each identity is '["NAME" "CATEGORY" "TYPE"]', and each
     feature is a string denoting the namespace of the feature.

     If the request failed, the result is an '<error/>' node.

 -- Function: jabber-disco-get-items jc jid node callback closure-data
          &optional force
     Get disco information for JID and NODE.  A request is sent
     asynchronously on the connection JC.  When the response arrives,
     CALLBACK is called with three arguments: JC, CLOSURE-DATA, and the
     result.  The result may be retrieved from the cache, unless FORCE
     is non-nil.

     If the request was successful, or retrieved from cache, the result
     is a list of items, where each item is '["NAME" "JID" "NODE"]'.
     The values are either strings or nil.

     If the request failed, the result is an '<error/>' node.

   If you only want to see what is in the cache, use one of the
following functions.  They don't use a callback, but return the result
directly.

 -- Function: jabber-disco-get-info-immediately jid node
     Return cached disco information for JID and NODE, or nil if the
     cache doesn't contain this information.  The result is the same as
     for 'jabber-disco-get-info'.

 -- Function: jabber-disco-get-items-immediately jid node
     Return cached disco items for JID and NODE, or nil if the cache
     doesn't contain this information.  The result is the same as for
     'jabber-disco-get-items'.

   In the future, this facility will be expanded to provide information
acquired through XEP-0115, Entity capabilities, which is a protocol for
sending disco information in '<presence/>' stanzas.

16.7 Chat printers
==================

Chat printers are functions that print a certain aspect of an incoming
message in a chat buffer.  Included are functions for printing subjects
('jabber-chat-print-subject'), bodies ('jabber-chat-print-body', and
'jabber:x:oob'-style URLs ('jabber-chat-print-url').  The functions in
'jabber-chat-printers' are called in order, with the entire '<message/>'
stanza as argument.  As described in the docstring of
'jabber-chat-printers', these functions are run in one of two modes:
'printp', in which they are supposed to return true if they would print
anything, and 'insert', in which they are supposed to actually print
something, if appropriate, using the function 'insert'.

   For MUC, the functions in 'jabber-muc-printers' are prepended to
those in 'jabber-chat-printers'.

   Body printers are a subgroup of chat printers.  They are exclusive;
only one of them applies to any given message.  The idea is that
"higher-quality" parts of the message override pieces included for
backwards compatibility.  Included are 'jabber-muc-print-invite' and
'jabber-chat-normal-body'; functions for XHTML-IM and PGP encrypted
messages may be written in the future.  The functions in
'jabber-body-printers' are called in order until one of them returns
non-nil.

16.8 Stanza chains
==================

If you really need to get under the skin of jabber.el, you can add
functions to the lists 'jabber-message-chain', 'jabber-iq-chain' and
'jabber-presence-chain'.  The functions in these lists will be called in
order when an XML stanza of the corresponding type arrives, with the
connection object and the entire XML stanza passed as arguments.
Earlier functions can modify the stanza to change the behaviour of
downstream functions, but remember: with great power comes great
responsibility.

Appendix A Protocol support
***************************

These are the protocols currently supported (in full or partially) by
jabber.el.

A.1 RFC 3920 (XMPP-CORE)
========================

Most of RFC 3920 is supported, with the following exceptions.

   SASL is supported only when an external SASL library from FLIM or
Gnus is present.  As SASL is an essential part to XMPP, jabber.el will
send pre-XMPP stream headers if it is not available.

   None of the stringprep profiles are implemented.  jabber.el changes
JIDs to lowercase internally; that's all.

   jabber.el doesn't interpret namespace prefixes.

   The 'xml:lang' attribute is neither interpreted nor generated.

   SRV records are used if a modern version of 'dns.el' is installed.

A.2 RFC 3921 (XMPP-IM)
======================

Most of RFC 3921 is supported, with the following exceptions.

   Messages of type "headline" are not treated in any special way.

   The '<thread/>' element is not used or generated.

   Sending "directed presence" is supported; however, presence stanzas
received from contacts not in roster are ignored.

   Privacy lists are not supported at all.

   jabber.el doesn't support XMPP-E2E or "im:" CPIM URIs.

A.3 XEP-0004 (Data Forms)
=========================

XEP-0004 support is good enough for many purposes.  Limitations are the
following.

   Forms in incoming messages are not interpreted.  See each specific
protocol for whether forms are accepted in that context.

   "Cancel" messages are probably not consistently generated when they
should be.  This is partly a paradigm clash, as jabber.el doesn't use
modal dialog boxes but buffers which can easily be buried.

   '<required/>' elements are not enforced.

   The field types "jid-single", "jid-multi" and "list-multi" are not
implemented, due to programmer laziness.  Let us know if you need them.

A.4 XEP-0012 (Last Activity)
============================

jabber.el can generate all three query types described in the protocol.
However, it does not answer to such requests.

A.5 XEP-0020 (Feature Negotiation)
==================================

There are no known limitations or bugs in XEP-0020 support.

A.6 XEP-0022 (Message Events)
=============================

jabber.el understands all four specified kinds of message events
(offline, delivered, displayed, and composing) and by default requests
all of them.  It also reports those three events that make sense for
clients.

A.7 XEP-0030 (Service Discovery)
================================

Service discovery is supported, both as client and server.  When used in
the code, service discovery results are cached indefinitely.

A.8 XEP-0045 (Multi-User Chat)
==============================

jabber.el supports parts of XEP-0045.  Entering, leaving and chatting
work.  So do invitations and private messages.  Room configuration is
supported.  Changing roles of participants (basic moderation) is
implemented, as is changing affiliations, but requesting affiliation
lists is not yet supported.

A.9 XEP-0049 (Private XML Storage)
==================================

jabber.el contains an implementation of XEP-0049; It is used for
bookmarks and roster's groups roll state saving.

A.10 XEP-0050 (Ad-Hoc Commands)
===============================

jabber.el is probably the first implementation of XEP-0050 (see post on
jdev from 2004-03-10
(http://article.gmane.org/gmane.network.jabber.devel/21413)).  Both the
client and server parts are supported.

A.11 XEP-0054 (vcard-temp)
==========================

Both displaying other users' vCards and editing your own vCard are
supported.  The implementation tries to follow the schema in the XEP
accurately.

A.12 XEP-0055 (Jabber Search)
=============================

XEP-0055 is supported, both with traditional fields and with Data Forms
(see XEP-0004).  As the traditional fields specified by the XEP is a
subset of those allowed in XEP-0077, handling of those two form types
are merged.  See XEP-0077.

A.13 XEP-0065 (SOCKS5 Bytestreams)
==================================

XEP-0065 is supported.  Currently jabber.el cannot act as a server, not
even on on Emacsen that support server sockets (GNU Emacs 22 and up).
Therefore it relies on proxies.  Proxies have to be entered and queried
manually.

   Psi's "fast mode" (<http://delta.affinix.com/specs/stream.html>),
which gives greater flexibility with regards to NAT, is not implemented.

A.14 XEP-0066 (Out of Band Data)
================================

jabber.el will display URLs sent in message stanzas qualified by the
'jabber:x:oob' namespace, as described in this XEP. Sending such URLs or
doing anything with iq stanzas (using the 'jabber:iq:oob' namespace) is
not supported.

A.15 XEP-0068 (Field Standardization for Data Forms)
====================================================

XEP-0068 is only used in the context of creating a new Jabber account,
to prefill the username field of the registration form.

A.16 XEP-0077 (In-Band Registration)
====================================

In-band registration is supported for all purposes.  That means
registering a new Jabber account, changing Jabber password, removing a
Jabber account, registering with a service, and cancelling registration
to a service.  Data forms are supported as well.  URL redirections are
not.

   jabber.el will not prevent or alert a user trying to change a
password over an unencrypted connection.

A.17 XEP-0078 (Non-SASL Authentication)
=======================================

Non-SASL authentication is supported, both plaintext and digest.  Digest
is preferred, and a warning is displayed to the user if only plaintext
is available.

A.18 XEP-0082 (Jabber Date and Time Profiles)
=============================================

The DateTime profile of XEP-0082 is supported.  Currently this is only
used for file transfer.

A.19 XEP-0085 (Chat State Notifications)
========================================

XEP-0085 is partially supported.  Currently only active/composing
notifications are _sent_ though all five notifications are handled on
receipt.

A.20 XEP-0086 (Error Condition Mappings)
========================================

Legacy errors are interpreted, but never generated.  XMPP style error
messages take precedence when errors are reported to the user.

A.21 XEP-0090 (Entity Time)
===========================

jabber.el can query other entities for their time, and return the
current time to those who ask.

A.22 XEP-0091 (Delayed Delivery)
================================

The time specified on delayed incoming messages is interpreted, and
displayed in chat buffers instead of the current time.

A.23 XEP-0092 (Software Version)
================================

The user can request the version of any entity.  jabber.el answers
version requests to anyone, giving "jabber.el" as name, and the Emacs
version as OS.

A.24 XEP-0095 (Stream Initiation)
=================================

XEP-0095 is supported, both incoming and outgoing, except that jabber.el
doesn't check service discovery results before sending a stream
initiation request.

A.25 XEP-0096 (File Transfer)
=============================

Both sending and receiving files is supported.  If a suitable program is
found, MD5 hashes of outgoing files are calculated and sent.  However,
hashes of received files are not checked.  Ranged transfers are not
supported.  In-band bytestreams are not yet supported, even though
XEP-0096 requires them.

A.26 XEP-0146 (Remote Controlling Clients)
==========================================

The "set-status" command in XEP-0146 is supported.

A.27 XEP-0153 (vCard-Based Avatars)
===================================

vCard-based avatars are supported, both publishing and displaying.  The
pixel size limits on avatars are not enforced.

A.28 XEP-0199 (XMPP Ping)
=========================

XEP-0199 is fully supported.

A.29 XEP-0245 (/me Command)
===========================

XEP-0245 is partially supported (except XHTML-IM).