imap-state.c revision 1c02804cdc5f1ad830fec081100e951bc67204b4
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen/* Copyright (c) 2014-2017 Dovecot authors, see the included COPYING file */
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen uint32_t keywords_count, keywords_crc32, uids_crc32;
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainenexport_seq_range(buffer_t *dest, const ARRAY_TYPE(seq_range) *range)
4ead43ecc06d10047998966c4dc0b142ecce4b66Timo Sirainen unsigned int i, count;
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen for (i = 0; i < count; i++) {
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen numpack_encode(dest, (uids[i].seq1 - next_uid) << 1);
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen numpack_encode(dest, 1 | ((uids[i].seq1 - next_uid) << 1));
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen numpack_encode(dest, uids[i].seq2 - uids[i].seq1 - 1);
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainenimport_seq_range(const unsigned char **data, const unsigned char *end,
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen for (i = 0; i < count; i++) {
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainenint imap_state_export_internal(struct client *client, buffer_t *dest,
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen const char **error_r)
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen /* the only IMAP command we allow running is IDLE or X-STATE */
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen strcasecmp(client->command_queue->name, "IDLE") != 0) {
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen /* this would require saving the seq <-> uid mapping
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen and restore it on import. quite a lot of trouble if
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen messages have been expunged in the mean time. */
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen *error_r = "Non-IDLE connections not supported currently";
9439bed2f07d6475febd8a247cd2f0990fb32a13Timo Sirainen return client->v.state_export(client, TRUE, dest, error_r);
1d4f710106fb498750456724628da6063e012e6dTimo Sirainenint imap_state_export_external(struct client *client, buffer_t *dest,
1d4f710106fb498750456724628da6063e012e6dTimo Sirainen const char **error_r)
while (size > 0) {
if (ret <= 0) {
const char **error_r)
const char **error_r)
const char **error_r)
return ret;
static uint32_t
const char *const *strp;
return crc;
&status);
int ret;
if (ret <= 0)
return ret;
MAILBOX_FEATURE_QRESYNC)) == 0);
if (internal) {
const char **str_r)
if (p == NULL)
unsigned int *expunge_count_r,
const char **error_r)
unsigned int i, expunge_count, n = 0;
int ret = 0;
*expunge_count_r = 0;
seq++; n++;
sizeof(expunged_uid));
seq++; n++;
sizeof(expunged_uid));
if (ret < 0)
for (i = expunge_count; i > 0; i--) {
unsigned int *flag_change_count_r)
int ret;
*flag_change_count_r = 0;
return ret;
static ssize_t
const char **error_r)
if (p == end) {
return p - data;
const char **error_r)
int ret = 0;
i_debug("Unhibernation sync: %u expunges, %u new messages, %u flag changes, %"PRIu64" modseq changes",
static ssize_t
if (ret <= 0) {
return ret;
return ret;
static ssize_t
size_t i = 0;
for (i = 0; i < size; i++) {
switch (feature) {
static ssize_t
const unsigned char *p = data;
return p - data;
static ssize_t
static ssize_t
} imap_states_public[] = {
} imap_states_internal[] = {
static ssize_t
static ssize_t
const char **error_r)
if (p == NULL)
return pos;