comparison lisp/erc/erc-services.el @ 75092:e566d4fc8dd2

Update from erc--emacs--22 Highlights: - New /RECONNECT command. - Improve default method for auto-identify to nickserv. - Fix another erc-iswitchb bug. - Fix reconnect lockup (defaulting to twice before giving up). - Fix reconnect on ban. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-587 Creator: Michael Olson <mwolson@gnu.org>
author Miles Bader <miles@gnu.org>
date Fri, 05 Jan 2007 02:09:07 +0000
parents 7010bb070445
children f45c5edf0be4
comparison
equal deleted inserted replaced
75091:2036fbeca1f2 75092:e566d4fc8dd2
92 (defun erc-nickserv-identify-mode (mode) 92 (defun erc-nickserv-identify-mode (mode)
93 "Set up hooks according to which MODE the user has chosen." 93 "Set up hooks according to which MODE the user has chosen."
94 (interactive 94 (interactive
95 (list (intern (completing-read 95 (list (intern (completing-read
96 "Choose Nickserv identify mode (RET to disable): " 96 "Choose Nickserv identify mode (RET to disable): "
97 '(("autodetect") ("nick-change")) nil t)))) 97 '(("autodetect") ("nick-change") ("both")) nil t))))
98 (cond ((eq mode 'autodetect) 98 (cond ((eq mode 'autodetect)
99 (setq erc-nickserv-identify-mode 'autodetect) 99 (setq erc-nickserv-identify-mode 'autodetect)
100 (add-hook 'erc-server-NOTICE-functions 100 (add-hook 'erc-server-NOTICE-functions
101 'erc-nickserv-identify-autodetect) 101 'erc-nickserv-identify-autodetect)
102 (remove-hook 'erc-nick-changed-functions 102 (remove-hook 'erc-nick-changed-functions
109 'erc-nickserv-identify-on-connect) 109 'erc-nickserv-identify-on-connect)
110 (add-hook 'erc-nick-changed-functions 110 (add-hook 'erc-nick-changed-functions
111 'erc-nickserv-identify-on-nick-change) 111 'erc-nickserv-identify-on-nick-change)
112 (remove-hook 'erc-server-NOTICE-functions 112 (remove-hook 'erc-server-NOTICE-functions
113 'erc-nickserv-identify-autodetect)) 113 'erc-nickserv-identify-autodetect))
114 ((eq mode 'both)
115 (setq erc-nickserv-identify-mode 'both)
116 (add-hook 'erc-server-NOTICE-functions
117 'erc-nickserv-identify-autodetect)
118 (add-hook 'erc-after-connect
119 'erc-nickserv-identify-on-connect)
120 (add-hook 'erc-nick-changed-functions
121 'erc-nickserv-identify-on-nick-change))
114 (t 122 (t
115 (setq erc-nickserv-identify-mode nil) 123 (setq erc-nickserv-identify-mode nil)
116 (remove-hook 'erc-server-NOTICE-functions 124 (remove-hook 'erc-server-NOTICE-functions
117 'erc-nickserv-identify-autodetect) 125 'erc-nickserv-identify-autodetect)
118 (remove-hook 'erc-after-connect 126 (remove-hook 'erc-after-connect
119 'erc-nickserv-identify-on-connect) 127 'erc-nickserv-identify-on-connect)
120 (remove-hook 'erc-nick-changed-functions 128 (remove-hook 'erc-nick-changed-functions
121 'erc-nickserv-identify-on-nick-change)))) 129 'erc-nickserv-identify-on-nick-change))))
122 130
123 (defcustom erc-nickserv-identify-mode 'autodetect 131 (defcustom erc-nickserv-identify-mode 'both
124 "The mode which is used when identifying to Nickserv. 132 "The mode which is used when identifying to Nickserv.
125 133
126 Possible settings are:. 134 Possible settings are:.
127 135
128 'autodetect - Identify when the real Nickserv sends an identify request. 136 'autodetect - Identify when the real Nickserv sends an identify request.
129 'nick-change - Identify when you change your nickname. 137 'nick-change - Identify when you change your nickname.
138 'both - Do the former if the network supports it, otherwise do the
139 latter.
130 nil - Disables automatic Nickserv identification. 140 nil - Disables automatic Nickserv identification.
131 141
132 You can also use M-x erc-nickserv-identify-mode to change modes." 142 You can also use M-x erc-nickserv-identify-mode to change modes."
133 :group 'erc-services 143 :group 'erc-services
134 :type '(choice (const autodetect) 144 :type '(choice (const autodetect)
135 (const nick-change) 145 (const nick-change)
146 (const both)
136 (const nil)) 147 (const nil))
137 :set (lambda (sym val) 148 :set (lambda (sym val)
138 (set-default sym val) 149 (set sym val)
139 (erc-nickserv-identify-mode val))) 150 (erc-nickserv-identify-mode val)))
140 151
141 (defcustom erc-prompt-for-nickserv-password t 152 (defcustom erc-prompt-for-nickserv-password t
142 "Ask for the password when identifying to NickServ." 153 "Ask for the password when identifying to NickServ."
143 :group 'erc-services 154 :group 'erc-services
154 :group 'erc-services 165 :group 'erc-services
155 :type '(repeat 166 :type '(repeat
156 (list :tag "Network" 167 (list :tag "Network"
157 (choice :tag "Network name" 168 (choice :tag "Network name"
158 (const freenode) 169 (const freenode)
170 (const OFTC)
159 (const DALnet) 171 (const DALnet)
160 (const GalaxyNet) 172 (const GalaxyNet)
161 (const SlashNET) 173 (const SlashNET)
162 (const BRASnet) 174 (const BRASnet)
163 (const iip) 175 (const iip)
164 (const Austnet) 176 (const Austnet)
177 (const Azzurra)
165 (symbol :tag "Network name")) 178 (symbol :tag "Network name"))
166 (repeat :tag "Nickname and password" 179 (repeat :tag "Nickname and password"
167 (cons :tag "Identity" 180 (cons :tag "Identity"
168 (string :tag "Nick") 181 (string :tag "Nick")
169 (string :tag "Password")))))) 182 (string :tag "Password"))))))
207 "/NickServ\\s-IDENTIFY\\s-senha" 220 "/NickServ\\s-IDENTIFY\\s-senha"
208 "NickServ" 221 "NickServ"
209 "IDENTIFY" 222 "IDENTIFY"
210 nil 223 nil
211 "") 224 "")
212 (Austnet 225 (Austnet
213 "NickOP!service@austnet.org" 226 "NickOP!service@austnet.org"
214 "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>" 227 "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
215 "nickop@austnet.org" 228 "nickop@austnet.org"
216 "identify" 229 "identify"
217 nil) 230 nil)
218 (Azzurra 231 (Azzurra
219 "NickServ!service@azzurra.org" 232 "NickServ!service@azzurra.org"
220 "/ns\\s-IDENTIFY\\s-password" 233 "/ns\\s-IDENTIFY\\s-password"
221 "NickServ" 234 "NickServ"
222 "IDENTIFY" 235 "IDENTIFY"
223 nil) 236 nil)
224 (OFTC 237 (OFTC
225 "NickServ!services@services.oftc.net" 238 "NickServ!services@services.oftc.net"
226 "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password" 239 "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
227 "NickServ" 240 "NickServ"
228 "IDENTIFY" 241 "IDENTIFY"
229 nil)) 242 nil))
230 "Alist of NickServer details, sorted by network. 243 "Alist of NickServer details, sorted by network.
231 Every element in the list has the form 244 Every element in the list has the form
232 \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER) 245 \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER)
233 246
234 SYMBOL is a network identifier, a symbol, as used in `erc-networks-alist'. 247 SYMBOL is a network identifier, a symbol, as used in `erc-networks-alist'.
277 (erc-nickserv-call-identify-function nick) 290 (erc-nickserv-call-identify-function nick)
278 nil)))) 291 nil))))
279 292
280 (defun erc-nickserv-identify-on-connect (server nick) 293 (defun erc-nickserv-identify-on-connect (server nick)
281 "Identify to Nickserv after the connection to the server is established." 294 "Identify to Nickserv after the connection to the server is established."
282 (unless (and (null erc-nickserv-passwords) 295 (unless (or (and (null erc-nickserv-passwords)
283 (null erc-prompt-for-nickserv-password)) 296 (null erc-prompt-for-nickserv-password))
297 (and (eq erc-nickserv-identify-mode 'both)
298 (nth 2 (assoc (erc-network) erc-nickserv-alist))))
284 (erc-nickserv-call-identify-function nick))) 299 (erc-nickserv-call-identify-function nick)))
285 300
286 (defun erc-nickserv-identify-on-nick-change (nick old-nick) 301 (defun erc-nickserv-identify-on-nick-change (nick old-nick)
287 "Identify to Nickserv whenever your nick changes." 302 "Identify to Nickserv whenever your nick changes."
288 (unless (and (null erc-nickserv-passwords) 303 (unless (or (and (null erc-nickserv-passwords)
289 (null erc-prompt-for-nickserv-password)) 304 (null erc-prompt-for-nickserv-password))
305 (and (eq erc-nickserv-identify-mode 'both)
306 (nth 2 (assoc (erc-network) erc-nickserv-alist))))
290 (erc-nickserv-call-identify-function nick))) 307 (erc-nickserv-call-identify-function nick)))
291 308
292 (defun erc-nickserv-call-identify-function (nickname) 309 (defun erc-nickserv-call-identify-function (nickname)
293 "Call `erc-nickserv-identify' interactively or run it with NICKNAME's 310 "Call `erc-nickserv-identify' interactively or run it with NICKNAME's
294 password. 311 password.