Gnus development mailing list
 help / color / mirror / Atom feed
* qmail bounce information in summary, plus a nnheader.el fake message ID question
@ 2004-06-11 14:35 Ted Zlatanov
  2004-06-14 17:23 ` Ted Zlatanov
  0 siblings, 1 reply; 2+ messages in thread
From: Ted Zlatanov @ 2004-06-11 14:35 UTC (permalink / raw)


I deal with qmail bounces a lot, being a qmail administrator.  Here's
a user-format-function to analyze a bounce message and give the first
bounce address found.  You just put %uB in your summary format line (I
do this for just the "root" group where bounces go).

I wanted to use the registry, but the "fake+none" message IDs Gnus
generates are not consistent.  It would be nice if the fake message
ID, generated in nnheader.el:

(concat "fake+none+" (int-to-string (incf nnheader-fake-message-id)))

could incorporate the real article number and group name, so that when
you re-enter the group, the fake message ID is the same as before.  I
think this would help make Gnus more consistent, and the registry
more useful (e.g. for nnrss groups).

Ted

;; note: we try to use the gnus-registry to cache this, but qmail doesn't give valid message IDs to bounces!
(defun gnus-user-format-function-B (headers)
  (if (and headers gnus-newsgroup-name)
      (let* ((article (spam-fetch-field-fast -4332 'number headers)) ; -4332 is a fake article number
	     (id (spam-fetch-field-message-id-fast article headers))
	     (bounce (gnus-registry-fetch-extra id 'qmail-bounce-address)))
	(if (and bounce (stringp bounce))
	    (format "C_BOUNCE %s" bounce)
	  (with-temp-buffer
	    (gnus-request-article-this-buffer
	     article
	     gnus-newsgroup-name)
	    (if (and
		 (search-forward "Hi. This is the" nil t)
		 (search-forward-regexp "<\\(.*\\)>:" nil t))
		(progn
		  (setq bounce (match-string 1))
		  (gnus-registry-store-extra-entry id 'qmail-bounce-address bounce)
		  (format "BOUNCE %s" bounce))
	      "no match"))))
    "invalid headers"))



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: qmail bounce information in summary, plus a nnheader.el fake message ID question
  2004-06-11 14:35 qmail bounce information in summary, plus a nnheader.el fake message ID question Ted Zlatanov
@ 2004-06-14 17:23 ` Ted Zlatanov
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Zlatanov @ 2004-06-14 17:23 UTC (permalink / raw)


On Fri, 11 Jun 2004, tzz@lifelogs.com wrote:

> I deal with qmail bounces a lot, being a qmail administrator.  Here's
> a user-format-function to analyze a bounce message and give the first
> bounce address found.  You just put %uB in your summary format line (I
> do this for just the "root" group where bounces go).

Attached is the updated version of this function.  NB: it conflicts
with bbdb-gnus.el, which also defines a -B user format function.


> I wanted to use the registry, but the "fake+none" message IDs Gnus
> generates are not consistent.  It would be nice if the fake message
> ID, generated in nnheader.el:
> 
> (concat "fake+none+" (int-to-string (incf nnheader-fake-message-id)))
> 
> could incorporate the real article number and group name, so that when
> you re-enter the group, the fake message ID is the same as before.  I
> think this would help make Gnus more consistent, and the registry
> more useful (e.g. for nnrss groups).

It turns out that nnrss specifically is not a problem, but generally
these unique IDs are a nice thing for nnimap, for example, where you
don't want to download every article every time.  They work well, and
I added code today to support generating fake message IDs that are
repeatable w.r.t. the gnus-newsgroup-name and the article number.

If you notice any problems with the function below or with my patches
to allow for repeatable fake message IDs, let me know please.

Thanks
Ted

;; this function uses the gnus-registry to cache data; you need a recent Gnus in order to use that
(defun gnus-user-format-function-B (headers)
  (if (and headers gnus-newsgroup-name)
      (let* ((article (spam-fetch-field-fast -4332 'number headers)) ; -4332 is a fake article number
	     (id (spam-fetch-field-message-id-fast article headers))
	     (bounce (cdr-safe (gnus-registry-fetch-extra id 'qmail-bounce-address))))
	(if (and bounce (stringp bounce))
	    (format "C_BOUNCE %s" bounce)
	  (with-temp-buffer
	    (gnus-request-article-this-buffer
	     article
	     gnus-newsgroup-name)
	    (if (and
		 (search-forward "Hi. This is the" nil t)
		 (search-forward-regexp "<\\(.*\\)>:" nil t))
		(progn
		  (setq bounce (match-string 1))
		  (gnus-registry-store-extra-entry id 'qmail-bounce-address bounce)
		  (format "BOUNCE %s" bounce))
	      "no match"))))
    "invalid headers or group name"))



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-14 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-11 14:35 qmail bounce information in summary, plus a nnheader.el fake message ID question Ted Zlatanov
2004-06-14 17:23 ` Ted Zlatanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).