diff options
Diffstat (limited to 'src/imap/imap-list.c')
-rw-r--r-- | src/imap/imap-list.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/imap/imap-list.c b/src/imap/imap-list.c new file mode 100644 index 0000000..38a81ba --- /dev/null +++ b/src/imap/imap-list.c @@ -0,0 +1,35 @@ +/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */ + +#include "imap-common.h" +#include "str.h" +#include "imap-list.h" + +bool imap_mailbox_flags2str(string_t *str, enum mailbox_info_flags flags) +{ + size_t orig_len = str_len(str); + + if ((flags & MAILBOX_SUBSCRIBED) != 0) + str_append(str, "\\Subscribed "); + + if ((flags & MAILBOX_NOSELECT) != 0) + str_append(str, "\\Noselect "); + if ((flags & MAILBOX_NONEXISTENT) != 0) + str_append(str, "\\NonExistent "); + + if ((flags & MAILBOX_CHILDREN) != 0) + str_append(str, "\\HasChildren "); + else if ((flags & MAILBOX_NOINFERIORS) != 0) + str_append(str, "\\NoInferiors "); + else if ((flags & MAILBOX_NOCHILDREN) != 0) + str_append(str, "\\HasNoChildren "); + + if ((flags & MAILBOX_MARKED) != 0) + str_append(str, "\\Marked "); + if ((flags & MAILBOX_UNMARKED) != 0) + str_append(str, "\\UnMarked "); + + if (str_len(str) == orig_len) + return FALSE; + str_truncate(str, str_len(str)-1); + return TRUE; +} |