Gnus development mailing list
 help / color / mirror / Atom feed
* mail-sources strangeness
@ 2000-06-10 21:31 Kai Großjohann
  2000-08-13 18:42 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2000-06-10 21:31 UTC (permalink / raw)
  Cc: Michael Hühne

`mail-sources' uses pop3-movemail if nothing is specified, right?  So
the following two behave the same, right?

(setq mail-sources '((pop :user "foo" :server "bar"))
(setq mail-sources '((pop :user "foo" :server "bar" :function pop3-movemail))

Wrong.

/----
|       (setq result
| 	    (cond
| 	     (program
| 	      (mail-source-fetch-with-program
| 	       (format-spec
| 		program
| 		(format-spec-make ?p password ?t mail-source-crash-box
| 				  ?s server ?P port ?u user))))
| 	     (function
| 	      (funcall function mail-source-crash-box))
| 	     ;; The default is to use pop3.el.
| 	     (t
| 	      (let ((pop3-password password)
| 		    (pop3-maildrop user)
| 		    (pop3-mailhost server)
| 		    (pop3-port port)
| 		    (pop3-authentication-scheme
| 		     (if (eq authentication 'apop) 'apop 'pass)))
| 		(save-excursion (pop3-movemail mail-source-crash-box))))))
\----

This code binds lots of variables if `:function' isn't present, and
does nothing like this if `:function' is present.

I think there should be a specified protocol for passing the necessary
information to the function: user name, host name, password, port,
authentication scheme.  It's not clear to me how a function is
supposed to get at these values, anyway.  (Well, there is
`mail-source-bind' which might do this, but it's not easy to
understand what that does...  Hm.  It appears to provide defaults for
the colon keywords.)

Whichever scheme is chosen, it should be documented, I think.  And
there should be a function which can be put in like `:function foo'
such that the default behavior is chosen.

A simple idea would be to merge the `function' and `t' cases in the
cond such that pop3-password, ..., pop3-authentication-scheme are
always bound and save-excursion is always used to execute the
function.

kai
-- 
I like BOTH kinds of music.



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

* Re: mail-sources strangeness
  2000-06-10 21:31 mail-sources strangeness Kai Großjohann
@ 2000-08-13 18:42 ` Lars Magne Ingebrigtsen
  2000-08-13 19:34   ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2000-08-13 18:42 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> `mail-sources' uses pop3-movemail if nothing is specified, right?

Well, no.  :-) If nothing is specified, it kinda calls another
function (well, progn, but in Emacs Lisp there's not much of a
difference) which then calls pop3-movemail.

> So
> the following two behave the same, right?
> 
> (setq mail-sources '((pop :user "foo" :server "bar"))
> (setq mail-sources '((pop :user "foo" :server "bar" :function pop3-movemail))
> 
> Wrong.

Yup. 

> I think there should be a specified protocol for passing the necessary
> information to the function: user name, host name, password, port,
> authentication scheme.  It's not clear to me how a function is
> supposed to get at these values, anyway.  (Well, there is
> `mail-source-bind' which might do this, but it's not easy to
> understand what that does...  Hm.  It appears to provide defaults for
> the colon keywords.)

Yup.

> Whichever scheme is chosen, it should be documented, I think.  And
> there should be a function which can be put in like `:function foo'
> such that the default behavior is chosen.

Well, OK, but the function will just look like the progn there, with a
defun before it.  Emacs Lisp has nice dynamic variables, so they
should be used.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: mail-sources strangeness
  2000-08-13 18:42 ` Lars Magne Ingebrigtsen
@ 2000-08-13 19:34   ` Kai Großjohann
  2000-08-13 19:43     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2000-08-13 19:34 UTC (permalink / raw)


On 13 Aug 2000, Lars Magne Ingebrigtsen wrote:

> Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:
> 
>> `mail-sources' uses pop3-movemail if nothing is specified, right?
> 
> 
>> Whichever scheme is chosen, it should be documented, I think.  And
>> there should be a function which can be put in like `:function foo'
>> such that the default behavior is chosen.
> 
> Well, OK, but the function will just look like the progn there, with
> a defun before it.  Emacs Lisp has nice dynamic variables, so they
> should be used.  :-)

I think I needed many words to say the following:

When I use the :function keyword inside a `pop' mail source, how does
the function know about the user name, host name, and so on?

In other words:

Nowhere in the node `Mail Source Specifiers' it is documented how such
a function knows about the user name and host name and so on.

kai
-- 
I like BOTH kinds of music.



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

* Re: mail-sources strangeness
  2000-08-13 19:34   ` Kai Großjohann
@ 2000-08-13 19:43     ` Lars Magne Ingebrigtsen
  2000-08-14 12:59       ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2000-08-13 19:43 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> When I use the :function keyword inside a `pop' mail source, how does
> the function know about the user name, host name, and so on?

It should be documented which variables are bound when the function is
called; yes.  It's the variables in `mail-source-keyword-map'. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: mail-sources strangeness
  2000-08-13 19:43     ` Lars Magne Ingebrigtsen
@ 2000-08-14 12:59       ` Kai Großjohann
  2000-08-14 17:11         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2000-08-14 12:59 UTC (permalink / raw)


On 13 Aug 2000, Lars Magne Ingebrigtsen wrote:

> It should be documented which variables are bound when the function
> is called; yes.  It's the variables in `mail-source-keyword-map'.

Hm.  Hmmm...  I looked at the source (cursorily), and it appears that
an entry `(pop :host "foo" :user "jrl" :password "verysecret")' means
that the symbols `host', `user' and `password' are bound, to "foo",
"jrl", and "verysecret", respectively.

Is this what you mean?  Then I'll try to document this.

kai
-- 
I like BOTH kinds of music.



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

* Re: mail-sources strangeness
  2000-08-14 12:59       ` Kai Großjohann
@ 2000-08-14 17:11         ` Lars Magne Ingebrigtsen
  2000-08-14 21:05           ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2000-08-14 17:11 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> Hm.  Hmmm...  I looked at the source (cursorily), and it appears that
> an entry `(pop :host "foo" :user "jrl" :password "verysecret")' means
> that the symbols `host', `user' and `password' are bound, to "foo",
> "jrl", and "verysecret", respectively.

Yes.  But not only those.  For instance, pop mail source functions
will have the following variables bound:

      (pop
       (:prescript)
       (:prescript-delay)
       (:postscript)
       (:server (getenv "MAILHOST"))
       (:port 110)
       (:user (or (user-login-name) (getenv "LOGNAME") (getenv "USER")))
       (:program)
       (:function)
       (:password)
       (:authentication password))

With the default values as shown, and with the user-supplied values
overriding the defaults.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



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

* Re: mail-sources strangeness
  2000-08-14 17:11         ` Lars Magne Ingebrigtsen
@ 2000-08-14 21:05           ` Kai Großjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2000-08-14 21:05 UTC (permalink / raw)


On 14 Aug 2000, Lars Magne Ingebrigtsen wrote:

> Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:
> 
>> Hm.  Hmmm...  I looked at the source (cursorily), and it appears
>> that an entry `(pop :host "foo" :user "jrl" :password
>> "verysecret")' means that the symbols `host', `user' and `password'
>> are bound, to "foo", "jrl", and "verysecret", respectively.
> 
> Yes.  But not only those.  For instance, pop mail source functions
> will have the following variables bound:

I see.  Here's the new text for the info file that I've just
commited.  Okay?

/----
| Function Interface
| ..................
| 
|    Some of the above keywords specify a Lisp function to be executed.
| For each keyword `:foo', the Lisp variable `foo' is bound to the value
| of the keyword while the function is executing.  For example, consider
| the following mail-source setting:
| 
|      (setq mail-sources '((pop :user "jrl"
|                                :server "pophost" :function fetchfunc)))
| 
|    While the function `fetchfunc' is executing, the symbol `user' is
| bound to `"jrl"', and the symbol `server' is bound to `"pophost"'.  The
| symbols `port', `password', `program', `prescript', `postscript',
| `function', and `authentication' are also bound (to their default
| values).
| 
|    See above for a list of keywords for each type of mail source.
| 
\----

This comes at the end of the `Mail Source Specifiers' node.

kai
-- 
I like BOTH kinds of music.



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

end of thread, other threads:[~2000-08-14 21:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-10 21:31 mail-sources strangeness Kai Großjohann
2000-08-13 18:42 ` Lars Magne Ingebrigtsen
2000-08-13 19:34   ` Kai Großjohann
2000-08-13 19:43     ` Lars Magne Ingebrigtsen
2000-08-14 12:59       ` Kai Großjohann
2000-08-14 17:11         ` Lars Magne Ingebrigtsen
2000-08-14 21:05           ` Kai Großjohann

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