Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Is there a better way to reply "Disposition-Notification-To"?
@ 2007-06-29  4:33 id.brep
  0 siblings, 0 replies; only message in thread
From: id.brep @ 2007-06-29  4:33 UTC (permalink / raw)
  To: info-gnus-english

I want to reply messages with a "Disposition-Notification-To" field in
the header automatically.
Here is a working solution, is there a better soloution?

(add-hook 'gnus-startup-hook
          '(lambda ()
             (setq gnus-visible-headers
                   (concat "^Disposition-Notification-To:\\|"
                           gnus-visible-headers))))

(eval-after-load "gnus-sum"
  '(add-hook 'gnus-mark-article-hook 'my-check-notification))

(defun my-check-notification ()
  (if (gnus-summary-article-unread-p (gnus-summary-article-number))
      (add-hook 'gnus-article-prepare-hook 'my-reply-notification)
    (remove-hook 'gnus-article-prepare-hook 'my-reply-notification)))

(defun my-reply-notification ()
  (save-excursion
    (save-restriction
      (message-narrow-to-headers)
      (if (and (mail-fetch-field "disposition-notification-to")
	       (yes-or-no-p "Really send the dispositon notification?"))
          (progn (gnus-summary-reply)
                 (insert "Got it, thanks.")
                 (message-send-and-exit))))))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-29  4:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-29  4:33 Is there a better way to reply "Disposition-Notification-To"? id.brep

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