-(defun nnml-server-opened (&optional server)
- (and (equal server nnml-current-server)
- nntp-server-buffer
- (buffer-name nntp-server-buffer)))
-
-(defun nnml-status-message (&optional server)
- nnml-status-string)
-
-(defun nnml-request-article (id &optional newsgroup server buffer)
- (nnml-possibly-change-directory newsgroup)
- (let* ((group-num (and (stringp id) (nnml-find-group-number id)))
- (number (if (numberp id) id (cdr group-num)))
- (file
- (and number
- (concat
- (if (numberp id)
- nnml-current-directory
- (nnmail-group-pathname (car group-num) nnml-directory))
- (int-to-string number))))
- (nntp-server-buffer (or buffer nntp-server-buffer)))
- (and file
- (file-exists-p file)
- (not (file-directory-p file))
- (save-excursion (nnmail-find-file file))
- ;; We return the article number.
- (cons newsgroup (string-to-int (file-name-nondirectory file))))))
-
-(defun nnml-request-group (group &optional server dont-check)
- (if (not (nnml-possibly-change-directory group))
- (progn
- (setq nnml-status-string "Invalid group (no such directory)")
- nil)
- (if dont-check
- t
- (nnmail-activate 'nnml)
- (let ((active (nth 1 (assoc group nnml-group-alist))))
- (save-excursion
- (set-buffer nntp-server-buffer)
- (erase-buffer)
- (if (not active)
- ()
- (insert (format "211 %d %d %d %s\n"
- (max (1+ (- (cdr active) (car active))) 0)
- (car active) (cdr active) group))
- t))))))
-
-(defun nnml-request-scan (&optional group server)
+(deffoo nnml-request-article (id &optional group server buffer)
+ (nnml-possibly-change-directory group server)
+ (let* ((nntp-server-buffer (or buffer nntp-server-buffer))
+ path gpath group-num)
+ (if (stringp id)
+ (when (and (setq group-num (nnml-find-group-number id))
+ (cdr
+ (assq (cdr group-num)
+ (nnheader-article-to-file-alist
+ (setq gpath
+ (nnmail-group-pathname
+ (car group-num)
+ nnml-directory))))))
+ (setq path (concat gpath (int-to-string (cdr group-num)))))
+ (setq path (nnml-article-to-file id)))
+ (cond
+ ((not path)
+ (nnheader-report 'nnml "No such article: %s" id))
+ ((not (file-exists-p path))
+ (nnheader-report 'nnml "No such file: %s" path))
+ ((file-directory-p path)
+ (nnheader-report 'nnml "File is a directory: %s" path))
+ ((not (save-excursion (nnmail-find-file path)))
+ (nnheader-report 'nnml "Couldn't read file: %s" path))
+ (t
+ (nnheader-report 'nnml "Article %s retrieved" id)
+ ;; We return the article number.
+ (cons (if group-num (car group-num) group)
+ (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))))))
+
+(deffoo nnml-request-scan (&optional group server)
+ (setq nnml-article-file-alist nil)
+ (nnml-possibly-change-directory group server)