Example #1
0
BOOL EnumMailBox(THash& MailBoxes)
{
	std::string path = bka.GetDataFolder();
	WIN32_FIND_DATA fd;
	HANDLE hFind = FindFirstFile(path.append("*.mb").c_str(), &fd);
	
	if (hFind == INVALID_HANDLE_VALUE) {
		return false;
	}

	do {
		if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
			continue;
		}
		std::string mailbox_dir(fd.cFileName);
		std::string mailbox_name = bka.GetFolderDisplayName(mailbox_dir.append("\\").c_str());
		mailbox_name = mailbox_name.substr(1, mailbox_name.size() - 3);
		MailBoxes.insert(std::pair<std::string, std::string>(mailbox_dir, mailbox_name));
	} while (FindNextFile(hFind, &fd));

	FindClose(hFind);

	return true;
}