+ (save-window-excursion
+ (let ((servers gnus-opened-servers)
+ server
+ (nnmail-fetched-sources (list t)))
+ (while (setq server (car (pop servers)))
+ (and (gnus-check-backend-function 'request-scan (car server))
+ (or (gnus-server-opened server)
+ (gnus-open-server server))
+ (gnus-request-scan nil server))))))
+
+(defun gnus-demon-add-rescan ()
+ "Add daemonic scanning of new articles from all backends."
+ (gnus-demon-add-handler 'gnus-demon-scan-news 120 60))
+
+(defun gnus-demon-scan-news ()
+ (let ((win (current-window-configuration)))
+ (unwind-protect
+ (save-window-excursion
+ (when (gnus-alive-p)
+ (with-current-buffer gnus-group-buffer
+ (gnus-group-get-new-news))))
+ (set-window-configuration win))))
+
+(defun gnus-demon-add-scan-timestamps ()
+ "Add daemonic updating of timestamps in empty newgroups."
+ (gnus-demon-add-handler 'gnus-demon-scan-timestamps nil 30))
+
+(defun gnus-demon-scan-timestamps ()
+ "Set the timestamp on all newsgroups with no unread and no ticked articles."
+ (when (gnus-alive-p)
+ (let ((cur-time (current-time))
+ (newsrc (cdr gnus-newsrc-alist))
+ info group unread has-ticked)
+ (while (setq info (pop newsrc))
+ (setq group (gnus-info-group info)
+ unread (gnus-group-unread group)
+ has-ticked (cdr (assq 'tick (gnus-info-marks info))))
+ (when (and (numberp unread)
+ (= unread 0)
+ (not has-ticked))
+ (gnus-group-set-parameter group 'timestamp cur-time))))))