Skip to content

Commit

Permalink
Enable delivery to Exchange 2007 IMAP
Browse files Browse the repository at this point in the history
Set env FDM_EXCHANGE_VERSION=2007 to activate workaround
  • Loading branch information
filippz committed Mar 22, 2019
1 parent 4268e46 commit 4c8cde5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions deliver-imap.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ deliver_imap_deliver(struct deliver_ctx *dctx, struct actitem *ti)
struct io *io;
struct fetch_ctx fctx;
struct fetch_imap_data fdata;
char *cause, *folder, *ptr, *line;
char *cause, *folder, *ptr, *line, *exchange_version;
size_t len, maillen;
u_int total, body;

Expand Down Expand Up @@ -235,9 +235,14 @@ deliver_imap_deliver(struct deliver_ctx *dctx, struct actitem *ti)
*/
count_lines(m, &total, &body);
maillen = m->size + total - 1;
if (fdata.capa & IMAP_CAPA_XYZZY) {
log_debug2("%s: adjusting size: actual %zu", a->name, maillen);
maillen = m->size;
exchange_version = getenv("FDM_EXCHANGE_VERSION");
if (exchange_version != NULL) {
if (strncmp(exchange_version, "2007", strlen(exchange_version)) == 0) {
log_debug2("%s: reducing size by 1 for Exchange %s", a->name, exchange_version);
maillen--;
}
}
if (fdata.capa & IMAP_CAPA_XYZZY) { log_debug2("%s: adjusting size: actual %zu", a->name, maillen); maillen = m->size;
}
if (fdata.capa & IMAP_CAPA_NOSPACE) {
if (imap_putln(a, "%s{%zu}", folder, maillen) != 0)
Expand Down

0 comments on commit 4c8cde5

Please sign in to comment.