Variable: erc-server-005-functions

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

Value

(erc-server-005)

Documentation

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

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(define-erc-response-handler (005)
  "Set the variable `erc-server-parameters' and display the received message.

According to RFC 2812, suggests alternate servers on the network.
Many servers, however, use this code to show which parameters they have set,
for example, the network identifier, maximum allowed topic length, whether
certain commands are accepted and more.  See documentation for
`erc-server-parameters' for more information on the parameters sent.

A server may send more than one 005 message."
  nil
  (let ((line (mapconcat #'identity
                         (setf (erc-response.command-args parsed)
                               (cdr (erc-response.command-args parsed)))
                         " ")))
    (while (erc-response.command-args parsed)
      (let ((section (pop (erc-response.command-args parsed))))
        ;; fill erc-server-parameters
        (when (string-match "^\\([A-Z]+\\)=\\(.*\\)$\\|^\\([A-Z]+\\)$"
                            section)
          (add-to-list 'erc-server-parameters
                       `(,(or (match-string 1 section)
                              (match-string 3 section))
                         .
                         ,(match-string 2 section))))))
    (erc-display-message parsed 'notice proc line)))