Mercurial > emacs
comparison lisp/erc/erc-capab.el @ 83561:dc002877ce12
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-674
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-675
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-676
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-677
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-678
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-679
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-680
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-681
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-682
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-683
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-684
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-685
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-686
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-687
Release ERC 5.2.
* emacs@sv.gnu.org/emacs--devo--0--patch-688
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-689
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-690
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-691
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-692
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-693
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-694
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-695
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-696
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-697
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-698
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-699
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-700
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-701
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-209
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-210
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-211
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-212
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-213
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-214
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-215
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-601
author | Karoly Lorentey <karoly@lorentey.hu> |
---|---|
date | Sun, 22 Apr 2007 12:42:47 +0000 |
parents | 2fae574a2382 |
children | 85d67fae9a94 |
comparison
equal
deleted
inserted
replaced
83560:738ce3540ffb | 83561:dc002877ce12 |
---|---|
54 | 54 |
55 ;; (require 'erc-capab) | 55 ;; (require 'erc-capab) |
56 ;; (erc-capab-identify-mode 1) | 56 ;; (erc-capab-identify-mode 1) |
57 | 57 |
58 ;; `erc-capab-identify-prefix' will now be added to the beginning of | 58 ;; `erc-capab-identify-prefix' will now be added to the beginning of |
59 ;; unidentified users' nicknames. The default is an asterisk, "*". If | 59 ;; unidentified users' nicknames. The default is an asterisk, "*". |
60 ;; the value of this variable is nil or you disable this module (see | 60 ;; You can customize the prefix and the face used to display it, |
61 ;; `erc-capab-identify-unidentified'. If the value of | |
62 ;; `erc-capab-identify-prefix' is nil or you disable this module (see | |
61 ;; `erc-capab-identify-disable'), no prefix will be inserted, but the | 63 ;; `erc-capab-identify-disable'), no prefix will be inserted, but the |
62 ;; flag sent by the server will still be stripped. | 64 ;; flag sent by the server will still be stripped. |
63 | 65 |
64 ;;; Code: | 66 ;;; Code: |
65 | 67 |
71 (defgroup erc-capab nil | 73 (defgroup erc-capab nil |
72 "Support for dancer-ircd's CAPAB settings." | 74 "Support for dancer-ircd's CAPAB settings." |
73 :group 'erc) | 75 :group 'erc) |
74 | 76 |
75 (defcustom erc-capab-identify-prefix "*" | 77 (defcustom erc-capab-identify-prefix "*" |
76 "The prefix used for unidentified users." | 78 "The prefix used for unidentified users. |
79 | |
80 If you change this from the default \"*\", be sure to use a | |
81 character not found in IRC nicknames to avoid confusion." | |
77 :group 'erc-capab | 82 :group 'erc-capab |
78 :type '(choice string (const nil))) | 83 :type '(choice string (const nil))) |
79 | 84 |
85 (defface erc-capab-identify-unidentified '((t)) ; same as `erc-default-face' | |
86 "Face to use for `erc-capab-identify-prefix'." | |
87 :group 'erc-capab | |
88 :group 'erc-faces) | |
89 | |
80 ;;; Define module: | 90 ;;; Define module: |
81 | |
82 (define-erc-response-handler (290) | |
83 "Handle dancer-ircd CAPAB messages." nil nil) | |
84 | 91 |
85 ;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t) | 92 ;;;###autoload (autoload 'erc-capab-identify-mode "erc-capab" nil t) |
86 (define-erc-module capab-identify nil | 93 (define-erc-module capab-identify nil |
87 "Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP." | 94 "Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP." |
88 ;; append so that `erc-server-parameters' is already set by `erc-server-005' | 95 ;; append so that `erc-server-parameters' is already set by `erc-server-005' |
122 Optional argument PARSED is the current message, a response struct. | 129 Optional argument PARSED is the current message, a response struct. |
123 | 130 |
124 These arguments are sent to this function when called as a hook in | 131 These arguments are sent to this function when called as a hook in |
125 `erc-server-005-functions'." | 132 `erc-server-005-functions'." |
126 (unless erc-capab-identify-sent | 133 (unless erc-capab-identify-sent |
127 (erc-capab-send-identify-messages))) | 134 (erc-capab-identify-send-messages))) |
128 | 135 |
129 (defun erc-capab-send-identify-messages () | 136 (defun erc-capab-identify-send-messages () |
130 "Send CAPAB IDENTIFY messages if the server supports it." | 137 "Send CAPAB IDENTIFY messages if the server supports it." |
131 (when (and (stringp erc-server-version) | 138 (when (and (stringp erc-server-version) |
132 (string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version) | 139 (string-match "^\\(dancer-ircd\\|hyperion\\)" erc-server-version) |
133 ;; could possibly check for '("IRCD" . "dancer") in | 140 ;; could possibly check for '("IRCD" . "dancer") in |
134 ;; `erc-server-parameters' instead of looking for a specific name | 141 ;; `erc-server-parameters' instead of looking for a specific name |
173 (defun erc-capab-identify-add-prefix () | 180 (defun erc-capab-identify-add-prefix () |
174 "Add `erc-capab-identify-prefix' to nickname if user is unidentified." | 181 "Add `erc-capab-identify-prefix' to nickname if user is unidentified." |
175 (when (and erc-capab-identify-prefix | 182 (when (and erc-capab-identify-prefix |
176 (erc-with-server-buffer erc-capab-identify-activated)) | 183 (erc-with-server-buffer erc-capab-identify-activated)) |
177 (goto-char (or (erc-find-parsed-property) (point-min))) | 184 (goto-char (or (erc-find-parsed-property) (point-min))) |
178 (let ((nickname (erc-capab-get-unidentified-nickname | 185 (let ((nickname (erc-capab-identify-get-unidentified-nickname |
179 (erc-get-parsed-vector (point))))) | 186 (erc-get-parsed-vector (point))))) |
180 (when (and nickname | 187 (when (and nickname |
181 (goto-char (point-min)) | 188 (goto-char (point-min)) |
182 ;; assuming the first use of `nickname' is the sender's nick | 189 ;; assuming the first use of `nickname' is the sender's nick |
183 (re-search-forward (regexp-quote nickname) nil t)) | 190 (re-search-forward (regexp-quote nickname) nil t)) |
184 (goto-char (match-beginning 0)) | 191 (goto-char (match-beginning 0)) |
185 (insert (erc-propertize erc-capab-identify-prefix | 192 (insert (erc-propertize erc-capab-identify-prefix |
186 'face (get-char-property (- (point) 1) | 193 'face 'erc-capab-identify-unidentified)))))) |
187 'face))))))) | 194 |
188 | 195 (defun erc-capab-identify-get-unidentified-nickname (parsed) |
189 (defun erc-capab-get-unidentified-nickname (parsed) | |
190 "Return the nickname of the user if unidentified. | 196 "Return the nickname of the user if unidentified. |
191 PARSED is an `erc-parsed' response struct." | 197 PARSED is an `erc-parsed' response struct." |
192 (when (and (erc-response-p parsed) | 198 (when (and (erc-response-p parsed) |
193 (equal 0 (get-text-property 0 'erc-identified | 199 (equal 0 (get-text-property 0 'erc-identified |
194 (erc-response.contents parsed)))) | 200 (erc-response.contents parsed)))) |