This is a bit klugdy but works as long as all callers use
imap_arg_get_astring() instead of trying to handle it themselves.
bool imap_arg_get_astring(const struct imap_arg *arg, const char **str_r)
{
+ if (arg->type == IMAP_ARG_NIL) {
+ /* RFC 3501 4.5. specifies that NIL is the same as "NIL" when
+ reading astring. */
+ *str_r = "NIL";
+ return TRUE;
+ }
if (!IMAP_ARG_IS_ASTRING(arg))
return FALSE;
unsigned int literal8:1; /* BINARY literal8 used */
};
-/* RFC 3501's astring type */
+/* RFC 3501's astring type. Note that this doesn't return TRUE for
+ IMAP_ARG_NIL, although it should be treated the same as "NIL" string when
+ reading an astring. */
#define IMAP_ARG_TYPE_IS_ASTRING(type) \
((type) == IMAP_ARG_ATOM || \
(type) == IMAP_ARG_STRING || \