-(defun nnmbox-get-new-mail (&optional group)
- "Read new incoming mail."
- (let* ((spools (nnmail-get-spool-files group))
- (group-in group)
- incoming incomings)
- (nnmbox-read-mbox)
- (if (or (not nnmbox-get-new-mail) (not nnmail-spool-file))
- ()
- ;; We go through all the existing spool files and split the
- ;; mail from each.
- (while spools
- (and
- (file-exists-p (car spools))
- (> (nth 7 (file-attributes (car spools))) 0)
- (progn
- (and gnus-verbose-backends
- (message "nnmbox: Reading incoming mail..."))
- (setq incoming
- (nnmail-move-inbox
- (car spools) (concat nnmbox-mbox-file "-Incoming")))
- (setq incomings (cons incoming incomings))
- (save-excursion
- (setq group (nnmail-get-split-group (car spools) group-in))
- (let ((in-buf (nnmail-split-incoming
- incoming 'nnmbox-save-mail t group)))
- (set-buffer nnmbox-mbox-buffer)
- (goto-char (point-max))
- (insert-buffer-substring in-buf)
- (kill-buffer in-buf)))))
- (setq spools (cdr spools)))
- ;; If we did indeed read any incoming spools, we save all info.
- (and (buffer-modified-p nnmbox-mbox-buffer)
- (save-excursion
- (nnmail-save-active nnmbox-group-alist nnmbox-active-file)
- (set-buffer nnmbox-mbox-buffer)
- (save-buffer)))
- (if incomings (run-hooks 'nnmail-read-incoming-hook))
- (while incomings
- (setq incoming (car incomings))
- (and nnmail-delete-incoming
- (file-exists-p incoming)
- (file-writable-p incoming)
- (delete-file incoming))
- (setq incomings (cdr incomings))))))
-
-