- (setq activenumber (1+ activenumber))
- (nnfolder-insert-newsgroup-line (cons nil activenumber))
- (widen))))
-
- ;; Make absolutely sure that the active list reflects reality!
- (setcdr active activenumber)
- (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
- (current-buffer))))
-
-(defun nnfolder-get-new-mail (&optional group)
- "Read new incoming mail."
- (let* ((spools (nnmail-get-spool-files group))
- (group-in group)
- incomings incoming)
- (if (or (not nnfolder-get-new-mail) (not nnmail-spool-file))
- ()
- ;; We first activate all the groups.
- (nnfolder-possibly-activate-groups nil)
- ;; The 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 "nnfolder: Reading incoming mail..."))
- (setq incoming
- (nnmail-move-inbox
- (car spools)
- (concat (file-name-as-directory nnfolder-directory)
- "Incoming")))
- (setq incomings (cons incoming incomings))
- (setq group (nnmail-get-split-group (car spools) group-in))
- (nnmail-split-incoming incoming 'nnfolder-save-mail nil group)))
- (setq spools (cdr spools)))
- ;; If we did indeed read any incoming spools, we save all info.
- (if incoming
- (progn
- (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
- (run-hooks 'nnmail-read-incoming-hook)
- (and gnus-verbose-backends
- (message "nnfolder: Reading incoming mail...done"))))
- (let ((bufs nnfolder-buffer-alist))
- (save-excursion
- (while bufs
- (if (not (buffer-name (nth 1 (car bufs))))
- (setq nnfolder-buffer-alist
- (delq (car bufs) nnfolder-buffer-alist))
- (set-buffer (nth 1 (car bufs)))
- (and (buffer-modified-p) (save-buffer)))
- (setq bufs (cdr bufs)))))
- (while incomings
- (and
- nnmail-delete-incoming
- (file-writable-p incoming)
- (delete-file incoming))
- (setq incomings (cdr incomings))))))
+ (nnfolder-insert-newsgroup-line
+ (cons nil (nnfolder-active-number nnfolder-current-group)))
+ (widen)))
+
+ ;; Make absolutely sure that the active list reflects reality!
+ (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
+ ;; Set the scantime for this group.
+ (setq newscantime (visited-file-modtime))
+ (if scantime
+ (setcdr scantime (list newscantime))
+ (push (list nnfolder-current-group newscantime)
+ nnfolder-scantime-alist))
+ (current-buffer))))))
+
+;;;###autoload
+(defun nnfolder-generate-active-file ()
+ "Look for mbox folders in the nnfolder directory and make them into groups."
+ (interactive)
+ (nnmail-activate 'nnfolder)
+ (let ((files (directory-files nnfolder-directory))
+ file)
+ (while (setq file (pop files))
+ (when (and (not (backup-file-name-p file))
+ (nnheader-mail-file-mbox-p
+ (concat nnfolder-directory file)))
+ (nnheader-message 5 "Adding group %s..." file)
+ (push (list file (cons 1 0)) nnfolder-group-alist)
+ (nnfolder-possibly-change-group file)
+ (nnfolder-close-group file))
+ (message ""))))
+
+(defun nnfolder-group-pathname (group)
+ "Make pathname for GROUP."
+ (let ((dir (file-name-as-directory (expand-file-name nnfolder-directory))))
+ ;; If this file exists, we use it directly.
+ (if (or nnmail-use-long-file-names
+ (file-exists-p (concat dir group)))
+ (concat dir group)
+ ;; If not, we translate dots into slashes.
+ (concat dir (nnheader-replace-chars-in-string group ?. ?/)))))
+
+(defun nnfolder-save-buffer ()
+ "Save the buffer."
+ (when (buffer-modified-p)
+ (run-hooks 'nnfolder-save-buffer-hook)
+ (save-buffer)))