cmd-thread.c revision cdac58636c2fd38ba5d4ea6cceab9383b13e82f8
/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
#include "imap-common.h"
#include "str.h"
#include "ostream.h"
#include "imap-base-subject.h"
#include "imap-commands.h"
#include "imap-search-args.h"
#include "mail-thread.h"
{
const struct mail_thread_child_node *node;
struct mail_thread_iterate_context *child_iter;
unsigned int count;
int ret = 0;
if (count == 0)
return 0;
/* only one child - special case to avoid extra paranthesis */
if (child_iter != NULL) {
T_BEGIN {
} T_END;
if (mail_thread_iterate_deinit(&child_iter) < 0)
return -1;
}
return ret;
}
if (child_iter == NULL) {
/* no children */
} else {
/* node with children */
T_BEGIN {
} T_END;
if (mail_thread_iterate_deinit(&child_iter) < 0 ||
ret < 0)
return -1;
}
}
return 0;
}
static int
{
struct mail_thread_iterate_context *iter;
int ret;
T_BEGIN {
} T_END;
if (mail_thread_iterate_deinit(&iter) < 0)
ret = -1;
return ret;
}
struct mail_search_args *search_args,
enum mail_thread_type thread_type)
{
struct mail_thread_context *ctx;
int ret;
search_args, &ctx);
if (ret == 0) {
}
if (ret == 0) {
}
return ret;
}
struct orderedsubject_thread {
};
const struct orderedsubject_thread *t2)
{
return -1;
return 1;
return -1;
return 1;
i_unreached();
}
static void
const struct orderedsubject_thread *thread)
{
unsigned int i, count;
str_truncate(reply, 0);
}
switch (count) {
case 1:
break;
case 2:
break;
default:
/* (1 (2)(3)) */
for (i = 1; i < count; i++) {
str_truncate(reply, 0);
}
}
}
}
struct mail_search_args *search_args)
{
static const enum mail_sort_type sort_program[] = {
0
};
struct mailbox_transaction_context *trans;
struct mail_search_context *search_ctx;
const char *subject, *base_subject;
const struct orderedsubject_thread *thread;
int ret;
/* first read all of the threads into memory */
0, NULL);
subject = "";
T_BEGIN {
/* thread changed */
cur_thread = NULL;
}
str_truncate(prev_subject, 0);
} T_END;
if (cur_thread == NULL) {
/* starting a new thread. get the first message's
date */
cur_thread->timestamp == 0) {
(void)mail_get_received_date(mail,
&cur_thread->timestamp);
}
}
}
(void)mailbox_transaction_commit(&trans);
if (ret < 0) {
pool_unref(&pool);
return -1;
}
/* sort the threads by their first message's timestamp */
/* write the threads to client */
}
pool_unref(&pool);
return 0;
}
{
enum mail_thread_type thread_type;
struct mail_search_args *sargs;
int ret;
return FALSE;
if (!client_verify_open_mailbox(cmd))
return TRUE;
return TRUE;
}
args += 2;
return TRUE;
}
if (ret <= 0)
return ret < 0;
else
if (ret < 0) {
return TRUE;
}
0, "OK Thread completed.");
}