X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-biff.el;h=63c5dff315014c0d3ca4221d5f7ca80f324f6de9;hb=bf3cea82e421d7bc2b717780c4d30805899847c0;hp=4157f262c16c1d7c5d5d860eb09279c7c3152e56;hpb=8770f03ef8630ee41a9c48b6c255fd45fe5b7c5d;p=riece diff --git a/lisp/riece-biff.el b/lisp/riece-biff.el index 4157f26..63c5dff 100644 --- a/lisp/riece-biff.el +++ b/lisp/riece-biff.el @@ -1,5 +1,5 @@ -;;; riece-biff.el --- biff add-on -;; Copyright (C) 2003 OHASHI Akira +;;; riece-biff.el --- be notified if messages arrives +;; Copyright (C) 2004 OHASHI Akira ;; Author: OHASHI Akira ;; Keywords: IRC, riece @@ -18,20 +18,20 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: -;; To use, add the following line to your ~/.riece/init.el: -;; (add-to-list 'riece-addons 'riece-biff) +;; NOTE: This is an add-on module for Riece. ;;; Code: -(eval-when-compile (require 'riece-message)) +(require 'riece-message) (defgroup riece-biff nil - "Biff for new arrival messages" + "Be notified if messages arrives." + :prefix "riece-" :group 'riece) (defcustom riece-biff-check-channels nil @@ -49,39 +49,39 @@ :type 'string :group 'riece-biff) -(defcustom riece-biff-functions nil - "*Functions for processing new arrival messages." - :type 'function - :group 'riece-biff) - (defvar riece-biff-mode-string 'riece-biff-default-mode-string) -(defvar riece-biff-enabled nil) - (defconst riece-biff-description - "Biff for new arrival messages") + "Be notified if messages arrives.") (defun riece-biff-after-display-message-function (message) - (when (and riece-biff-enabled + (when (and (get 'riece-biff 'riece-addon-enabled) (not (or (eq (window-buffer (selected-window)) (get-buffer riece-command-buffer)) (riece-message-own-p message) (riece-message-type message)))) - (when (or (null riece-biff-channels) + (when (or (null riece-biff-check-channels) (member (riece-format-identity (riece-message-target message)) riece-biff-check-channels)) - (setq riece-biff-mode-string 'riece-biff-biff-mode-string) - (run-hook-with-args 'riece-biff-functions message)))) + (setq riece-biff-mode-string 'riece-biff-biff-mode-string)))) (defun riece-biff-clear (&optional dummy) - (when riece-biff-enabled + (when (get 'riece-biff 'riece-addon-enabled) (setq riece-biff-mode-string 'riece-biff-default-mode-string))) (defun riece-biff-insinuate () (add-hook 'riece-after-display-message-functions 'riece-biff-after-display-message-function) (add-hook 'riece-redisplay-buffers-hook 'riece-biff-clear) - (add-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear)) + (add-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear) + (add-hook 'riece-exit-hook 'riece-biff-disable)) + +(defun riece-biff-uninstall () + (remove-hook 'riece-after-display-message-functions + 'riece-biff-after-display-message-function) + (remove-hook 'riece-redisplay-buffers-hook 'riece-biff-clear) + (remove-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear) + (remove-hook 'riece-exit-hook 'riece-biff-disable)) (defun riece-biff-enable () (setq global-mode-string @@ -92,8 +92,7 @@ (append '("" riece-biff-mode-string) (remove "" global-mode-string))) (t - global-mode-string))) - (setq riece-biff-enabled t)) + global-mode-string)))) (defun riece-biff-disable () (setq global-mode-string @@ -103,8 +102,7 @@ (remq 'riece-biff-mode-string global-mode-string)) (t global-mode-string))) - (riece-biff-clear) - (setq riece-biff-enabled nil)) + (riece-biff-clear)) (provide 'riece-biff)