Exemplo n.º 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);
}
int main(int argc, char* argv[]) {
    UIDSet uids;

    if (argc < 3) {
        std::cerr << "ERROR: Must have at least two arguments: basename and a UID"
                  << std::endl;
        return -1;
    }

    try {
        stoi(argv[1], NULL, 10);
        std::cerr << "ERROR: First argument must not be an integer"
                  << std::endl;
        return -1;
    } catch (...) {}

    std::string basename(std::string(argv[1]) + "_mixed");

    if (basename.find("/") != std::string::npos) {
        std::cerr << "ERROR: Basename may not contain path separator"
                  << std::endl;
        return -1;
    }

    for (int i = 2; i < argc; ++i) {
        uids.insert(stoi(argv[i], NULL, 10));
    }
    ParamSet extraParams;
    extraParams.insert(-1); // Don't-care value
    SetuidState startState = SetuidState::get();
    Explorer explorer(
        Graph(VG(), uids, startState),
        EG(),
        uids,
        extraParams);

    explorer.exploreAll();

    Graph const& graph = explorer.getGraph();
    GraphName name(basename, uids, extraParams);
    ArchiveWriter<Graph>().write(graph, name);
    DotWriter<Graph>().write(graph, name);

    return 0;
}