* riece-identity.el (riece-identity-member-no-server): Abolish.
authorueno <ueno>
Wed, 11 Jun 2003 23:40:20 +0000 (23:40 +0000)
committerueno <ueno>
Wed, 11 Jun 2003 23:40:20 +0000 (23:40 +0000)
* riece-doctor.el (riece-doctor-patients): Make it global variable.
(riece-doctor-after-privmsg-hook): Use riece-identity-member
instead of riece-identity-member-no-server.

lisp/ChangeLog
lisp/riece-doctor.el
lisp/riece-identity.el

index 24f5466..7abf1db 100644 (file)
@@ -1,5 +1,13 @@
 2003-06-11  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece-identity.el (riece-identity-member-no-server): Abolish.
+
+       * riece-doctor.el (riece-doctor-patients): Make it global variable.
+       (riece-doctor-after-privmsg-hook): Use riece-identity-member
+       instead of riece-identity-member-no-server.
+
+2003-06-11  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-doctor.el: New add-on.
        * COMPILE (riece-modules): Add riece-doctor.
        * Makefile.am (EXTRA_DIST): Add riece-doctor.el
index 9dca31f..1f07a62 100644 (file)
@@ -35,9 +35,7 @@
 (defvar riece-doctor-patients nil)
 
 (defun riece-doctor-buffer-name (user)
-  (concat " *riece-doctor*"
-         (riece-decode-identity (riece-make-identity user
-                                                     riece-server-name))))
+  (concat " *riece-doctor*" (riece-decode-identity user)))
 
 (defun riece-doctor-reply (target string)
   (riece-own-channel-message string
   (riece-send-string (format "NOTICE %s :%s\r\n" target string)))
 
 (defun riece-doctor-after-privmsg-hook (prefix string)
-  (let* ((user (riece-prefix-nickname prefix))
+  (let* ((user (riece-make-identity (riece-prefix-nickname prefix)
+                                   riece-server-name))
         (parameters (riece-split-parameters string))
         (targets (split-string (car parameters) ","))
         (message (nth 1 parameters)))
     (if (string-match "^, doctor" message)
-       (if (riece-identity-member-no-server user riece-doctor-patients)
+       (if (riece-identity-member user riece-doctor-patients)
            (riece-doctor-reply
             (car targets)
             "You are already talking with me.")
           (car targets)           
           "I am the psychotherapist.  Please, describe your problems."))
       (if (string-match "^, bye doctor" message)
-         (let ((pointer (riece-identity-member-no-server
-                         user riece-doctor-patients)))
+         (let ((pointer (riece-identity-member user riece-doctor-patients)))
            (when pointer
              (kill-buffer (riece-doctor-buffer-name user))
              (setq riece-doctor-patients (delq (car pointer)
                                                riece-doctor-patients))
              (riece-doctor-reply (car targets) "Good bye.")))
-       (if (riece-identity-member-no-server user riece-doctor-patients)
-           (save-excursion
-             (let ((point (point))
-                   string)
+       (if (riece-identity-member user riece-doctor-patients)
+           (let (string)
+             (save-excursion
                (set-buffer (get-buffer (riece-doctor-buffer-name user)))
                (goto-char (point-max))
                (insert message "\n")
-               (doctor-read-print)
-               (setq string (buffer-substring (1+ point) (- (point) 2)))
+               (let ((point (point)))
+                 (doctor-read-print)
+                 (setq string (buffer-substring (1+ point) (- (point) 2))))
                (with-temp-buffer
                  (insert string)
                  (subst-char-in-region (point-min) (point-max) ?\n ? )
-                 (setq string (buffer-string)))
-               (riece-doctor-reply (car targets) string))))))))
+                 (setq string (buffer-string))))
+             (riece-doctor-reply (car targets) string)))))))
 
 (defun riece-doctor-insinuate ()
-  (make-variable-buffer-local 'riece-doctor-patients)
   (add-hook 'riece-after-privmsg-hook 'riece-doctor-after-privmsg-hook))
 
 (provide 'riece-doctor)
index c2c3b75..32cc7da 100644 (file)
@@ -90,19 +90,6 @@ RFC2812, 2.2 \"Character codes\" says:
          (throw 'found list)
        (setq list (cdr list))))))
 
-(defun riece-identity-member-no-server (elt list)
-  "Return non-nil if an identity ELT is an element of LIST.
-The only difference with `riece-identity-member', this function doesn't
-take server names into account."
-  (catch 'found
-    (while list
-      (if (and (vectorp (car list))    ;needed because
-                                       ;riece-current-channels
-                                       ;contains nil.
-              (riece-identity-equal-no-server (car list) elt))
-         (throw 'found list)
-       (setq list (cdr list))))))
-
 (defun riece-identity-assoc (elt alist)
   "Return non-nil if an identity ELT matches the car of an element of ALIST."
   (catch 'found