Codebase list fdm / b2130d1
Attempted workaround for some Google brokenness. Nicholas Marriott 13 years ago
4 changed file(s) with 24 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
0 01 September 2010
1
2 * Detect GMail's XYZZY capability for IMAP and use it to try and workaround
3 some of their broken behaviour (incorrectly reported message sizes).
4
05 31 May 2009
16
27 * Print a warning on missing maildirs when fetching from them rather than
169169 struct fetch_ctx fctx;
170170 struct fetch_imap_data fdata;
171171 char *cause, *folder, *ptr, *line;
172 size_t len;
172 size_t len, maillen;
173173 u_int total, body;
174174
175175 /* Connect to the IMAP server. */
227227 goto error;
228228 }
229229
230 /* Send the mail size, not forgetting lines are CRLF terminated. */
230 /*
231 * Send the mail size, not forgetting lines are CRLF terminated. The
232 * Google IMAP server is written strangely, so send the size as if
233 * every CRLF was a CR if the server has XYZZY.
234 */
231235 count_lines(m, &total, &body);
232 if (imap_putln(a, "%s {%zu}", folder, m->size + total - 1) != 0)
236 maillen = m->size + total - 1;
237 if (fdata.capa & IMAP_CAPA_XYZZY) {
238 log_debug2("%s: adjusting size: actual %zu", a->name, maillen);
239 maillen = m->size;
240 }
241 if (imap_putln(a, "%s {%zu}", folder, maillen) != 0)
233242 goto error;
234243 switch (deliver_imap_waitappend(a, &fctx, io, &line)) {
235244 case IMAP_TAG_ERROR:
244244 #define IMAP_UNTAGGED 2
245245 #define IMAP_RAW 3
246246
247 #define IMAP_CAPA_AUTH_CRAM_MD5 0x1
248 #define IMAP_CAPA_XYZZY 0x2
249
247250 /* fetch-maildir.c */
248251 extern struct fetch fetch_maildir;
249252
6060 int imap_state_close(struct account *, struct fetch_ctx *);
6161 int imap_state_quit(struct account *, struct fetch_ctx *);
6262
63 #define IMAP_CAPA_AUTH_CRAM_MD5 0x1
64
6563 /* Put line to server. */
6664 int
6765 imap_putln(struct account *a, const char *fmt, ...)
368366 if (strstr(line, "AUTH=CRAM-MD5") != NULL)
369367 data->capa |= IMAP_CAPA_AUTH_CRAM_MD5;
370368
369 /* Use XYZZY to detect Google brokenness. */
370 if (strstr(line, "XYZZY") != NULL)
371 data->capa |= IMAP_CAPA_XYZZY;
372
371373 fctx->state = imap_state_capability2;
372374 return (FETCH_AGAIN);
373375 }