:group 'gnus-agent
:type 'integer)
+(defcustom gnus-agent-expire-days 7
+ "Read articles older than this will be expired."
+ :group 'gnus-agent
+ :type 'integer)
+
;;; Internal variables
(defvar gnus-agent-history-buffers nil)
(goto-char (point-max))
(insert id "\t" (number-to-string date) "\t")
(while group-arts
- (insert (caar group-arts) "/" (number-to-string (cdr (pop group-arts)))
+ (insert (caar group-arts) " " (number-to-string (cdr (pop group-arts)))
" "))
(insert "\n")))
"Expire all old articles."
(interactive)
(let ((methods gnus-agent-covered-methods)
+ (day (- (gnus-time-to-day (current-time)) gnus-agent-expire-days))
+ (expiry-hashtb (gnus-make-hashtable 1023))
+ gnus-command-method sym group articles
+ history overview file histories elem art nov-file low info
+ unreads marked article)
+ (save-excursion
+ (setq overview (get-buffer-create " *expire overview*"))
+ (while (setq gnus-command-method (pop methods))
+ (gnus-agent-open-history)
+ (set-buffer
+ (setq gnus-agent-current-history
+ (setq history (gnus-agent-history-buffer))))
+ (goto-char (point-min))
+ (while (not (eobp))
+ (skip-chars-forward "^\t")
+ (if (> (read (current-buffer)) day)
+ ;; New article; we don't expire it.
+ (forward-line 1)
+ ;; Old article. Schedule it for possible nuking.
+ (while (not (eolp))
+ (setq sym (let ((obarray expiry-hashtb))
+ (read (current-buffer))))
+ (if (boundp sym)
+ (set sym (cons (cons (read (current-buffer)) (point))
+ (symbol-value sym)))
+ (set sym (list (cons (read (current-buffer)) (point)))))
+ (skip-chars-forward " "))
+ (forward-line 1)))
+ ;; We now have all articles that can possibly be expired.
+ (mapatoms
+ (lambda (sym)
+ (setq group (symbol-name sym)
+ articles (sort (symbol-value sym) 'car-less-than-car)
+ low (car (gnus-active group))
+ info (gnus-get-info group)
+ unreads (ignore-errors (gnus-list-of-unread-articles group))
+ marked (nconc (gnus-uncompress-range
+ (cdr (assq 'ticked (gnus-info-marks info))))
+ (gnus-uncompress-range
+ (cdr (assq 'dormant (gnus-info-marks info)))))
+ nov-file (gnus-agent-article-name ".overview" group))
+ (gnus-message 5 "Expiring articles in %s" group)
+ (set-buffer overview)
+ (erase-buffer)
+ (when (file-exists-p nov-file)
+ (insert-file-contents nov-file))
+ (goto-char (point-min))
+ (while (setq elem (pop articles))
+ (setq article (car elem))
+ (when (or (null low)
+ (< article low)
+ (and (not (memq article unreads))
+ (not (memq article marked))))
+ ;; Find and nuke the NOV line.
+ (while (and (not (eobp))
+ (< (setq art (read (current-buffer))) article))
+ (forward-line 1))
+ (if (or (eobp)
+ (/= art article))
+ (beginning-of-line)
+ (gnus-delete-line))
+ ;; Nuke the article.
+ (when (file-exists-p (setq file (gnus-agent-article-name
+ (number-to-string article)
+ group)))
+ (delete-file file))
+ ;; Schedule the history line for nuking.
+ (push (cdr elem) histories)))
+ (write-region (point-min) (point-max) nov-file nil 'silent))
+ expiry-hashtb)
+ (set-buffer history)
+ (setq histories (nreverse (sort histories '<)))
+ (while histories
+ (goto-char (pop histories))
+ (gnus-delete-line))
+ (gnus-agent-save-history)
+ (gnus-agent-close-history)))))
+
+(defun gnus-agent-expire-old ()
+ "Expire all old articles."
+ (interactive)
+ (let ((methods gnus-agent-covered-methods)
(alist (cdr gnus-newsrc-alist))
gnus-command-method ofiles info method file group)
(while (setq gnus-command-method (pop methods))
\input texinfo @c -*-texinfo-*-
@setfilename gnus
-@settitle Quassia Gnus 0.36 Manual
+@settitle Quassia Gnus 0.37 Manual
@synindex fn cp
@synindex vr cp
@synindex pg cp
@tex
@titlepage
-@title Quassia Gnus 0.36 Manual
+@title Quassia Gnus 0.37 Manual
@author by Lars Magne Ingebrigtsen
@page
spool or your mbox file. All at the same time, if you want to push your
luck.
-This manual corresponds to Quassia Gnus 0.36.
+This manual corresponds to Quassia Gnus 0.37.
@end ifinfo
* Agent Basics:: How it all is supposed to work.
* Agent Categories:: How to tell the Gnus Agent what to download.
* Agent Commands:: New commands for all the buffers.
+* Agent Expiry:: How to make old articles go away.
* Outgoing Messages:: What happens when you post/mail something?
* Agent Variables:: Customizing is fun.
* Example Setup:: An example @file{.gnus.el} file for offline people.
@end table
+@node Agent Expiry
+@subsection Agent Expiry
+
+@vindex gnus-agent-expiry-days
+@findex gnus-agent-expiry
+@kindex M-x gnus-agent-expiry
+
+@code{nnagent} doesn't handle expiry. Instead, there's a special
+@code{gnus-agent-expiry} command that will expire all read articles that
+are older than @code{gnus-agent-expiry-days} days. It can be run
+whenever you feel that you're running out of space. It's not
+particularly fast or efficient, and it's not a particularly good idea to
+interrupt it (with @kbd{C-g} or anything else) once you've started it.
+
+
@node Outgoing Messages
@subsection Outgoing Messages
Andre Deparade,
Ulrik Dickow,
Dave Disser,
+Rui-Tao Dong, @c ?
Joev Dubach,
Michael Welsh Duggan,
Dave Edmondson,
Nat Makarevitch,
Istvan Marko,
David Martin,
+Jason R Mastaler,
Gordon Matzigkeit,
Timo Metzemakers,
Richard Mlynarik,
Hideki Ono, @c Ono
William Perry,
Stephen Peters,
+Jens-Ulrik Holger Petersen,
Ulrich Pfeifer,
John McClary Prevost,
Colin Rafferty,
+Lasse Rasinen,
Lars Balker Rasmussen,
Joe Reiss,
Renaud Rioboo,