+ nil (list backend-article-number))))
+
+(deffoo nnir-request-update-mark (group article mark)
+ (let ((artgroup (nnir-article-group article))
+ (artnumber (nnir-article-number article)))
+ (gnus-request-update-mark artgroup artnumber mark)))
+
+(deffoo nnir-request-set-mark (group actions &optional server)
+ (nnir-possibly-change-group group server)
+ (let (mlist)
+ (dolist (action actions)
+ (destructuring-bind (range action marks) action
+ (let ((articles-by-group (nnir-categorize
+ (gnus-uncompress-range range)
+ nnir-article-group nnir-article-number)))
+ (dolist (artgroup articles-by-group)
+ (push (list
+ (car artgroup)
+ (list (gnus-compress-sequence
+ (sort (cadr artgroup) '<)) action marks)) mlist)))))
+ (dolist (request (nnir-categorize mlist car cadr))
+ (gnus-request-set-mark (car request) (cadr request)))))
+
+
+(deffoo nnir-request-update-info (group info &optional server)
+ (nnir-possibly-change-group group server)
+ ;; clear out all existing marks.
+ (gnus-info-set-marks info nil)
+ (gnus-info-set-read info nil)
+ (let ((group (gnus-group-guess-full-name-from-command-method group))
+ (articles-by-group
+ (nnir-categorize
+ (gnus-uncompress-range (cons 1 (nnir-artlist-length nnir-artlist)))
+ nnir-article-group nnir-article-ids)))
+ (gnus-set-active group
+ (cons 1 (nnir-artlist-length nnir-artlist)))
+ (while (not (null articles-by-group))
+ (let* ((group-articles (pop articles-by-group))
+ (articleids (reverse (cadr group-articles)))
+ (group-info (gnus-get-info (car group-articles)))
+ (marks (gnus-info-marks group-info))
+ (read (gnus-info-read group-info)))
+ (gnus-info-set-read
+ info
+ (gnus-add-to-range
+ (gnus-info-read info)
+ (delq nil
+ (mapcar
+ #'(lambda (art)
+ (when (gnus-member-of-range (cdr art) read) (car art)))
+ articleids))))
+ (dolist (mark marks)
+ (destructuring-bind (type . range) mark
+ (gnus-add-marked-articles
+ group type
+ (delq nil
+ (mapcar
+ #'(lambda (art)
+ (when (gnus-member-of-range (cdr art) range) (car art)))
+ articleids)))))))))
+
+
+(deffoo nnir-close-group (group &optional server)
+ (nnir-possibly-change-group group server)
+ (let ((pgroup (gnus-group-guess-full-name-from-command-method group)))
+ (when (and nnir-artlist (not (gnus-ephemeral-group-p pgroup)))
+ (gnus-group-set-parameter pgroup 'nnir-artlist nnir-artlist))
+ (setq nnir-artlist nil)
+ (when (gnus-ephemeral-group-p pgroup)
+ (gnus-kill-ephemeral-group pgroup)
+ (setq gnus-ephemeral-servers
+ (delq (assq 'nnir gnus-ephemeral-servers)
+ gnus-ephemeral-servers)))))
+;; (gnus-opened-servers-remove
+;; (car (assoc '(nnir "nnir-ephemeral" (nnir-address "nnir"))
+;; gnus-opened-servers))))
+