Function: erc--parse-isupport-value

erc--parse-isupport-value is a byte-compiled function defined in erc-backend.el.gz.

Signature

(erc--parse-isupport-value VALUE)

Documentation

Return list of unescaped components from an "ISUPPORT" VALUE.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(defun erc--parse-isupport-value (value)
  "Return list of unescaped components from an \"ISUPPORT\" VALUE."
  ;; https://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-2
  ;;
  ;; > The server SHOULD send "X", not "X="; this is the normalized form.
  ;;
  ;; Note: for now, assume the server will only send non-empty values,
  ;; possibly with printable ASCII escapes.  Though in practice, the
  ;; only two escapes we're likely to see are backslash and space,
  ;; meaning the pattern is too liberal.
  (let (case-fold-search)
    (mapcar
     (lambda (v)
       (let ((start 0)
             m
             c)
         (while (and (< start (length v))
                     (string-match "[\\]x[0-9A-F][0-9A-F]" v start))
           (setq m (substring v (+ 2 (match-beginning 0)) (match-end 0))
                 c (string-to-number m 16))
           (if (<= ?\  c ?~)
               (setq v (concat (substring v 0 (match-beginning 0))
                               (string c)
                               (substring v (match-end 0)))
                     start (- (match-end 0) 3))
             (setq start (match-end 0))))
         v))
     (if (string-search "," value)
         (split-string value ",")
       (list value)))))