1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
*/
#include "lib.h"
#include "str.h"
#include "managesieve-quote.h"
#include "managesieve-common.h"
#include "managesieve-commands.h"
bool cmd_noop(struct client_command_context *cmd)
{
struct client *client = cmd->client;
const struct managesieve_arg *args;
const char *text;
string_t *resp_code;
/* [<echo string>] */
if (!client_read_args(cmd, 0, 0, FALSE, &args))
return FALSE;
if (MANAGESIEVE_ARG_IS_EOL(&args[0])) {
client_send_ok(client, "NOOP Completed");
return TRUE;
}
if (!managesieve_arg_get_string(&args[0], &text)) {
client_send_no(client, "Invalid echo tag.");
return TRUE;
}
if (!MANAGESIEVE_ARG_IS_EOL(&args[1])) {
client_send_command_error(cmd, "Too many arguments.");
return TRUE;
}
resp_code = t_str_new(256);
str_append(resp_code, "TAG ");
managesieve_quote_append_string(resp_code, text, FALSE);
client_send_okresp(client, str_c(resp_code), "Done");
return TRUE;
}
|