Function: erc--create-current-channel-member
erc--create-current-channel-member is a byte-compiled function defined
in erc.el.gz.
Signature
(erc--create-current-channel-member NICK STATUS TIMEP &optional NEW-NICK HOST LOGIN FULL-NAME INFO)
Documentation
Add an erc-channel-member entry for NICK.
Create a new erc-server-users entry if necessary, and ensure
erc-channel-members-changed-hook runs exactly once, regardless.
Pass STATUS to the erc-channel-user constructor. With TIMEP,
assume NICK has just spoken, and initialize last-message-time.
Pass NEW-NICK, HOST, LOGIN, FULL-NAME, and INFO to
erc-update-user if a server user exists and otherwise to the
erc-server-user constructor.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc--create-current-channel-member
(nick status timep &optional new-nick host login full-name info)
"Add an `erc-channel-member' entry for NICK.
Create a new `erc-server-users' entry if necessary, and ensure
`erc-channel-members-changed-hook' runs exactly once, regardless.
Pass STATUS to the `erc-channel-user' constructor. With TIMEP,
assume NICK has just spoken, and initialize `last-message-time'.
Pass NEW-NICK, HOST, LOGIN, FULL-NAME, and INFO to
`erc-update-user' if a server user exists and otherwise to the
`erc-server-user' constructor."
(cl-assert (null (erc-get-channel-member nick)))
(let* ((user-changed-p nil)
(down (erc-downcase nick))
(user (gethash down (erc-with-server-buffer erc-server-users))))
(if user
(progn
(cl-pushnew (current-buffer) (erc-server-user-buffers user))
;; Update *after* ^ so hook has chance to run.
(setf user-changed-p (erc-update-user user new-nick host login
full-name info)))
(erc-add-server-user nick
(setq user (make-erc-server-user
:nickname (or new-nick nick)
:host host
:full-name full-name
:login login
:info nil
:buffers (list (current-buffer))))))
(let ((cusr (erc-channel-user--make
:status (or status 0)
:last-message-time (and timep
(erc-compat--current-lisp-time)))))
(puthash down (cons user cusr) erc-channel-users))
;; An existing `cusr' was changed or a new one was added, and
;; `user' was not updated, though possibly just created (since
;; `erc-update-user' runs this same hook in all a user's buffers).
(unless user-changed-p
(run-hooks 'erc-channel-members-changed-hook))
t))