* riece-xemacs.el (riece-make-overlay): New alias.
[riece] / lisp / riece-message.el
index 8a20efb..bac5784 100644 (file)
   :prefix "riece-"
   :group 'riece)
 
+(defcustom riece-message-filter-functions nil
+  "Functions to filter incoming messages."
+  :type 'function
+  :group 'riece-message)
+
 (defcustom riece-message-make-open-bracket-function
   #'riece-message-make-open-bracket
   "Function which makes `open-bracket' string for each message."
@@ -138,8 +143,7 @@ Normally they are *Dialogue* and/or *Others*."
        (list riece-dialogue-buffer riece-others-buffer)
       riece-dialogue-buffer)))
 
-(defun riece-display-message (message)
-  "Display MESSAGE object."
+(defun riece-display-message-1 (message)
   (let ((open-bracket
         (funcall riece-message-make-open-bracket-function message))
        (close-bracket
@@ -170,6 +174,16 @@ Normally they are *Dialogue* and/or *Others*."
                             " (from " server-name ")\n")))
     (run-hook-with-args 'riece-after-display-message-functions message)))
 
+(defun riece-display-message (message)
+  "Display MESSAGE object."
+  (let ((functions riece-message-filter-functions))
+    (setq message (copy-sequence message))
+    (while functions
+      (setq message (funcall (car functions) message)
+           functions (cdr functions)))
+    (if message
+       (riece-display-message-1 message))))
+
 (defun riece-make-message (speaker target text &optional type own-p)
   "Make an instance of message object.
 Arguments are appropriate to the sender, the receiver, and text