Function: erc-server-KICK

erc-server-KICK is a byte-compiled function defined in erc-backend.el.gz.

Signature

(erc-server-KICK PROC PARSED)

Documentation

Handle kick messages received from the server.

Handler for a KICK server response. PROC is the server process which returned the response. PARSED is the actual response as an ‘erc-response’ struct. If you want to add responses don’t modify this function, but rather add things to ‘erc-server-KICK-functions’ instead.

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))))
      (erc-remove-channel-member buffer tgt)
      (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))
        (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))
       (t (erc-display-message
             parsed 'notice buffer
             'KICK ?k tgt ?n nick ?u login ?h host ?c ch ?r reason))))))