Function: erc-update-current-channel-member

erc-update-current-channel-member is a byte-compiled function defined in erc.el.gz.

Signature

(erc-update-current-channel-member NICK NEW-NICK &optional ADD VOICE HALFOP OP ADMIN OWNER HOST LOGIN FULL-NAME INFO UPDATE-MESSAGE-TIME)

Documentation

Update the stored user information for the user with nickname NICK.

erc-update-user is called to handle changes to nickname, HOST, LOGIN, FULL-NAME, and INFO. If VOICE HALFOP OP ADMIN or OWNER are non-nil, they must be equal to either on or off, in which case the status of the user in the current channel is changed accordingly. If UPDATE-MESSAGE-TIME is non-nil, the last-message-time of the user
 in the current channel is set to (current-time).

If ADD is non-nil, the user will be added with the specified information if it is not already present in the user or channel lists.

If, and only if, changes are made, or the user is added, erc-channel-members-changed-hook is run, and t is returned.

See also: erc-update-user and erc-update-channel-member.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-update-current-channel-member
  (nick new-nick &optional add voice halfop op admin owner host login full-name info
        update-message-time)
  "Update the stored user information for the user with nickname NICK.
`erc-update-user' is called to handle changes to nickname,
HOST, LOGIN, FULL-NAME, and INFO.  If VOICE HALFOP OP ADMIN or OWNER
are non-nil, they must be equal to either `on' or `off', in which
case the status of the user in the current channel is changed accordingly.
If UPDATE-MESSAGE-TIME is non-nil, the last-message-time of the user
 in the current channel is set to (current-time).

If ADD is non-nil, the user will be added with the specified
information if it is not already present in the user or channel
lists.

If, and only if, changes are made, or the user is added,
`erc-channel-members-changed-hook' is run, and t is returned.

See also: `erc-update-user' and `erc-update-channel-member'."
  (let* (changed user-changed
                 (channel-data (erc-get-channel-user nick))
                 (cuser (cdr channel-data))
                 (user (if channel-data (car channel-data)
                         (erc-get-server-user nick))))
    (if cuser
        (progn
          (erc-log (format "update-member: user = %S, cuser = %S" user cuser))
          (when (and voice
                     (not (eq (erc-channel-user-voice cuser) voice)))
            (setq changed t)
            (setf (erc-channel-user-voice cuser)
                  (cond ((eq voice 'on) t)
                        ((eq voice 'off) nil)
                        (t voice))))
          (when (and halfop
                     (not (eq (erc-channel-user-halfop cuser) halfop)))
            (setq changed t)
            (setf (erc-channel-user-halfop cuser)
                  (cond ((eq halfop 'on) t)
                        ((eq halfop 'off) nil)
                        (t halfop))))
          (when (and op
                     (not (eq (erc-channel-user-op cuser) op)))
            (setq changed t)
            (setf (erc-channel-user-op cuser)
                  (cond ((eq op 'on) t)
                        ((eq op 'off) nil)
                        (t op))))
          (when (and admin
                     (not (eq (erc-channel-user-admin cuser) admin)))
            (setq changed t)
            (setf (erc-channel-user-admin cuser)
                  (cond ((eq admin 'on) t)
                        ((eq admin 'off) nil)
                        (t admin))))
          (when (and owner
                     (not (eq (erc-channel-user-owner cuser) owner)))
            (setq changed t)
            (setf (erc-channel-user-owner cuser)
                  (cond ((eq owner 'on) t)
                        ((eq owner 'off) nil)
                        (t owner))))
          (when update-message-time
            (setf (erc-channel-user-last-message-time cuser) (current-time)))
          (setq user-changed
                (erc-update-user user new-nick
                                 host login full-name info)))
      (when add
        (if (null user)
            (progn
              (setq user (make-erc-server-user
                          :nickname nick
                          :host host
                          :full-name full-name
                          :login login
                          :info info
                          :buffers (list (current-buffer))))
              (erc-add-server-user nick user))
          (setf (erc-server-user-buffers user)
                (cons (current-buffer)
                      (erc-server-user-buffers user))))
        (setq cuser (make-erc-channel-user
                     :voice (cond ((eq voice 'on) t)
                                  ((eq voice 'off) nil)
                                  (t voice))
                     :halfop (cond ((eq halfop 'on) t)
                                ((eq halfop 'off) nil)
                                (t halfop))
                     :op (cond ((eq op 'on) t)
                               ((eq op 'off) nil)
                               (t op))
                     :admin (cond ((eq admin 'on) t)
                                  ((eq admin 'off) nil)
                                  (t admin))
                     :owner (cond ((eq owner 'on) t)
                                  ((eq owner 'off) nil)
                                  (t owner))
                     :last-message-time
                     (if update-message-time (current-time))))
        (puthash (erc-downcase nick) (cons user cuser)
                 erc-channel-users)
        (setq changed t)))
    (when (and changed (null user-changed))
      (run-hooks 'erc-channel-members-changed-hook))
    (or changed user-changed add)))