bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mailutils configuration, some work needed


From: Sam Roberts
Subject: Mailutils configuration, some work needed
Date: Fri, 22 Feb 2002 12:08:56 -0500
User-agent: Mutt/1.3.16i

Ok, Sergey, while we're both awake, I think we can
make the configuration work a little better.

Let me throw some ideas out for unifying the server-side
and user-side configuration mechanisms.

--maildir parsing is something that has to be explicitly coded
for by users of the mailbox API who want to open the spool.

I would like mailbox_open_default() to behave like this:

  "sroberts" -> if it exist in the cwd, detect 
     the spool for sroberts, using the --homedir specification.

  NULL -> $(USER) -> spool for $(USER)

  ! -> NULL -> see above

  ~/INBOX  -> $(HOME)/INBOX

  +file -> expand to ~/Mail/file -> $(HOME)/Mail/file

Where $(USER) is the env variable, or pulled out of /etc/passwd,
and likewise for $(HOME).

I think this will effectively move some of the maildir handling
code out of the server-side programs (mail.local, pop3d, ...)
into a place where all the users of the mailbox API will have
a common view of where the mail spool for a user is.

There's a bunch of ways to do this. One way we're already close
to is:

Have a global:

  char* mailbox_maildir = NULL; /* NULL means uses MU_PATH_MAILDIR

You can set it:

  mailbox_set_maildir(const char* maildir);

  mailbox_open_default() will use mailbox_maildir if it needs to (if
  the mbox is NULL, or the name of the user who's spool we want to open).


We're close to this with your common opts, but:

- the global variables set aren't known to the mailbox code

  How about if mu_common_argp_parser() calls a:
    mailbox_set_maildir(), so the arg is used by mailbox_open_default()
    mu_syslog_set_facility() so the arg is used by mu_syslog_error_printer()

- mu_argcv_get() takes all it's input from the command line args, or
  a system wide config file, there's no per-user configuration other
  than the command line, that's why I didn't use it for the sieve
  utility.

  Cut 1:

  mu_argcv_get() either takes an extra arg, the name of a rc file, and
  makes an argv containing:
    mailutils (maildir and syslog facility) from /etc/mailutils/rc
    everything from ~/.<argv[0]>rc OR the extra arg
    everything from the command line

  Would that be OK with you?

  Cut 2:

  /etc/mailutils.rc is currently 2 level, global and command-specific.
  But the "global" is too global. Does mail.local use the SQL and
  PAM stuff? If not, I'd stick it in what's called daemon options.
  Or mu_argcv_get() could take an array of those things it understands:

   // pseudo code!

  struct argp_child my_options[] =
{
    {&mu_authstuff_argp},
    {&mu_maildir_argp},
    {&mu_syslog_argp},
    {NULL, 0, NULL, 0},
};

  char* capa[] = { "authstuff", "maildir", "syslog", NULL }

  mu_argcv_get(argc, argv, "~/.utilrc", &av, &ac, capa);

    /* ASIDE: why isn't this an addon to the argp library already,
       it must have been done by a thousand programmers before
       us... And what about ENV variables, they should be tucked
       in after config files and before the arguments, can't
       we steal this code from another GNU project? */

  Cut 3:

  If we pass in a capa array, we can pull the exact pieces out we
  need, so you can have a ~/.mailutils.rc, and say I want the
  sieve options and the maildir options.


Do you have any comments on this approach, or maybe some other
suggestions? I can start working on this this weekend if we
have something that works to unify the server-side and client-side
utility configurations. I think the mu_argp stuff brings us
pretty close already.

Cheers!

> We already have --maildir option, understood by (almost) all mailutils 
> programs. Now it specifies the path to the mailspool directory. Its 
> argument is actually a URL, so one might run, e.g.  
>  
>     imap4d --maildir=mh:/home/USERNAME/Mail 

Could this be:

  --maildir=mh:~/Mail

Then the expansion could happen in mailbox_open_default(&mbox, "user"),
it would call the ~ expansion routines with "user" as an arg, and we
wouldn't need to write code to go looing through the string and
doing macro substitution, something I liked about your syntax here:

  --maildir=/usr/spool?user=

Sam

-- 
Sam Roberts <address@hidden> (Vivez sans temps mort!)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]