summaryrefslogtreecommitdiffstats
path: root/pigeonhole/src/lib-sieve/plugins/special-use/ext-special-use-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'pigeonhole/src/lib-sieve/plugins/special-use/ext-special-use-common.c')
-rw-r--r--pigeonhole/src/lib-sieve/plugins/special-use/ext-special-use-common.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/pigeonhole/src/lib-sieve/plugins/special-use/ext-special-use-common.c b/pigeonhole/src/lib-sieve/plugins/special-use/ext-special-use-common.c
new file mode 100644
index 0000000..fcaf1b5
--- /dev/null
+++ b/pigeonhole/src/lib-sieve/plugins/special-use/ext-special-use-common.c
@@ -0,0 +1,31 @@
+/* Copyright (c) 2019 Pigeonhole authors, see the included COPYING file */
+
+#include "lib.h"
+#include "imap-arg.h"
+
+#include "ext-special-use-common.h"
+
+bool ext_special_use_flag_valid(const char *flag)
+{
+ const char *p = flag;
+
+ /* RFC 6154, Section 6:
+
+ use-attr = "\All" / "\Archive" / "\Drafts" / "\Flagged" /
+ "\Junk" / "\Sent" / "\Trash" / use-attr-ext
+ use-attr-ext = "\" atom
+ */
+
+ /* "\" */
+ if (*p != '\\')
+ return FALSE;
+ p++;
+
+ /* atom */
+ for (; *p != '\0'; p++) {
+ if (!IS_ATOM_CHAR(*p))
+ return FALSE;
+ }
+
+ return TRUE;
+}