Example #1
0
void
IMAPFolder::MessageEntriesFetched()
{
	_WaitForFolderState();

	// Synchronize all pending flags first
	UIDToFlagsMap::const_iterator pendingIterator = fPendingFlagsMap.begin();
	for (; pendingIterator != fPendingFlagsMap.end(); pendingIterator++)
		SyncMessageFlags(pendingIterator->first, pendingIterator->second);

	fPendingFlagsMap.clear();

	// Delete all local messages that are no longer found on the server

	MutexLocker locker(fLock);
	UIDSet deleteUIDs;
	UIDToRefMap::const_iterator iterator = fRefMap.begin();
	for (; iterator != fRefMap.end(); iterator++) {
		uint32 uid = iterator->first;
		if (fSynchronizedUIDsSet.find(uid) == fSynchronizedUIDsSet.end())
			deleteUIDs.insert(uid);
	}

	fSynchronizedUIDsSet.clear();
	locker.Unlock();

	UIDSet::const_iterator deleteIterator = deleteUIDs.begin();
	for (; deleteIterator != deleteUIDs.end(); deleteIterator++)
		_DeleteLocalMessage(*deleteIterator);
}
GraphName::GraphName(
    std::string const& basename,
    UIDSet const& uidSet,
    ParamSet const& paramSet) {
    std::vector<int> uids, params;
    for (UIDSet::const_iterator it = uidSet.begin(), ie = uidSet.end();
         it != ie; ++it) {
        uids.push_back(static_cast<int>(*it));
    }
    std::sort(uids.begin(), uids.end());
    for (ParamSet::const_iterator it = paramSet.begin(), ie = paramSet.end();
         it != ie; ++it) {
        params.push_back(*it);
    }
    std::sort(params.begin(), params.end());

    std::stringstream ss;
    ss << basename << "__u_";
    for (std::vector<int>::iterator it = uids.begin(), ie = uids.end();
         it != ie; ++it) {
        ss << *it;
        if (it +1 != uids.end()) {
            ss << "_";
        }
    }
    ss << "__p_";
    for (std::vector<int>::iterator it = params.begin(), ie = params.end();
         it != ie; ++it) {
        ss << *it;
        if (it +1 != params.end()) {
            ss << "_";
        }
    }

    name = ss.str();
}