void LLPanelClassifiedEdit::sendUpdate()
{
	LLAvatarClassifiedInfo c_data;

	if(getClassifiedId().isNull())
	{
		setClassifiedId(LLUUID::generateNewID());
	}

	c_data.agent_id = gAgent.getID();
	c_data.classified_id = getClassifiedId();
	// *HACK 
	// Categories on server start with 1 while combo-box index starts with 0
	c_data.category = getCategory() + 1;
	c_data.name = getClassifiedName();
	c_data.description = getDescription();
	c_data.parcel_id = getParcelId();
	c_data.snapshot_id = getSnapshotId();
	c_data.pos_global = getPosGlobal();
	c_data.flags = getFlags();
	c_data.price_for_listing = getPriceForListing();

	LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoUpdate(&c_data);
	
	if(isNew())
	{
		// Lets assume there will be some error.
		// Successful sendClassifiedInfoUpdate will trigger processProperties and
		// let us know there was no error.
		mIsNewWithErrors = true;
	}
}
STDMETHODIMP SnapshotChangedEventWrap::COMGETTER(SnapshotId)(BSTR *aSnapshotId)
{
    LogRelFlow(("{%p} %s: enter aSnapshotId=%p\n", this, "SnapshotChangedEvent::getSnapshotId", aSnapshotId));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        CheckComArgOutPointerValidThrow(aSnapshotId);

        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = getSnapshotId(UuidOutConverter(aSnapshotId).uuid());
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave *aSnapshotId=%ls hrc=%Rhrc\n", this, "SnapshotChangedEvent::getSnapshotId", *aSnapshotId, hrc));
    return hrc;
}
void SnapshotRandomAllocationSegment::setPageSuccessor(
    PageId pageId, PageId successorId)
{
    assert(!readOnlyCommittedData);

    // The successor should be set in the latest page version.  The
    // pageId passed in may correspond to the anchor.
    PageId snapshotId = getSnapshotId(pageId);
    DelegatingSegment::setPageSuccessor(snapshotId, successorId);

    SXMutexExclusiveGuard mapGuard(modPageMapMutex);
    incrPageUpdateCount(
        snapshotId,
        ANON_PAGE_OWNER_ID,
        ModifiedPageEntry::MODIFIED);
}
BlockId SnapshotRandomAllocationSegment::translatePageId(PageId pageId)
{
    PageId snapshotId = getSnapshotId(pageId);
    return DelegatingSegment::translatePageId(snapshotId);
}
PageId SnapshotRandomAllocationSegment::updatePage(
    PageId pageId,
    bool needsTranslation)
{
    assert(!readOnlyCommittedData);

    PageId anchorPageId;
    PageId snapshotId;
    PageOwnerId ownerId;

    // If the snapshot page is newly allocated, then we can update the page
    // in-place.  The page we would have updated should be the page chained
    // from the anchor, which corresponds to the latest version of the page.
    // That, in turn, should correspond to the snapshot we would have read.

    if (needsTranslation) {
        assert(pageId == getAnchorPageId(pageId));
        VersionedPageEntry pageEntry;
        pVersionedRandomSegment->getLatestPageEntryCopy(pageId, pageEntry);
        assert(pageEntry.versionChainPageId == getSnapshotId(pageId));
        if (isPageNewlyAllocated(pageEntry.versionChainPageId)) {
            return NULL_PAGE_ID;
        }

        anchorPageId = pageId;
        snapshotId = pageEntry.versionChainPageId;
        ownerId = pageEntry.ownerId;

    } else {
        if (isPageNewlyAllocated(pageId)) {
            return NULL_PAGE_ID;
        }
        VersionedPageEntry pageEntry;
        anchorPageId = getAnchorPageId(pageId);
        pVersionedRandomSegment->getLatestPageEntryCopy(
            anchorPageId,
            pageEntry);
        assert(pageEntry.versionChainPageId == pageId);
        assert(pageId == getSnapshotId(anchorPageId));

        snapshotId = pageId;
        ownerId = pageEntry.ownerId;
    }

    // Otherwise, this is the first time we're modifying the page.
    // Allocate a new page and chain it into the existing version chain.
    // Also set the successor page on the new page to the successor set
    // on the current snapshot page.

    PageId newPageId = allocatePageId(ownerId);

    SXMutexExclusiveGuard mapGuard(modPageMapMutex);

    VersionedPageEntry pageEntry;
    pVersionedRandomSegment->getLatestPageEntryCopy(snapshotId, pageEntry);
    chainPageEntries(
        newPageId,
        snapshotId,
        pageEntry.successorId);
    chainPageEntries(anchorPageId, newPageId, NULL_PAGE_ID);

    // Store a mapping of the new page to itself so when we later need to
    // update that page, our cached mapping will tell us to directly
    // access that page.
    StrictMutexGuard mutexGuard(snapshotPageMapMutex);
    snapshotPageMap[newPageId] = newPageId;
    snapshotPageMap[anchorPageId] = newPageId;
    return newPageId;
}
PageId SnapshotRandomAllocationSegment::getPageSuccessor(PageId pageId)
{
    PageId snapshotId = getSnapshotId(pageId);
    return DelegatingSegment::getPageSuccessor(snapshotId);
}