Function: pop3-list

pop3-list is a byte-compiled function defined in pop3.el.gz.

Signature

(pop3-list PROCESS &optional MSG)

Documentation

If MSG is nil, return an alist of (MESSAGE-ID . SIZE) pairs.

Otherwise, return the size of the message-id MSG.

Source Code

;; Defined in /usr/src/emacs/lisp/net/pop3.el.gz
(defun pop3-list (process &optional msg)
  "If MSG is nil, return an alist of (MESSAGE-ID . SIZE) pairs.
Otherwise, return the size of the message-id MSG."
  (pop3-send-command process (if msg
				 (format "LIST %d" msg)
			       "LIST"))
  (let ((response (pop3-read-response process t)))
    (if msg
	(string-to-number (nth 2 (split-string response " ")))
      (let ((start pop3-read-point) end)
	(with-current-buffer (process-buffer process)
	  (while (not (re-search-forward "^\\.\r\n" nil t))
	    (pop3-accept-process-output process)
	    (goto-char start))
	  (setq pop3-read-point (point-marker))
	  (goto-char (match-beginning 0))
	  (setq end (point-marker))
          (mapcar (lambda (s) (let ((split (split-string s " ")))
                           (cons (string-to-number (nth 0 split))
                                 (string-to-number (nth 1 split)))))
		  (split-string (buffer-substring start end) "\r\n" t)))))))