/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */
#include "imap-common.h"
#include "buffer.h"
#include "imap-commands.h"
#include "imap-search-args.h"
#include "imap-search.h"
struct sort_name {
const char *name;
};
{ MAIL_SORT_ARRIVAL, "arrival" },
{ MAIL_SORT_CC, "cc" },
{ MAIL_SORT_DATE, "date" },
{ MAIL_SORT_FROM, "from" },
{ MAIL_SORT_SIZE, "size" },
{ MAIL_SORT_SUBJECT, "subject" },
{ MAIL_SORT_TO, "to" },
{ MAIL_SORT_RELEVANCY, "relevancy" },
{ MAIL_SORT_DISPLAYFROM, "displayfrom" },
{ MAIL_SORT_DISPLAYTO, "displayto" },
{ MAIL_SORT_END, NULL }
};
static int
{
const char *arg;
unsigned int i, pos;
if (IMAP_ARG_IS_EOL(args)) {
/* empty list */
return -1;
}
if (last_reverse) {
continue;
}
break;
}
return -1;
}
continue;
/* @UNSAFE: mask check should prevent us from ever
overflowing */
(reverse ? MAIL_SORT_FLAG_REVERSE : 0);
}
if (last_reverse) {
return -1;
}
if (!IMAP_ARG_IS_EOL(args)) {
"Invalid sort list argument.");
return -1;
}
return 0;
}
{
const char *charset;
int ret;
return FALSE;
if (!client_verify_open_mailbox(cmd))
return TRUE;
/* error / waiting for unambiguity */
return ret < 0;
}
/* sort program */
return TRUE;
}
return TRUE;
}
args++;
/* charset */
return TRUE;
}
args++;
if (ret <= 0) {
return ret < 0;
}
}