* riece-message.el (riece-own-channel-message): Abolish.
authorueno <ueno>
Thu, 12 Jun 2003 00:43:24 +0000 (00:43 +0000)
committerueno <ueno>
Thu, 12 Jun 2003 00:43:24 +0000 (00:43 +0000)
* 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
lisp/riece-commands.el
lisp/riece-doctor.el
lisp/riece-message.el

index 7abf1db..4274483 100644 (file)
@@ -1,3 +1,15 @@
+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.
index 52e6582..4e2776b 100644 (file)
         (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."
index 1f07a62..0b14ff2 100644 (file)
 
 (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))
index 92c7821..a2d1aff 100644 (file)
 (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