Gnus development mailing list
 help / color / mirror / Atom feed
* message-send-mail-function, agent, and a day of work
@ 2004-04-15 16:05 Wes Hardaker
  2004-04-15 17:20 ` Kevin Greiner
  0 siblings, 1 reply; 7+ messages in thread
From: Wes Hardaker @ 2004-04-15 16:05 UTC (permalink / raw)
  Cc: Michael Baer


I spent way too much time the other day figuring out why my simple
code to switch smtp servers was not working and all.  I was properly
setting every variable I could find documented, but the effect seemed
to be nothing.  The end result was because I was running with the
agent turned on, I was missing a variable that is not documented with
the rest of them (which makes some sense, as all the agents stuff is
in one place).

The problem is essentially this:

1) when you read about sending mail, the documentation says that the
   variable 'message-send-mail-function is consulted to figure out how
   to send mail.  This is what I was trying to modify.

2) However, the agent has his own variable for what to do when sending
   anything:  gnus-agent-send-mail-function.

The problem is twofold: first, there is no reference to the second
variable in least a warning in the documentation related to sending
mail.  Since the agent is turned on by default now, this will likely
confuse a lot of people.  Second, the second variable is independent
of the first.  This is part of the confusion.  I think the most simple
solution would be to make the second variable point to a different
function which checks the value of the first variable and uses that
at runtime.  By default they both point at the same value, however, if
the first one changes the second one never picks up that change in
value.

The gnus-agent-send-mail-function variable is set in gnus-agentize as
follows:

  (unless gnus-agent-send-mail-function
    (setq gnus-agent-send-mail-function
	  (or message-send-mail-real-function
	      message-send-mail-function)
	  message-send-mail-real-function 'gnus-agent-send-mail))

I'm suggesting this would be better:

  (defun gnus-agent-use-current-send-mail-function ()
         (funcall (or message-send-mail-real-function
                      message-send-mail-function)))

  (unless gnus-agent-send-mail-function
    (setq gnus-agent-send-mail-function
          'gnus-agent-use-current-send-mail-function))

This way dynamic changes to the message-send-mail-function are picked
up, but it still allows for customization of the agent specifically if
desired.

Thoughts?

-- 
"In the bathtub of history the truth is harder to hold than the soap,
 and much more difficult to find."  -- Terry Pratchett



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

end of thread, other threads:[~2004-04-16  4:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-15 16:05 message-send-mail-function, agent, and a day of work Wes Hardaker
2004-04-15 17:20 ` Kevin Greiner
2004-04-15 18:26   ` Wes Hardaker
2004-04-15 20:28     ` Kevin Greiner
2004-04-15 20:35       ` Wes Hardaker
2004-04-15 23:50         ` Kevin Greiner
2004-04-16  4:09           ` Wes Hardaker

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