diff -urN imap-2001a.RELEASE-CANDIDATE.2.orig/Makefile imap-2001a.RELEASE-CANDIDATE.2/Makefile --- imap-2001a.RELEASE-CANDIDATE.2.orig/Makefile Fri Oct 19 18:53:15 2001 +++ imap-2001a.RELEASE-CANDIDATE.2/Makefile Mon Oct 29 17:46:41 2001 @@ -211,8 +211,21 @@ # years. The Orthodox and Gregorian calendars diverge by 1 day for # gradually-increasing intervals, starting at 2800-2900, and becoming # permanent at 48,300. +# +# -DMBXHOMEDIR="/var/spool/mbx" +# If /var/spool/mbx/user/INBOX exists, mail is delivered there +# (allows you to have both users with MBX mailboxes and folders on the +# mail server, while others use MBOX format and have folders in their +# homedirs (MBX doesn't work over NFS)) +# This lets you have a mix of users who do imap only or do a mix of +# imap and reading mbox mailboxes via NFS in their homedir +# (by Marc MERLIN, http://marc.merlins.org/linux/uwimap/) +# +# -DHOMEMAILDIR="Mail" +# Will look for folders in /home/user/Mail instead of /home/user +# (by Marc MERLIN, http://marc.merlins.org/linux/uwimap/) -EXTRACFLAGS= +EXTRACFLAGS=-DMBXHOMEDIR="/var/spool/mbx" -DHOMEMAILDIR="Mail" # Extra linker flags (additional/alternative libraries, etc.) diff -urN imap-2001a.RELEASE-CANDIDATE.2.orig/src/osdep/unix/env_unix.c imap-2001a.RELEASE-CANDIDATE.2/src/osdep/unix/env_unix.c --- imap-2001a.RELEASE-CANDIDATE.2.orig/src/osdep/unix/env_unix.c Wed Oct 17 20:35:20 2001 +++ imap-2001a.RELEASE-CANDIDATE.2/src/osdep/unix/env_unix.c Tue Oct 30 11:24:31 2001 @@ -628,6 +628,7 @@ { extern MAILSTREAM CREATEPROTO; extern MAILSTREAM EMPTYPROTO; + extern MAILSTREAM mbxproto; struct passwd *pw; struct stat sbuf; char tmp[MAILTMPLEN]; @@ -673,7 +674,29 @@ sysInbox = cpystr (tmp); /* make system INBOX */ anonymous = T; /* flag as anonymous */ } - myHomeDir = cpystr (home); /* set home directory */ +#ifdef MBXHOMEDIR + /* If that specific user has an INBOX in the MBX location, we look for */ + /* all our files there */ + sprintf (tmp,"%s/%s/INBOX",MBXHOMEDIR,myUserName); + if (access (tmp, R_OK | W_OK) == 0) { + sprintf (tmp,"%s/%s/",MBXHOMEDIR,myUserName); + myHomeDir = cpystr (tmp); + + /* Our default is to create new mailboxes in unix mailbox format, but */ + /* we change this to MBX if the user has MBX mailboxes in MBXHOMEDIR */ + createProto = &mbxproto; + } + else { +#endif +#ifdef HOMEMAILDIR + sprintf (tmp,"%s/%s",home,HOMEMAILDIR); + myHomeDir = cpystr (tmp); +#else + myHomeDir = cpystr (home); /* set home directory */ +#endif +#ifdef MBXHOMEDIR + } +#endif } if (allowuserconfig) { /* allow user config files */