* riece.el (riece-dialogue-mode-map): Bind riece-command-change-layout.
[riece] / lisp / riece-unread.el
index af09f29..8f42ddc 100644 (file)
 ;; "unread messages".
 
 ;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-unread t)
+;; (add-to-list 'riece-addons 'riece-unread)
 
 ;;; Code:
 
-(eval-when-compile (require 'riece-message))
+(require 'riece-message)
+(require 'riece-commands)
 
 (defvar riece-unread-channels nil)
 
 (defun riece-unread-display-message-function (message)
   (unless (or (riece-message-own-p message)
-             (and (equal (riece-message-target message) riece-current-channel)
-                  (eq (window-buffer (selected-window))
-                      (get-buffer riece-command-buffer))))
+             (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
@@ -61,7 +60,8 @@
          (goto-char (point-min))
          (while (not (eobp))
            (if (looking-at "\\( ?[0-9]+:\\)\\([ !]\\)\\(.+\\)")
-               (let ((channel (match-string 3)))
+               (let ((channel (save-match-data
+                                (riece-parse-identity (match-string 3)))))
                  (replace-match
                   (concat "\\1"
                           (if (member channel riece-unread-channels)
@@ -85,8 +85,8 @@
            '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)
+  (add-hook 'riece-update-buffer-functions
+           'riece-unread-update-channel-list-buffer t)
   (define-key riece-command-mode-map
     "\C-c\C-u" 'riece-unread-switch-to-channel)
   (define-key riece-dialogue-mode-map