* riece-addon.el (riece-uninstall-addon): Don't check the add-on
[riece] / lisp / riece-unread.el
index 9283cd7..f0355a9 100644 (file)
 
 (defvar riece-unread-channels nil)
 
-(defvar riece-unread-enabled nil)
-
 (defconst riece-unread-description
   "Mark channels where new messages arrived.")
 
 (defun riece-unread-after-display-message-function (message)
-  (if riece-unread-enabled
+  (if (get 'riece-unread 'riece-addon-enabled)
       (let ((target (if (riece-message-private-p message)
                        (riece-message-speaker message)
                      (riece-message-target message))))
          (riece-emit-signal 'channel-list-changed)))))
 
 (defun riece-unread-after-switch-to-channel-function (last)
-  (if riece-unread-enabled
+  (if (get 'riece-unread 'riece-addon-enabled)
       (setq riece-unread-channels
            (delq (car (riece-identity-member riece-current-channel
                                              riece-unread-channels))
                  riece-unread-channels))))
 
 (defun riece-unread-format-identity-for-channel-list-buffer (index identity)
-  (if (and riece-unread-enabled
+  (if (and (get 'riece-unread 'riece-addon-enabled)
           (riece-identity-member identity riece-unread-channels))
       (concat (format "%2d:!" index)
              (riece-format-identity identity))))
 
 (defun riece-unread-format-identity-for-channel-list-indicator (index identity)
-  (if (and riece-unread-enabled
+  (if (and (get 'riece-unread 'riece-addon-enabled)
           (riece-identity-member identity riece-unread-channels))
       (let ((string (riece-format-identity identity))
            (start 0))
   (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)
-  (setq riece-unread-enabled t)
+    "u" 'riece-unread-switch-to-channel)  
   (riece-emit-signal 'channel-list-changed))
 
 (defun riece-unread-disable ()
     "u" nil)
   (define-key riece-channel-list-mode-map
     "u" nil)
-  (setq riece-unread-channels nil
-       riece-unread-enabled nil)
+  (setq riece-unread-channels nil)
   (riece-emit-signal 'channel-list-changed))
 
 (provide 'riece-unread)