Function: erc-parse-server-response
erc-parse-server-response is a byte-compiled function defined in
erc-backend.el.gz.
Signature
(erc-parse-server-response PROC STRING)
Documentation
Parse and act upon a complete line from an IRC server.
PROC is the process (connection) from which STRING was received.
PROCs process-buffer is current-buffer when this function is called.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
(defun erc-parse-server-response (proc string)
"Parse and act upon a complete line from an IRC server.
PROC is the process (connection) from which STRING was received.
PROCs `process-buffer' is `current-buffer' when this function is called."
(unless (string= string "") ;; Ignore empty strings
(save-match-data
(let* ((tag-list (when (eq (aref string 0) ?@)
(substring string 1
(string-search " " string))))
(msg (make-erc-response :unparsed string :tags
(when tag-list
(erc--parse-message-tags tag-list))))
(string (if tag-list
(substring string (+ 1 (string-search " " string)))
string))
(posn (if (eq (aref string 0) ?:)
(string-search " " string)
0)))
(setf (erc-response.sender msg)
(if (eq posn 0)
erc-session-server
(substring string 1 posn)))
(setf (erc-response.command msg)
(let* ((bposn (string-match "[^ \n]" string posn))
(eposn (string-search " " string bposn)))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn)))
(while (and posn
(not (eq (aref string posn) ?:)))
(push (let* ((bposn posn)
(eposn (string-search " " string bposn)))
(setq posn (and eposn
(string-match "[^ \n]" string eposn)))
(substring string bposn eposn))
(erc-response.command-args msg)))
(when posn
(let ((str (substring string (1+ posn))))
(push str (erc-response.command-args msg))))
(setf (erc-response.contents msg)
(car (erc-response.command-args msg)))
(setf (erc-response.command-args msg)
(nreverse (erc-response.command-args msg)))
(erc-decode-parsed-server-response msg)
(erc-handle-parsed-server-response proc msg)))))