index-messageset.c revision 02b32cf39a098edf60981fc228e4b034f11f3b90
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "mail-index.h"
#include "mail-index-util.h"
#include "mail-hash.h"
#include "mail-modifylog.h"
#include "index-messageset.h"
static unsigned int get_next_number(const char **str)
{
unsigned int num;
num = 0;
while (**str != '\0') {
break;
(*str)++;
}
return num;
}
const char **error)
{
const unsigned int *expunges;
unsigned int expunges_before;
int expunges_found;
/* Second sequence can't be smaller than first - we could swap
them but I think it's a bug in client if it does this,
and better complain about it immediately than later let
them wonder why it doesn't work with other imapds.. */
return -2;
}
/* get list of expunged messages in our range. the expunges_before
can be used to calculate the current real sequence position */
/* Reset index errors, since we later rely on it to check if failed */
/* get the first non-expunged message. note that if all messages
were expunged in the range, this points outside wanted range. */
/* skip expunged sequences */
expunges++;
seq++;
}
break;
t_push();
t_pop();
return 0;
}
t_pop();
}
/* error occured */
return -1;
}
}
const char *messageset,
unsigned int messages_count,
const char **error)
{
const char *input;
if (messages_count == 0) {
/* no messages in mailbox */
return 1;
}
input = messageset;
while (*input != '\0') {
if (*input == '*') {
/* last message */
input++;
} else {
if (seq == 0) {
messageset, NULL);
return -2;
}
}
if (*input != ':')
else {
/* first:last range */
input++;
if (*input != '*') {
if (seq2 == 0) {
"messageset: ",
messageset, NULL);
return -2;
}
if (seq2 > messages_count) {
/* too large .. ignore silently */
}
} else {
input++;
}
}
if (*input == ',')
input++;
else if (*input != '\0') {
"with messageset: %s",
*input, messageset);
return -2;
}
if (seq > messages_count) {
/* too large .. ignore silently */
} else {
if (ret <= 0)
return ret;
if (ret == 2)
}
}
}
const char **error)
{
const unsigned int *expunges;
unsigned int seq;
int expunges_found;
/* not allowed - see mail_index_foreach() */
return -2;
}
/* get list of expunged messages in our range. */
/* skip expunged messages at the beginning */
expunges++;
/* all were expunged */
return 2;
}
}
expunges++;
seq++;
}
t_push();
t_pop();
return 0;
}
t_pop();
seq++;
}
/* error occured */
return -1;
}
}
unsigned int messages_count,
const char **error)
{
const char *input;
while (*input != '\0') {
if (*input == '*') {
/* last message */
if (messages_count == 0)
uid = 0;
else {
}
input++;
} else {
if (uid == 0) {
return -2;
}
}
if (*input != ':')
else {
/* first:last range */
input++;
if (*input != '*') {
if (uid2 == 0) {
return -2;
}
} else {
/* allow requesting "n:*" where n is
larger than the actual (synced)
messages count */
}
input++;
}
}
if (*input == ',')
input++;
else if (*input != '\0') {
return -2;
}
/* too large .. ignore silently */
} else {
if (ret <= 0)
return ret;
if (ret == 2)
}
}
}
const char *messageset, int uidset,
{
const char *error;
int ret;
if (uidset) {
} else {
}
if (ret < 0) {
if (ret == -2) {
/* user error */
} else {
}
}
return ret;
}