1
/* Copyright (c) 2002-2009 Dovecot Sieve authors, see the included COPYING file
7
#include "sieve-storage.h"
8
#include "sieve-storage-list.h"
9
#include "managesieve-quote.h"
11
bool cmd_listscripts(struct client_command_context *cmd)
13
struct client *client = cmd->client;
14
struct sieve_list_context *ctx;
15
const char *scriptname;
19
if ( (ctx = sieve_storage_list_init(client->storage))
21
client_send_storage_error(client, client->storage);
25
/* FIXME: This will be quite slow for large script lists. Implement
26
* some buffering to fix this. Wont truely be an issue with managesieve
29
while ((scriptname = sieve_storage_list_next(ctx, &active)) != NULL) {
33
managesieve_quote_append_string(str, scriptname, FALSE);
36
str_append(str, " ACTIVE");
38
client_send_line(client, str_c(str));
42
if ( sieve_storage_list_deinit(&ctx) < 0 ) {
43
client_send_storage_error(client, client->storage);
47
client_send_ok(client, "Listscripts completed.");