Variable: erc-server-396-functions

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

Value

(erc-server-396)

Documentation

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

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
;; https://defs.ircdocs.horse/defs/numerics.html#rpl-visiblehost-396
;; As of ERC 5.6, if the client hasn't yet joined any channels,
;; there's a good chance a server user for the current nick simply
;; doesn't exist (and there's not enough info in this reply to create
;; one).  To fix this, ERC could WHO itself on 372 or similar if it
;; hasn't yet received a 900.
(define-erc-response-handler (396)
  "RPL_VISIBLEHOST or RPL_YOURDISPLAYHOST or RPL_HOSTHIDDEN." nil
  (pcase-let* ((userhost (cadr (erc-response.command-args parsed)))
               ;; Behavior blindly copied from event_hosthidden in irssi 1.4.
               (rejectrx (rx (| (: bot (in ?@ ?: ?-)) (in ?* ?? ?! ?# ?& ?\s)
                                (: ?- eot))))
               (`(,_ ,user ,host) (and (not (string-match rejectrx userhost))
                                       (erc--parse-nuh userhost))))
    (when host
      (erc-update-user-nick (erc-current-nick) nil host user)
      (erc-display-message parsed 'notice 'active 's396 ?s userhost))))