* riece-naming.el (riece-naming-assert-channel-users): Remove
authorueno <ueno>
Wed, 1 Sep 2004 06:05:50 +0000 (06:05 +0000)
committerueno <ueno>
Wed, 1 Sep 2004 06:05:50 +0000 (06:05 +0000)
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.

lisp/ChangeLog
lisp/riece-300.el
lisp/riece-naming.el

index 54feb4b..fbf2410 100644 (file)
@@ -1,5 +1,11 @@
 2004-09-01  Daiki Ueno  <ueno@unixuser.org>
 
+       * 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
index 5f1383e..edf75b5 100644 (file)
                 (substring string (match-end 0))))
        "\n"))))
 
+(defvar riece-353-users nil)
 (defun riece-handle-353-message (prefix number name string)
-  "RPL_NAMREPLY        \"<channel> :[[@|+]<nick> [[@|+]<nick> [...]]]\"."
+  "RPL_NAMREPLY        \"[=\*@] <channel> :[[@|+]<nick> [[@|+]<nick> [...]]]\"."
   (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 "\\) *")
                           (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)))
 (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 \"<channel> :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)
 
index dd5ad10..2ff492b 100644 (file)
 (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)