mbox-sync-update.c revision fb2e0bbb7737f3223b16aa41e4b40fb0cd5f288f
/* Copyright (C) 2004 Timo Sirainen */
#include "lib.h"
#include "array.h"
#include "buffer.h"
#include "str.h"
#include "message-parser.h"
#include "index-storage.h"
#include "mbox-storage.h"
#include "mbox-sync-private.h"
/* Line length when to wrap X-IMAP, X-IMAPbase and X-Keywords headers to next
line. Keep this pretty long, as after we wrap we lose compatibility with
UW-IMAP */
#define KEYWORD_WRAP_LINE_LENGTH 1024
const struct mbox_flag_type *flags_list)
{
int i;
for (i = 0; flags_list[i].chr != 0; i++) {
}
}
{
int i;
if (diff == 0) {
} else {
/* FIXME: if (diff < ctx->space && pos < ctx->offset) then
space from there. update header_last_change accordingly.
(except pos and offset can't be compared directly) */
for (i = 0; i < MBOX_HDR_COUNT; i++) {
}
/* free space offset moves */
}
}
if (diff < 0)
else {
}
}
}
const struct mbox_flag_type *flags_list)
{
unsigned char *data;
/* how many bytes do we need? */
need++;
}
/* how many bytes do we have now? */
break;
/* see if this is unknown flag for us */
for (i = 0; flags_list[i].chr != 0; i++) {
break;
}
if (flags_list[i].chr != 0)
have++;
else {
/* save this one */
}
}
/* @UNSAFE */
}
}
const array_t *keyword_indexes_arr)
{
ARRAY_SET_TYPE(keyword_indexes_arr, unsigned int);
const char *const *keyword_names;
const unsigned int *keyword_indexes;
unsigned int i, idx_count, keywords_count;
/* wrap the line whenever it gets too long */
if (i > 0)
} else {
}
}
}
static void
{
const char *const *names;
const unsigned char *p;
unsigned int i, count;
last_break = 0;
else {
/* set last_break to beginning of line */
break;
}
}
for (i = 0; i < count; i++) {
/* wrap the line whenever it gets too long */
else {
}
}
}
{
if (new_hdr_size > 0 &&
/* broken header - doesn't end with \n. fix it. */
}
}
}
}
}
}
}
}
}
{
}
}
{
}
}
{
const char *hdr, *p;
/* set p = end of header, handle also wrapped headers */
for (;;) {
p = strchr(p, '\n');
if (p == NULL) {
/* shouldn't really happen, but allow anyway.. */
break;
}
if (p[1] != '\t' && p[1] != ' ')
break;
p += 2;
}
/* extra space points to this line. remove it. */
}
}
{
return;
t_push();
t_pop();
}
{
if (!sync_ctx->dest_first_mail ||
return;
if (!ctx->imapbase_rewrite) {
/* uid-last might need updating, but we'll do it later by
writing it directly where needed. */
return;
}
/* a) keyword list changed, b) uid-last didn't use 10 digits */
t_push();
t_pop();
}
{
return;
t_push();
t_pop();
}
{
bool keywords_changed;
if ((old_flags & XSTATUS_FLAGS_MASK) !=
if (keywords_changed)
}
if ((old_flags & STATUS_FLAGS_MASK) !=
}
const struct mbox_sync_mail *mail)
{
}
}
/* no keywords for this mail */
}
/* adding first keywords */
unsigned int,
/* keywords changed. */
}
/* we might not have done the UID validity checks in same way this
time, so just overwrite conflicting UIDs if uid_broken was set in
first parse time */
}