Function: rcirc-handler-NICK
rcirc-handler-NICK is a byte-compiled function defined in rcirc.el.gz.
Signature
(rcirc-handler-NICK PROCESS SENDER ARGS TEXT)
Documentation
Handle NICK message from SENDER.
ARGS should have the form (NEW-NICK). PROCESS is the process object for the current connection.
Source Code
;; Defined in /usr/src/emacs/lisp/net/rcirc.el.gz
(defun rcirc-handler-NICK (process sender args _text)
"Handle NICK message from SENDER.
ARGS should have the form (NEW-NICK).
PROCESS is the process object for the current connection."
(let* ((old-nick sender)
(new-nick (car args))
(channels (rcirc-nick-channels process old-nick)))
;; update list of ignored nicks
(rcirc-ignore-update-automatic old-nick)
(when (member old-nick rcirc-ignore-list)
(add-to-list 'rcirc-ignore-list new-nick)
(add-to-list 'rcirc-ignore-list-automatic new-nick))
;; print message to nick's channels
(dolist (target channels)
(rcirc-print process sender "NICK" target new-nick))
;; update chat buffer, if it exists
(when-let ((chat-buffer (rcirc-get-buffer process old-nick)))
(with-current-buffer chat-buffer
(rcirc-print process sender "NICK" old-nick new-nick)
(setq rcirc-target new-nick)
(rename-buffer (rcirc-generate-new-buffer-name process new-nick)))
(setf rcirc-buffer-alist
(cons (cons new-nick chat-buffer)
(delq (assoc-string old-nick rcirc-buffer-alist t)
rcirc-buffer-alist))))
;; remove old nick and add new one
(with-rcirc-process-buffer process
(let ((v (gethash old-nick rcirc-nick-table)))
(remhash old-nick rcirc-nick-table)
(puthash new-nick v rcirc-nick-table))
;; if this is our nick...
(when (string= old-nick rcirc-nick)
(setq rcirc-nick new-nick)
(rcirc-update-prompt t)
;; reauthenticate
(when rcirc-auto-authenticate-flag (rcirc-authenticate))))))