From: ueno Date: Wed, 1 Sep 2004 06:05:50 +0000 (+0000) Subject: * riece-naming.el (riece-naming-assert-channel-users): Remove X-Git-Tag: riece-1_0_3~2 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=31c67f4bf957d63fafb9103ef84c312298fce43f;p=elisp%2Friece.git * riece-naming.el (riece-naming-assert-channel-users): Remove nonexistent users. * riece-300.el (riece-353-users): New variable. (riece-handle-353-message): Don't update user-list. (riece-handle-366-message): Update user-list here. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 54feb4b..fbf2410 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2004-09-01 Daiki Ueno + * riece-naming.el (riece-naming-assert-channel-users): Remove + nonexistent users. + * riece-300.el (riece-353-users): New variable. + (riece-handle-353-message): Don't update user-list. + (riece-handle-366-message): Update user-list here. + * riece-channel.el (riece-channel-toggle-operator): Don't add ?o if it already appears in user's mode. (riece-channel-toggle-speaker): Don't add ?v if it already appears diff --git a/lisp/riece-300.el b/lisp/riece-300.el index 5f1383e..edf75b5 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -223,12 +223,14 @@ (substring string (match-end 0)))) "\n")))) +(defvar riece-353-users nil) (defun riece-handle-353-message (prefix number name string) - "RPL_NAMREPLY \" :[[@|+] [[@|+] [...]]]\"." + "RPL_NAMREPLY \"[=\*@] :[[@|+] [[@|+] [...]]]\"." (if (string-match "^[=\*@] *\\([^ ]+\\) +:" string) (let ((channel (match-string 1 string)) (start 0) - user users) + user) + (make-local-variable 'riece-353-users) (setq string (substring string (match-end 0))) (while (string-match (concat "\\([@+]\\)?\\(" riece-user-regexp "\\) *") @@ -245,8 +247,7 @@ (if (eq (aref string (match-beginning 1)) ?+) (list (match-string 2 string) ?v))) (list (match-string 2 string))) - users (cons user users))) - (riece-naming-assert-channel-users (nreverse users) channel) + riece-353-users (cons user riece-353-users))) (let* ((channel-identity (riece-make-identity channel riece-server-name)) (buffer (riece-channel-buffer channel-identity))) @@ -424,7 +425,14 @@ (defun riece-handle-315-message (prefix number name string)) (defun riece-handle-318-message (prefix number name string)) (defun riece-handle-323-message (prefix number name string)) -(defun riece-handle-366-message (prefix number name string)) + +(defun riece-handle-366-message (prefix number name string) + "RPL_ENDOFNAMES \" :End of NAMES list\"" + (if (string-match "^\\([^ ]+\\) +:" string) + (let ((channel (match-string 1 string))) + (riece-naming-assert-channel-users (nreverse riece-353-users) + channel))) + (setq riece-353-users nil)) (provide 'riece-300) diff --git a/lisp/riece-naming.el b/lisp/riece-naming.el index dd5ad10..2ff492b 100644 --- a/lisp/riece-naming.el +++ b/lisp/riece-naming.el @@ -70,22 +70,24 @@ (defun riece-naming-assert-channel-users (users channel-name) (let ((channel-identity (riece-make-identity channel-name riece-server-name)) - user-identity-list) - (while users - (riece-user-toggle-channel (car (car users)) channel-name t) - (riece-channel-toggle-user channel-name (car (car users)) t) - (if (memq ?o (cdr (car users))) - (riece-channel-toggle-operator channel-name (car (car users)) t) - (if (memq ?v (cdr (car users))) - (riece-channel-toggle-speaker channel-name (car (car users)) t) - (riece-channel-toggle-operator channel-name (car (car users)) nil) - (riece-channel-toggle-speaker channel-name (car (car users)) nil))) - (setq user-identity-list - (cons (cons (riece-make-identity (car (car users)) - riece-server-name) - (cdr (car users))) - user-identity-list) - users (cdr users))) + (pointer users)) + (while pointer + (riece-user-toggle-channel (car (car pointer)) channel-name t) + (riece-channel-toggle-user channel-name (car (car pointer)) t) + (if (memq ?o (cdr (car pointer))) + (riece-channel-toggle-operator channel-name (car (car pointer)) t) + (if (memq ?v (cdr (car pointer))) + (riece-channel-toggle-speaker channel-name (car (car pointer)) t) + (riece-channel-toggle-operator channel-name (car (car pointer)) nil) + (riece-channel-toggle-speaker channel-name (car (car pointer)) nil))) + (setq pointer (cdr pointer))) + ;; Remove nonexistent users. + (setq pointer (riece-channel-users (riece-get-channel channel-name))) + (while pointer + (unless (assq (car (car pointer)) users) + (riece-user-toggle-channel (car (car pointer)) channel-name nil) + (riece-channel-toggle-user channel-name (car (car pointer)) nil)) + (setq pointer (cdr pointer))) (riece-emit-signal 'user-list-changed channel-identity))) (defun riece-naming-assert-channel-modes (channel modes)