Commit Graph

56 Commits

Author SHA1 Message Date
Oswald Buddenhagen
2585dd3324 add support for hierarchical mailboxes 2012-09-01 21:15:18 +02:00
Oswald Buddenhagen
28cccf4b35 fix error handling of invalid SyncState *
when we find that the store is incompatible with in-store sync state,
we want to fail the whole channel. however, we must not claim that the
store died, otherwise it won't be disposed of properly.
2012-09-01 21:15:08 +02:00
Oswald Buddenhagen
233f563569 deal with concurrent maildir modifications during listing
files may be renamed (due to new -> cur transition or flag changes),
which may lead to two effects if ignored:
- we see both the old and the new name, so we report a spurious
  duplicate UID
- we see neither name, so we report a spurious deletion

as countermeasure, record and compare directory modification times. upon
mismatch, we just start over - as usual.
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
9c86ec3442 employ alternative scheme to finding messages by TUID
instead of SEARCHing every single message (which is slow and happens to
be unreliabe with M$ Exchange 2010), just FETCH the new messages from
the mailbox - the ones we just appended will be amongst them.
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
06b303da88 use ATTR_PRINTFALIKE 2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
2aae866e80 remove Ontty flag
i can't figure out why i added it in the first place. it doesn't seem to
make any sense ...
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
6b3b6f12bb centralize flushing of unfinished debug lines 2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
d2bed4990d unify error reporting
- introduce sys_error() and use it instead of perror() and
  error(strerror()) in all expected error conditions
- perror() is used only for "something's really wrong with the system"
  kind of errors
- file names, etc. are quoted if they are not validated yet, so e.g. an
  empty string becomes immediately obvious
- improve and unify language
- add missing newlines
2012-09-01 21:15:07 +02:00
Oswald Buddenhagen
ae85e455d3 enlarge receive buffer considerably
the tiny buffer makes no sense in the face of huge payloads and now
additionally masses of replies from pipelined commands.
2012-09-01 21:15:06 +02:00
Oswald Buddenhagen
96eaeb428d define _GNU_SOURCE on the command line
that way it is already set in configure and can thus be used by tests.
2012-09-01 21:14:53 +02:00
Oswald Buddenhagen
bd93d689db fully asynchronous IMAP operation
- asynchronous sockets using an event loop
  - connect & starttls have completion callback parameters
  - callbacks for notification about filled input buffer and emptied
    output buffer
- unsent imap command queue
  - used when
    - socket output buffer is non-empty
    - number of commands in flight exceeds limit
    - last sent command requires round-trip
    - command has a dependency on completion of previous command
  - trashnc is tri-state so only a single "scout" trash APPEND/COPY is
    sent at first. a possibly resulting CREATE is injected in front of
    the remaining trash commands, so they can succeed (or be cancel()d
    if it fails).
  - queue's presence necessitates imap_cancel implementation
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
7867eb9009 add simple mainloop implementation
not used so far
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
802c99edcf make socket read/write error reporting callback-based
the functions still have synchronous return codes as well - this enables
early error returns without having to resort to refcounting.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
f1df2f40d1 decouple the filling of the read buffer from consuming it
this prepares the code for being called from a callback.

notably, this makes the imap list parser have a "soft stack", so the
recursion can be suspended at any time.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
f8d73ac346 make socket_write() capable of taking ownership of the buffer
that way the user code doesn't have to free it any more.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
171f7d6cd3 Socket_t + buffer_t => conn_t
remove the layering, in favor of a "buffered connection" abstraction.
2012-09-01 16:03:36 +02:00
Oswald Buddenhagen
ef41349035 move socket code to a separate file
this makes the layering more obvious
2012-09-01 16:03:35 +02:00
Oswald Buddenhagen
584e51ed7d docs
- insert "separator comments" between driver entry points
- document driver API
- document sync_vars_t parts that are stored in the sync state header
2012-09-01 16:03:35 +02:00
Oswald Buddenhagen
05fd0b9970 split out drv->load() from drv->select() 2012-09-01 16:02:50 +02:00
Oswald Buddenhagen
ea951a697f fix error paths wrt sync drivers, take 2
synchronous error codes which are passed through callbacks aren't a
particularly good idea, after all: latest when the callback does stuff
which does not concern the caller, the return code becomes ambiguous.
instead, protect the sync_vars object with a refcount when invoking
driver functions from loops, as the callbacks they call could invalidate
the object and we would have no way of knowing that the loop should be
aborted prematurely. the upcoming async imap driver will also need a
refcount to protect the cancelation marker of the imap socket dispatcher
loop.
2012-07-30 01:21:32 +02:00
Oswald Buddenhagen
b0bbd23512 replace DRV_STORE_BAD with a separate bad_callback()
that way we don't have to piggy-back (possibly asynchronous) fatal
errors to particular commands.

internally, the drivers still use synchronous return values as well,
so they don't try to access the invalidated store after calling back.
2012-07-30 01:21:31 +02:00
Oswald Buddenhagen
9554026443 make drv->cancel()'s callback have no status code
this function is not going to actually execute any commands, so it
makes no sense for the callback to have a status code.
2012-07-29 12:25:24 +02:00
Oswald Buddenhagen
fd229040d8 DRV_SERVER_BAD is and will probably stay unused => trash 2012-07-07 18:00:47 +02:00
Oswald Buddenhagen
e6a356ffc7 add extra verbose mode which dumps the message contents
i needed that to debug the line ending issues. maybe it will find other
uses as well ...
2010-02-06 10:49:57 +01:00
Oswald Buddenhagen
d94dadbaeb fix line ending conversion logic
imap may very well store messages with LF line endings. only RFC2822
requires CRLF.
consequently, preserve the line endings as much as possible unless the
mailbox format does not support it (this would be the case for unix mbox
- i actually have no idea about maildir).
2010-02-06 10:49:57 +01:00
Oswald Buddenhagen
023d3ee577 fix error paths wrt sync drivers 2006-12-09 10:39:30 +00:00
Oswald Buddenhagen
168e5f3282 make the driver model, sync_chans() and sync_boxes() fully async.
async drivers to follow ...
2006-03-21 20:03:21 +00:00
Oswald Buddenhagen
72a2d4b690 info() about opening of stores 2006-03-21 10:30:45 +00:00
Oswald Buddenhagen
3e3cf3ac9a update copyrights 2006-03-20 20:16:22 +00:00
Oswald Buddenhagen
7f9ece8e7e move whole responsibility for recycling open stores/server connections
to the drivers.
2006-03-20 19:38:20 +00:00
Oswald Buddenhagen
47e592b603 keep the result of driver->list() and a flag whether it is valid in the store. 2006-03-20 19:27:38 +00:00
Oswald Buddenhagen
861dd7468e aggregate all (two ...) drivers in an array instead of naming them in
each (one ...) location explicitly.
2006-03-20 18:36:49 +00:00
Oswald Buddenhagen
d7126dca5e "fprintf( stderr," => "error(". new functions debugn() and infon()
for messages with missing newline; warn() and error() act upon this.
2006-03-19 11:29:12 +00:00
Oswald Buddenhagen
1453e61840 update fsf's postal address. i think it's sort of useless nowadays
anyway, but heck ...
2006-02-09 17:44:22 +00:00
Oswald Buddenhagen
850addecd5 wrap message storing into transactions. nice side effect: drivers don't
need to deal with line end conversion any move.
2006-02-03 21:33:43 +00:00
Oswald Buddenhagen
19128f1587 major overhaul of flag change propagation and MaxMessages handling:
- wrap message (un)expirations into transactions
- no redundand flag propagations in conjunction with expirations
- better prepared for the upcoming async operation
2006-02-02 17:03:01 +00:00
Oswald Buddenhagen
1a536a3415 M_EXPIRED -> M_EXPIRE 2006-01-30 13:49:46 +00:00
Oswald Buddenhagen
c7d938f965 now that messages know their sync records, M_SYNCES is superfluous. 2006-01-30 11:12:14 +00:00
Oswald Buddenhagen
2277ecefb6 establish bi-directional mapping between mails and sync records. use it
to merge the --renew case into the --new case.
2006-01-30 10:26:04 +00:00
Oswald Buddenhagen
9c6c158ef3 undocumented flag -J to skip committing the new sync state. 2006-01-29 15:46:09 +00:00
Oswald Buddenhagen
a1a5a817bb merge Quiet, Verbose & Debug into DFlags 2006-01-29 14:46:16 +00:00
Oswald Buddenhagen
185769640b M_NOT_SYNCED => M_SYNCED. now that sync records know their messages, it
is simpler to track the positive case.
2006-01-29 11:49:49 +00:00
Oswald Buddenhagen
a1c402678c split driver->prepare into ->prepare_opts and ->prepare_paths 2006-01-29 11:22:45 +00:00
Oswald Buddenhagen
4ec56f8cf6 - instead of having {m,s}foo, we have foo[2] now, so we can do
everything with loops instead of symmetric function calls
- added some const
2005-12-28 10:02:22 +00:00
Oswald Buddenhagen
e0cc45044f stdarg.h at the right places 2004-09-20 11:28:33 +00:00
Oswald Buddenhagen
130664b622 The Big Rewrite. too many change to list them all.
as opposed to earlier threats, BerkDB was not entirely dropped; i
suppose the isync 0.7 -> 0.8 change had a reason, so i added an
alternative UID storage scheme.
note that BDB 4.0 is not sufficient, as the db->open function changed in
an incompatible way ...

i updated the debian packaging except for a changelog entry.
note that i removed the upgrade blurb, as upstream now has a smooth
upgrade path down to at least isync 0.4.
2004-03-27 16:07:20 +00:00
Oswald Buddenhagen
a52fd7dde0 more sophisticated CAPABILITY handling. also, don't issue the command if
the initial response already had it in the status code.
2004-01-31 01:01:07 +00:00
Oswald Buddenhagen
c2c4490431 following the "screw murphy" principle and commiting untested patch:
obey LOGINDISABLED
2004-01-30 23:35:50 +00:00
Oswald Buddenhagen
f80f91d98b make Tag int, move it to imap.c 2004-01-27 20:50:49 +00:00
Oswald Buddenhagen
b5307f0e16 another message output cleanup, still not perfect (info messages will be
interleaved with progress dots).
support specifying -q twice to suppress warnings as well.
2004-01-18 02:22:17 +00:00