]> code.delx.au - gnu-emacs/blobdiff - lisp/erc/erc-capab.el
M-v corrections.
[gnu-emacs] / lisp / erc / erc-capab.el
index 268c4bfe68ad10659f0b7bb71df74de75e8a5407..3f6ce085e4e9b9cec286df4b37f7d66317e6c520 100644 (file)
@@ -1,11 +1,11 @@
 ;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB
 
-;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -13,9 +13,7 @@
 ;; GNU General Public License for more details.
 
 ;; 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., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -45,7 +43,7 @@
 ;; From freenode.net's web site (not there anymore) on how to mark
 ;; unidentified users:
 ;; "We recommend that you add an asterisk before the nick, and
-;;  optionally either highlight or colourize the line in some
+;;  optionally either highlight or colorize the line in some
 ;;  appropriate fashion, if the user is not identified."
 
 ;;; Usage:
 ;; (erc-capab-identify-mode 1)
 
 ;; `erc-capab-identify-prefix' will now be added to the beginning of
-;; unidentified users' nicknames.  The default is an asterisk, "*".  If
-;; the value of this variable is nil or you disable this module (see
+;; unidentified users' nicknames.  The default is an asterisk, "*".
+;; You can customize the prefix and the face used to display it,
+;; `erc-capab-identify-unidentified'.  If the value of
+;; `erc-capab-identify-prefix' is nil or you disable this module (see
 ;; `erc-capab-identify-disable'), no prefix will be inserted, but the
 ;; flag sent by the server will still be stripped.
 
   :group 'erc)
 
 (defcustom erc-capab-identify-prefix "*"
-  "The prefix used for unidentified users."
+  "The prefix used for unidentified users.
+
+If you change this from the default \"*\", be sure to use a
+character not found in IRC nicknames to avoid confusion."
   :group 'erc-capab
   :type '(choice string (const nil)))
 
-;;; Define module:
+(defface erc-capab-identify-unidentified '((t)) ; same as `erc-default-face'
+  "Face to use for `erc-capab-identify-prefix'."
+  :group 'erc-capab
+  :group 'erc-faces)
 
-(define-erc-response-handler (290)
-  "Handle dancer-ircd CAPAB messages." nil nil)
+;;; Define module:
 
 ;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t)
 (define-erc-module capab-identify nil
@@ -124,9 +129,9 @@ Optional argument PARSED is the current message, a response struct.
 These arguments are sent to this function when called as a hook in
 `erc-server-005-functions'."
   (unless erc-capab-identify-sent
-    (erc-capab-send-identify-messages)))
+    (erc-capab-identify-send-messages)))
 
-(defun erc-capab-send-identify-messages ()
+(defun erc-capab-identify-send-messages ()
   "Send CAPAB IDENTIFY messages if the server supports it."
   (when (and (stringp erc-server-version)
              (string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version)
@@ -175,7 +180,7 @@ PARSED is an `erc-parsed' response struct."
   (when (and erc-capab-identify-prefix
              (erc-with-server-buffer erc-capab-identify-activated))
     (goto-char (or (erc-find-parsed-property) (point-min)))
-    (let ((nickname (erc-capab-get-unidentified-nickname
+    (let ((nickname (erc-capab-identify-get-unidentified-nickname
                      (erc-get-parsed-vector (point)))))
       (when (and nickname
                  (goto-char (point-min))
@@ -183,10 +188,9 @@ PARSED is an `erc-parsed' response struct."
                  (re-search-forward (regexp-quote nickname) nil t))
         (goto-char (match-beginning 0))
         (insert (erc-propertize erc-capab-identify-prefix
-                                'face (get-char-property (- (point) 1)
-                                                         'face)))))))
+                                'face 'erc-capab-identify-unidentified))))))
 
-(defun erc-capab-get-unidentified-nickname (parsed)
+(defun erc-capab-identify-get-unidentified-nickname (parsed)
   "Return the nickname of the user if unidentified.
 PARSED is an `erc-parsed' response struct."
   (when (and (erc-response-p parsed)