* riece-xface.el: Support enable/disable.
authorueno <ueno>
Sat, 22 May 2004 18:36:52 +0000 (18:36 +0000)
committerueno <ueno>
Sat, 22 May 2004 18:36:52 +0000 (18:36 +0000)
(riece-xface-enabled): New flag.
(riece-xface-description): New variable.
(riece-xface-update-user-list-buffer): Check riece-xface-enabled.
(riece-xface-enable): New function.
(riece-xface-disable): New function.

* riece-url.el: Support enable/disable.
(riece-url-enabled): New flag.
(riece-url-description): New variable.
(riece-url-enable): New function; bind command keys here.
(riece-url-disable): New function.

* riece-unread.el: Support enable/disable.
(riece-unread-enabled): New flag.
(riece-unread-description): New variable.
(riece-unread-after-display-message-function): Check
riece-unread-enabled.
(riece-unread-after-switch-to-channel-function): Ditto.
(riece-unread-format-identity-for-channel-list-buffer): Ditto.
(riece-unread-format-identity-for-channel-list-indicator): Ditto.
(riece-unread-enable): New function; bind command keys here.
(riece-unread-disable): New function.

* riece-rdcc.el: Support enable/disable.
(riece-rdcc-enabled): New flag.
(riece-rdcc-description): New variable.
(riece-handle-dcc-request): Check riece-rdcc-enabled.
(riece-rdcc-enable): New function; bind command keys here.
(riece-rdcc-disable): New function.

* riece-ndcc.el: Support enable/disable.
(riece-ndcc-enabled): New flag.
(riece-ndcc-description): New variable.
(riece-handle-dcc-request): Check riece-ndcc-enabled.
(riece-ndcc-enable): New function; bind command keys here.
(riece-ndcc-disable): New function.

* riece-menu.el: Support enable/disable; put
riece-addon-default-disabled property.
(riece-menu-enabled): New flag.
(riece-menu-description): New variable.
(riece-menu-enable): New function.
(riece-menu-disable): New function.

* riece-lsdb.el: Support enable/disable.
(riece-lsdb-enabled): New flag.
(riece-lsdb-description): New variable.
(riece-lsdb-enable): New function; bind command keys here.
(riece-lsdb-disable): New function.

* riece-keyword.el: Support enable/disable.
(riece-keyword-enabled): New flag.
(riece-keyword-description): New variable.
(riece-keyword-message-filter): Check riece-keyword-enabled.
(riece-keyword-enable): New function.
(riece-keyword-disable): New function.

* riece-ignore.el: Support enable/disable.
(riece-ignore-enabled): New flag.
(riece-ignore-description): New variable.
(riece-ignore-message-filter): Check riece-ignore-enabled.
(riece-ignore-enable): New function; bind command keys here.
(riece-ignore-disable): New function.

* riece-icon.el: Support enable/disable.
(riece-icon-enabled): New flag.
(riece-icon-description): New variable.
(riece-icon-update-user-list-buffer): Check riece-icon-enabled.
(riece-icon-update-channel-list-buffer): Check riece-icon-enabled.
(riece-icon-enable): New function.
(riece-icon-disable): New function.

* riece-history.el: Support enable/disable.
(riece-history-enabled): New flag.
(riece-history-description): New variable.
(riece-history-format-identity-for-channel-list-buffer): Check
riece-history-enabled.
(riece-history-format-identity-for-channel-list-indicator): Ditto.
(riece-history-enable): New function.
(riece-history-disable): New function.

* riece-hangman.el: Support enable/disable; put
riece-addon-default-disabled property.
(riece-hangman-enabled): New flag.
(riece-hangman-description): New variable.
(riece-hangman-after-privmsg-hook): Check riece-hangman-enabled.
(riece-hangman-enable): New function.
(riece-hangman-disable): New function.

* riece-guess.el: Support enable/disable.
(riece-guess-enabled): New flag.
(riece-guess-description): New variable.
(riece-guess-insinuate): Nothing to do.
(riece-guess-enable): New function; bind command keys here.
(riece-guess-disable): New function.

* riece-doctor.el: Support enable/disable; put
'riece-addon-default-disabled property.
(riece-doctor-enabled): New flag.
(riece-doctor-description): New variable.
(riece-doctor-after-privmsg-hook): Check riece-doctor-enabled.
(riece-doctor-enable): New function.
(riece-doctor-disable): New function.

* riece-ctlseq.el: Support enable/disable.
(riece-ctlseq-enabled): New flag.
(riece-ctlseq-description): New variable.
(riece-ctlseq-message-filter): Check riece-ctlseq-enabled.
(riece-ctlseq-enable): New function.
(riece-ctlseq-disable): New function.

* riece-button.el: Support enable/disable.
(riece-button-enabled): New flag
(riece-button-description): New variable.
(riece-button-enable): New function.
(riece-button-disable): New function.

* riece-async.el (riece-async-description): New variable.

* riece-alias.el: Support enable/disable.
(riece-alias-enabled): New flag.
(riece-alias-description): New variable.
(riece-alias-insinuate): Nothing to do.
(riece-alias-enable): New function.
(riece-alias-disable): New function.

* riece-addon.el (riece-addon-list-mark-face-alist): Change mark
for addons which does not support enable/disable.
(riece-addon-list-font-lock-keywords): Follow the above change.
(riece-command-list-addons): Ditto.

* riece.el (riece): Check 'riece-addon-default-disabled property.
(riece-exit): Disable addons.

21 files changed:
lisp/ChangeLog
lisp/riece-addon.el
lisp/riece-alias.el
lisp/riece-async.el
lisp/riece-button.el
lisp/riece-ctlseq.el
lisp/riece-doctor.el
lisp/riece-guess.el
lisp/riece-hangman.el
lisp/riece-history.el
lisp/riece-icon.el
lisp/riece-ignore.el
lisp/riece-keyword.el
lisp/riece-lsdb.el
lisp/riece-menu.el
lisp/riece-ndcc.el
lisp/riece-rdcc.el
lisp/riece-unread.el
lisp/riece-url.el
lisp/riece-xface.el
lisp/riece.el

index 7900914..9ba9eca 100644 (file)
@@ -1,5 +1,142 @@
 2004-05-22  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece-xface.el: Support enable/disable.
+       (riece-xface-enabled): New flag.
+       (riece-xface-description): New variable.
+       (riece-xface-update-user-list-buffer): Check riece-xface-enabled.
+       (riece-xface-enable): New function.
+       (riece-xface-disable): New function.
+
+       * riece-url.el: Support enable/disable.
+       (riece-url-enabled): New flag.
+       (riece-url-description): New variable.
+       (riece-url-enable): New function; bind command keys here.
+       (riece-url-disable): New function.
+
+       * riece-unread.el: Support enable/disable.
+       (riece-unread-enabled): New flag.
+       (riece-unread-description): New variable.
+       (riece-unread-after-display-message-function): Check
+       riece-unread-enabled.
+       (riece-unread-after-switch-to-channel-function): Ditto.
+       (riece-unread-format-identity-for-channel-list-buffer): Ditto.
+       (riece-unread-format-identity-for-channel-list-indicator): Ditto.
+       (riece-unread-enable): New function; bind command keys here.
+       (riece-unread-disable): New function.
+
+       * riece-rdcc.el: Support enable/disable.
+       (riece-rdcc-enabled): New flag.
+       (riece-rdcc-description): New variable.
+       (riece-handle-dcc-request): Check riece-rdcc-enabled.
+       (riece-rdcc-enable): New function; bind command keys here.
+       (riece-rdcc-disable): New function.
+
+       * riece-ndcc.el: Support enable/disable.
+       (riece-ndcc-enabled): New flag.
+       (riece-ndcc-description): New variable.
+       (riece-handle-dcc-request): Check riece-ndcc-enabled.
+       (riece-ndcc-enable): New function; bind command keys here.
+       (riece-ndcc-disable): New function.
+
+       * riece-menu.el: Support enable/disable; put
+       riece-addon-default-disabled property.
+       (riece-menu-enabled): New flag.
+       (riece-menu-description): New variable.
+       (riece-menu-enable): New function.
+       (riece-menu-disable): New function.
+
+       * riece-lsdb.el: Support enable/disable.
+       (riece-lsdb-enabled): New flag.
+       (riece-lsdb-description): New variable.
+       (riece-lsdb-enable): New function; bind command keys here.
+       (riece-lsdb-disable): New function.
+
+       * riece-keyword.el: Support enable/disable.
+       (riece-keyword-enabled): New flag.
+       (riece-keyword-description): New variable.
+       (riece-keyword-message-filter): Check riece-keyword-enabled.
+       (riece-keyword-enable): New function.
+       (riece-keyword-disable): New function.
+
+       * riece-ignore.el: Support enable/disable.
+       (riece-ignore-enabled): New flag.
+       (riece-ignore-description): New variable.
+       (riece-ignore-message-filter): Check riece-ignore-enabled.
+       (riece-ignore-enable): New function; bind command keys here.
+       (riece-ignore-disable): New function.
+
+       * riece-icon.el: Support enable/disable.
+       (riece-icon-enabled): New flag.
+       (riece-icon-description): New variable.
+       (riece-icon-update-user-list-buffer): Check riece-icon-enabled.
+       (riece-icon-update-channel-list-buffer): Check riece-icon-enabled.
+       (riece-icon-enable): New function.
+       (riece-icon-disable): New function.
+
+       * riece-history.el: Support enable/disable.
+       (riece-history-enabled): New flag.
+       (riece-history-description): New variable.
+       (riece-history-format-identity-for-channel-list-buffer): Check
+       riece-history-enabled.
+       (riece-history-format-identity-for-channel-list-indicator): Ditto.
+       (riece-history-enable): New function.
+       (riece-history-disable): New function.
+
+       * riece-hangman.el: Support enable/disable; put
+       riece-addon-default-disabled property.
+       (riece-hangman-enabled): New flag.
+       (riece-hangman-description): New variable.
+       (riece-hangman-after-privmsg-hook): Check riece-hangman-enabled.
+       (riece-hangman-enable): New function.
+       (riece-hangman-disable): New function.
+
+       * riece-guess.el: Support enable/disable.
+       (riece-guess-enabled): New flag.
+       (riece-guess-description): New variable.
+       (riece-guess-insinuate): Nothing to do.
+       (riece-guess-enable): New function; bind command keys here.
+       (riece-guess-disable): New function.
+
+       * riece-doctor.el: Support enable/disable; put
+       'riece-addon-default-disabled property.
+       (riece-doctor-enabled): New flag.
+       (riece-doctor-description): New variable.
+       (riece-doctor-after-privmsg-hook): Check riece-doctor-enabled.
+       (riece-doctor-enable): New function.
+       (riece-doctor-disable): New function.
+
+       * riece-ctlseq.el: Support enable/disable.
+       (riece-ctlseq-enabled): New flag.
+       (riece-ctlseq-description): New variable.
+       (riece-ctlseq-message-filter): Check riece-ctlseq-enabled.
+       (riece-ctlseq-enable): New function.
+       (riece-ctlseq-disable): New function.
+
+       * riece-button.el: Support enable/disable.
+       (riece-button-enabled): New flag
+       (riece-button-description): New variable.
+       (riece-button-enable): New function.
+       (riece-button-disable): New function.
+
+       * riece-async.el (riece-async-description): New variable.
+
+       * riece-alias.el: Support enable/disable.
+       (riece-alias-enabled): New flag.
+       (riece-alias-description): New variable.
+       (riece-alias-insinuate): Nothing to do.
+       (riece-alias-enable): New function.
+       (riece-alias-disable): New function.
+
+       * riece-addon.el (riece-addon-list-mark-face-alist): Change mark
+       for addons which does not support enable/disable.
+       (riece-addon-list-font-lock-keywords): Follow the above change.
+       (riece-command-list-addons): Ditto.
+
+       * riece.el (riece): Check 'riece-addon-default-disabled property.
+       (riece-exit): Disable addons.
+
+2004-05-22  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-addon.el (riece-addon-list-mode): Call font-lock-set-defaults.
 
        * riece-highlight.el (riece-highlight-setup-dialogue): Call
index 9ffa494..4ceb00e 100644 (file)
 (defcustom riece-addon-list-mark-face-alist
   '((?+ . riece-addon-list-enabled-face)
     (?- . riece-addon-list-disabled-face)
-    (?= . riece-addon-list-unsupported-face)
+    (?! . riece-addon-list-unsupported-face)
     (?? . riece-addon-list-unknown-face))
   "An alist mapping marks on riece-addon-list-buffer to faces."
   :type 'list
   :group 'riece-addon-list)
 
 (defcustom riece-addon-list-font-lock-keywords
-  '(("^\\([-+=?] [^:]+\\): \\(.*\\)"
+  '(("^\\([-+!?] [^:]+\\): \\(.*\\)"
      (1 (cdr (assq (aref (match-string 1) 0)
                   riece-addon-list-mark-face-alist)))
      (2 riece-addon-list-description-face)))
@@ -247,7 +247,7 @@ All normal editing commands are turned off."
                      (if (not (featurep (car pointer)))
                          ??
                        (if (null enabled)
-                           ?=
+                           ?!
                          (if (symbol-value enabled)
                              ?+
                            ?-)))
@@ -262,7 +262,7 @@ Symbols in the leftmost column:
 
   +     The add-on is enabled.
   -     The add-on is disabled.
-  =    The add-on doesn't support enable/disable operation.
+  !    The add-on doesn't support enable/disable operation.
   ?    The add-on status is unknown.
 ")
     (insert (substitute-command-keys "
index 4755310..cdb90f2 100644 (file)
   :type 'list
   :group 'riece-alias)
 
+(defvar riece-alias-enabled nil)
+
+(defconst riece-alias-description
+  "Define aliases of channel/user names")
+
 (defun riece-alias-abbrev-percent-hack (string)
   (if (string-match (concat "^#\\([^ ]+\\):"
                            (regexp-quote riece-alias-percent-hack-mask)
       string)))
 
 (defun riece-alias-insinuate ()
+  )
+
+(defun riece-alias-enable ()
   (setq riece-abbrev-identity-string-function
        #'riece-alias-abbrev-identity-string
        riece-expand-identity-string-function
-       #'riece-alias-expand-identity-string))
+       #'riece-alias-expand-identity-string)
+  (riece-emit-signal 'channel-list-changed)
+  (setq riece-alias-enabled t))
+
+(defun riece-alias-disable ()
+  (setq riece-abbrev-identity-string-function nil
+       riece-expand-identity-string-function nil)
+  (riece-emit-signal 'channel-list-changed)
+  (setq riece-alias-enabled nil))
 
 (provide 'riece-alias)
 
index 34b0b16..930a2c3 100644 (file)
@@ -106,6 +106,9 @@ socket.close
   :type 'integer
   :group 'riece-async)
 
+(defconst riece-async-description
+  "Keep IRC connection with external process")
+
 (defun riece-async-substitute-variables (program variable value)
   (setq program (copy-sequence program))
   (let ((pointer program))
index f9f2188..f92eeb7 100644 (file)
     ["Allow To Speak" riece-user-button-set-speakers])
   "Menu for user buttons.")
 
+(defvar riece-button-enabled nil)
+
+(defconst riece-button-description
+  "Display useful buttons in IRC buffers")
+
 (defvar help-echo-owns-message)
 (define-widget 'riece-identity-button 'push-button
   "A channel button."
@@ -179,17 +184,19 @@ This function is used as a callback for a channel button."
 
 (defvar riece-identity-button-map)
 (defun riece-button-add-identity-button (start end)
-  (riece-scan-property-region
-   'riece-identity
-   start end
-   (lambda (start end)
-     (let ((inhibit-read-only t)
-          buffer-read-only)
-       (widget-convert-button 'riece-identity-button start end
-                             (get-text-property start 'riece-identity))
-       (add-text-properties start end
-                           (list 'local-map riece-identity-button-map
-                                 'keymap riece-identity-button-map))))))
+  (if riece-button-enabled
+      (riece-scan-property-region
+       'riece-identity
+       start end
+       (lambda (start end)
+        (let ((inhibit-read-only t)
+              buffer-read-only)
+          (widget-convert-button 'riece-identity-button start end
+                                 (get-text-property start 'riece-identity))
+          (add-text-properties
+           start end
+           (list 'local-map riece-identity-button-map
+                 'keymap riece-identity-button-map)))))))
 
 (defun riece-button-update-buffer ()
   (riece-button-add-identity-button (point-min) (point-max)))
@@ -219,6 +226,29 @@ This function is used as a callback for a channel button."
                   (riece-make-identity-button-map))))
   (add-hook 'riece-after-insert-functions 'riece-button-add-identity-button))
 
+(defun riece-button-enable ()
+  (setq riece-button-enabled t)
+  (let ((pointer riece-buffer-list))
+    (while pointer
+      (with-current-buffer (car pointer)
+       (if (eq (derived-mode-class major-mode)
+               'riece-dialogue-mode)
+           (riece-button-update-buffer)))
+      (setq pointer (cdr pointer)))
+    (if riece-current-channel
+       (riece-emit-signal 'user-list-changed riece-current-channel))
+    (riece-emit-signal 'channel-list-changed)))
+
+(defun riece-button-disable ()
+  (setq riece-button-enabled nil)
+  (let ((pointer riece-buffer-list))
+    (while pointer
+      (widget-map-buttons
+       (lambda (widget maparg)
+        (widget-leave-text widget))
+       (car pointer))
+      (setq pointer (cdr pointer)))))
+
 (provide 'riece-button)
 
 ;;; riece-button.el ends here
index 70dc797..987e4ca 100644 (file)
 (defvar riece-ctlseq-face-cache nil)
 (defvar riece-ctlseq-face-counter 0)
 
+(defvar riece-ctlseq-enabled nil)
+
+(defvar riece-ctlseq-description
+  "Highlight control sequences in IRC buffers")
+
 (defun riece-ctlseq-compatible-attributes-p (this other)
   (let ((pointer this))
     (catch 'mismatched
     attrs)))
 
 (defun riece-ctlseq-message-filter (message)
-  (let ((start 0)
-       (end (length (riece-message-text message)))
-       attrs)
-    (while (string-match
-           "[\x2\xF\x16\x1F]\\|\x3\\([0-9]+\\)?\\(,[0-9]+\\)?"
-           (riece-message-text message) start)
-      (if riece-ctlseq-hide-controls
-         (put-text-property (match-beginning 0) (match-end 0)
-                            'invisible 'riece-ctlseq
-                            (riece-message-text message)))
-      (if attrs
-         (put-text-property start (match-beginning 0)
-                            'riece-ctlseq-attributes (copy-sequence attrs)
-                            (riece-message-text message)))
-      (setq start (match-end 0)
-           attrs (riece-ctlseq-update-attributes
-                  (match-string 0 (riece-message-text message)) attrs)))
-    (if (and (< start end) attrs)
-       (put-text-property start end
-                          'riece-overlay-face
-                          (riece-ctlseq-face-from-cache attrs)
-                          (riece-message-text message))))
+  (if riece-ctlseq-enabled
+      (let ((start 0)
+           (end (length (riece-message-text message)))
+           attrs)
+       (while (string-match
+               "[\x2\xF\x16\x1F]\\|\x3\\([0-9]+\\)?\\(,[0-9]+\\)?"
+               (riece-message-text message) start)
+         (if riece-ctlseq-hide-controls
+             (put-text-property (match-beginning 0) (match-end 0)
+                                'invisible 'riece-ctlseq
+                                (riece-message-text message)))
+         (if attrs
+             (put-text-property start (match-beginning 0)
+                                'riece-ctlseq-attributes (copy-sequence attrs)
+                                (riece-message-text message)))
+         (setq start (match-end 0)
+               attrs (riece-ctlseq-update-attributes
+                      (match-string 0 (riece-message-text message)) attrs)))
+       (if (and (< start end) attrs)
+           (put-text-property start end
+                              'riece-overlay-face
+                              (riece-ctlseq-face-from-cache attrs)
+                              (riece-message-text message)))))
   message)
 
 (defun riece-ctlseq-requires ()
 (defun riece-ctlseq-insinuate ()
   (add-hook 'riece-message-filter-functions 'riece-ctlseq-message-filter))
 
+(defun riece-ctlseq-enable ()
+  (setq riece-ctlseq-enabled t))
+
+(defun riece-ctlseq-disable ()
+  (setq riece-ctlseq-enabled nil))
+
 (provide 'riece-ctlseq)
 
 ;;; riece-ctlseq.el ends here
index 07ebb1b..a7fbdd7 100644 (file)
 
 (defvar riece-doctor-patients nil)
 
+(defvar riece-doctor-enabled nil)
+
+(defconst riece-doctor-description
+  "Allow users in channel to talk with the classic pseudo-AI")
+
+(put 'riece-doctor 'riece-addon-default-disabled t)
+
 (autoload 'doctor-mode "doctor")
 (autoload 'doctor-read-print "doctor")
 
   (riece-send-string (format "NOTICE %s :%s\r\n" target string)))
 
 (defun riece-doctor-after-privmsg-hook (prefix string)
-  (let* ((user (riece-prefix-nickname prefix))
-        (parameters (riece-split-parameters string))
-        (targets (split-string (car parameters) ","))
-        (message (nth 1 parameters)))
-    (if (string-match riece-doctor-hello-regexp message)
-       (if (riece-identity-member user riece-doctor-patients t)
-           (riece-doctor-reply
-            (car targets)
-            (format "%s: You are already talking with me." user))
-         (save-excursion
-           (set-buffer (get-buffer-create (riece-doctor-buffer-name user)))
-           (erase-buffer)
-           (doctor-mode))
-         (setq riece-doctor-patients (cons user riece-doctor-patients))
-         (riece-doctor-reply
-          (car targets)           
-          (format
-           "%s: I am the psychotherapist.  Please, describe your problems."
-           user)))
-      (if (string-match riece-doctor-bye-regexp message)
-         (let ((pointer (riece-identity-member user riece-doctor-patients t)))
-           (when pointer
-             (kill-buffer (riece-doctor-buffer-name user))
-             (setq riece-doctor-patients (delq (car pointer)
-                                               riece-doctor-patients))
-             (riece-doctor-reply
-              (car targets)
-              (format "%s: Good bye." user))))
-       (if (riece-identity-member user riece-doctor-patients t)
-           (let (string)
+  (if riece-doctor-enabled
+      (let* ((user (riece-prefix-nickname prefix))
+            (parameters (riece-split-parameters string))
+            (targets (split-string (car parameters) ","))
+            (message (nth 1 parameters)))
+       (if (string-match riece-doctor-hello-regexp message)
+           (if (riece-identity-member user riece-doctor-patients t)
+               (riece-doctor-reply
+                (car targets)
+                (format "%s: You are already talking with me." user))
              (save-excursion
-               (set-buffer (get-buffer (riece-doctor-buffer-name user)))
-               (goto-char (point-max))
-               (insert message "\n")
-               (let ((point (point)))
-                 (doctor-read-print)
-                 (setq string (buffer-substring (1+ point) (- (point) 2))))
-               (with-temp-buffer
-                 (insert string)
-                 (subst-char-in-region (point-min) (point-max) ?\n ? )
-                 (setq string (buffer-string))))
+               (set-buffer (get-buffer-create
+                            (riece-doctor-buffer-name user)))
+               (erase-buffer)
+               (doctor-mode))
+             (setq riece-doctor-patients (cons user riece-doctor-patients))
              (riece-doctor-reply
-              (car targets)
-              (format "%s: %s" user string))))))))
+              (car targets)       
+              (format
+               "%s: I am the psychotherapist.  \
+Please, describe your problems."
+               user)))
+         (if (string-match riece-doctor-bye-regexp message)
+             (let ((pointer (riece-identity-member user 
+                                                   riece-doctor-patients t)))
+               (when pointer
+                 (kill-buffer (riece-doctor-buffer-name user))
+                 (setq riece-doctor-patients (delq (car pointer)
+                                                   riece-doctor-patients))
+                 (riece-doctor-reply
+                  (car targets)
+                  (format "%s: Good bye." user))))
+           (if (riece-identity-member user riece-doctor-patients t)
+               (let (string)
+                 (save-excursion
+                   (set-buffer (get-buffer (riece-doctor-buffer-name user)))
+                   (goto-char (point-max))
+                   (insert message "\n")
+                   (let ((point (point)))
+                     (doctor-read-print)
+                     (setq string (buffer-substring (1+ point)
+                                                    (- (point) 2))))
+                   (with-temp-buffer
+                     (insert string)
+                     (subst-char-in-region (point-min) (point-max) ?\n ? )
+                     (setq string (buffer-string))))
+                 (riece-doctor-reply
+                  (car targets)
+                  (format "%s: %s" user string)))))))))
 
 (defun riece-doctor-insinuate ()
   (add-hook 'riece-after-privmsg-hook 'riece-doctor-after-privmsg-hook))
 
+(defun riece-doctor-enable ()
+  (setq riece-doctor-enabled t))
+
+(defun riece-doctor-disable ()
+  (setq riece-doctor-enabled nil))
+
 (provide 'riece-doctor)
 
 ;;; riece-doctor.el ends here
index 2a5371d..c9dba35 100644 (file)
   :type '(repeat function)
   :group 'riece-guess)
 
+(defvar riece-guess-enabled nil)
+
+(defconst riece-guess-description
+  "Guess the next channel, using multiple methods")
+
 (defvar riece-current-channels)
 
 (defun riece-guess-candidates ()
@@ -86,13 +91,26 @@ merge the results."
 (defvar riece-channel-list-mode-map)
 
 (defun riece-guess-insinuate ()
+  )
+
+(defun riece-guess-enable ()
   (define-key riece-command-mode-map
     "\C-cg" 'riece-command-guess-switch-to-channel)
   (define-key riece-dialogue-mode-map
     "g" 'riece-command-guess-switch-to-channel)
   (define-key riece-channel-list-mode-map
-    "g" 'riece-command-guess-switch-to-channel))
-       
+    "g" 'riece-command-guess-switch-to-channel)
+  (setq riece-guess-enabled t))
+
+(defun riece-guess-disable ()
+  (define-key riece-command-mode-map
+    "\C-cg" nil)
+  (define-key riece-dialogue-mode-map
+    "g" nil)
+  (define-key riece-channel-list-mode-map
+    "g" nil)
+  (setq riece-guess-enabled nil))
+  
 (provide 'riece-guess)
 
 ;;; riece-guess.el ends here
index bc48b76..cb7dd1f 100644 (file)
 (defvar riece-hangman-player-context-alist nil)
 (defvar riece-hangman-words-buffer nil)
 
+(defvar riece-hangman-enabled nil)
+
+(defconst riece-hangman-description
+  "Allow users in channel to play classic textual game \"hangman\"")
+
+(put 'riece-hangman 'riece-addon-default-disabled t)
+
 (defun riece-hangman-make-context (word)
   "Make an instance of player context object.
 This function is for internal use only."
@@ -133,86 +140,98 @@ The wordlist is read from `riece-hangman-words-file'."
               "")))))
 
 (defun riece-hangman-after-privmsg-hook (prefix string)
-  (let* ((user (riece-prefix-nickname prefix))
-        (parameters (riece-split-parameters string))
-        (targets (split-string (car parameters) ","))
-        (message (nth 1 parameters))
-        case-fold-search
-        pointer word guessed index)
-    (if (string-match riece-hangman-hello-regexp message)
-       (if (riece-identity-assoc user riece-hangman-player-context-alist t)
-           (riece-hangman-reply
-            (car targets)
-            (format "%s: You are already playing the game." user))
-         (let ((context (riece-hangman-make-context (riece-hangman-word))))
-           (setq riece-hangman-player-context-alist
-                 (cons (cons user context)
-                       riece-hangman-player-context-alist))
-           (riece-hangman-reply-with-context user (car targets) context)))
-      (if (string-match riece-hangman-bye-regexp message)
-         (when (setq pointer (riece-identity-assoc
-                              user riece-hangman-player-context-alist t))
-           (setq riece-hangman-player-context-alist
-                 (delq pointer riece-hangman-player-context-alist))
-           (riece-hangman-reply
-            (car targets)
-            (format "%s: Sorry, the word was \"%s\""
-                    user
-                    (riece-hangman-context-word (cdr pointer)))))
-       (if (setq pointer (riece-identity-assoc
-                          user riece-hangman-player-context-alist t))
-           (if (or (/= (length message) 1)
-                   (not (string-match "[a-z]" message)))
+  (if riece-hangman-enabled
+      (let* ((user (riece-prefix-nickname prefix))
+            (parameters (riece-split-parameters string))
+            (targets (split-string (car parameters) ","))
+            (message (nth 1 parameters))
+            case-fold-search
+            pointer word guessed index)
+       (if (string-match riece-hangman-hello-regexp message)
+           (if (riece-identity-assoc user riece-hangman-player-context-alist
+                                     t)
                (riece-hangman-reply
                 (car targets)
-                (format "%s: Not a valid guess: %s" user message))
-             (if (memq (aref message 0)
-                       (riece-hangman-context-guessed (cdr pointer)))
-                 (riece-hangman-reply (car targets)
-                                      (format "%s: Already guessed '%c'"
-                                              user (aref message 0)))
-               (setq guessed (riece-hangman-context-set-guessed
-                              (cdr pointer)
-                              (cons (aref message 0)
-                                    (riece-hangman-context-guessed
-                                     (cdr pointer))))
-                     word (riece-hangman-context-word (cdr pointer)))
-               (unless (catch 'found
-                         (setq index 0)
-                         (while (< index (length word))
-                           (if (eq (aref word index) (aref message 0))
-                               (throw 'found t))
-                           (setq index (1+ index))))
-                 (riece-hangman-context-set-missed-count
-                  (cdr pointer)
-                  (1+ (riece-hangman-context-missed-count (cdr pointer)))))
-               (if (>= (riece-hangman-context-missed-count (cdr pointer)) 7)
-                   (progn
-                     (riece-hangman-reply
-                      (car targets)
-                      (format "%s: Sorry, the word was \"%s\""
-                              user
-                              (riece-hangman-context-word (cdr pointer))))
-                     (setq riece-hangman-player-context-alist
-                           (delq pointer
-                                 riece-hangman-player-context-alist)))
-                 (if (catch 'missing
-                       (setq index 0)
-                       (while (< index (length word))
-                         (unless (memq (aref word index) guessed)
-                           (throw 'missing t))
-                         (setq index (1+ index))))
-                     (riece-hangman-reply-with-context user (car targets)
-                                                       (cdr pointer))
-                   (riece-hangman-reply (car targets)
-                                        (format "%s: You got it!" user))
-                   (setq riece-hangman-player-context-alist
-                         (delq pointer
-                               riece-hangman-player-context-alist)))))))))))
+                (format "%s: You are already playing the game." user))
+             (let ((context (riece-hangman-make-context
+                             (riece-hangman-word))))
+               (setq riece-hangman-player-context-alist
+                     (cons (cons user context)
+                           riece-hangman-player-context-alist))
+               (riece-hangman-reply-with-context user (car targets) context)))
+         (if (string-match riece-hangman-bye-regexp message)
+             (when (setq pointer (riece-identity-assoc
+                                  user riece-hangman-player-context-alist t))
+               (setq riece-hangman-player-context-alist
+                     (delq pointer riece-hangman-player-context-alist))
+               (riece-hangman-reply
+                (car targets)
+                (format "%s: Sorry, the word was \"%s\""
+                        user
+                        (riece-hangman-context-word (cdr pointer)))))
+           (if (setq pointer (riece-identity-assoc
+                              user riece-hangman-player-context-alist t))
+               (if (or (/= (length message) 1)
+                       (not (string-match "[a-z]" message)))
+                   (riece-hangman-reply
+                    (car targets)
+                    (format "%s: Not a valid guess: %s" user message))
+                 (if (memq (aref message 0)
+                           (riece-hangman-context-guessed (cdr pointer)))
+                     (riece-hangman-reply (car targets)
+                                          (format "%s: Already guessed '%c'"
+                                                  user (aref message 0)))
+                   (setq guessed (riece-hangman-context-set-guessed
+                                  (cdr pointer)
+                                  (cons (aref message 0)
+                                        (riece-hangman-context-guessed
+                                         (cdr pointer))))
+                         word (riece-hangman-context-word (cdr pointer)))
+                   (unless (catch 'found
+                             (setq index 0)
+                             (while (< index (length word))
+                               (if (eq (aref word index) (aref message 0))
+                                   (throw 'found t))
+                               (setq index (1+ index))))
+                     (riece-hangman-context-set-missed-count
+                      (cdr pointer)
+                      (1+ (riece-hangman-context-missed-count
+                           (cdr pointer)))))
+                   (if (>= (riece-hangman-context-missed-count (cdr pointer))
+                           7)
+                       (progn
+                         (riece-hangman-reply
+                          (car targets)
+                          (format "%s: Sorry, the word was \"%s\""
+                                  user
+                                  (riece-hangman-context-word (cdr pointer))))
+                         (setq riece-hangman-player-context-alist
+                               (delq pointer
+                                     riece-hangman-player-context-alist)))
+                     (if (catch 'missing
+                           (setq index 0)
+                           (while (< index (length word))
+                             (unless (memq (aref word index) guessed)
+                               (throw 'missing t))
+                             (setq index (1+ index))))
+                         (riece-hangman-reply-with-context user (car targets)
+                                                           (cdr pointer))
+                       (riece-hangman-reply (car targets)
+                                            (format "%s: You got it!" user))
+                       (setq riece-hangman-player-context-alist
+                             (delq
+                              pointer
+                              riece-hangman-player-context-alist))))))))))))
 
 (defun riece-hangman-insinuate ()
   (add-hook 'riece-after-privmsg-hook 'riece-hangman-after-privmsg-hook))
 
+(defun riece-hangman-enable ()
+  (setq riece-hangman-enabled t))
+
+(defun riece-hangman-disable ()
+  (setq riece-hangman-enabled nil))
+
 (provide 'riece-hangman)
 
 ;;; riece-hangman.el ends here
index 5b9fc1e..e737159 100644 (file)
 
 (defvar riece-channel-history nil)
 
+(defvar riece-history-enabled nil)
+
+(defconst riece-history-description
+  "Keep track channel history")
+
 (defun riece-guess-channel-from-history ()
   (let ((length (ring-length riece-channel-history))
        (index 0)
     (nreverse result)))
 
 (defun riece-history-format-identity-for-channel-list-buffer (index identity)
-  (if (and (not (ring-empty-p riece-channel-history))
+  (if (and riece-history-enabled
+          (not (ring-empty-p riece-channel-history))
           (riece-identity-equal identity (ring-ref riece-channel-history 0)))
       (concat (format "%2d:+" index)
              (riece-format-identity identity))))
 
 (defun riece-history-format-identity-for-channel-list-indicator (index
                                                                 identity)
-  (if (and (not (ring-empty-p riece-channel-history))
+  (if (and riece-history-enabled
+          (not (ring-empty-p riece-channel-history))
           (riece-identity-equal identity (ring-ref riece-channel-history 0)))
       (let ((string (riece-format-identity identity))
            (start 0))
 ;;;       '(riece-guess)))
 
 (defun riece-history-insinuate ()
-  (add-hook 'riece-startup-hook
-           (lambda ()
-             (setq riece-channel-history
-                   (make-ring riece-channel-history-length))))
-  (add-hook 'riece-exit-hook
-           (lambda ()
-             (setq riece-channel-history nil)))
   (add-hook 'riece-after-switch-to-channel-functions
            (lambda (last)
-             (if (and last
+             (if (and riece-history-enabled last
                       (not (riece-identity-equal last riece-current-channel)))
                  (ring-insert riece-channel-history last))))
   (add-hook 'riece-format-identity-for-channel-list-buffer-functions
 ;;;            'riece-guess-channel-from-history))
   )
 
+(defun riece-history-enable ()
+  (setq riece-channel-history
+       (make-ring riece-channel-history-length))
+  (setq riece-history-enabled t)
+  (riece-emit-signal 'channel-list-changed))
+
+(defun riece-history-disable ()
+  (setq riece-channel-history nil
+       riece-history-enabled nil)
+  (riece-emit-signal 'channel-list-changed))
+
 (provide 'riece-history)
 
 ;;; riece-history.el ends here
-
index 82ce4e6..9780886 100644 (file)
@@ -179,6 +179,11 @@ static char * a_xpm[] = {
 \"  @@@@@@@@@@@ \",
 \"              \"};")
 
+(defvar riece-icon-enabled nil)
+
+(defconst riece-icon-description
+  "Add icon images on IRC buffers")
+
 (defun riece-icon-available-p ()
   (if (featurep 'xemacs)
       (featurep 'xpm)
@@ -229,22 +234,24 @@ static char * a_xpm[] = {
                                   'rear-nonsticky (list 'display)))))))
 
 (defun riece-icon-update-user-list-buffer ()
-  (let ((images (riece-icon-make-images riece-user-list-icons)))
-    (save-excursion
-      (goto-char (point-min))
-      (while (re-search-forward "^[ @+]" nil t)
-       (riece-icon-add-image-region
-        (cdr (assoc (match-string 0) images))
-        (1- (point)) (point))))))
+  (if riece-icon-enabled
+      (let ((images (riece-icon-make-images riece-user-list-icons)))
+       (save-excursion
+         (goto-char (point-min))
+         (while (re-search-forward "^[ @+]" nil t)
+           (riece-icon-add-image-region
+            (cdr (assoc (match-string 0) images))
+            (1- (point)) (point)))))))
 
 (defun riece-icon-update-channel-list-buffer ()
-  (let ((images (riece-icon-make-images riece-channel-list-icons)))
-    (save-excursion
-      (goto-char (point-min))
-      (while (re-search-forward "^ ?[0-9]+:\\([ !+*]\\)" nil t)
-       (riece-icon-add-image-region
-        (cdr (assoc (match-string 1) images))
-        (match-beginning 1) (match-end 1))))))
+  (if riece-icon-enabled
+      (let ((images (riece-icon-make-images riece-channel-list-icons)))
+       (save-excursion
+         (goto-char (point-min))
+         (while (re-search-forward "^ ?[0-9]+:\\([ !+*]\\)" nil t)
+           (riece-icon-add-image-region
+            (cdr (assoc (match-string 1) images))
+            (match-beginning 1) (match-end 1)))))))
 
 (eval-and-compile
   (if (featurep 'xemacs)
@@ -301,7 +308,7 @@ Modify whole identification by side effect."
 
 (defun riece-icon-insinuate ()
   (defalias 'riece-mode-line-buffer-identification
-    'riece-icon-modeline-buffer-identification)
+    #'riece-icon-modeline-buffer-identification)
   (add-hook 'riece-user-list-mode-hook
            (lambda ()
              (if (riece-icon-available-p)
@@ -313,6 +320,18 @@ Modify whole identification by side effect."
                  (add-hook 'riece-update-buffer-functions
                            'riece-icon-update-channel-list-buffer t t)))))
 
+(defun riece-icon-enable ()
+  (setq riece-icon-enabled t)
+  (if riece-current-channel
+      (riece-emit-signal 'user-list-changed riece-current-channel))
+  (riece-emit-signal 'channel-list-changed))
+
+(defun riece-icon-disable ()
+  (setq riece-icon-enabled nil)
+  (if riece-current-channel
+      (riece-emit-signal 'user-list-changed riece-current-channel))
+  (riece-emit-signal 'channel-list-changed))
+
 (provide 'riece-icon)
 
 ;;; riece-icon.el ends here
index 6b3bbaf..42a3396 100644 (file)
@@ -56,6 +56,11 @@ Otherwise, they are not removed from IRC buffers, but are hidden with
 (defvar riece-ignore-buffer nil)
 (defvar riece-ignored-user-list nil)
 
+(defvar riece-ignore-enabled nil)
+
+(defconst riece-ignore-description
+  "Ignore users")
+
 (defun riece-ignore-user-rename-signal-function (signal handback)
   (let ((pointer (riece-identity-member (car (riece-signal-args signal))
                                        riece-ignored-user-list)))
@@ -91,8 +96,9 @@ Otherwise, they are not removed from IRC buffers, but are hidden with
        #'riece-ignore-user-rename-signal-function))))
 
 (defun riece-ignore-message-filter (message)
-  (if (riece-identity-member (riece-message-speaker message)
-                            riece-ignored-user-list)
+  (if (and riece-ignore-enabled
+          (riece-identity-member (riece-message-speaker message)
+                                 riece-ignored-user-list))
       (if riece-ignore-discard-message
          (when (eq riece-ignore-discard-message 'log)
            (unless riece-ignore-buffer
@@ -116,9 +122,17 @@ Otherwise, they are not removed from IRC buffers, but are hidden with
 
 (defvar riece-command-mode-map)
 (defun riece-ignore-insinuate ()
-  (add-hook 'riece-message-filter-functions 'riece-ignore-message-filter)
+  (add-hook 'riece-message-filter-functions 'riece-ignore-message-filter))
+
+(defun riece-ignore-enable ()
+  (define-key riece-command-mode-map
+    "\C-ck" 'riece-ignore-user)
+  (setq riece-ignore-enabled t))
+
+(defun riece-ignore-disable ()
   (define-key riece-command-mode-map
-    "\C-ck" 'riece-ignore-user))
+    "\C-ck" nil)
+  (setq riece-ignore-enabled nil))
 
 (provide 'riece-ignore)
 
index 44262e2..a2c8797 100644 (file)
@@ -66,10 +66,16 @@ and the matched message object."
   :group 'riece-highlight-faces)
 (defvar riece-keyword-face 'riece-keyword-face)
 
+(defvar riece-keyword-enabled nil)
+
+(defconst riece-keyword-description
+  "Highlight keywords in IRC buffers")
+
 ;;; The old XEmacs package doesn't have autoload setting for regexp-opt.
 (autoload 'regexp-opt "regexp-opt")
 (defun riece-keyword-message-filter (message)
-  (if (and riece-keywords
+  (if (and riece-keyword-enabled
+          riece-keywords
           ;; Ignore messages which belongs to myself.
           (not (riece-message-own-p message)))
       (let* (keywords
@@ -109,6 +115,12 @@ and the matched message object."
 (defun riece-keyword-insinuate ()
   (add-hook 'riece-message-filter-functions 'riece-keyword-message-filter))
 
+(defun riece-keyword-enable ()
+  (setq riece-keyword-enabled t))
+
+(defun riece-keyword-disable ()
+  (setq riece-keyword-enabled nil))
+
 (provide 'riece-keyword)
 
 ;;; riece-keyword.el ends here
\ No newline at end of file
index 57f628f..bec5701 100644 (file)
 
 (defvar riece-lsdb-cache nil)
 
+(defvar riece-lsdb-enabled nil)
+
+(defconst riece-lsdb-description
+  "Use LSDB (Lovely Sister Database)")
+
 (defun riece-lsdb-update-cache (record)
   (let ((irc (cdr (assq 'irc record))))
     (while irc
   (add-to-list 'lsdb-after-update-record-functions
               'riece-lsdb-update-cache)
   (add-to-list 'lsdb-after-delete-record-functions
-              'riece-lsdb-delete-cache)
+              'riece-lsdb-delete-cache))
+
+(defun riece-lsdb-enable ()
   (define-key riece-command-mode-map
     "\C-c\C-ll" 'riece-lsdb-display-records)
   (define-key riece-command-mode-map
-    "\C-c\C-la" 'riece-lsdb-add-user))
+    "\C-c\C-la" 'riece-lsdb-add-user)
+  (setq riece-lsdb-enabled t))
+
+(defun riece-lsdb-disable ()
+  (define-key riece-command-mode-map
+    "\C-c\C-ll" nil)
+  (define-key riece-command-mode-map
+    "\C-c\C-la" nil)
+  (setq riece-lsdb-enabled nil))
 
 (provide 'riece-lsdb)
 
index 4bc4f5e..2c349e9 100644 (file)
     ("Servers" :filter riece-menu-create-servers-menu))
   "Menu used in command mode.")
 
+(defvar riece-menu-enabled nil)
+
+(defconst riece-menu-description
+  "Setup command menus on menubar")
+
+(put 'riece-menu 'riece-addon-default-disabled t)
+
 (defun riece-menu-create-layouts-menu (menu)
   (mapcar (lambda (entry)
            (vector (car entry) (list 'riece-command-change-layout (car entry))
                                riece-command-mode-map
                                "Riece Menu"
                                riece-menu-items)
-             (easy-menu-add riece-menu))))
+             (riece-enable-addon 'riece-menu))))
+
+(defun riece-menu-enable ()
+  (with-current-buffer riece-command-buffer
+    (easy-menu-add riece-menu))
+  (setq riece-menu-enabled t))
+
+(defun riece-menu-disable ()
+  (with-current-buffer riece-command-buffer
+    (easy-menu-remove riece-menu))
+  (setq riece-menu-enabled nil))
 
 (provide 'riece-menu)
 
index 10efdc4..3dd90d6 100644 (file)
@@ -44,6 +44,11 @@ Only used for sending files."
 (defvar riece-ndcc-request-user nil)
 (defvar riece-ndcc-request-size nil)
 
+(defvar riece-ndcc-enabled nil)
+
+(defconst riece-ndcc-description
+  "DCC file sending extension implemented with `make-network-process'")
+
 (defun riece-ndcc-encode-address (address)
   (unless (string-match
           "^\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$"
@@ -187,9 +192,10 @@ Only used for sending files."
 
 (defun riece-handle-dcc-request (prefix target message)
   (let ((case-fold-search t))
-    (when (string-match
-          "SEND \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)"
-          message)
+    (when (and riece-ndcc-enabled
+              (string-match
+               "SEND \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)"
+               message))
       (let ((file (match-string 1 message))
            (address (match-string 2 message))
            (port (string-to-number (match-string 3 message)))
@@ -222,10 +228,16 @@ Only used for sending files."
 
 (defvar riece-dialogue-mode-map)
 (defun riece-ndcc-insinuate ()
-  (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request)
+  (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request))
+
+(defun riece-ndcc-enable ()
   (define-key riece-dialogue-mode-map "\C-ds" 'riece-command-dcc-send)
   (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive))
 
+(defun riece-ndcc-disable ()
+  (define-key riece-dialogue-mode-map "\C-ds" nil)
+  (define-key riece-dialogue-mode-map "\C-dr" nil))
+
 (provide 'riece-ndcc)
 
 ;;; riece-ndcc.el ends here
index 188fb76..530f40e 100644 (file)
@@ -100,6 +100,11 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
 (defvar riece-rdcc-temp-file nil)
 (defvar riece-rdcc-received-size nil)
 
+(defvar riece-rdcc-enabled nil)
+
+(defconst riece-rdcc-description
+  "DCC file sending extension implemented in Ruby")
+
 (defvar temporary-file-directory)
 (defvar jka-compr-compression-info-list)
 (defvar jam-zcat-filename-list)
@@ -315,9 +320,10 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
 
 (defun riece-handle-dcc-request (prefix target message)
   (let ((case-fold-search t))
-    (when (string-match
-          "SEND \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)"
-          message)
+    (when (and riece-rdcc-enabled
+              (string-match
+               "SEND \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)"
+               message))
       (let ((file (match-string 1 message))
            (address (match-string 2 message))
            (port (string-to-number (match-string 3 message)))
@@ -361,9 +367,17 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
 (defvar riece-dialogue-mode-map)
 (defun riece-rdcc-insinuate ()
   (add-to-list 'riece-ctcp-additional-clientinfo "DCC")
-  (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request)
+  (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request))
+
+(defun riece-rdcc-enable ()
   (define-key riece-dialogue-mode-map "\C-ds" 'riece-command-dcc-send)
-  (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive))
+  (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive)
+  (setq riece-rdcc-enabled t))
+
+(defun riece-rdcc-disable ()
+  (define-key riece-dialogue-mode-map "\C-ds" nil)
+  (define-key riece-dialogue-mode-map "\C-dr" nil)
+  (setq riece-rdcc-enabled nil))
 
 (provide 'riece-rdcc)
 
index 3514358..fecd65f 100644 (file)
 
 (defvar riece-unread-channels nil)
 
+(defvar riece-unread-enabled nil)
+
+(defconst riece-unread-description
+  "Mark channels where \"unread\" messages arrived")
+
 (defun riece-unread-after-display-message-function (message)
-  (let ((target (if (riece-message-private-p message)
-                   (riece-message-speaker message)
-                 (riece-message-target message))))
-    (unless (or (riece-message-own-p message)
-               (riece-message-type message)
-               (riece-identity-equal target riece-current-channel)
-               (riece-identity-member target riece-unread-channels))
-      (setq riece-unread-channels (cons target riece-unread-channels))
-      (riece-emit-signal 'channel-list-changed))))
+  (if riece-unread-enabled
+      (let ((target (if (riece-message-private-p message)
+                       (riece-message-speaker message)
+                     (riece-message-target message))))
+       (unless (or (riece-message-own-p message)
+                   (riece-message-type message)
+                   (riece-identity-equal target riece-current-channel)
+                   (riece-identity-member target riece-unread-channels))
+         (setq riece-unread-channels (cons target riece-unread-channels))
+         (riece-emit-signal 'channel-list-changed)))))
 
 (defun riece-unread-after-switch-to-channel-function (last)
-  (setq riece-unread-channels
-       (delete riece-current-channel
-               riece-unread-channels)))
+  (if riece-unread-enabled
+      (setq riece-unread-channels
+           (delete riece-current-channel
+                   riece-unread-channels))))
 
 (defun riece-unread-format-identity-for-channel-list-buffer (index identity)
-  (if (riece-identity-member identity riece-unread-channels)
+  (if (and riece-unread-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 (riece-identity-member identity riece-unread-channels)
+  (if (and riece-unread-enabled
+          (riece-identity-member identity riece-unread-channels))
       (let ((string (riece-format-identity identity))
            (start 0))
        ;; Escape % -> %%.
 (defun riece-guess-channel-from-unread ()
   riece-unread-channels)
 
-(defvar riece-command-mode-map)
-(defvar riece-dialogue-mode-map)
-(defvar riece-channel-list-mode-map)
-
 (defun riece-unread-requires ()
   (let (requires)
     (if (memq 'riece-highlight riece-addons)
            'riece-unread-format-identity-for-channel-list-buffer)
   (add-hook 'riece-format-identity-for-channel-list-indicator-functions
            'riece-unread-format-identity-for-channel-list-indicator)
-  (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)
   (if (memq 'riece-highlight riece-addons)
       (setq riece-channel-list-mark-face-alist
            (cons '(?! . riece-channel-list-unread-face)
 ;;;            'riece-guess-channel-from-unread))
   )
 
+(defvar riece-command-mode-map)
+(defvar riece-dialogue-mode-map)
+(defvar riece-channel-list-mode-map)
+(defun riece-unread-enable ()
+  (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)
+  (setq riece-unread-enabled t)
+  (riece-emit-signal 'channel-list-changed))
+
+(defun riece-unread-disable ()
+  (define-key riece-command-mode-map
+    "\C-c\C-u" nil)
+  (define-key riece-dialogue-mode-map
+    "u" nil)
+  (define-key riece-channel-list-mode-map
+    "u" nil)
+  (setq riece-unread-enabled nil)
+  (riece-emit-signal 'channel-list-changed))
+
 (provide 'riece-unread)
 
 ;;; riece-unread.el ends here
index 449e27b..58909ba 100644 (file)
 (defvar riece-urls nil
   "A list of URL which appears in Riece buffers.")
 
+(defvar riece-url-enabled nil)
+
+(defconst riece-url-description
+  "Collect URL in IRC buffers")
+
 (autoload 'widget-convert-button "wid-edit")
 
 (defun riece-url-scan-region (start end)
@@ -80,7 +85,6 @@
 
 (defun riece-url-insinuate ()
   (add-hook 'riece-after-insert-functions 'riece-url-scan-region)
-  (define-key riece-dialogue-mode-map "U" 'riece-command-browse-url)
   (if (memq 'riece-menu riece-addons)
       (add-hook 'riece-command-mode-hook
                (lambda ()
                   '("Open URL..." :filter riece-url-create-menu)))
                t)))
 
+(defun riece-url-enable ()
+  (define-key riece-dialogue-mode-map "U" 'riece-command-browse-url)
+  (setq riece-url-enabled t))
+
+(defun riece-url-disable ()
+  (define-key riece-dialogue-mode-map "U" nil)
+  (setq riece-url-enabled nil))
+  
 (provide 'riece-url)
 
 ;;; riece-url.el ends here
index 29a71ad..1ec5066 100644 (file)
 (require 'riece-display)
 (require 'riece-lsdb)
 
+(defvar riece-xface-enabled nil)
+
+(defconst riece-xface-description
+  "Display X-Face in user list buffer")
+
 (defvar lsdb-insert-x-face-function)
 
 (defun riece-xface-update-user-list-buffer ()
-  (riece-scan-property-region
-   'riece-identity (point-min)(point-max)
-   (lambda (start end)
-     (let ((records (riece-lsdb-lookup-records (get-text-property
-                                               start 'riece-identity)))
-          xface)
-       (while (and records
-                  (null xface))
-        (setq xface (nth 1 (assq 'x-face (car records)))
-              records (cdr records)))
-       (if (and xface
-               (not (eq (char-after end) ? )))
-          (let ((inhibit-read-only t)
-                buffer-read-only)
-            (goto-char end)
-            (insert " ")
-            (funcall lsdb-insert-x-face-function xface)))))))
+  (if riece-xface-enabled
+      (riece-scan-property-region
+       'riece-identity (point-min)(point-max)
+       (lambda (start end)
+        (let ((records (riece-lsdb-lookup-records (get-text-property
+                                                   start 'riece-identity)))
+              xface)
+          (while (and records
+                      (null xface))
+            (setq xface (nth 1 (assq 'x-face (car records)))
+                  records (cdr records)))
+          (if (and xface
+                   (not (eq (char-after end) ? )))
+              (let ((inhibit-read-only t)
+                    buffer-read-only)
+                (goto-char end)
+                (insert " ")
+                (funcall lsdb-insert-x-face-function xface))))))))
 
 (defun riece-xface-requires ()
   '(riece-lsdb))
              (add-hook 'riece-update-buffer-functions
                        'riece-xface-update-user-list-buffer t t))))
 
+(defun riece-xface-enable ()
+  (setq riece-xface-enabled t)
+  (if riece-current-channel
+      (riece-emit-signal 'user-list-changed riece-current-channel)))
+
+(defun riece-xface-disable ()
+  (setq riece-xface-enabled nil)
+  (if riece-current-channel
+      (riece-emit-signal 'user-list-changed riece-current-channel)))
+
 (provide 'riece-xface)
 
 ;;; riece-xface.el ends here
index 9bf039b..58ac0cf 100644 (file)
@@ -275,6 +275,8 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
       (let ((pointer riece-addons))
        (while pointer
          (riece-insinuate-addon (car pointer) riece-debug)
+         (unless (get (car pointer) 'riece-addon-default-disabled)
+           (riece-enable-addon (car pointer) riece-debug))
          (setq pointer (cdr pointer))))
       (setq riece-addons-insinuated t))
     (if (or confirm (null riece-server))
@@ -303,10 +305,6 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
       (while server-list
        (riece-command-open-server (car server-list))
        (setq server-list (cdr server-list))))
-    (let ((pointer riece-addons))
-      (while pointer
-       (riece-enable-addon (car pointer) riece-debug)
-       (setq pointer (cdr pointer))))
     (run-hooks 'riece-startup-hook)
     (message "%s" (substitute-command-keys
                   "Type \\[describe-mode] for help"))))
@@ -327,6 +325,10 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
        (delete-region start end)))))
 
 (defun riece-exit ()
+  (let ((pointer riece-addons))
+    (while pointer
+      (riece-disable-addon (car pointer) riece-debug)
+      (setq pointer (cdr pointer))))
   (if riece-save-variables-are-dirty
       (riece-save-variables-files))
   (while riece-buffer-list