Function: imap-arrival-filter

imap-arrival-filter is a byte-compiled function defined in imap.el.gz.

Signature

(imap-arrival-filter PROC STRING)

Documentation

IMAP process filter.

Source Code

;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-arrival-filter (proc string)
  "IMAP process filter."
  ;; Sometimes, we are called even though the process has died.
  ;; Better abstain from doing stuff in that case.
  (when (buffer-name (process-buffer proc))
    (with-current-buffer (process-buffer proc)
      (goto-char (point-max))
      (insert string)
      (imap-log string)
      (let (end)
	(goto-char (point-min))
	(while (setq end (imap-find-next-line))
	  (save-restriction
	    (narrow-to-region (point-min) end)
	    (delete-char (- (length imap-server-eol)))
	    (goto-char (point-min))
	    (unwind-protect
		(cond ((eq imap-state 'initial)
		       (imap-parse-greeting))
		      ((or (eq imap-state 'auth)
			   (eq imap-state 'nonauth)
			   (eq imap-state 'selected)
			   (eq imap-state 'examine))
		       (imap-parse-response))
		      (t
		       (message "Unknown state %s in arrival filter"
				imap-state)))
	      (delete-region (point-min) (point-max)))))))))