From: Magnus H. <leg...@us...> - 2014-10-31 18:58:38
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "emacs-jabber". The branch, master has been updated via 262602e1b7e97922420832cba00c54d9966b13c5 (commit) from 4891befb7d947c132dfd8b0de4a322d8751f9d0f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 262602e1b7e97922420832cba00c54d9966b13c5 Author: Magnus Henoch <mag...@gm...> Date: Fri Oct 31 18:55:56 2014 +0000 Allow inhibiting history entries for incoming messages New variable `jabber-history-inhibit-received-message-functions' can contain a list of functions. If any of them returns non-nil, the given incoming message is not included in the message history. diff --git a/jabber-history.el b/jabber-history.el index 53953b8..a1e8250 100644 --- a/jabber-history.el +++ b/jabber-history.el @@ -92,6 +92,12 @@ number after the last rotation." :type 'integer :group 'jabber-history) +(defvar jabber-history-inhibit-received-message-functions nil + "Functions determining whether to log an incoming message stanza. +The functions in this list are called with two arguments, +the connection and the full message stanza. +If any of the functions returns non-nil, the stanza is not logged +in the message history.") (defun jabber-rotate-history-p (history-file) "Return true if HISTORY-FILE should be rotated." @@ -114,16 +120,19 @@ number after the last rotation." (not (file-directory-p jabber-history-dir))) (make-directory jabber-history-dir)) (let ((is-muc (jabber-muc-message-p xml-data))) - (if (and jabber-history-enabled - (or - (not is-muc) ;chat message or private MUC message - (and jabber-history-muc-enabled is-muc))) ;muc message and muc logging active - (let ((from (jabber-xml-get-attribute xml-data 'from)) - (text (car (jabber-xml-node-children - (car (jabber-xml-get-children xml-data 'body))))) - (timestamp (jabber-message-timestamp xml-data))) - (when (and from text) - (jabber-history-log-message "in" from nil text timestamp)))))) + (when (and jabber-history-enabled + (or + (not is-muc) ;chat message or private MUC message + (and jabber-history-muc-enabled is-muc))) ;muc message and muc logging active + (unless (run-hook-with-args-until-success + 'jabber-history-inhibit-received-message-functions + jc xml-data) + (let ((from (jabber-xml-get-attribute xml-data 'from)) + (text (car (jabber-xml-node-children + (car (jabber-xml-get-children xml-data 'body))))) + (timestamp (jabber-message-timestamp xml-data))) + (when (and from text) + (jabber-history-log-message "in" from nil text timestamp))))))) (add-hook 'jabber-chat-send-hooks 'jabber-history-send-hook) ----------------------------------------------------------------------- Summary of changes: jabber-history.el | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) hooks/post-receive -- emacs-jabber |