* riece-unread.el (riece-unread-display-message-function): Delete the
authorbg66 <bg66>
Fri, 6 Jun 2003 01:54:46 +0000 (01:54 +0000)
committerbg66 <bg66>
Fri, 6 Jun 2003 01:54:46 +0000 (01:54 +0000)
target before adding to list.
(riece-unread-switch-to-channel): New function.
(riece-unread-insinuate): Follow change above.

lisp/ChangeLog
lisp/riece-unread.el

index c8f2174..ab40c06 100644 (file)
@@ -1,5 +1,10 @@
 2003-06-06  OHASHI Akira  <bg66@koka-in.org>
 
+       * riece-unread.el (riece-unread-display-message-function): Delete the
+       target before adding to list.
+       (riece-unread-switch-to-channel): New function.
+       (riece-unread-insinuate): Follow change above.
+
        * riece.el (riece-channel-list-mode-map): Don't bind
        `riece-command-unread-channel'.
 
index 5c7ad7f..d2e3100 100644 (file)
@@ -38,6 +38,8 @@
 (defun riece-unread-display-message-function (message)
   (unless (or (riece-message-own-p message)
              (equal (riece-message-target message) riece-current-channel))
+    (setq riece-unread-channels
+         (delete (riece-message-target message) riece-unread-channels))
     (add-to-list 'riece-unread-channels
                 (riece-message-target message))
     (riece-unread-update-channel-list-buffer)))
                           "\\3"))))
            (forward-line))))))
       
+(defun riece-unread-switch-to-channel ()
+  (interactive)
+  (if (car riece-unread-channels)
+      (riece-command-switch-to-channel (car riece-unread-channels))
+    (error "No unread channel!")))
+
+(defvar riece-command-mode-map)
+(defvar riece-dialogue-mode-map)
+(defvar riece-channel-list-mode-map)
+
 (defun riece-unread-insinuate ()
   (add-hook 'riece-after-display-message-functions
            'riece-unread-display-message-function)
   (add-hook 'riece-channel-switch-hook
            'riece-unread-channel-switch-hook)
   (add-hook 'riece-update-buffers-hook
-           'riece-unread-update-channel-list-buffer))
+           'riece-unread-update-channel-list-buffer)
+  (define-key riece-command-mode-map
+    "\C-c\C-u" 'riece-unread-switch-to-channel)
+  (define-key riece-dialogue-mode-map
+    "u" 'riece-unread-switch-to-channel)
+  (define-key riece-channel-list-mode-map
+    "u" 'riece-unread-switch-to-channel))
 
 (provide 'riece-unread)