From: ueno Date: Tue, 18 May 2004 04:40:20 +0000 (+0000) Subject: * riece-ignore.el (riece-ignore-buffer-name): New user option. X-Git-Tag: riece-1_0_0~50 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4b3cd5b561159baee6685386ff437abc9a72718b;p=elisp%2Friece.git * riece-ignore.el (riece-ignore-buffer-name): New user option. (riece-ignore-discard-message): Fixed custom spec to follow the logging option. (riece-ignore-buffer): New variable. * riece-log.el (riece-log-display-message-function): Use riece-format-message. * riece-message.el (riece-format-message): New function splitted from riece-display-message-1. (riece-display-message-1): Use it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 84315a9..6f62326 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,19 @@ 2004-05-18 Daiki Ueno + * riece-ignore.el (riece-ignore-buffer-name): New user option. + (riece-ignore-discard-message): Fixed custom spec to follow the + logging option. + (riece-ignore-buffer): New variable. + + * riece-log.el (riece-log-display-message-function): Use + riece-format-message. + + * riece-message.el (riece-format-message): New function splitted + from riece-display-message-1. + (riece-display-message-1): Use it. + +2004-05-18 Daiki Ueno + * riece-ignore.el (riece-ignore-user): Renamed from riece-ignore-by-user. diff --git a/lisp/riece-ignore.el b/lisp/riece-ignore.el index f8c277f..9a455e6 100644 --- a/lisp/riece-ignore.el +++ b/lisp/riece-ignore.el @@ -37,12 +37,23 @@ "Ignore messages in IRC buffers." :group 'riece) -(defcustom riece-ignore-discard-message t - "If non-nil, messages from ignored user are completely discarded. -Otherwise, they are left there but not visible." +(defcustom riece-ignore-discard-message 'log + "If t, messages from ignored user are completely discarded. +If 'log, messages are removed from IRC buffers, but they are saved in +`riece-ignore-buffer'. +Otherwise, they are not removed from IRC buffers, but are hidden with +'invisible text-property." :group 'riece-ignore - :type 'boolean) + :type '(choice (const :tag "Discard completely" t) + (const :tag "Discard but save logs" log) + (const :tag "Make messages invisible" nil))) +(defcustom riece-ignore-buffer-name "*Ignore*" + "The name of buffer where ignored messages are stored." + :group 'riece-ignore + :type 'string) + +(defvar riece-ignore-buffer nil) (defvar riece-ignored-user-list nil) (defun riece-ignore-user-rename-signal-function (signal handback) @@ -63,7 +74,7 @@ Otherwise, they are left there but not visible." (riece-get-users-on-server (riece-current-server-name)) (lambda (user) (not (riece-identity-member - (riece-parse-identity user) + (riece-parse-identity (car user)) riece-ignored-user-list))))) (not current-prefix-arg)))) (if toggle @@ -82,7 +93,15 @@ Otherwise, they are left there but not visible." (defun riece-ignore-message-filter (message) (if (riece-identity-member (riece-message-speaker message) riece-ignored-user-list) - (unless riece-ignore-discard-message + (if riece-ignore-discard-message + (when (eq riece-ignore-discard-message 'log) + (unless riece-ignore-buffer + (setq riece-ignore-buffer + (riece-get-buffer-create riece-ignore-buffer-name))) + (save-excursion + (set-buffer riece-ignore-buffer) + (goto-char (point-max)) + (insert (riece-format-message message t)))) (put-text-property 0 (length (riece-message-text message)) 'invisible 'riece-ignore (riece-message-text message)) diff --git a/lisp/riece-log.el b/lisp/riece-log.el index dd997e6..5b79710 100644 --- a/lisp/riece-log.el +++ b/lisp/riece-log.el @@ -67,19 +67,12 @@ If integer, flash back only this line numbers. t means all lines." :group 'riece-log) (defun riece-log-display-message-function (message) - (let ((open-bracket - (funcall riece-message-make-open-bracket-function message)) - (close-bracket - (funcall riece-message-make-close-bracket-function message)) - (name - (funcall riece-message-make-name-function message)) - (file (riece-log-get-file (riece-message-target message))) + (let ((file (riece-log-get-file (riece-message-target message))) (coding-system-for-write riece-log-coding-system)) (unless (file-directory-p (file-name-directory file)) (make-directory (file-name-directory file) t)) (write-region (concat (format-time-string "%H:%M") " " - open-bracket name close-bracket - " " (riece-message-text message) "\n") + (riece-format-message message)) nil file t 0))) (defun riece-log-get-file (identity) diff --git a/lisp/riece-message.el b/lisp/riece-message.el index 8db0334..a8a2576 100644 --- a/lisp/riece-message.el +++ b/lisp/riece-message.el @@ -142,17 +142,23 @@ Normally they are *Dialogue* and/or *Others*." (list riece-dialogue-buffer riece-others-buffer) riece-dialogue-buffer))) -(defun riece-display-message-1 (message) +(defun riece-format-message (message &optional global) (let ((open-bracket (funcall riece-message-make-open-bracket-function message)) (close-bracket (funcall riece-message-make-close-bracket-function message)) (name - (funcall riece-message-make-name-function message)) - (global-name - (funcall riece-message-make-global-name-function message)) - (buffer (riece-message-buffer message)) - (server-name (riece-identity-server (riece-message-speaker message))) + (if global + (funcall riece-message-make-global-name-function message) + (funcall riece-message-make-name-function message))) + (server-name (riece-identity-server (riece-message-speaker message)))) + (riece-with-server-buffer (riece-current-server-name) + (riece-concat-server-name + (concat open-bracket name close-bracket + " " (riece-message-text message) "\n"))))) + +(defun riece-display-message-1 (message) + (let ((buffer (riece-message-buffer message)) parent-buffers) (when (and buffer (riece-message-own-p message) @@ -161,16 +167,8 @@ Normally they are *Dialogue* and/or *Others*." (setq riece-freeze nil)) (riece-emit-signal 'buffer-freeze-changed buffer nil)) (setq parent-buffers (riece-message-parent-buffers message buffer)) - (riece-insert buffer - (concat open-bracket name close-bracket - " " (riece-message-text message) "\n")) - (riece-insert parent-buffers - (if (equal server-name "") - (concat open-bracket global-name close-bracket - " " (riece-message-text message) "\n") - (concat open-bracket global-name close-bracket - " " (riece-message-text message) - " (from " server-name ")\n"))) + (riece-insert buffer (riece-format-message message)) + (riece-insert parent-buffers (riece-format-message message t)) (run-hook-with-args 'riece-after-display-message-functions message))) (defun riece-display-message (message)