Gnus development mailing list
 help / color / mirror / Atom feed
From: "Ted Zlatanov" <tzz@lifelogs.com>
Subject: Re: qmail bounce information in summary, plus a nnheader.el fake message ID question
Date: 14 Jun 2004 13:23:39 -0400	[thread overview]
Message-ID: <4n4qpeyrxg.fsf@lifelogs.com> (raw)
In-Reply-To: <4nwu2ejh7m.fsf@lifelogs.com> (Ted Zlatanov's message of "Fri, 11 Jun 2004 10:35:09 -0400")

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"))



      reply	other threads:[~2004-06-14 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-11 14:35 Ted Zlatanov
2004-06-14 17:23 ` Ted Zlatanov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4n4qpeyrxg.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).