/* Copyright (c) 2006-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "unichar.h"
#include "message-address.h"
#include "message-header-decode.h"
#include "imap-base-subject.h"
#include "index-storage.h"
#include "index-sort-private.h"
struct mail_sort_node_date {
};
struct mail_sort_node_size {
};
struct mail_sort_node_float {
float num;
};
struct sort_cmp_context {
bool reverse;
};
static void
{
case MAIL_ERROR_EXPUNGED:
break;
/* just change the error message */
"Requested sort would have taken too long.");
/* fall through */
default:
break;
}
}
static time_t
{
/* limit reached - sort the rest of the mails at the end of
the list by their UIDs */
return LONG_MAX;
} else {
/* expunged / some other error - sort in the beginning */
return 0;
}
}
static void
{
}
static void
{
int tz;
}
}
static void
{
}
}
{
const char *str;
return -1;
}
return 0;
}
static void
{
}
{
const char *str;
*result_r = 0;
return -1;
}
return 0;
}
static void
{
}
{
/* if lookup_abort isn't NEVER, mail_sort_max_read_count handling
doesn't work right. */
if (program->slow_mails_left == 0)
T_BEGIN {
} T_END;
}
}
const struct mail_sort_node_date *n2)
{
}
static void
{
}
const struct mail_sort_node_size *n2)
{
}
static void
{
}
const struct mail_sort_node_float *n2)
{
}
static void
{
/* NOTE: higher relevancy is returned first, unlike with all
other number based sort keys, so temporarily reverse the search */
}
{
}
{
return FALSE;
return TRUE;
}
struct mail_search_sort_program *
const enum mail_sort_type *sort_program)
{
unsigned int i;
return NULL;
/* we support internal sorting by the primary condition */
program->t = t;
if (program->slow_mails_left == 0)
for (i = 0; i < MAX_SORT_PROGRAM_SIZE; i++) {
if (sort_program[i] == MAIL_SORT_END)
break;
}
if (i == MAX_SORT_PROGRAM_SIZE)
i_panic("index_sort_program_init(): Invalid sort program");
case MAIL_SORT_ARRIVAL:
case MAIL_SORT_DATE: {
if ((program->sort_program[0] &
else
break;
}
case MAIL_SORT_SIZE: {
break;
}
case MAIL_SORT_CC:
case MAIL_SORT_FROM:
case MAIL_SORT_SUBJECT:
case MAIL_SORT_TO:
case MAIL_SORT_DISPLAYFROM:
case MAIL_SORT_DISPLAYTO:
break;
case MAIL_SORT_RELEVANCY: {
break;
}
case MAIL_SORT_POP3_ORDER: {
break;
}
default:
i_unreached();
}
return program;
}
{
return ret;
}
static int
struct message_address **addr_r)
{
const char *str;
int ret;
return ret;
}
(const unsigned char *)str,
return 0;
}
static int
{
*mailbox_r = "";
return -1;
}
return 0;
}
static int
{
*name_r = "";
return -1;
return 0;
(void)message_header_decode_utf8(
return 0;
}
}
return 0;
}
static void
{
program->slow_mails_left > 0)
if (program->slow_mails_left == 0) {
/* too many slow lookups - just return the rest of the results
in whatever order. */
}
}
{
const char *str;
int ret;
bool reply_or_fw;
str_truncate(dest, 0);
switch (sort_type & MAIL_SORT_MASK) {
case MAIL_SORT_SUBJECT:
if (ret < 0)
break;
if (ret == 0) {
/* nonexistent header */
return 1;
}
str, &reply_or_fw);
return 1;
case MAIL_SORT_CC:
break;
case MAIL_SORT_FROM:
break;
case MAIL_SORT_TO:
break;
case MAIL_SORT_DISPLAYFROM:
break;
case MAIL_SORT_DISPLAYTO:
break;
default:
i_unreached();
}
if (ret < 0) {
return 0;
return -1;
}
return 1;
}
const enum mail_sort_type *sort_program,
{
switch (sort_type) {
case MAIL_SORT_CC:
case MAIL_SORT_FROM:
case MAIL_SORT_TO:
case MAIL_SORT_SUBJECT:
case MAIL_SORT_DISPLAYFROM:
case MAIL_SORT_DISPLAYTO:
T_BEGIN {
} T_END;
break;
case MAIL_SORT_ARRIVAL:
break;
case MAIL_SORT_DATE:
else if (time1 == 0) {
}
else if (time2 == 0) {
}
break;
case MAIL_SORT_SIZE:
size1 = 0;
}
size2 = 0;
}
break;
case MAIL_SORT_RELEVANCY:
/* NOTE: higher relevancy is returned first, unlike with all
other number based sort keys */
break;
case MAIL_SORT_POP3_ORDER:
/* 32bit numbers would be enough, but since there is already
existing code for uoff_t in sizes, just use them. */
break;
case MAIL_SORT_END:
case MAIL_SORT_MASK:
case MAIL_SORT_FLAG_REVERSE:
i_unreached();
}
if (ret == 0) {
}
if ((*sort_program & MAIL_SORT_FLAG_REVERSE) != 0)
return ret;
}