Variable: erc-server-AUTHENTICATE-functions

erc-server-AUTHENTICATE-functions is a variable defined in erc-sasl.el.gz.

Value

(erc-server-AUTHENTICATE)

Documentation

Hook called upon receiving a AUTHENTICATE 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-AUTHENTICATE.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-sasl.el.gz
(define-erc-response-handler (AUTHENTICATE)
  "Begin or resume an SASL session." nil
  (if-let* ((response (car (erc-response.command-args parsed)))
            ((= 400 (length response))))
      (cl-callf (lambda (s) (concat s response))
          (erc-sasl--state-pending erc-sasl--state))
    (cl-assert response t)
    (when (string= "+" response)
      (setq response ""))
    (setf response (base64-decode-string
                    (concat (erc-sasl--state-pending erc-sasl--state)
                            response))
          (erc-sasl--state-pending erc-sasl--state) nil)
    (let ((client (erc-sasl--state-client erc-sasl--state))
          (step (erc-sasl--state-step erc-sasl--state))
          data)
      (when step
        (sasl-step-set-data step response))
      (setq step (setf (erc-sasl--state-step erc-sasl--state)
                       (sasl-next-step client step))
            data (sasl-step-data step))
      (when (string= data "")
        (setq data nil))
      (when data
        (setq data (erc--unfun (base64-encode-string data t))))
      (erc-server-send (concat "AUTHENTICATE " (or data "+"))))))