void LLLibraryOutfitsFetch::importedFolderDone()
{
	llinfos << "start" << llendl;

	LLInventoryModel::cat_array_t cat_array;
	LLInventoryModel::item_array_t wearable_array;
	uuid_vec_t folders;
	
	// Collect the contents of the Imported Clothing folder
	gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array, 
								  LLInventoryModel::EXCLUDE_TRASH);
	
	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
		 iter != cat_array.end();
		 ++iter)
	{
		const LLViewerInventoryCategory *cat = iter->get();
		
		// Get the name of every imported outfit
		folders.push_back(cat->getUUID());
		mImportedClothingFolders.push_back(cat->getUUID());
	}
	
	mComplete.clear();
	setFetchIDs(folders);
	startFetch();
	if (isFinished())
	{
		done();
	}
}
void FeedFetcher::scheduleFetch(shared_ptr<Feed> feed) {
    CHECK(feed.get());
    qDebug() << "Feed added to queue: " << feed->feed_url();
    // TODO(hjiang): Check if the feed is already in the queue.
    impl_->pending_feeds_.push(feed);
    startFetch();
}
// called from Peer and when an Item tracker completes
void
PendingEnvelopes::recvSCPEnvelope(SCPEnvelope const& envelope)
{
    auto const& nodeID = envelope.statement.nodeID;
    if (!isNodeInQuorum(nodeID))
    {
        CLOG(DEBUG, "Herder") << "Dropping envelope from "
                              << mApp.getConfig().toShortString(nodeID)
                              << " (not in quorum)";
        return;
    }

    // do we already have this envelope?
    // do we have the qset
    // do we have the txset

    try
    {
        auto& set = mFetchingEnvelopes[envelope.statement.slotIndex];
        auto& processedList = mProcessedEnvelopes[envelope.statement.slotIndex];

        auto fetching = find(set.begin(), set.end(), envelope);

        if (fetching == set.end())
        { // we aren't fetching this envelope
            if (find(processedList.begin(), processedList.end(), envelope) ==
                processedList.end())
            { // we haven't seen this envelope before
                // insert it into the fetching set
                fetching = set.insert(envelope).first;
                startFetch(envelope);
            }
            else
            {
                // we already have this one
                fetching = set.end();
            }
        }

        if (fetching != set.end())
        { // we are fetching this envelope
            // check if we are done fetching it
            if (isFullyFetched(envelope))
            {
                // move the item from fetching to processed
                processedList.emplace_back(*fetching);
                set.erase(fetching);
                envelopeReady(envelope);
            } // else just keep waiting for it to come in
        }
    }
    catch (xdr::xdr_runtime_error& e)
    {
        CLOG(TRACE, "Herder")
            << "PendingEnvelopes::recvSCPEnvelope got corrupt message: "
            << e.what();
    }
}
void LLLibraryOutfitsFetch::outfitsDone()
{
	llinfos << "start" << llendl;

	LLInventoryModel::cat_array_t cat_array;
	LLInventoryModel::item_array_t wearable_array;
	uuid_vec_t folders;
	
	// Collect the contents of the Library's Clothing folder
	gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, 
								  LLInventoryModel::EXCLUDE_TRASH);
	
	llassert(cat_array.count() > 0);
	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
		 iter != cat_array.end();
		 ++iter)
	{
		const LLViewerInventoryCategory *cat = iter->get();
		
		// Get the names and id's of every outfit in the library, skip "Ruth"
		// because it's a low quality legacy outfit
		if (cat->getName() != "Ruth")
		{
			// Get the name of every outfit in the library 
			folders.push_back(cat->getUUID());
			mLibraryClothingFolders.push_back(cat->getUUID());
		}
	}
	cat_array.clear();
	wearable_array.clear();

	// Check if you already have an "Imported Library Clothing" folder
	LLNameCategoryCollector matchFolderFunctor(mImportedClothingName);
	gInventory.collectDescendentsIf(mClothingID, 
									cat_array, wearable_array, 
									LLInventoryModel::EXCLUDE_TRASH,
									matchFolderFunctor);
	if (cat_array.size() > 0)
	{
		const LLViewerInventoryCategory *cat = cat_array.get(0);
		mImportedClothingID = cat->getUUID();
	}
	
	mComplete.clear();
	setFetchIDs(folders);
	startFetch();
	if (isFinished())
	{
		done();
	}
}
// called from Peer and when an Item tracker completes
void
PendingEnvelopes::recvSCPEnvelope(SCPEnvelope const& envelope)
{
    // do we already have this envelope?
    // do we have the qset
    // do we have the txset

    try
    {
        auto& set = mFetchingEnvelopes[envelope.statement.slotIndex];

        if (find(set.begin(), set.end(), envelope) == set.end())
        { // we aren't fetching this envelop

            auto& receivedList =
                mReceivedEnvelopes[envelope.statement.slotIndex];
            if (find(receivedList.begin(), receivedList.end(), envelope) ==
                receivedList.end())
            { // we haven't seen this envelope before

                receivedList.push_back(envelope);
                if (startFetch(envelope))
                { // fully fetched
                    envelopeReady(envelope);
                }
                else
                {
                    mFetchingEnvelopes[envelope.statement.slotIndex].insert(
                        envelope);
                }

                CLOG(DEBUG, "Herder") << "PendingEnvelopes::recvSCPEnvelope";

            } // else we already have this one
        }
        else
        { // we are fetching this envelope
            // check if we are done fetching it
            if (isFullyFetched(envelope))
            {
                envelopeReady(envelope);
            } // else just keep waiting for it to come in
        }
    }
    catch (xdr::xdr_runtime_error& e)
    {
        CLOG(TRACE, "Herder")
            << "PendingEnvelopes::recvSCPEnvelope got corrupt message: "
            << e.what();
    }
}
// virtual
BOOL LLFloaterGesture::postBuild()
{
	std::string label;

	label = getTitle();
	
	setTitle(label);
	mGestureList = getChild<LLScrollListCtrl>("gesture_list");
	mGestureList->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this));
	mGestureList->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));

	getChild<LLUICtrl>("edit_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickEdit, this));

	getChild<LLUICtrl>("play_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
	getChild<LLUICtrl>("stop_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
	getChild<LLButton>("activate_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
	
	getChild<LLUICtrl>("FSShowOnlyActiveGestures")->setCommitCallback(boost::bind(&LLFloaterGesture::refreshForActiveSort, this)); // <FS:PP> FIRE-5646: Option to show only active gestures

	getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this));
	getChild<LLButton>("del_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onDeleteSelected, this));

	getChildView("play_btn")->setVisible( true);
	getChildView("stop_btn")->setVisible( false);
	setDefaultBtn("play_btn");
	mGestureFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE, false);

	uuid_vec_t folders;
	folders.push_back(mGestureFolderID);
	//perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.
	gInventory.addObserver(this);
	setFetchIDs(folders);
	startFetch();

	if (mGestureList)
	{
		buildGestureList();
	
		mGestureList->setFocus(TRUE);

		const BOOL ascending = TRUE;
		mGestureList->sortByColumn(std::string("name"), ascending);
		mGestureList->selectFirstItem();
	}
	
	// Update button labels
	onCommitList();
	
	return TRUE;
}
void LLLibraryOutfitsFetch::importedFolderFetch()
{
	llinfos << "start" << llendl;

	// Fetch the contents of the Imported Clothing Folder
	uuid_vec_t folders;
	folders.push_back(mImportedClothingID);
	
	mComplete.clear();
	setFetchIDs(folders);
	startFetch();
	if (isFinished())
	{
		done();
	}
}
AIInventoryFetchDescendentsObserver::AIInventoryFetchDescendentsObserver(AIStateMachine* statemachine, LLUUID const& folder) : 
	mStateMachine(statemachine),
	LLInventoryFetchDescendentsObserver(folder)
{
	// Call idle() on the parent state machine before passing it.
	llassert(mStateMachine->waiting());
	startFetch();
	if(isFinished())
	{
		done();
	}
	else
	{
		 gInventory.addObserver(this);
	}
}
void LLFloaterGesture::done()
{
	//this method can be called twice: for GestureFolder and once after loading all sudir of GestureFolder
	if (gInventory.isCategoryComplete(mGestureFolderID))
	{
		LL_DEBUGS("Gesture")<< "mGestureFolderID loaded" << LL_ENDL;
		// we load only gesture folder without childred.
		LLInventoryModel::cat_array_t* categories;
		LLInventoryModel::item_array_t* items;
		uuid_vec_t unloaded_folders;
		LL_DEBUGS("Gesture")<< "Get subdirs of Gesture Folder...." << LL_ENDL;
		gInventory.getDirectDescendentsOf(mGestureFolderID, categories, items);
		if (categories->empty())
		{
			gInventory.removeObserver(this);
			LL_INFOS("Gesture")<< "Gesture dos NOT contains sub-directories."<< LL_ENDL;
			return;
		}
		LL_DEBUGS("Gesture")<< "There are " << categories->size() << " Folders "<< LL_ENDL;
		for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); it != categories->end(); it++)
		{
			if (!gInventory.isCategoryComplete(it->get()->getUUID()))
			{
				unloaded_folders.push_back(it->get()->getUUID());
				LL_DEBUGS("Gesture")<< it->get()->getName()<< " Folder added to fetchlist"<< LL_ENDL;
			}

		}
		if (!unloaded_folders.empty())
		{
			LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL;
			setFetchIDs(unloaded_folders);
			startFetch();
		}
		else
		{
			LL_DEBUGS("Gesture")<< "All Gesture subdirectories have been loaded."<< LL_ENDL;
			gInventory.removeObserver(this);
			buildGestureList();
		}
	}
	else
	{
		LL_WARNS("Gesture")<< "Gesture list was NOT loaded"<< LL_ENDL;
	}
}
void LLLibraryOutfitsFetch::folderDone()
{
	llinfos << "start" << llendl;

	LLInventoryModel::cat_array_t cat_array;
	LLInventoryModel::item_array_t wearable_array;
	gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, 
								  LLInventoryModel::EXCLUDE_TRASH);
	
	// Early out if we already have items in My Outfits
	// except the case when My Outfits contains just initial outfit
	if (cat_array.count() > 1)
	{
		mOutfitsPopulated = true;
		return;
	}

	mClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
	mLibraryClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING, false, true);

	// If Library->Clothing->Initial Outfits exists, use that.
	LLNameCategoryCollector matchFolderFunctor("Initial Outfits");
	cat_array.clear();
	gInventory.collectDescendentsIf(mLibraryClothingID,
									cat_array, wearable_array, 
									LLInventoryModel::EXCLUDE_TRASH,
									matchFolderFunctor);
	if (cat_array.count() > 0)
	{
		const LLViewerInventoryCategory *cat = cat_array.get(0);
		mLibraryClothingID = cat->getUUID();
	}

	mComplete.clear();
	
	// Get the complete information on the items in the inventory.
	uuid_vec_t folders;
	folders.push_back(mClothingID);
	folders.push_back(mLibraryClothingID);
	setFetchIDs(folders);
	startFetch();
	if (isFinished())
	{
		done();
	}
}
void FeedFetcher::finishFetch(int connection_id, bool error) {
    // process data here, yeah, need a better way
    if (bytes_.isEmpty()) return;
    QByteArray bytes = xmlAtomValidator(bytes_);
    //TODO emit signal to caller that whether the request is finished
    if (!impl_->parser_->append(bytes)) {
        qDebug() << "Error parsing feed: "
                    << impl_->parser_->errorString();
    }
    bytes_.clear();
    qDebug() << "Connection finished: " << connection_id;
    if (connection_id == impl_->connection_id_) {
        // Stop and clear all pending fetch ops if this is true
        // (network connection problem).
        bool has_error = false;
        if (error) {
            qDebug() << "Received error during HTTP fetch: "
                     << impl_->http_->errorString();
            QHttp::Error e = impl_->http_->error();
            if (e == QHttp::HostNotFound || e == QHttp::UnknownError) {
                has_error = true;
            }
        } else {
            if (impl_->parser_->hasError()) {
                qDebug() << "Error parsing feed: "
                         << impl_->parser_->errorString();
            } else if (impl_->parser_->finished()) {
                impl_->parser_->finalize();
                emit feedUpdated(impl_->parser_->feed());
            } else {
                qDebug() << "Feed ended prematurely!";
            }
        }
        impl_->pending_feeds_.pop();
        impl_->current_feed_.reset();
        if (has_error) {
            emit networkError();
            return;
        }
        startFetch();
    }
}
Example #12
0
void MainWindow::downloadVPN()
{
    Website *last = NULL;
    emit abortFetch();
    for( int i = 0; i < vpnList.count(); ++i )
    {
        if (vpnList[i]->out == false) {
               //qDebug() << vpnList[i]->timescore;
            Website *w = new Website;
            QString filename = QString("%1/%2").arg(this->ui->filePath->text(), vpnList[i]->getFilename());
            w->fetchLater(vpnList[i]->getDownloadURL(), filename);
            if (last) {
                connect(w, SIGNAL(finished()), last, SLOT(startFetch()));
            } else {
                connect(w, SIGNAL(finished()), this, SLOT(allDone()));
            }
            last = w;
            connect(this, SIGNAL(abortFetch()), w, SLOT(abortFetch()));
        }
    }

    last->startFetch();
}
Example #13
0
// called from Peer and when an Item tracker completes
Herder::EnvelopeStatus
PendingEnvelopes::recvSCPEnvelope(SCPEnvelope const& envelope)
{
    auto const& nodeID = envelope.statement.nodeID;
    if (!isNodeInQuorum(nodeID))
    {
        CLOG(DEBUG, "Herder")
            << "Dropping envelope from "
            << mApp.getConfig().toShortString(nodeID) << " (not in quorum)";
        return Herder::ENVELOPE_STATUS_DISCARDED;
    }

    // did we discard this envelope?
    // do we already have this envelope?
    // do we have the qset
    // do we have the txset

    try
    {
        if (isDiscarded(envelope))
        {
            return Herder::ENVELOPE_STATUS_DISCARDED;
        }

        touchFetchCache(envelope);

        auto& set = mEnvelopes[envelope.statement.slotIndex].mFetchingEnvelopes;
        auto& processedList =
            mEnvelopes[envelope.statement.slotIndex].mProcessedEnvelopes;

        auto fetching = find(set.begin(), set.end(), envelope);

        if (fetching == set.end())
        { // we aren't fetching this envelope
            if (find(processedList.begin(), processedList.end(), envelope) ==
                processedList.end())
            { // we haven't seen this envelope before
                // insert it into the fetching set
                fetching = set.insert(envelope).first;
                startFetch(envelope);
            }
            else
            {
                // we already have this one
                return Herder::ENVELOPE_STATUS_PROCESSED;
            }
        }

        // we are fetching this envelope
        // check if we are done fetching it
        if (isFullyFetched(envelope))
        {
            // move the item from fetching to processed
            processedList.emplace_back(*fetching);
            set.erase(fetching);
            envelopeReady(envelope);
            updateMetrics();
            return Herder::ENVELOPE_STATUS_READY;
        } // else just keep waiting for it to come in

        updateMetrics();
        return Herder::ENVELOPE_STATUS_FETCHING;
    }
    catch (xdr::xdr_runtime_error& e)
    {
        CLOG(TRACE, "Herder")
            << "PendingEnvelopes::recvSCPEnvelope got corrupt message: "
            << e.what();
        return Herder::ENVELOPE_STATUS_DISCARDED;
    }
}