(deffoo nnmh-request-list (&optional server dir)
(nnheader-insert "")
(let ((nnmh-toplev
- (or dir (file-truename (file-name-as-directory nnmh-directory)))))
+ (file-truename (or dir (file-name-as-directory nnmh-directory)))))
(nnmh-request-list-1 nnmh-toplev))
(setq nnmh-group-alist (nnmail-get-active))
t)
(deffoo nnmh-request-accept-article (group &optional server last noinsert)
(nnmh-possibly-change-directory group server)
(nnmail-check-syntax)
- (if (stringp group)
- (and
- (nnmail-activate 'nnmh)
- (car (nnmh-save-mail
- (list (cons group (nnmh-active-number group)))
- noinsert)))
- (and
- (nnmail-activate 'nnmh)
- (car (nnmh-save-mail (nnmail-article-group 'nnmh-active-number)
- noinsert)))))
+ (when nnmail-cache-accepted-message-ids
+ (nnmail-cache-insert (nnmail-fetch-field "message-id")))
+ (prog1
+ (if (stringp group)
+ (and
+ (nnmail-activate 'nnmh)
+ (car (nnmh-save-mail
+ (list (cons group (nnmh-active-number group)))
+ noinsert)))
+ (and
+ (nnmail-activate 'nnmh)
+ (let ((res (nnmail-article-group 'nnmh-active-number)))
+ (if (and (null res)
+ (yes-or-no-p "Moved to `junk' group; delete article? "))
+ 'junk
+ (car (nnmh-save-mail res noinsert))))))
+ (when (and last nnmail-cache-accepted-message-ids)
+ (nnmail-cache-close))))
(deffoo nnmh-request-replace-article (article group buffer)
(nnmh-possibly-change-directory group)
(defun nnmh-active-number (group)
"Compute the next article number in GROUP."
- (let ((active (cadr (assoc group nnmh-group-alist))))
+ (let ((active (cadr (assoc group nnmh-group-alist)))
+ (dir (nnmail-group-pathname group nnmh-directory)))
(unless active
;; The group wasn't known to nnmh, so we just create an active
;; entry for it.
(setq active (cons 1 0))
(push (list group active) nnmh-group-alist)
+ (unless (file-exists-p dir)
+ (make-directory dir))
;; Find the highest number in the group.
(let ((files (sort
(mapcar
(lambda (f)
(string-to-int f))
- (directory-files
- (nnmail-group-pathname group nnmh-directory)
- nil "^[0-9]+$"))
- '>)))
+ (directory-files dir nil "^[0-9]+$"))
+ '>)))
(when files
(setcdr active (car files)))))
(setcdr active (1+ (cdr active)))