i implemented some cool stuff (tm).
first, the long missing "create server-side missing mailboxes". -C now
creates both local and remote boxes; -L and -R create only local/remote.
second, i implemented a 1:1 remote:local folder mapping (-1) with an
optional INBOX exception (inbox/-I). the remote folder is specified with
the folder keyword (or -F switch) and takes precedence over the
namespace setting. the local directory with the mailboxes can now be
specified on the command line, too (-M).
another patch:
- made the -1 switch settable permanently (OneToOne). after all, you
usually define your mailbox layout once forever. removed -A, as it is
semantically -a modified by -1.
- cleaned up message output a bit. still, the quiet variable should be
used throughout the program. at best, create some generic output
function, which obeys a global verbosity level variable.
- optimized + cleaned up configuration parser slightly
- minor cleanups
add an (almost) unique id to every uploaded message and search for it
right after. i thought about using the message-id, but a) it is not
guaranteed to be unique in a mailbox (imagine you edit a mail and store
the dupe in the same box) and b) some mails (e.g., postponed) don't even
have one. a downside of the current implementation is, that this
id-header remains in the mailbox, but given that it wastes only 27 bytes
per mail and removing it would mean several roundtrips more, this seems
acceptable.
i changed the line-counting loop to use a mmapped file instead of
reading it in chunks, as it makes things simpler and is probably even
faster for big mails.
the amount of goto statements in my code may be scary, but c is simply
lacking a multi-level break statement. :)
this is the "shut up" patch. :) it makes the -q option consequent, so to
say.
additionally it adds an -l option which gathers all defined/found
mailboxes and just outputs the list. don't ask what i need it for. ;)
- move prompt for password to imap_open()
- don't ask for global password in PREAUTH state
- use socketpair() to create one full-duplex fd in tunnel mode
instead of two half-duplex pipes
- don't set lck.l_pid in fcntl() call (its read-only)
- use F_SETLK instead of F_SETLKW to avoid infinite waiting
- use "$@" in autogen.sh to get proper word expansion
move dotlocking code to dotlock.c.
dotlocking code fixed to ignore whether or not the lockfile exists on
open(). we only care about whether fcntl() was able to lock it.
locking cleanups from Oswald Buddenhagen <ossi@kde.org>
* don't need to stat the lockfile since it will always be size 0
* only remove lockfile when we actually succeeded in locking
fixed segmentation fault caused by double free() when an error occurred
during the IMAP transmission.
fixed bug where isync could not handle a 0 value UIDVALIDITY
Added Tunnel directive to allow the user to specify a shell command to run
to set up an IMAP connection in place of a TCP socket (eg., to run over
an SSH session).