Here's a simple example of a handler for a message that tells XEmacs to display a string in the mini-buffer area. The message operation is called ‘emacs-display-string’. Its first (0th) argument is the string to display.
(defun tooltalk-display-string-handler (msg)
(message (get-tooltalk-message-attribute msg 'arg_val 0)))
(defvar display-string-pattern
'(category TT_HANDLE
scope TT_SESSION
op "emacs-display-string"
callback tooltalk-display-string-handler))
(let ((p (make-tooltalk-pattern display-string-pattern)))
(register-tooltalk-pattern p))