Commit 10dc9f9e authored by Miles Bader's avatar Miles Bader

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>
parent a0583738
...@@ -8,6 +8,20 @@ an alias of `erc'. Likewise, `erc-select-ssl' has been renamed to ...@@ -8,6 +8,20 @@ an alias of `erc'. Likewise, `erc-select-ssl' has been renamed to
`erc-ssl' with `erc-select-ssl' as its alias. The function that was `erc-ssl' with `erc-select-ssl' as its alias. The function that was
known as `erc' is now `erc-open'. known as `erc' is now `erc-open'.
** New command: /RECONNECT
This command tries to reconnect to the current IRC server exactly
once. It does not work in server buffers (throws an error before the
command is run), but works in query and channel buffers.
** New options
*** erc-server-reconnect-attempts: Determines the number of
reconnection attempts that ERC will make per server.
*** erc-server-reconnect-timeout: New option that determines the
amount of time, in seconds, that ERC will wait between successive
reconnect attempts.
** Changes and additions to modules ** Changes and additions to modules
*** Channel lists (erc-list.el) *** Channel lists (erc-list.el)
......
2006-12-28 Michael Olson <mwolson@gnu.org>
* erc-list.el: Change header to mention that this is part of ERC,
rather than GNU Emacs.
* erc-networks.el (erc-server-alist): Add Ars OpenIRC and
LinuxChix networks. Thanks to Angelina Carlton for mentioning
them. Properly escape periods in Konfido.Net and Kewl.Org.
(erc-networks-alist): Add entries for Ars and LinuxChix, though
the latter does not actually provide an announced network name.
* erc-services.el (erc-nickserv-identify-mode): Add 'both method,
which waits for a NickServ message if the network supports it,
otherwise sends the password after connecting.
(erc-nickserv-identify-mode): Default to 'both.
(erc-nickserv-passwords): Add OFTC and Azzurra to custom options.
(erc-nickserv-alist): Indentation fix.
(erc-nickserv-identify-on-connect)
(erc-nickserv-identify-on-nick-change): Handle 'both method.
2006-12-28 Leo <sdl.web@gmail.com> (tiny change)
* erc.el (erc-iswitchb): Wrap body in unwind-protect so that
hitting C-g does not leave iswitchb-mode on.
2006-12-27 Michael Olson <mwolson@gnu.org>
* erc.el (erc-cmd-RECONNECT): New command that calls
erc-server-reconnect.
* erc-backend.el (erc-server-reconnect-count): New server variable
that keeps track of reconnection attempts.
(erc-server-reconnect-attempts): New option that determines the
number of reconnection attempts that ERC will make per server.
(erc-server-reconnect-timeout): New option that determines the
amount of time, in seconds, that ERC will wait between successive
reconnect attempts.
(erc-server-reconnect): New function that reestablishes the
current IRC connection. Move some commands from
erc-process-sentinel-1 here.
(erc-process-sentinel-1): If we have been disconnected, loop until
we either reconnect or run out of attempts.
(erc-server-reconnect-p): Move higher and make this a defsubst,
since I'm worried about the current buffer changing from
underneath us. Implement limit of number of reconnect attempts..
* erc.texi (Getting Started): Update for /RECONNECT command.
2006-12-26 Michael Olson <mwolson@gnu.org>
* erc.el (erc-open): Restore old point correctly, or at least get
closer to doing so than before.
2006-12-13 Leo <sdl.web@gmail.com> (tiny change) 2006-12-13 Leo <sdl.web@gmail.com> (tiny change)
* erc.el (erc-iswitchb): Temporarily enable iswitchb mode if it * erc.el (erc-iswitchb): Temporarily enable iswitchb mode if it
...@@ -38,7 +91,7 @@ ...@@ -38,7 +91,7 @@
(erc-update-current-channel-member, erc-load-script): (erc-update-current-channel-member, erc-load-script):
(erc-mode-line-away-status-format): Doc fixes. (erc-mode-line-away-status-format): Doc fixes.
2006-11-20 Andrea Russo <rastandy@inventati.org> 2006-11-20 Andrea Russo <rastandy@inventati.org> (tiny change)
* erc-dcc.el (erc-dcc-chat-setup): Initialize `erc-input-marker' * erc-dcc.el (erc-dcc-chat-setup): Initialize `erc-input-marker'
before calling `erc-display-prompt'. before calling `erc-display-prompt'.
...@@ -111,7 +164,7 @@ ...@@ -111,7 +164,7 @@
`erc-show-my-nick' is non-nil. `erc-show-my-nick' is non-nil.
(erc-compute-server): Doc fix. (erc-compute-server): Doc fix.
2006-10-01 John J Foerch <jjfoerch@earthlink.net> 2006-10-01 John J Foerch <jjfoerch@earthlink.net> (tiny change)
* erc-stamp.el (erc-insert-timestamp-right): Exclude the newline * erc-stamp.el (erc-insert-timestamp-right): Exclude the newline
from the erc-timestamp field. from the erc-timestamp field.
...@@ -121,7 +174,7 @@ ...@@ -121,7 +174,7 @@
* erc-nicklist.el (erc-nicklist-insert-contents): Add missing * erc-nicklist.el (erc-nicklist-insert-contents): Add missing
parenthesis. Thanks to Stephan Stahl for the report. parenthesis. Thanks to Stephan Stahl for the report.
2006-09-10 Eric Hanchrow <offby1@blarg.net> 2006-09-10 Eric Hanchrow <offby1@blarg.net> (tiny change)
* erc.el (erc-cmd-IGNORE): Prompt user if this might be a regexp * erc.el (erc-cmd-IGNORE): Prompt user if this might be a regexp
instead of a single user. instead of a single user.
...@@ -230,6 +283,13 @@ ...@@ -230,6 +283,13 @@
* NEWS: Added note about these changes. * NEWS: Added note about these changes.
2006-08-20 Diane Murray <disumu@x3y2z1.net>
* erc-backend.el (erc-process-sentinel-1): Doc fix. Let
`erc-server-reconnect-p' check all condition cases.
(erc-server-reconnect-p): Moved rest of checks from
`erc-process-sentinel-1' to here. Now takes an argument, EVENT.
2006-08-21 Diane Murray <disumu@x3y2z1.net> 2006-08-21 Diane Murray <disumu@x3y2z1.net>
* erc-track.el (erc-track-mode-line-mouse-face): New variable. * erc-track.el (erc-track-mode-line-mouse-face): New variable.
...@@ -242,6 +302,18 @@ ...@@ -242,6 +302,18 @@
(erc-menu-definition): Name the menu "ERC" instead of "IRC" to (erc-menu-definition): Name the menu "ERC" instead of "IRC" to
avoid confusion with rcirc and other clients. avoid confusion with rcirc and other clients.
* erc-backend.el (erc-server-banned): New variable.
(erc-server-connect): Set `erc-server-banned' to nil.
(erc-process-sentinel-1): Use `erc-server-reconnect-p'.
(erc-server-reconnect-p): New function. Return non-nil if the
user wants automatic reconnects and if the user has not been
banned from the server. This should fix a bug where ERC gets into
a loop trying to reconnect with no way to stop it when the user is
denied access to the server due to a server ban. It might also
help when Tor users are blocked from freenode if freenode servers
send the 465 message before disconnecting.
(465): Handle "banned from server" error notices.
2006-08-13 Romain Francoise <romain@orebokech.com> 2006-08-13 Romain Francoise <romain@orebokech.com>
* erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p' * erc-match.el (erc-log-matches-make-buffer): End `y-or-n-p'
......
...@@ -179,10 +179,18 @@ WALLCHOPS - supports sending messages to all operators in a channel") ...@@ -179,10 +179,18 @@ WALLCHOPS - supports sending messages to all operators in a channel")
This variable is buffer-local.") This variable is buffer-local.")
(make-variable-buffer-local 'erc-server-connected) (make-variable-buffer-local 'erc-server-connected)
(defvar erc-server-reconnect-count 0
"Number of times we have failed to reconnect to the current server.")
(make-variable-buffer-local 'erc-server-reconnect-count)
(defvar erc-server-quitting nil (defvar erc-server-quitting nil
"Non-nil if the user requests a quit.") "Non-nil if the user requests a quit.")
(make-variable-buffer-local 'erc-server-quitting) (make-variable-buffer-local 'erc-server-quitting)
(defvar erc-server-banned nil
"Non-nil if the user is denied access because of a server ban.")
(make-variable-buffer-local 'erc-server-banned)
(defvar erc-server-lines-sent nil (defvar erc-server-lines-sent nil
"Line counter.") "Line counter.")
(make-variable-buffer-local 'erc-server-lines-sent) (make-variable-buffer-local 'erc-server-lines-sent)
...@@ -259,6 +267,23 @@ Reconnection will happen automatically for any unexpected disconnection." ...@@ -259,6 +267,23 @@ Reconnection will happen automatically for any unexpected disconnection."
:group 'erc-server :group 'erc-server
:type 'boolean) :type 'boolean)
(defcustom erc-server-reconnect-attempts 2
"The number of times that ERC will attempt to reestablish a
broken connection, or t to always attempt to reconnect.
This only has an effect if `erc-server-auto-reconnect' is non-nil."
:group 'erc-server
:type '(choice (const :tag "Always reconnect" t)
integer))
(defcustom erc-server-reconnect-timeout 1
"The amount of time, in seconds, that ERC will wait between
successive reconnect attempts.
If a key is pressed while ERC is waiting, it will stop waiting."
:group 'erc-server
:type 'number)
(defcustom erc-split-line-length 440 (defcustom erc-split-line-length 440
"*The maximum length of a single message. "*The maximum length of a single message.
If a message exceeds this size, it is broken into multiple ones. If a message exceeds this size, it is broken into multiple ones.
...@@ -434,6 +459,7 @@ We will store server variables in the current buffer." ...@@ -434,6 +459,7 @@ We will store server variables in the current buffer."
(message "%s...done" msg)) (message "%s...done" msg))
;; Misc server variables ;; Misc server variables
(setq erc-server-quitting nil) (setq erc-server-quitting nil)
(setq erc-server-banned nil)
(setq erc-server-last-sent-time (erc-current-time)) (setq erc-server-last-sent-time (erc-current-time))
(setq erc-server-last-ping-time (erc-current-time)) (setq erc-server-last-ping-time (erc-current-time))
(setq erc-server-lines-sent 0) (setq erc-server-lines-sent 0)
...@@ -457,6 +483,21 @@ We will store server variables in the current buffer." ...@@ -457,6 +483,21 @@ We will store server variables in the current buffer."
"Opening connection..\n") "Opening connection..\n")
(erc-login))) (erc-login)))
(defun erc-server-reconnect ()
"Reestablish the current IRC connection.
Make sure you are in an ERC buffer when running this."
(let ((server (erc-server-buffer)))
(unless (and server
(buffer-live-p server))
(error "Couldn't switch to server buffer"))
(with-current-buffer server
(erc-update-mode-line)
(erc-set-active-buffer (current-buffer))
(setq erc-server-last-sent-time 0)
(setq erc-server-lines-sent 0)
(erc-open erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password))))
(defun erc-server-filter-function (process string) (defun erc-server-filter-function (process string)
"The process filter for the ERC server." "The process filter for the ERC server."
(with-current-buffer (process-buffer process) (with-current-buffer (process-buffer process)
...@@ -485,11 +526,24 @@ We will store server variables in the current buffer." ...@@ -485,11 +526,24 @@ We will store server variables in the current buffer."
(match-end 0)))) (match-end 0))))
(erc-parse-server-response process line))))))) (erc-parse-server-response process line)))))))
(defsubst erc-server-reconnect-p (event)
"Return non-nil if ERC should attempt to reconnect automatically.
EVENT is the message received from the closed connection process."
(and erc-server-auto-reconnect
(not erc-server-banned)
;; make sure we don't infinitely try to reconnect, unless the
;; user wants that
(or (eq erc-server-reconnect-attempts t)
(and (integerp erc-server-reconnect-attempts)
(< erc-server-reconnect-count erc-server-reconnect-attempts)))
(not (string-match "^deleted" event))
;; open-network-stream-nowait error for connection refused
(not (string-match "^failed with code 111" event))))
(defun erc-process-sentinel-1 (event) (defun erc-process-sentinel-1 (event)
"This will be called when erc-process-sentinel has decided that we "Called when `erc-process-sentinel' has decided that we're disconnecting.
are going to quit. Determine whether user has quit or whether erc has Determine whether user has quit or whether erc has been terminated.
been terminated. Conditionally try to reconnect and take appropriate Conditionally try to reconnect and take appropriate action."
action."
(if erc-server-quitting (if erc-server-quitting
;; normal quit ;; normal quit
(progn (progn
...@@ -498,25 +552,26 @@ action." ...@@ -498,25 +552,26 @@ action."
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(kill-buffer (current-buffer)))) (kill-buffer (current-buffer))))
;; unexpected disconnect ;; unexpected disconnect
(erc-display-message nil 'error (current-buffer) (let ((again t))
(if erc-server-auto-reconnect (while again
'disconnected (setq again nil)
'disconnected-noreconnect)) (erc-display-message nil 'error (current-buffer)
(erc-update-mode-line) (if (erc-server-reconnect-p event)
(erc-set-active-buffer (current-buffer)) 'disconnected
(setq erc-server-last-sent-time 0) 'disconnected-noreconnect))
(setq erc-server-lines-sent 0) (if (erc-server-reconnect-p event)
(if (and erc-server-auto-reconnect (condition-case err
(not (string-match "^deleted" event)) (progn
;; open-network-stream-nowait error for connection refused (erc-server-reconnect)
(not (string-match "^failed with code 111" event))) (setq erc-server-reconnect-count 0))
;; Yuck, this should perhaps funcall (error (when (integerp erc-server-reconnect-attempts)
;; erc-server-reconnect-function with no args (setq erc-server-reconnect-count
(erc-open erc-session-server erc-session-port erc-server-current-nick (1+ erc-server-reconnect-count))
erc-session-user-full-name t erc-session-password) (sit-for erc-server-reconnect-timeout)
;; terminate, do not reconnect (setq again t))))
(erc-display-message nil 'error (current-buffer) ;; terminate, do not reconnect
'terminated ?e event)))) (erc-display-message nil 'error (current-buffer)
'terminated ?e event))))))
(defun erc-process-sentinel (cproc event) (defun erc-process-sentinel (cproc event)
"Sentinel function for ERC process." "Sentinel function for ERC process."
...@@ -1708,6 +1763,14 @@ See `erc-display-server-message'." nil ...@@ -1708,6 +1763,14 @@ See `erc-display-server-message'." nil
?c (second (erc-response.command-args parsed)) ?c (second (erc-response.command-args parsed))
?m (erc-response.contents parsed))) ?m (erc-response.contents parsed)))
(define-erc-response-handler (465)
"You are banned from this server." nil
(setq erc-server-banned t)
;; show the server's message, as a reason might be provided
(erc-display-error-notice
parsed
(erc-response.contents parsed)))
(define-erc-response-handler (474) (define-erc-response-handler (474)
"Banned from channel errors" nil "Banned from channel errors" nil
(erc-display-message parsed '(notice error) nil (erc-display-message parsed '(notice error) nil
...@@ -1741,7 +1804,7 @@ See `erc-display-server-message'." nil ...@@ -1741,7 +1804,7 @@ See `erc-display-server-message'." nil
(erc-display-message parsed '(error notice) 'active 's482 (erc-display-message parsed '(error notice) 'active 's482
?c channel ?m message))) ?c channel ?m message)))
(define-erc-response-handler (431 445 446 451 462 463 464 465 481 483 484 485 (define-erc-response-handler (431 445 446 451 462 463 464 481 483 484 485
491 501 502) 491 501 502)
;; 431 - No nickname given ;; 431 - No nickname given
;; 445 - SUMMON has been disabled ;; 445 - SUMMON has been disabled
...@@ -1750,7 +1813,6 @@ See `erc-display-server-message'." nil ...@@ -1750,7 +1813,6 @@ See `erc-display-server-message'." nil
;; 462 - Unauthorized command (already registered) ;; 462 - Unauthorized command (already registered)
;; 463 - Your host isn't among the privileged ;; 463 - Your host isn't among the privileged
;; 464 - Password incorrect ;; 464 - Password incorrect
;; 465 - You are banned from this server
;; 481 - Need IRCop privileges ;; 481 - Need IRCop privileges
;; 483 - You can't kill a server! ;; 483 - You can't kill a server!
;; 484 - Your connection is restricted! ;; 484 - Your connection is restricted!
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000))) ("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000)))
("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 )) ("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 ))
("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667))) ("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667)))
("Ars-OpenIRC: Random server" Ars "irc.arstechnica.com" 6667)
("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 )) ("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 ))
("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667))) ("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667)))
("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 7777 )) ("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 7777 ))
...@@ -280,12 +281,12 @@ ...@@ -280,12 +281,12 @@
("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669))) ("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669)))
("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669))) ("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669)))
("Kemik: Random server" Kemik "irc.kemik.net" 6667) ("Kemik: Random server" Kemik "irc.kemik.net" 6667)
("Kewl.Org: Random server" Kewl.Org "irc.kewl.org" (6667 7000 )) ("Kewl.Org: Random server" Kewl\.Org "irc.kewl.org" (6667 7000 ))
("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 )) ("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 ))
("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669))) ("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669)))
("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 )) ("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 ))
("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" (6667 5555 )) ("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" (6667 5555 ))
("Konfido.Net: Random server" Konfido.Net "irc.konfido.net" 6667) ("Konfido.Net: Random server" Konfido\.Net "irc.konfido.net" 6667)
("KreyNet: Random server" Kreynet "irc.krey.net" 6667) ("KreyNet: Random server" Kreynet "irc.krey.net" 6667)
("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 )) ("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 ))
("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667) ("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667)
...@@ -294,6 +295,7 @@ ...@@ -294,6 +295,7 @@
("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667) ("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667)
("Librenet: Random server" Librenet "irc.librenet.net" 6667) ("Librenet: Random server" Librenet "irc.librenet.net" 6667)
("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669))) ("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669)))
("LinuxChix: Random server" LinuxChix "irc.linuxchix.org" 6667)
("Liquidized: Random server" Liquidized "irc.liquidized.net" (6667 7000 )) ("Liquidized: Random server" Liquidized "irc.liquidized.net" (6667 7000 ))
("M-IRC: Random server" M-IRC "irc.m-sys.org" ((6667 6669))) ("M-IRC: Random server" M-IRC "irc.m-sys.org" ((6667 6669)))
("MagicStar: Random server" MagicStar "irc.magicstar.net" 6667) ("MagicStar: Random server" MagicStar "irc.magicstar.net" 6667)
...@@ -457,6 +459,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges." ...@@ -457,6 +459,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges."
(AngelEyez "angeleyez.net") (AngelEyez "angeleyez.net")
(Anothernet "another.net") (Anothernet "another.net")
(ArabChat "arabchat.org") (ArabChat "arabchat.org")
(Ars "arstechnica.com")
(AsiaTalk "asiatalk.org") (AsiaTalk "asiatalk.org")
(AstroLink "astrolink.org") (AstroLink "astrolink.org")
(Asylumnet "asylumnet.org") (Asylumnet "asylumnet.org")
...@@ -586,6 +589,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges." ...@@ -586,6 +589,7 @@ PORTS is either a number, a list of numbers, or a list of port ranges."
(LagNet "lagnet.org.za") (LagNet "lagnet.org.za")
(Librenet "librenet.net") (Librenet "librenet.net")
(LinkNet "link-net.org") (LinkNet "link-net.org")
(LinuxChix "cats\.meow\.at\\|linuxchix\.org")
(Liquidized "liquidized.net") (Liquidized "liquidized.net")
(M-IRC "m-sys.org") (M-IRC "m-sys.org")
(MagicStar "magicstar.net") (MagicStar "magicstar.net")
......
...@@ -94,7 +94,7 @@ communication with those Services." ...@@ -94,7 +94,7 @@ communication with those Services."
(interactive (interactive
(list (intern (completing-read (list (intern (completing-read
"Choose Nickserv identify mode (RET to disable): " "Choose Nickserv identify mode (RET to disable): "
'(("autodetect") ("nick-change")) nil t)))) '(("autodetect") ("nick-change") ("both")) nil t))))
(cond ((eq mode 'autodetect) (cond ((eq mode 'autodetect)
(setq erc-nickserv-identify-mode 'autodetect) (setq erc-nickserv-identify-mode 'autodetect)
(add-hook 'erc-server-NOTICE-functions (add-hook 'erc-server-NOTICE-functions
...@@ -111,6 +111,14 @@ communication with those Services." ...@@ -111,6 +111,14 @@ communication with those Services."
'erc-nickserv-identify-on-nick-change) 'erc-nickserv-identify-on-nick-change)
(remove-hook 'erc-server-NOTICE-functions (remove-hook 'erc-server-NOTICE-functions
'erc-nickserv-identify-autodetect)) 'erc-nickserv-identify-autodetect))
((eq mode 'both)
(setq erc-nickserv-identify-mode 'both)
(add-hook 'erc-server-NOTICE-functions
'erc-nickserv-identify-autodetect)
(add-hook 'erc-after-connect
'erc-nickserv-identify-on-connect)
(add-hook 'erc-nick-changed-functions
'erc-nickserv-identify-on-nick-change))
(t (t
(setq erc-nickserv-identify-mode nil) (setq erc-nickserv-identify-mode nil)
(remove-hook 'erc-server-NOTICE-functions (remove-hook 'erc-server-NOTICE-functions
...@@ -120,22 +128,25 @@ communication with those Services." ...@@ -120,22 +128,25 @@ communication with those Services."
(remove-hook 'erc-nick-changed-functions (remove-hook 'erc-nick-changed-functions
'erc-nickserv-identify-on-nick-change)))) 'erc-nickserv-identify-on-nick-change))))
(defcustom erc-nickserv-identify-mode 'autodetect (defcustom erc-nickserv-identify-mode 'both
"The mode which is used when identifying to Nickserv. "The mode which is used when identifying to Nickserv.
Possible settings are:. Possible settings are:.
'autodetect - Identify when the real Nickserv sends an identify request. 'autodetect - Identify when the real Nickserv sends an identify request.
'nick-change - Identify when you change your nickname. 'nick-change - Identify when you change your nickname.
'both - Do the former if the network supports it, otherwise do the
latter.
nil - Disables automatic Nickserv identification. nil - Disables automatic Nickserv identification.
You can also use M-x erc-nickserv-identify-mode to change modes." You can also use M-x erc-nickserv-identify-mode to change modes."
:group 'erc-services :group 'erc-services
:type '(choice (const autodetect) :type '(choice (const autodetect)
(const nick-change) (const nick-change)
(const both)
(const nil)) (const nil))
:set (lambda (sym val) :set (lambda (sym val)
(set-default sym val) (set sym val)
(erc-nickserv-identify-mode val))) (erc-nickserv-identify-mode val)))
(defcustom erc-prompt-for-nickserv-password t (defcustom erc-prompt-for-nickserv-password t
...@@ -156,12 +167,14 @@ Example of use: ...@@ -156,12 +167,14 @@ Example of use:
(list :tag "Network" (list :tag "Network"
(choice :tag "Network name" (choice :tag "Network name"
(const freenode) (const freenode)
(const OFTC)
(const DALnet) (const DALnet)
(const GalaxyNet) (const GalaxyNet)
(const SlashNET) (const SlashNET)
(const BRASnet) (const BRASnet)
(const iip) (const iip)
(const Austnet) (const Austnet)
(const Azzurra)
(symbol :tag "Network name")) (symbol :tag "Network name"))
(repeat :tag "Nickname and password" (repeat :tag "Nickname and password"
(cons :tag "Identity" (cons :tag "Identity"
...@@ -209,24 +222,24 @@ Example of use: ...@@ -209,24 +222,24 @@ Example of use:
"IDENTIFY" "IDENTIFY"
nil nil
"") "")
(Austnet (Austnet
"NickOP!service@austnet.org" "NickOP!service@austnet.org"
"/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>" "/msg\\s-NickOP@austnet.org\\s-identify\\s-<password>"
"nickop@austnet.org" "nickop@austnet.org"
"identify" "identify"
nil) nil)
(Azzurra (Azzurra
"NickServ!service@azzurra.org" "NickServ!service@azzurra.org"
"/ns\\s-IDENTIFY\\s-password" "/ns\\s-IDENTIFY\\s-password"
"NickServ" "NickServ"
"IDENTIFY" "IDENTIFY"
nil) nil)
(OFTC (OFTC
"NickServ!services@services.oftc.net" "NickServ!services@services.oftc.net"
"/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password" "/msg\\s-NickServ\\s-IDENTIFY\\s-\^_password"
"NickServ" "NickServ"
"IDENTIFY" "IDENTIFY"
nil)) nil))
"Alist of NickServer details, sorted by network. "Alist of NickServer details, sorted by network.
Every element in the list has the form Every element in the list has the form
\(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER) \(SYMBOL NICKSERV REGEXP NICK KEYWORD USE-CURRENT ANSWER)
...@@ -279,14 +292,18 @@ password for this nickname, otherwise try to send it automatically." ...@@ -279,14 +292,18 @@ password for this nickname, otherwise try to send it automatically."
(defun erc-nickserv-identify-on-connect (server nick) (defun erc-nickserv-identify-on-connect (server nick)
"Identify to Nickserv after the connection to the server is established." "Identify to Nickserv after the connection to the server is established."
(unless (and (null erc-nickserv-passwords) (unless (or (and (null erc-nickserv-passwords)
(null erc-prompt-for-nickserv-password)) (null erc-prompt-for-nickserv-password))
(and (eq erc-nickserv-identify-mode 'both)
(nth 2 (assoc (erc-network) erc-nickserv-alist))))
(erc-nickserv-call-identify-function nick))) (erc-nickserv-call-identify-function nick)))
(defun erc-nickserv-identify-on-nick-change (nick old-nick) (defun erc-nickserv-identify-on-nick-change (nick old-nick)
"Identify to Nickserv whenever your nick changes." "Identify to Nickserv whenever your nick changes."
(unless (and (null erc-nickserv-passwords) (unless (or (and (null erc-nickserv-passwords)
(null erc-prompt-for-nickserv-password)) (null erc-prompt-for-nickserv-password))
(and (eq erc-nickserv-identify-mode 'both)
(nth 2 (assoc (erc-network) erc-nickserv-alist))))
(erc-nickserv-call-identify-function nick))) (erc-nickserv-call-identify-function nick)))
(defun erc-nickserv-call-identify-function (nickname) (defun erc-nickserv-call-identify-function (nickname)
......
...@@ -1672,21 +1672,22 @@ needs to be active for this function to work." ...@@ -1672,21 +1672,22 @@ needs to be active for this function to work."
(require 'iswitchb)) (require 'iswitchb))
(let ((enabled iswitchb-mode)) (let ((enabled iswitchb-mode))
(or enabled (iswitchb-mode 1)) (or enabled (iswitchb-mode 1))
(let ((iswitchb-make-buflist-hook (unwind-protect
(lambda () (let ((iswitchb-make-buflist-hook
(setq iswitchb-temp-buflist (lambda ()
(mapcar 'buffer-name (setq iswitchb-temp-buflist
(erc-buffer-list (mapcar 'buffer-name
nil (erc-buffer-list
(when arg erc-server-process))))))) nil
(switch-to-buffer (when arg erc-server-process)))))))
(iswitchb-read-buffer (switch-to-buffer