From a722972ffd4407a7b24455493fc3b47aa21933c3 Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 11 Jun 2003 23:40:20 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 8 ++++++++ lisp/riece-doctor.el | 29 +++++++++++++---------------- lisp/riece-identity.el | 13 ------------- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 24f5466..7abf1db 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,13 @@ 2003-06-11 Daiki Ueno + * 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 + * riece-doctor.el: New add-on. * COMPILE (riece-modules): Add riece-doctor. * Makefile.am (EXTRA_DIST): Add riece-doctor.el diff --git a/lisp/riece-doctor.el b/lisp/riece-doctor.el index 9dca31f..1f07a62 100644 --- a/lisp/riece-doctor.el +++ b/lisp/riece-doctor.el @@ -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 @@ -46,12 +44,13 @@ (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.") @@ -64,30 +63,28 @@ (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) diff --git a/lisp/riece-identity.el b/lisp/riece-identity.el index c2c3b75..32cc7da 100644 --- a/lisp/riece-identity.el +++ b/lisp/riece-identity.el @@ -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 -- 1.7.10.4