cmd-list.c revision c2820b44812b2da7f3b172bb3521b623a3f84f2b
/* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "str.h"
#include "strescape.h"
#include "imap-quote.h"
#include "imap-match.h"
#include "commands.h"
struct list_node {
char *name; /* escaped */
enum mailbox_flags flags;
};
struct list_context {
struct mail_storage *storage;
};
struct list_send_context {
const char *response_name;
const char *sep;
char sep_chr;
struct imap_match_glob *glob;
int listext, no_placeholder;
};
int listext, int no_placeholder)
{
const char *str;
if (flags & MAILBOX_PLACEHOLDER) {
if (!listext || no_placeholder)
} else {
/* it was at one point, but then we got better specs */
flags &= ~MAILBOX_PLACEHOLDER;
}
}
NULL);
}
enum mailbox_flags flags)
{
continue;
t_push();
/* find the node */
break;
}
/* not found, create it */
} else {
if (*path == '\0') {
(flags & MAILBOX_NOSELECT) == 0) {
/* overrides previous flag */
}
}
}
t_pop();
if (*path == '\0')
break;
}
}
const char *path)
{
enum imap_match_result match;
t_push();
/* Send INBOX always uppercased */
name = "INBOX";
else
else {
/* make sure the placeholder matches. */
const char *buf;
/* FIXME: IMAP spec says this should be done, but
a) this is broken, we shouldn't give \NoSelect for
this folder if it actually works.
b) at least mozilla's subscriptions list breaks if
this is sent
c) cyrus and courier doesn't do this either..
if (match == IMAP_MATCH_CHILDREN) {
send_name = t_strdup_printf("%s%c", name,
ctx->sep);
buf = str_unescape(t_strdup_noconst(send_name));
match = imap_match(ctx->glob, buf);
}*/
}
if (match == IMAP_MATCH_YES) {
/* node->name should already be escaped */
t_push();
t_pop();
}
t_pop();
}
}
struct mailbox_list_context *ctx,
const char *response_name, const char *mask,
{
struct mailbox_list *list;
struct list_send_context send_ctx;
}
}
struct mailbox_list_context *ctx,
{
struct mailbox_list *list;
t_push();
sep);
else
t_pop();
}
}
enum mailbox_list_flags *list_flags)
{
const char *atom;
"List options contains non-atoms.");
return FALSE;
}
else {
return FALSE;
}
args++;
}
return TRUE;
}
{
enum mailbox_list_flags list_flags;
struct mailbox_list_context *ctx;
if (IS_ESCAPED_CHAR(sep_chr)) {
sep[0] = '\\';
} else {
}
/* [(<options>)] <reference> <mailbox wildcards> */
return FALSE;
if (lsub)
else {
list_flags = 0;
if (!parse_list_flags(client,
&list_flags))
return TRUE;
args++;
}
}
return TRUE;
}
/* special request to return the hierarchy delimiter */
} else {
if (*ref != '\0') {
/* join reference + mask */
/* LIST A. .B -> A.B */
mask++;
}
/* LIST A B -> A.B */
} else {
}
}
list_flags, &sorted);
else {
if (sorted) {
listext);
} else {
listext);
}
}
}
if (failed)
else {
"OK Lsub completed." :
"OK List completed.");
}
return TRUE;
}
{
}