Variable: erc-server-KICK-functions

erc-server-KICK-functions is a variable defined in erc-backend.el.gz.

Value

(erc-server-KICK)

Documentation

Hook called upon receiving a KICK server response.

Each function is called with two arguments, the process associated with the response and the parsed response. If the function returns non-nil, stop processing the hook. Otherwise, continue.

See also erc-server-KICK.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(define-erc-response-handler (KICK)
  "Handle kick messages received from the server." nil
  (let* ((ch (nth 0 (erc-response.command-args parsed)))
         (tgt (nth 1 (erc-response.command-args parsed)))
         (reason (erc-trim-string (erc-response.contents parsed)))
         (buffer (erc-get-buffer ch proc)))
    (pcase-let ((`(,nick ,login ,host)
                 (erc-parse-user (erc-response.sender parsed))))
      (cond
       ((string= tgt (erc-current-nick))
        (erc-display-message
         parsed 'notice buffer
         'KICK-you ?n nick ?u login ?h host ?c ch ?r reason)
        (run-hook-with-args 'erc-kick-hook buffer)
        (erc-with-buffer
            (buffer)
          (erc--remove-channel-users-but tgt))
        (with-suppressed-warnings ((obsolete erc-delete-default-channel))
          (erc-delete-default-channel ch buffer))
        (erc-update-mode-line buffer))
       ((string= nick (erc-current-nick))
        (erc-display-message
         parsed 'notice buffer
         'KICK-by-you ?k tgt ?c ch ?r reason)
        (erc-remove-channel-member buffer tgt))
       (t (erc-display-message
           parsed 'notice buffer
           'KICK ?k tgt ?n nick ?u login ?h host ?c ch ?r reason)
          (erc-remove-channel-member buffer tgt)))))
  nil)