aboutsummaryrefslogtreecommitdiffstats
path: root/examples/example6.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2015-03-03 18:17:48 +0000
committerVincent Richard <[email protected]>2015-03-03 18:17:48 +0000
commit5c767edb9cbfc55e356dbdadfad6d3a6c33c23a9 (patch)
tree4a953708791c028dc82c8136c7e15f996fcf2893 /examples/example6.cpp
parentFixed unit test so that is does not depend on the current locale charset. (diff)
downloadvmime-5c767edb9cbfc55e356dbdadfad6d3a6c33c23a9.tar.gz
vmime-5c767edb9cbfc55e356dbdadfad6d3a6c33c23a9.zip
Display folder flags and use.
Diffstat (limited to 'examples/example6.cpp')
-rw-r--r--examples/example6.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/examples/example6.cpp b/examples/example6.cpp
index 27c6e157..428cb6a4 100644
--- a/examples/example6.cpp
+++ b/examples/example6.cpp
@@ -178,7 +178,37 @@ static void printFolders(vmime::shared_ptr <vmime::net::folder> folder, const in
for (int j = 0 ; j < level * 2 ; ++j)
std::cout << " ";
- std::cout << getFolderPathString(folder) << std::endl;
+ const vmime::net::folderAttributes attr = folder->getAttributes();
+ std::ostringstream attrStr;
+
+ if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_ALL)
+ attrStr << " \\use:All";
+ else if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_ARCHIVE)
+ attrStr << " \\use:Archive";
+ else if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_DRAFTS)
+ attrStr << " \\use:Drafts";
+ else if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_FLAGGED)
+ attrStr << " \\use:Flagged";
+ else if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_JUNK)
+ attrStr << " \\use:Junk";
+ else if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_SENT)
+ attrStr << " \\use:Sent";
+ else if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_TRASH)
+ attrStr << " \\use:Trash";
+ else if (attr.getSpecialUse() == vmime::net::folderAttributes::SPECIALUSE_IMPORTANT)
+ attrStr << " \\use:Important";
+
+ if (attr.getFlags() & vmime::net::folderAttributes::FLAG_HAS_CHILDREN)
+ attrStr << " \\flag:HasChildren";
+ if (attr.getFlags() & vmime::net::folderAttributes::FLAG_NO_OPEN)
+ attrStr << " \\flag:NoOpen";
+
+ for (size_t i = 0, n = attr.getUserFlags().size() ; i < n ; ++i)
+ attrStr << " \\" << attr.getUserFlags()[i];
+
+ std::cout << getFolderPathString(folder);
+ std::cout << " " << attrStr.str();
+ std::cout << std::endl;
std::vector <vmime::shared_ptr <vmime::net::folder> > subFolders = folder->getFolders(false);