(nnoo-declare nnml)
(defvoo nnml-directory message-directory
- "Mail spool directory.")
+ "Spool directory for the nnml mail backend.")
(defvoo nnml-active-file
(concat (file-name-as-directory nnml-directory) "active")
(let ((file nil)
(number (length sequence))
(count 0)
+ ;; 1997/8/12 by MORIOKA Tomohiko
+ (file-name-coding-system 'binary) ; for Emacs 20
+ (pathname-coding-system 'binary) ; for XEmacs/mule
beg article)
(if (stringp (car sequence))
'headers
(deffoo nnml-request-article (id &optional group server buffer)
(nnml-possibly-change-directory group server)
(let* ((nntp-server-buffer (or buffer nntp-server-buffer))
+ ;; 1997/8/12 by MORIOKA Tomohiko
+ (file-name-coding-system 'binary) ; for Emacs 20
+ (pathname-coding-system 'binary) ; for XEmacs/mule
path gpath group-num)
(if (stringp id)
(when (and (setq group-num (nnml-find-group-number id))
(string-to-int (file-name-nondirectory path)))))))
(deffoo nnml-request-group (group &optional server dont-check)
- (cond
- ((not (nnml-possibly-change-directory group server))
- (nnheader-report 'nnml "Invalid group (no such directory)"))
- ((not (file-exists-p nnml-current-directory))
- (nnheader-report 'nnml "Directory %s does not exist"
- nnml-current-directory))
- ((not (file-directory-p nnml-current-directory))
- (nnheader-report 'nnml "%s is not a directory" nnml-current-directory))
- (dont-check
- (nnheader-report 'nnml "Group %s selected" group)
- t)
- (t
- (nnheader-re-read-dir nnml-current-directory)
- (nnmail-activate 'nnml)
- (let ((active (nth 1 (assoc group nnml-group-alist))))
- (if (not active)
- (nnheader-report 'nnml "No such group: %s" group)
- (nnheader-report 'nnml "Selected group %s" group)
- (nnheader-insert "211 %d %d %d %s\n"
- (max (1+ (- (cdr active) (car active))) 0)
- (car active) (cdr active) group))))))
+ ;; 1997/8/12 by MORIOKA Tomohiko
+ (let ((file-name-coding-system 'binary) ; for Emacs 20
+ (pathname-coding-system 'binary)) ; for XEmacs/mule
+ (cond
+ ((not (nnml-possibly-change-directory group server))
+ (nnheader-report 'nnml "Invalid group (no such directory)"))
+ ((not (file-exists-p nnml-current-directory))
+ (nnheader-report 'nnml "Directory %s does not exist"
+ nnml-current-directory))
+ ((not (file-directory-p nnml-current-directory))
+ (nnheader-report 'nnml "%s is not a directory" nnml-current-directory))
+ (dont-check
+ (nnheader-report 'nnml "Group %s selected" group)
+ t)
+ (t
+ (nnheader-re-read-dir nnml-current-directory)
+ (nnmail-activate 'nnml)
+ (let ((active (nth 1 (assoc group nnml-group-alist))))
+ (if (not active)
+ (nnheader-report 'nnml "No such group: %s" group)
+ (nnheader-report 'nnml "Selected group %s" group)
+ (nnheader-insert "211 %d %d %d %s\n"
+ (max (1+ (- (cdr active) (car active))) 0)
+ (car active) (cdr active) group)))))))
(deffoo nnml-request-scan (&optional group server)
(setq nnml-article-file-alist nil)
(deffoo nnml-request-list (&optional server)
(save-excursion
- (nnmail-find-file nnml-active-file)
+ ;; 1997/8/12 by MORIOKA Tomohiko
+ ;; for XEmacs/mule.
+ (let ((nnmail-file-coding-system nnmail-active-file-coding-system)
+ (file-name-coding-system 'binary) ; for Emacs 20
+ (pathname-coding-system 'binary)) ; for XEmacs/mule
+ (nnmail-find-file nnml-active-file)
+ )
(setq nnml-group-alist (nnmail-get-active))
t))
(defun nnml-article-to-file (article)
(nnml-update-file-alist)
(let (file)
- (when (setq file (cdr (assq article nnml-article-file-alist)))
- (concat nnml-current-directory file))))
+ (if (setq file (cdr (assq article nnml-article-file-alist)))
+ (concat nnml-current-directory file)
+ ;; Just to make sure nothing went wrong when reading over NFS --
+ ;; check once more.
+ (when (file-exists-p
+ (setq file (concat nnml-current-directory "/"
+ (number-to-string article))))
+ (nnml-update-file-alist t)
+ file))))
(defun nnml-deletable-article-p (group article)
"Say whether ARTICLE in GROUP can be deleted."
(nnml-open-server server))
(if (not group)
t
- (let ((pathname (nnmail-group-pathname group nnml-directory)))
+ (let ((pathname (nnmail-group-pathname group nnml-directory))
+ ;; 1997/8/14 by MORIOKA Tomohiko
+ (file-name-coding-system 'binary) ; for Emacs 20
+ (pathname-coding-system 'binary)) ; for XEmacs/mule
(when (not (equal pathname nnml-current-directory))
(setq nnml-current-directory pathname
nnml-current-group group
(search-forward "\n\n" nil t)
(setq chars (- (point-max) (point)))
(max 1 (1- (point)))))
- (when (and (not (= 0 chars)) ; none of them empty files...
- (not (= (point-min) (point-max))))
+ (unless (zerop (buffer-size))
(goto-char (point-min))
(setq headers (nnml-parse-head chars (caar files)))
(save-excursion
(setf (car active) num)))))))
t))
-(defun nnml-update-file-alist ()
- (unless nnml-article-file-alist
+(defun nnml-update-file-alist (&optional force)
+ (when (or (not nnml-article-file-alist)
+ force)
(setq nnml-article-file-alist
(nnheader-article-to-file-alist nnml-current-directory))))