- (if (nnmbox-possibly-change-newsgroup group)
- (if dont-check
- t
- (nnmbox-get-new-mail)
- (save-excursion
- (set-buffer nntp-server-buffer)
- (erase-buffer)
- (let ((active (assoc group nnmbox-group-alist)))
- (insert (format "211 %d %d %d %s\n"
- (1+ (- (cdr (car (cdr active)))
- (car (car (cdr active)))))
- (car (car (cdr active)))
- (cdr (car (cdr active)))
- (car active))))
- t)))))
-
-(defun nnmbox-close-group (group &optional server)
+ (set-buffer nnmbox-mbox-buffer)
+ (goto-char (point-min))
+ (when (search-forward (nnmbox-article-string article) nil t)
+ (let (start stop)
+ (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
+ (setq start (point))
+ (forward-line 1)
+ (or (and (re-search-forward
+ (concat "^" message-unix-mail-delimiter) nil t)
+ (forward-line -1))
+ (goto-char (point-max)))
+ (setq stop (point))
+ (let ((nntp-server-buffer (or buffer nntp-server-buffer)))
+ (set-buffer nntp-server-buffer)
+ (erase-buffer)
+ (insert-buffer-substring nnmbox-mbox-buffer start stop)
+ (goto-char (point-min))
+ (while (looking-at "From ")
+ (delete-char 5)
+ (insert "X-From-Line: ")
+ (forward-line 1))
+ (if (numberp article)
+ (cons nnmbox-current-group article)
+ (nnmbox-article-group-number)))))))
+
+(deffoo nnmbox-request-group (group &optional server dont-check)
+ (let ((active (cadr (assoc group nnmbox-group-alist))))
+ (cond
+ ((or (null active)
+ (null (nnmbox-possibly-change-newsgroup group server)))
+ (nnheader-report 'nnmbox "No such group: %s" group))
+ (dont-check
+ (nnheader-report 'nnmbox "Selected group %s" group)
+ (nnheader-insert ""))
+ (t
+ (nnheader-report 'nnmbox "Selected group %s" group)
+ (nnheader-insert "211 %d %d %d %s\n"
+ (1+ (- (cdr active) (car active)))
+ (car active) (cdr active) group)))))
+
+(deffoo nnmbox-request-scan (&optional group server)
+ (nnmbox-possibly-change-newsgroup group server)
+ (nnmbox-read-mbox)
+ (nnmail-get-new-mail
+ 'nnmbox
+ (lambda ()
+ (save-excursion
+ (set-buffer nnmbox-mbox-buffer)
+ (save-buffer)))
+ (file-name-directory nnmbox-mbox-file)
+ group
+ (lambda ()
+ (save-excursion
+ (let ((in-buf (current-buffer)))
+ (set-buffer nnmbox-mbox-buffer)
+ (goto-char (point-max))
+ (insert-buffer-substring in-buf)))
+ (nnmail-save-active nnmbox-group-alist nnmbox-active-file))))
+
+(deffoo nnmbox-close-group (group &optional server)