changeset 6351:1d2b67440878 HEAD

Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new IS_ATOM_SPECIAL() that contains all of the specials.
author Timo Sirainen <tss@iki.fi>
date Sun, 02 Sep 2007 05:27:03 +0300
parents e7f61751822e
children 0f1a4b7b39a3
files src/lib-imap/imap-parser.c src/lib-imap/imap-parser.h
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-imap/imap-parser.c	Sun Sep 02 05:03:41 2007 +0300
+++ b/src/lib-imap/imap-parser.c	Sun Sep 02 05:27:03 2007 +0300
@@ -223,7 +223,7 @@
 
 static int is_valid_atom_char(struct imap_parser *parser, char chr)
 {
-	if (IS_ATOM_SPECIAL((unsigned char)chr)) {
+	if (IS_ATOM_SPECIAL_INPUT((unsigned char)chr)) {
 		parser->error = "Invalid characters in atom";
 		return FALSE;
 	} else if ((chr & 0x80) != 0) {
--- a/src/lib-imap/imap-parser.h	Sun Sep 02 05:03:41 2007 +0300
+++ b/src/lib-imap/imap-parser.h	Sun Sep 02 05:27:03 2007 +0300
@@ -3,13 +3,20 @@
 
 #include "array.h"
 
-/* FIXME: we don't have ']' here due to FETCH BODY[] handling failing
-   with it.. also '%' and '*' are banned due to LIST, and '\' due to it being
-   in flags. oh well.. */
-#define IS_ATOM_SPECIAL(c) \
+/* We use this macro to read atoms from input. It should probably contain
+   everything some day, but for now we can't handle some input otherwise:
+
+   ']' is required for parsing section (FETCH BODY[])
+   '%', '*' and ']' are valid list-chars for LIST patterns
+   '\' is used in flags */
+#define IS_ATOM_SPECIAL_INPUT(c) \
 	((c) == '(' || (c) == ')' || (c) == '{' || \
 	 (c) == '"' || (c) <= 32 || (c) == 0x7f)
 
+#define IS_ATOM_SPECIAL(c) \
+	(IS_ATOM_SPECIAL_INPUT(c) || \
+	 (c) == ']' || (c) == '%' || (c) == '*' || (c) == '\\')
+
 enum imap_parser_flags {
 	/* Set this flag if you wish to read only size of literal argument
 	   and not convert literal into string. Useful when you need to deal