summaryrefslogtreecommitdiffstats
path: root/pigeonhole/src/managesieve/cmd-noop.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:36:47 +0000
commit0441d265f2bb9da249c7abf333f0f771fadb4ab5 (patch)
tree3f3789daa2f6db22da6e55e92bee0062a7d613fe /pigeonhole/src/managesieve/cmd-noop.c
parentInitial commit. (diff)
downloaddovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.tar.xz
dovecot-0441d265f2bb9da249c7abf333f0f771fadb4ab5.zip
Adding upstream version 1:2.3.21+dfsg1.upstream/1%2.3.21+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pigeonhole/src/managesieve/cmd-noop.c')
-rw-r--r--pigeonhole/src/managesieve/cmd-noop.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/pigeonhole/src/managesieve/cmd-noop.c b/pigeonhole/src/managesieve/cmd-noop.c
new file mode 100644
index 0000000..76d96c3
--- /dev/null
+++ b/pigeonhole/src/managesieve/cmd-noop.c
@@ -0,0 +1,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;
+}
+