Mercurial > emacs
annotate lisp/erc/erc-services.el @ 93156:3ef12fa772f2
* dbusbind.c (xd_read_message): Removed extra copying of message
strings. Check for NULL `interface' or `member'.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Sun, 23 Mar 2008 16:45:39 +0000 |
parents | b8f89dd3680d |
children | 2a734255bcc7 |
rev | line source |
---|---|
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
1 ;;; erc-services.el --- Identify to NickServ |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
2 |
79706 | 3 ;; Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
4 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 ;; This file is part of GNU Emacs. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
6 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 ;; GNU Emacs is free software; you can redistribute it and/or modify |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 ;; it under the terms of the GNU General Public License as published by |
78219
85d67fae9a94
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76856
diff
changeset
|
9 ;; the Free Software Foundation; either version 3, or (at your option) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 ;; any later version. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
11 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; GNU Emacs is distributed in the hope that it will be useful, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 ;; GNU General Public License for more details. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
16 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
17 ;; You should have received a copy of the GNU General Public License |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
19 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 ;; Boston, MA 02110-1301, USA. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
22 ;;; Commentary: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;; There are two ways to go about identifying yourself automatically to |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 ;; NickServ with this module. The more secure way is to listen for identify |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 ;; requests from the user NickServ. Another way is to identify yourself to |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 ;; NickServ directly after a successful connection and every time you change |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 ;; your nickname. This method is rather insecure, though, because no checks |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 ;; are made to test if NickServ is the real NickServ for a given network or |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 ;; server. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 |
87202 | 32 ;; As a default, ERC has the data for the official nickname services on |
33 ;; the networks Austnet, BrasNET, Dalnet, freenode, GalaxyNet, GRnet, | |
34 ;; and Slashnet. You can add more by using M-x customize-variable RET | |
35 ;; erc-nickserv-alist. | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
36 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 ;; Usage: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
38 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
39 ;; Put into your .emacs: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
40 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 ;; (require 'erc-services) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
42 ;; (erc-services-mode 1) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
43 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
44 ;; Add your nickname and NickServ password to `erc-nickserv-passwords'. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
45 ;; Using the freenode network as an example: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
46 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
47 ;; (setq erc-nickserv-passwords '((freenode (("nickname" "password"))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
48 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
49 ;; The default automatic identification mode is autodetection of NickServ |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
50 ;; identify requests. Set the variable `erc-nickserv-identify-mode' if |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
51 ;; you'd like to change this behavior. You can also change the way |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
52 ;; automatic identification is handled by using: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
53 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
54 ;; M-x erc-nickserv-identify-mode |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
55 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
56 ;; If you'd rather not identify yourself automatically but would like access |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
57 ;; to the functions contained in this file, just load this file without |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
58 ;; enabling `erc-services-mode'. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
59 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
60 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
61 ;;; Code: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
62 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
63 (require 'erc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
64 (require 'erc-networks) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
65 (eval-when-compile (require 'cl)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
66 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
67 ;; Customization: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
68 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
69 (defgroup erc-services nil |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
70 "Configuration for IRC services. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
71 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
72 On some networks, there exists a special type of automated irc bot, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
73 called Services. Those usually allow you to register your nickname, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
74 post/read memos to other registered users who are currently offline, |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
75 and do various other things. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
76 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
77 This group allows you to set variables to somewhat automate |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
78 communication with those Services." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
79 :group 'erc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
80 |
75259 | 81 (defcustom erc-nickserv-identify-mode 'both |
82 "The mode which is used when identifying to Nickserv. | |
83 | |
84 Possible settings are:. | |
85 | |
86 'autodetect - Identify when the real Nickserv sends an identify request. | |
87 'nick-change - Identify when you log in or change your nickname. | |
88 'both - Do the former if the network supports it, otherwise do the | |
89 latter. | |
90 nil - Disables automatic Nickserv identification. | |
91 | |
92 You can also use M-x erc-nickserv-identify-mode to change modes." | |
93 :group 'erc-services | |
94 :type '(choice (const autodetect) | |
95 (const nick-change) | |
96 (const both) | |
97 (const nil)) | |
98 :set (lambda (sym val) | |
99 (set sym val) | |
100 ;; avoid recursive load at startup | |
101 (when (featurep 'erc-services) | |
102 (erc-nickserv-identify-mode val)))) | |
103 | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
104 ;;;###autoload (autoload 'erc-services-mode "erc-services" nil t) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
105 (define-erc-module services nickserv |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
106 "This mode automates communication with services." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
107 ((erc-nickserv-identify-mode erc-nickserv-identify-mode)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
108 ((remove-hook 'erc-server-NOTICE-functions |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
109 'erc-nickserv-identify-autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
110 (remove-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
111 'erc-nickserv-identify-on-connect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
112 (remove-hook 'erc-nick-changed-functions |
87202 | 113 'erc-nickserv-identify-on-nick-change) |
114 (remove-hook 'erc-server-NOTICE-functions | |
115 'erc-nickserv-identification-autodetect))) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
116 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
117 ;;;###autoload |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
118 (defun erc-nickserv-identify-mode (mode) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
119 "Set up hooks according to which MODE the user has chosen." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
120 (interactive |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
121 (list (intern (completing-read |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
122 "Choose Nickserv identify mode (RET to disable): " |
75092 | 123 '(("autodetect") ("nick-change") ("both")) nil t)))) |
87202 | 124 (add-hook 'erc-server-NOTICE-functions |
125 'erc-nickserv-identification-autodetect) | |
87952
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
126 (unless erc-networks-mode |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
127 ;; Force-enable networks module, because we need it to set |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
128 ;; erc-network for us. |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
129 (erc-networks-enable)) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
130 (cond ((eq mode 'autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
131 (setq erc-nickserv-identify-mode 'autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
132 (add-hook 'erc-server-NOTICE-functions |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
133 'erc-nickserv-identify-autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
134 (remove-hook 'erc-nick-changed-functions |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
135 'erc-nickserv-identify-on-nick-change) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
136 (remove-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
137 'erc-nickserv-identify-on-connect)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
138 ((eq mode 'nick-change) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
139 (setq erc-nickserv-identify-mode 'nick-change) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
140 (add-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
141 'erc-nickserv-identify-on-connect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
142 (add-hook 'erc-nick-changed-functions |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
143 'erc-nickserv-identify-on-nick-change) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
144 (remove-hook 'erc-server-NOTICE-functions |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
145 'erc-nickserv-identify-autodetect)) |
75092 | 146 ((eq mode 'both) |
147 (setq erc-nickserv-identify-mode 'both) | |
148 (add-hook 'erc-server-NOTICE-functions | |
149 'erc-nickserv-identify-autodetect) | |
150 (add-hook 'erc-after-connect | |
151 'erc-nickserv-identify-on-connect) | |
152 (add-hook 'erc-nick-changed-functions | |
153 'erc-nickserv-identify-on-nick-change)) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
154 (t |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
155 (setq erc-nickserv-identify-mode nil) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
156 (remove-hook 'erc-server-NOTICE-functions |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
157 'erc-nickserv-identify-autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
158 (remove-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
159 'erc-nickserv-identify-on-connect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
160 (remove-hook 'erc-nick-changed-functions |
87202 | 161 'erc-nickserv-identify-on-nick-change) |
162 (remove-hook 'erc-server-NOTICE-functions | |
163 'erc-nickserv-identification-autodetect)))) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
164 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
165 (defcustom erc-prompt-for-nickserv-password t |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
166 "Ask for the password when identifying to NickServ." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
167 :group 'erc-services |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
168 :type 'boolean) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
169 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
170 (defcustom erc-nickserv-passwords nil |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
171 "Passwords used when identifying to NickServ automatically. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
172 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
173 Example of use: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
174 (setq erc-nickserv-passwords |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
175 '((freenode ((\"nick-one\" . \"password\") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
176 (\"nick-two\" . \"password\"))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
177 (DALnet ((\"nick\" . \"password\")))))" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
178 :group 'erc-services |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
179 :type '(repeat |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
180 (list :tag "Network" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
181 (choice :tag "Network name" |
76856 | 182 (const Ars) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
183 (const Austnet) |
75092 | 184 (const Azzurra) |
76856 | 185 (const BitlBee) |
186 (const BRASnet) | |
187 (const DALnet) | |
188 (const freenode) | |
189 (const GalaxyNet) | |
87202 | 190 (const GRnet) |
76856 | 191 (const iip) |
192 (const OFTC) | |
193 (const QuakeNet) | |
87952
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
194 (const Rizon) |
76856 | 195 (const SlashNET) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
196 (symbol :tag "Network name")) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
197 (repeat :tag "Nickname and password" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
198 (cons :tag "Identity" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
199 (string :tag "Nick") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
200 (string :tag "Password")))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
201 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
202 ;; Variables: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
203 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
204 (defcustom erc-nickserv-alist |
76856 | 205 '((Ars |
206 nil nil | |
207 "Census" | |
87202 | 208 "IDENTIFY" nil nil nil) |
76856 | 209 (Austnet |
210 "NickOP!service@austnet.org" | |
211 "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>" | |
212 "nickop@austnet.org" | |
87202 | 213 "identify" nil nil nil) |
76856 | 214 (Azzurra |
215 "NickServ!service@azzurra.org" | |
216 "/ns\\s-IDENTIFY\\s-password" | |
217 "NickServ" | |
87202 | 218 "IDENTIFY" nil nil nil) |
76856 | 219 (BitlBee |
220 nil nil | |
75259 | 221 "&bitlbee" |
87202 | 222 "identify" nil nil nil) |
76856 | 223 (BRASnet |
224 "NickServ!services@brasnet.org" | |
225 "/NickServ\\s-IDENTIFY\\s-senha" | |
226 "NickServ" | |
87202 | 227 "IDENTIFY" nil "" nil) |
75259 | 228 (DALnet |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
229 "NickServ!service@dal.net" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
230 "/msg\\s-NickServ@services.dal.net\\s-IDENTIFY\\s-<password>" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
231 "NickServ@services.dal.net" |
87202 | 232 "IDENTIFY" nil nil nil) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
233 (freenode |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
234 "NickServ!NickServ@services." |
87687
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
235 ;; freenode also accepts a password at login, see the `erc' |
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
236 ;; :password argument. |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
237 "/msg\\s-NickServ\\s-IDENTIFY\\s-<password>" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
238 "NickServ" |
87202 | 239 "IDENTIFY" nil nil |
240 "Password\\s-accepted\\s--\\s-you\\s-are\\s-now\\s-recognized") | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
241 (GalaxyNet |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
242 "NS!nickserv@galaxynet.org" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
243 "Please\\s-change\\s-nicks\\s-or\\s-authenticate." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
244 "NS@services.galaxynet.org" |
87202 | 245 "AUTH" t nil nil) |
246 (GRnet | |
247 "NickServ!service@irc.gr" | |
248 "This\\s-nickname\\s-is\\s-registered\\s-and\\s-protected." | |
249 "NickServ" | |
250 "IDENTIFY" nil nil | |
251 "Password\\s-accepted\\s--\\s-you\\s-are\\s-now\\s-recognized.") | |
76856 | 252 (iip |
253 "Trent@anon.iip" | |
254 "type\\s-/squery\\s-Trent\\s-identify\\s-<password>" | |
255 "Trent@anon.iip" | |
87202 | 256 "IDENTIFY" nil "SQUERY" nil) |
76856 | 257 (OFTC |
258 "NickServ!services@services.oftc.net" | |
87687
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
259 ;; OFTC's NickServ doesn't ask you to identify anymore. |
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
260 nil |
76856 | 261 "NickServ" |
87687
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
262 "IDENTIFY" nil nil |
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
263 "You\\s-are\\s-successfully\\s-identified\\s-as\\s-") |
87952
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
264 (Rizon |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
265 "NickServ!service@rizon.net" |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
266 "This\\s-nickname\\s-is\\s-registered\\s-and\\s-protected." |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
267 "NickServ" |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
268 "IDENTIFY" nil nil |
b8f89dd3680d
ERC: Sync version 5.3, release candidate 1.
Michael Olson <mwolson@gnu.org>
parents:
87687
diff
changeset
|
269 "Password\\s-accepted\\s--\\s-you\\s-are\\s-now\\s-recognized.") |
76856 | 270 (QuakeNet |
271 nil nil | |
272 "Q@CServe.quakenet.org" | |
87202 | 273 "auth" t nil nil) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
274 (SlashNET |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
275 "NickServ!services@services.slashnet.org" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
276 "/msg\\s-NickServ\\s-IDENTIFY\\s-password" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
277 "NickServ@services.slashnet.org" |
87202 | 278 "IDENTIFY" nil nil nil)) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
279 "Alist of NickServer details, sorted by network. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
280 Every element in the list has the form |
87202 | 281 \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER SUCCESS-REGEXP) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
282 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
283 SYMBOL is a network identifier, a symbol, as used in `erc-networks-alist'. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
284 NICKSERV is the description of the nickserv in the form nick!user@host. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
285 REGEXP is a regular expression matching the message from nickserv. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
286 NICK is nickserv's nickname. Use nick@server where necessary/possible. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
287 KEYWORD is the keyword to use in the reply message to identify yourself. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
288 USE-CURRENT indicates whether the current nickname must be used when |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
289 identifying. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
290 ANSWER is the command to use for the answer. The default is 'privmsg. |
87202 | 291 SUCCESS-REGEXP is a regular expression matching the message nickserv |
292 sends when you've successfully identified. | |
293 The last two elements are optional." | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
294 :group 'erc-services |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
295 :type '(repeat |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
296 (list :tag "Nickserv data" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
297 (symbol :tag "Network name") |
76856 | 298 (choice (string :tag "Nickserv's nick!user@host") |
299 (const :tag "No message sent by Nickserv" nil)) | |
300 (choice (regexp :tag "Identify request sent by Nickserv") | |
301 (const :tag "No message sent by Nickserv" nil)) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
302 (string :tag "Identify to") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
303 (string :tag "Identify keyword") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
304 (boolean :tag "Use current nick in identify message?") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
305 (choice :tag "Command to use (optional)" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
306 (string :tag "Command") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
307 (const :tag "No special command necessary" nil))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
308 |
75259 | 309 (defsubst erc-nickserv-alist-sender (network &optional entry) |
310 (nth 1 (or entry (assoc network erc-nickserv-alist)))) | |
311 | |
312 (defsubst erc-nickserv-alist-regexp (network &optional entry) | |
313 (nth 2 (or entry (assoc network erc-nickserv-alist)))) | |
314 | |
315 (defsubst erc-nickserv-alist-nickserv (network &optional entry) | |
316 (nth 3 (or entry (assoc network erc-nickserv-alist)))) | |
317 | |
318 (defsubst erc-nickserv-alist-ident-keyword (network &optional entry) | |
319 (nth 4 (or entry (assoc network erc-nickserv-alist)))) | |
320 | |
321 (defsubst erc-nickserv-alist-use-nick-p (network &optional entry) | |
322 (nth 5 (or entry (assoc network erc-nickserv-alist)))) | |
323 | |
324 (defsubst erc-nickserv-alist-ident-command (network &optional entry) | |
325 (nth 6 (or entry (assoc network erc-nickserv-alist)))) | |
326 | |
87202 | 327 (defsubst erc-nickserv-alist-identified-regexp (network &optional entry) |
328 (nth 7 (or entry (assoc network erc-nickserv-alist)))) | |
329 | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
330 ;; Functions: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
331 |
87202 | 332 (defcustom erc-nickserv-identified-hook nil |
333 "Run this hook when NickServ acknowledged successful identification. | |
334 Hooks are called with arguments (NETWORK NICK)." | |
335 :group 'erc-services | |
336 :type 'hook) | |
337 | |
338 (defun erc-nickserv-identification-autodetect (proc parsed) | |
339 "Check for NickServ's successful identification notice. | |
340 Make sure it is the real NickServ for this network and that it has | |
341 specifically confirmed a successful identification attempt. | |
342 If this is the case, run `erc-nickserv-identified-hook'." | |
343 (let* ((network (erc-network)) | |
344 (sender (erc-nickserv-alist-sender network)) | |
345 (success-regex (erc-nickserv-alist-identified-regexp network)) | |
346 (sspec (erc-response.sender parsed)) | |
347 (nick (car (erc-response.command-args parsed))) | |
348 (msg (erc-response.contents parsed))) | |
349 ;; continue only if we're sure it's the real nickserv for this network | |
350 ;; and it's told us we've successfully identified | |
351 (when (and sender (equal sspec sender) | |
87687
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
352 success-regex |
87202 | 353 (string-match success-regex msg)) |
354 (erc-log "NickServ IDENTIFY success notification detected") | |
355 (run-hook-with-args 'erc-nickserv-identified-hook network nick) | |
356 nil))) | |
357 | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
358 (defun erc-nickserv-identify-autodetect (proc parsed) |
87687
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
359 "Identify to NickServ when an identify request is received. |
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
360 Make sure it is the real NickServ for this network. |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
361 If `erc-prompt-for-nickserv-password' is non-nil, prompt the user for the |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
362 password for this nickname, otherwise try to send it automatically." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
363 (unless (and (null erc-nickserv-passwords) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
364 (null erc-prompt-for-nickserv-password)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
365 (let* ((network (erc-network)) |
75259 | 366 (sender (erc-nickserv-alist-sender network)) |
367 (identify-regex (erc-nickserv-alist-regexp network)) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
368 (sspec (erc-response.sender parsed)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
369 (nick (car (erc-response.command-args parsed))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
370 (msg (erc-response.contents parsed))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
371 ;; continue only if we're sure it's the real nickserv for this network |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
372 ;; and it's asked us to identify |
75259 | 373 (when (and sender (equal sspec sender) |
87687
aef7ff97a0c2
ERC: Sync changes from upstream.
Michael Olson <mwolson@gnu.org>
parents:
87649
diff
changeset
|
374 identify-regex |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
375 (string-match identify-regex msg)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
376 (erc-log "NickServ IDENTIFY request detected") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
377 (erc-nickserv-call-identify-function nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
378 nil)))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
379 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
380 (defun erc-nickserv-identify-on-connect (server nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
381 "Identify to Nickserv after the connection to the server is established." |
75092 | 382 (unless (or (and (null erc-nickserv-passwords) |
383 (null erc-prompt-for-nickserv-password)) | |
384 (and (eq erc-nickserv-identify-mode 'both) | |
75259 | 385 (erc-nickserv-alist-regexp (erc-network)))) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
386 (erc-nickserv-call-identify-function nick))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
387 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
388 (defun erc-nickserv-identify-on-nick-change (nick old-nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
389 "Identify to Nickserv whenever your nick changes." |
75092 | 390 (unless (or (and (null erc-nickserv-passwords) |
391 (null erc-prompt-for-nickserv-password)) | |
392 (and (eq erc-nickserv-identify-mode 'both) | |
75259 | 393 (erc-nickserv-alist-regexp (erc-network)))) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
394 (erc-nickserv-call-identify-function nick))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
395 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
396 (defun erc-nickserv-call-identify-function (nickname) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
397 "Call `erc-nickserv-identify' interactively or run it with NICKNAME's |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
398 password. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
399 The action is determined by the value of `erc-prompt-for-nickserv-password'." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
400 (if erc-prompt-for-nickserv-password |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
401 (call-interactively 'erc-nickserv-identify) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
402 (when erc-nickserv-passwords |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
403 (erc-nickserv-identify |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
404 (cdr (assoc nickname |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
405 (nth 1 (assoc (erc-network) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
406 erc-nickserv-passwords)))))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
407 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
408 ;;;###autoload |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
409 (defun erc-nickserv-identify (password) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
410 "Send an \"identify <PASSWORD>\" message to NickServ. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
411 When called interactively, read the password using `read-passwd'." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
412 (interactive |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
413 (list (read-passwd |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
414 (format "NickServ password for %s on %s (RET to cancel): " |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
415 (erc-current-nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
416 (or (and (erc-network) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
417 (symbol-name (erc-network))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
418 "Unknown network"))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
419 (when (and password (not (string= "" password))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
420 (let* ((erc-auto-discard-away nil) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
421 (network (erc-network)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
422 (nickserv-info (assoc network erc-nickserv-alist)) |
75259 | 423 (nickserv (or (erc-nickserv-alist-nickserv nil nickserv-info) |
424 "NickServ")) | |
425 (identify-word (or (erc-nickserv-alist-ident-keyword | |
426 nil nickserv-info) | |
427 "IDENTIFY")) | |
428 (nick (if (erc-nickserv-alist-use-nick-p nil nickserv-info) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
429 (concat (erc-current-nick) " ") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
430 "")) |
75259 | 431 (msgtype (or (erc-nickserv-alist-ident-command nil nickserv-info) |
432 "PRIVMSG"))) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
433 (erc-message msgtype |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
434 (concat nickserv " " identify-word " " nick password))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
435 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
436 (provide 'erc-services) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
437 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
438 ;;; erc-services.el ends here |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
439 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
440 ;; Local Variables: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
441 ;; indent-tabs-mode: t |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
442 ;; tab-width: 8 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
443 ;; End: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
444 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
445 ;; arch-tag: d401c8aa-d938-4255-96a9-3efb64c47e58 |