+2003-06-12 Daiki Ueno <ueno@unixuser.org>
+
+ * 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 <ueno@unixuser.org>
* riece-identity.el (riece-identity-member-no-server): Abolish.
(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."
(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)
(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)
(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))
(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."
(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