From fea3cf6cf23ce23ebdc33c172d5eebfc3fdb42fe Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 12 Jun 2003 00:43:24 +0000 Subject: [PATCH] * riece-message.el (riece-own-channel-message): Abolish. * riece-commands.el (riece-command-send-message): Don't use riece-own-channel-message. * riece-doctor.el (riece-doctor-reply): Don't use riece-own-channel-message. (riece-doctor-hello-regexp): New user option. (riece-doctor-bye-regexp): New user option. --- lisp/ChangeLog | 12 ++++++++++++ lisp/riece-commands.el | 8 ++++++-- lisp/riece-doctor.el | 27 ++++++++++++++++++++++----- lisp/riece-message.el | 35 +++++++++++++++-------------------- 4 files changed, 55 insertions(+), 27 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7abf1db..4274483 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2003-06-12 Daiki Ueno + + * riece-message.el (riece-own-channel-message): Abolish. + + * riece-commands.el (riece-command-send-message): Don't use + riece-own-channel-message. + + * riece-doctor.el (riece-doctor-reply): Don't use + riece-own-channel-message. + (riece-doctor-hello-regexp): New user option. + (riece-doctor-bye-regexp): New user option. + 2003-06-11 Daiki Ueno * riece-identity.el (riece-identity-member-no-server): Abolish. diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 52e6582..4e2776b 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -356,12 +356,16 @@ (format "NOTICE %s :%s\r\n" (riece-identity-prefix riece-current-channel) message)) - (riece-own-channel-message message riece-current-channel 'notice)) + (riece-display-message + (riece-make-message (riece-current-nickname) riece-current-channel + message 'notice t))) (riece-send-string (format "PRIVMSG %s :%s\r\n" (riece-identity-prefix riece-current-channel) message)) - (riece-own-channel-message message))) + (riece-display-message + (riece-make-message (riece-current-nickname) riece-current-channel + message nil t)))) (defun riece-command-enter-message () "Send the current line to the current channel." diff --git a/lisp/riece-doctor.el b/lisp/riece-doctor.el index 1f07a62..0b14ff2 100644 --- a/lisp/riece-doctor.el +++ b/lisp/riece-doctor.el @@ -32,15 +32,32 @@ (require 'doctor) +(defgroup riece-doctor nil + "Interface to doctor.el" + :prefix "riece-" + :group 'riece) + +(defcustom riece-doctor-hello-regexp "^, doctor" + "Pattern of string patients start consultation." + :type 'string + :group 'riece-doctor) + +(defcustom riece-doctor-bye-regexp "^, bye doctor" + "Pattern of string patients end consultation." + :type 'string + :group 'riece-doctor) + (defvar riece-doctor-patients nil) (defun riece-doctor-buffer-name (user) (concat " *riece-doctor*" (riece-decode-identity user))) (defun riece-doctor-reply (target string) - (riece-own-channel-message string - (riece-make-identity target riece-server-name) - 'notice) + (riece-display-message + (riece-make-message (riece-make-identity riece-real-nickname + riece-server-name) + (riece-make-identity target riece-server-name) + string 'notice t)) (riece-send-string (format "NOTICE %s :%s\r\n" target string))) (defun riece-doctor-after-privmsg-hook (prefix string) @@ -49,7 +66,7 @@ (parameters (riece-split-parameters string)) (targets (split-string (car parameters) ",")) (message (nth 1 parameters))) - (if (string-match "^, doctor" message) + (if (string-match riece-doctor-hello-regexp message) (if (riece-identity-member user riece-doctor-patients) (riece-doctor-reply (car targets) @@ -62,7 +79,7 @@ (riece-doctor-reply (car targets) "I am the psychotherapist. Please, describe your problems.")) - (if (string-match "^, bye doctor" message) + (if (string-match riece-doctor-bye-regexp message) (let ((pointer (riece-identity-member user riece-doctor-patients))) (when pointer (kill-buffer (riece-doctor-buffer-name user)) diff --git a/lisp/riece-message.el b/lisp/riece-message.el index 92c7821..a2d1aff 100644 --- a/lisp/riece-message.el +++ b/lisp/riece-message.el @@ -119,22 +119,24 @@ (defun riece-message-parent-buffers (message buffer) "Return the parents of BUFFER where MESSAGE should appear. Normally they are *Dialogue* and/or *Others*." - (if (riece-message-own-p message) - riece-dialogue-buffer - (if (and buffer (riece-frozen buffer)) ;the message might not be - ;visible in buffer's window - (list riece-dialogue-buffer riece-others-buffer) - (if (and riece-current-channel ;the message is not sent to + (if (and buffer (riece-frozen buffer)) ;the message might not be + ;visible in buffer's window + (list riece-dialogue-buffer riece-others-buffer) + (if (and riece-current-channel ;the message is not sent to ;the current channel - (if (riece-message-private-p message) + (if (riece-message-private-p message) + (if (riece-message-own-p message) + (not (riece-identity-equal + (riece-message-target message) + riece-current-channel)) (not (riece-identity-equal (riece-message-speaker message) - riece-current-channel)) - (not (riece-identity-equal - (riece-message-target message) - riece-current-channel)))) - (list riece-dialogue-buffer riece-others-buffer) - riece-dialogue-buffer)))) + riece-current-channel))) + (not (riece-identity-equal + (riece-message-target message) + riece-current-channel)))) + (list riece-dialogue-buffer riece-others-buffer) + riece-dialogue-buffer))) (defun riece-display-message (message) "Display MESSAGE object." @@ -217,13 +219,6 @@ Currently possible values are `action' and `notice'." (riece-make-identity user riece-server-name)) (riece-channel-get-users (riece-identity-prefix target)))))))) -(defun riece-own-channel-message (message &optional channel type) - "Display MESSAGE as you sent to CHNL." - (riece-display-message - (riece-make-message (riece-current-nickname) - (or channel riece-current-channel) - message type t))) - (provide 'riece-message) ;;; riece-message.el ends here -- 1.7.10.4