Next: , Previous: Extending service discovery, Up: Hacking and extending


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.