Next: , Previous: Customizing the chat buffer, Up: Customization


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.

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.