mail-sort.c revision c0435c854a0e7246373b9752d163095cc4fbe985
/* Copyright (C) 2002 Timo Sirainen */
/* Implementation of draft-ietf-imapext-sort-10 sorting algorithm */
#include "lib.h"
#include "buffer.h"
#include "ostream.h"
#include "imap-base-subject.h"
#include "mail-sort.h"
#include <stdlib.h>
struct mail_sort_context {
enum mail_sort_type common_mask;
struct mail_sort_funcs funcs;
void *func_context;
};
static enum mail_sort_type
{
if (*input == MAIL_SORT_REVERSE)
else {
if (reverse) {
}
}
}
}
return mask;
}
static enum mail_sort_type
enum mail_sort_type **output)
{
enum mail_sort_type mask = 0;
if (*input != MAIL_SORT_REVERSE)
}
return mask;
}
struct mail_sort_context *
{
struct mail_sort_context *ctx;
int i;
t_push();
norm_input, sizeof(norm_input));
norm_output, sizeof(norm_output));
t_pop();
/* remove the common part from output, we already know input is sorted
that much so we don't have to worry about it. */
for (i = 0; output[i] != MAIL_SORT_END; i++)
128 * sizeof(unsigned int),
(size_t)-1);
return ctx;
}
{
}
{
return 1;
/* FIXME: maybe create ascii_strcasecmp()? strcasecmp() may compare
non-ASCII too if locale is set. We don't do that now though. */
}
{
int ret;
return 1;
return ret;
}
unsigned int id)
{
const char *str;
time_t t;
ctx->func_context);
if (t != ctx->last_arrival) {
ctx->last_arrival = t;
}
}
ctx->func_context);
}
}
ctx->func_context);
}
}
ctx->func_context);
}
}
ctx->func_context);
}
}
ctx->func_context);
}
}
ctx->func_context);
}
}
if (changed)
}
{
if (ctx->common_mask != 0)
}
static struct mail_sort_context *mail_sort_qsort_context;
{
t_push();
ret = 0;
if (*output == MAIL_SORT_REVERSE) {
continue;
}
switch (*output) {
case MAIL_SORT_ARRIVAL:
case MAIL_SORT_DATE: {
break;
}
case MAIL_SORT_SIZE: {
break;
}
case MAIL_SORT_CC:
case MAIL_SORT_FROM:
case MAIL_SORT_TO: {
break;
}
case MAIL_SORT_SUBJECT:
break;
default:
i_unreached();
}
if (reverse) {
if (ret > 0)
ret = -1;
else if (ret < 0)
ret = 1;
}
}
t_pop();
}
{
unsigned int *arr;
}