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,
“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
to nil. This affects the behaviour of the default message function, so
you'll have to reimplement this functionality if you write your own
 Logically it should be
jabber-alert-message-message-function, but that would be