2004-05-18 Daiki Ueno <ueno@unixuser.org>
+ * 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 <ueno@unixuser.org>
+
* riece-ignore.el (riece-ignore-user): Renamed from
riece-ignore-by-user.
"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)
(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
(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))
: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)
(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)
(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)