mbox-sync-parse.c revision d371507847d62ba311b4bcc23d18f45c3d0f1a38
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen/* Copyright (C) 2004 Timo Sirainen */
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen/* MD5 header summing logic was pretty much copy&pasted from popa3d by
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen Solar Designer */
047c00cd3f7f403672f81569413669238df8c15aTimo Sirainen#define IS_LWSP_LF(c) (IS_LWSP(c) || (c) == '\n')
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen int (*func)(struct mbox_sync_mail_context *ctx,
4d4d6d4745682790c20d759ba93dbea46b812c5dTimo Sirainenstatic void parse_trailing_whitespace(struct mbox_sync_mail_context *ctx,
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen /* the value may contain newlines. we can't count whitespace before
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen and after it as a single contiguous whitespace block, as that may
a3fe8c0c54d87822f4b4f8f0d10caac611861b2bTimo Sirainen get us into situation where removing whitespace goes eg.
578ef2538ccf42e2a48234c24a8b709397101d88Timo Sirainen " \n \n" -> " \n\n" which would then be treated as end of headers.
578ef2538ccf42e2a48234c24a8b709397101d88Timo Sirainen that could probably be avoided by being careful, but as newlines
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen should never be there (we don't generate them), it's not worth the
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen ctx->mail.offset = hdr->full_value_offset + i;
3f603ef00e35fca21605afa0ad8d76e94fee2b96Timo Sirainenstatic enum mail_flags mbox_flag_find(struct mbox_flag_type *flags, char chr)
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainenstatic void parse_status_flags(struct mbox_sync_mail_context *ctx,
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen mbox_flag_find(flags_list, hdr->full_value[i]);
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainenstatic int parse_status(struct mbox_sync_mail_context *ctx,
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen parse_status_flags(ctx, hdr, mbox_status_flags);
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen ctx->hdr_pos[MBOX_HDR_STATUS] = str_len(ctx->header);
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainenstatic int parse_x_status(struct mbox_sync_mail_context *ctx,
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen parse_status_flags(ctx, hdr, mbox_xstatus_flags);
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen ctx->hdr_pos[MBOX_HDR_X_STATUS] = str_len(ctx->header);
6c2ce1d5bf17b21e804a079eb0f973b7ab83e0d8Timo Sirainenstatic int parse_x_imap_base(struct mbox_sync_mail_context *ctx,
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen const char *str;
return FALSE;
t_push();
t_pop();
pos++;
if (uid_validity == 0) {
return FALSE;
return TRUE;
return TRUE;
return FALSE;
return TRUE;
return TRUE;
size_t i;
return FALSE;
return FALSE;
return FALSE;
return TRUE;
size_t i;
return TRUE;
size_t i;
return FALSE;
return FALSE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return &header_funcs[i];
return NULL;
for (i = 0; i < MBOX_HDR_COUNT; i++)
line_start_pos = 0;