Mercurial > emacs
annotate lisp/erc/erc-services.el @ 81917:4a73d4ff3f6a
(clean): Don't delete *~.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 16 Jul 2007 22:37:01 +0000 |
parents | 2fae574a2382 |
children | 85d67fae9a94 |
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 |
75346 | 3 ;; Copyright (C) 2002, 2003, 2004, 2006, 2007 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 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
9 ;; the Free Software Foundation; either version 2, or (at your option) |
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 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
32 ;; As a default, ERC has the data for the official nickname services on the |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
33 ;; networks Austnet, BrasNET, Dalnet, freenode, GalaxyNet, and Slashnet. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 ;; You can add more by using M-x customize-variable RET erc-nickserv-alist. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
35 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
36 ;; Usage: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
38 ;; Put into your .emacs: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
39 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
40 ;; (require 'erc-services) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 ;; (erc-services-mode 1) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
42 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
43 ;; 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
|
44 ;; 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
|
45 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
46 ;; (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
|
47 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
48 ;; 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
|
49 ;; 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
|
50 ;; 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
|
51 ;; 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
|
52 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
53 ;; 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
|
54 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
55 ;; 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
|
56 ;; 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
|
57 ;; enabling `erc-services-mode'. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
58 ;; |
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 ;;; Code: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
61 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
62 (require 'erc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
63 (require 'erc-networks) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
64 (eval-when-compile (require 'cl)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
65 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
66 ;; Customization: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
67 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
68 (defgroup erc-services nil |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
69 "Configuration for IRC services. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
70 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
71 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
|
72 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
|
73 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
|
74 and do various other things. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
75 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
76 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
|
77 communication with those Services." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
78 :group 'erc) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
79 |
75259 | 80 (defcustom erc-nickserv-identify-mode 'both |
81 "The mode which is used when identifying to Nickserv. | |
82 | |
83 Possible settings are:. | |
84 | |
85 'autodetect - Identify when the real Nickserv sends an identify request. | |
86 'nick-change - Identify when you log in or change your nickname. | |
87 'both - Do the former if the network supports it, otherwise do the | |
88 latter. | |
89 nil - Disables automatic Nickserv identification. | |
90 | |
91 You can also use M-x erc-nickserv-identify-mode to change modes." | |
92 :group 'erc-services | |
93 :type '(choice (const autodetect) | |
94 (const nick-change) | |
95 (const both) | |
96 (const nil)) | |
97 :set (lambda (sym val) | |
98 (set sym val) | |
99 ;; avoid recursive load at startup | |
100 (when (featurep 'erc-services) | |
101 (erc-nickserv-identify-mode val)))) | |
102 | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
103 ;;;###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
|
104 (define-erc-module services nickserv |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
105 "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
|
106 ((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
|
107 ((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
|
108 'erc-nickserv-identify-autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
109 (remove-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
110 'erc-nickserv-identify-on-connect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
111 (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
|
112 '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
|
113 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
114 ;;;###autoload |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
115 (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
|
116 "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
|
117 (interactive |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
118 (list (intern (completing-read |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
119 "Choose Nickserv identify mode (RET to disable): " |
75092 | 120 '(("autodetect") ("nick-change") ("both")) nil t)))) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
121 (cond ((eq mode 'autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
122 (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
|
123 (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
|
124 'erc-nickserv-identify-autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
125 (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
|
126 '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
|
127 (remove-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
128 'erc-nickserv-identify-on-connect)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
129 ((eq mode 'nick-change) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
130 (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
|
131 (add-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
132 'erc-nickserv-identify-on-connect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
133 (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
|
134 '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
|
135 (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
|
136 'erc-nickserv-identify-autodetect)) |
75092 | 137 ((eq mode 'both) |
138 (setq erc-nickserv-identify-mode 'both) | |
139 (add-hook 'erc-server-NOTICE-functions | |
140 'erc-nickserv-identify-autodetect) | |
141 (add-hook 'erc-after-connect | |
142 'erc-nickserv-identify-on-connect) | |
143 (add-hook 'erc-nick-changed-functions | |
144 '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
|
145 (t |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
146 (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
|
147 (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
|
148 'erc-nickserv-identify-autodetect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
149 (remove-hook 'erc-after-connect |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
150 'erc-nickserv-identify-on-connect) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
151 (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
|
152 '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
|
153 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
154 (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
|
155 "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
|
156 :group 'erc-services |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
157 :type 'boolean) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
158 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
159 (defcustom erc-nickserv-passwords nil |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
160 "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
|
161 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
162 Example of use: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
163 (setq erc-nickserv-passwords |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
164 '((freenode ((\"nick-one\" . \"password\") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
165 (\"nick-two\" . \"password\"))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
166 (DALnet ((\"nick\" . \"password\")))))" |
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 '(repeat |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
169 (list :tag "Network" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
170 (choice :tag "Network name" |
76856 | 171 (const Ars) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
172 (const Austnet) |
75092 | 173 (const Azzurra) |
76856 | 174 (const BitlBee) |
175 (const BRASnet) | |
176 (const DALnet) | |
177 (const freenode) | |
178 (const GalaxyNet) | |
179 (const iip) | |
180 (const OFTC) | |
181 (const QuakeNet) | |
182 (const SlashNET) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
183 (symbol :tag "Network name")) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
184 (repeat :tag "Nickname and password" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
185 (cons :tag "Identity" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
186 (string :tag "Nick") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
187 (string :tag "Password")))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
188 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
189 ;; Variables: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
190 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
191 (defcustom erc-nickserv-alist |
76856 | 192 '((Ars |
193 nil nil | |
194 "Census" | |
195 "IDENTIFY" nil nil) | |
196 (Austnet | |
197 "NickOP!service@austnet.org" | |
198 "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>" | |
199 "nickop@austnet.org" | |
200 "identify" nil nil) | |
201 (Azzurra | |
202 "NickServ!service@azzurra.org" | |
203 "/ns\\s-IDENTIFY\\s-password" | |
204 "NickServ" | |
205 "IDENTIFY" nil nil) | |
206 (BitlBee | |
207 nil nil | |
75259 | 208 "&bitlbee" |
76856 | 209 "identify" nil nil) |
210 (BRASnet | |
211 "NickServ!services@brasnet.org" | |
212 "/NickServ\\s-IDENTIFY\\s-senha" | |
213 "NickServ" | |
214 "IDENTIFY" nil "") | |
75259 | 215 (DALnet |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
216 "NickServ!service@dal.net" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
217 "/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
|
218 "NickServ@services.dal.net" |
76856 | 219 "IDENTIFY" nil nil) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
220 (freenode |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
221 "NickServ!NickServ@services." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
222 "/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
|
223 "NickServ" |
76856 | 224 "IDENTIFY" nil nil) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
225 (GalaxyNet |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
226 "NS!nickserv@galaxynet.org" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
227 "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
|
228 "NS@services.galaxynet.org" |
76856 | 229 "AUTH" t nil) |
230 (iip | |
231 "Trent@anon.iip" | |
232 "type\\s-/squery\\s-Trent\\s-identify\\s-<password>" | |
233 "Trent@anon.iip" | |
234 "IDENTIFY" nil "SQUERY") | |
235 (OFTC | |
236 "NickServ!services@services.oftc.net" | |
237 "type\\s-/msg\\s-NickServ\\s-IDENTIFY\\s-password." | |
238 "NickServ" | |
239 "IDENTIFY" nil nil) | |
240 (QuakeNet | |
241 nil nil | |
242 "Q@CServe.quakenet.org" | |
243 "auth" t nil) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
244 (SlashNET |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
245 "NickServ!services@services.slashnet.org" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
246 "/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
|
247 "NickServ@services.slashnet.org" |
76856 | 248 "IDENTIFY" nil nil)) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
249 "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
|
250 Every element in the list has the form |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
251 \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
252 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
253 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
|
254 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 identifying. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
260 ANSWER is the command to use for the answer. The default is 'privmsg. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
261 This last element is optional." |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
262 :group 'erc-services |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
263 :type '(repeat |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
264 (list :tag "Nickserv data" |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
265 (symbol :tag "Network name") |
76856 | 266 (choice (string :tag "Nickserv's nick!user@host") |
267 (const :tag "No message sent by Nickserv" nil)) | |
268 (choice (regexp :tag "Identify request sent by Nickserv") | |
269 (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
|
270 (string :tag "Identify to") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
271 (string :tag "Identify keyword") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
272 (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
|
273 (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
|
274 (string :tag "Command") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
275 (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
|
276 |
75259 | 277 (defsubst erc-nickserv-alist-sender (network &optional entry) |
278 (nth 1 (or entry (assoc network erc-nickserv-alist)))) | |
279 | |
280 (defsubst erc-nickserv-alist-regexp (network &optional entry) | |
281 (nth 2 (or entry (assoc network erc-nickserv-alist)))) | |
282 | |
283 (defsubst erc-nickserv-alist-nickserv (network &optional entry) | |
284 (nth 3 (or entry (assoc network erc-nickserv-alist)))) | |
285 | |
286 (defsubst erc-nickserv-alist-ident-keyword (network &optional entry) | |
287 (nth 4 (or entry (assoc network erc-nickserv-alist)))) | |
288 | |
289 (defsubst erc-nickserv-alist-use-nick-p (network &optional entry) | |
290 (nth 5 (or entry (assoc network erc-nickserv-alist)))) | |
291 | |
292 (defsubst erc-nickserv-alist-ident-command (network &optional entry) | |
293 (nth 6 (or entry (assoc network erc-nickserv-alist)))) | |
294 | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
295 ;; Functions: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
296 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
297 (defun erc-nickserv-identify-autodetect (proc parsed) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
298 "Check for a NickServ identify request everytime a notice is received. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
299 Make sure it is the real NickServ for this network and that it has |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
300 specifically asked the user to IDENTIFY. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
301 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
|
302 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
|
303 (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
|
304 (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
|
305 (let* ((network (erc-network)) |
75259 | 306 (sender (erc-nickserv-alist-sender network)) |
307 (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
|
308 (sspec (erc-response.sender parsed)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
309 (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
|
310 (msg (erc-response.contents parsed))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
311 ;; 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
|
312 ;; and it's asked us to identify |
75259 | 313 (when (and sender (equal sspec sender) |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
314 (string-match identify-regex msg)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
315 (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
|
316 (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
|
317 nil)))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
318 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
319 (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
|
320 "Identify to Nickserv after the connection to the server is established." |
75092 | 321 (unless (or (and (null erc-nickserv-passwords) |
322 (null erc-prompt-for-nickserv-password)) | |
323 (and (eq erc-nickserv-identify-mode 'both) | |
75259 | 324 (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
|
325 (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
|
326 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
327 (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
|
328 "Identify to Nickserv whenever your nick changes." |
75092 | 329 (unless (or (and (null erc-nickserv-passwords) |
330 (null erc-prompt-for-nickserv-password)) | |
331 (and (eq erc-nickserv-identify-mode 'both) | |
75259 | 332 (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
|
333 (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
|
334 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
335 (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
|
336 "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
|
337 password. |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
338 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
|
339 (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
|
340 (call-interactively 'erc-nickserv-identify) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
341 (when erc-nickserv-passwords |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
342 (erc-nickserv-identify |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
343 (cdr (assoc nickname |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
344 (nth 1 (assoc (erc-network) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
345 erc-nickserv-passwords)))))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
346 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
347 ;;;###autoload |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
348 (defun erc-nickserv-identify (password) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
349 "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
|
350 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
|
351 (interactive |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
352 (list (read-passwd |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
353 (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
|
354 (erc-current-nick) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
355 (or (and (erc-network) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
356 (symbol-name (erc-network))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
357 "Unknown network"))))) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
358 (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
|
359 (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
|
360 (network (erc-network)) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
361 (nickserv-info (assoc network erc-nickserv-alist)) |
75259 | 362 (nickserv (or (erc-nickserv-alist-nickserv nil nickserv-info) |
363 "NickServ")) | |
364 (identify-word (or (erc-nickserv-alist-ident-keyword | |
365 nil nickserv-info) | |
366 "IDENTIFY")) | |
367 (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
|
368 (concat (erc-current-nick) " ") |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
369 "")) |
75259 | 370 (msgtype (or (erc-nickserv-alist-ident-command nil nickserv-info) |
371 "PRIVMSG"))) | |
68719
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
372 (erc-message msgtype |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
373 (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
|
374 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
375 (provide 'erc-services) |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
376 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
377 ;;; erc-services.el ends here |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
378 ;; |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
379 ;; Local Variables: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
380 ;; indent-tabs-mode: t |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
381 ;; tab-width: 8 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
382 ;; End: |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
383 |
2de3fcf69715
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-55
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
384 ;; arch-tag: d401c8aa-d938-4255-96a9-3efb64c47e58 |