[RLVa] Updates thanks to Kitty
1ea7389, 49be412, ed4c8e6 & 7ce9521 - changed : "Give to #RLV" agent-to-agent and script-to-agent offers can contain subfolders -> limited to 3 levels (e.g. #RLV/~FolderA/FolderB/FolderC) -> #RLV folder is auto-created if it doesn't currently exist 8780d84 - Incremented version number to RLVa-1.4.10 f078067 - internal : boolean (custom) debug settings should have a boolean type 72a8ad8 & 401ca14 - internal : added supporting code for "Detach Folder" RLVa lock checks 05718b5 - fixed : RenderResolutionDivisor is non-functional -> RenderResolutionDivisor isn't actually taken into account when checking the new screen resolution against the current screen buffer size 4fa138b - fixed : viewer clips mouse to its rectangle when switching into mouselook while it's not the active application -> Repro: * rez a prim with a script to llForceMouseLook(TRUE) and force-sit when clicked (with a slight delay) * click the prim and give focus to another application => the viewer will center the mouse cursor on itself and restrict movement to within its own rectangle (requires alt-tab to escape) + Singu Note: Thanks to Kitty for this, it is possible that this would happen in our last release 14132c9 - fixed : region name and global coordinates are shown on the About floater when @showloc restricted + Singu Note: RLV version is now shown in help->about 9a2af62 - changed : llRegionSayTo messages are no longer subject to @recvchat(from) or @recvemote(from) 2dc4b89 - fixed : @getstatus and @getstatusall should specify an (optional) separator -> added support for both @getstatus:tp;|=123 and @getstatus:;|=123 fbb3fb1 - Incremented API version number to 2.8.0 92c39b9 - internal : quick and dirty hack fix for RlvUtil::filterNames() but there's no time to do a proper backport from RLVa-1.5 2580f1c - internal : remove hack for legacy viewers without multi-attachment support
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* Copyright (c) 2009-2011, Kitty Barnett
|
||||
* Copyright (c) 2009-2014, Kitty Barnett
|
||||
*
|
||||
* The source code in this file is provided to you under the terms of the
|
||||
* GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY;
|
||||
@@ -270,7 +270,7 @@ const LLUUID& RlvInventory::getSharedRootID() const
|
||||
}
|
||||
|
||||
// Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-1.0.1a
|
||||
LLViewerInventoryCategory* RlvInventory::getSharedFolder(const LLUUID& idParent, const std::string& strFolderName) const
|
||||
LLViewerInventoryCategory* RlvInventory::getSharedFolder(const LLUUID& idParent, const std::string& strFolderName, bool fMatchPartial) const
|
||||
{
|
||||
LLInventoryModel::cat_array_t* pFolders; LLInventoryModel::item_array_t* pItems;
|
||||
gInventory.getDirectDescendentsOf(idParent, pFolders, pItems);
|
||||
@@ -279,22 +279,14 @@ LLViewerInventoryCategory* RlvInventory::getSharedFolder(const LLUUID& idParent,
|
||||
|
||||
// If we can't find an exact match then we'll settle for a "contains" match
|
||||
LLViewerInventoryCategory* pPartial = NULL;
|
||||
|
||||
//LLStringUtil::toLower(strFolderName); <- everything was already converted to lower case before
|
||||
|
||||
std::string strName;
|
||||
for (S32 idxFolder = 0, cntFolder = pFolders->count(); idxFolder < cntFolder; idxFolder++)
|
||||
for (LLInventoryModel::cat_array_t::const_iterator itFolder = pFolders->begin(); itFolder != pFolders->end(); ++itFolder)
|
||||
{
|
||||
LLViewerInventoryCategory* pFolder = pFolders->get(idxFolder);
|
||||
LLViewerInventoryCategory* pFolder = *itFolder;
|
||||
std::string strName = pFolder->getName();
|
||||
|
||||
strName = pFolder->getName();
|
||||
if (strName.empty())
|
||||
continue;
|
||||
LLStringUtil::toLower(strName);
|
||||
|
||||
if (strFolderName == strName)
|
||||
if (boost::iequals(strName, strFolderName))
|
||||
return pFolder; // Found an exact match, no need to keep on going
|
||||
else if ( (!pPartial) && (RLV_FOLDER_PREFIX_HIDDEN != strName[0]) && (std::string::npos != strName.find(strFolderName)) )
|
||||
else if ( (fMatchPartial) && (!pPartial) && (RLV_FOLDER_PREFIX_HIDDEN != strName[0]) && (boost::icontains(strName, strFolderName) ) )
|
||||
pPartial = pFolder; // Found a partial (non-hidden) match, but we might still find an exact one (first partial match wins)
|
||||
}
|
||||
|
||||
@@ -302,7 +294,7 @@ LLViewerInventoryCategory* RlvInventory::getSharedFolder(const LLUUID& idParent,
|
||||
}
|
||||
|
||||
// Checked: 2010-02-28 (RLVa-1.2.0a) | Modified: RLVa-0.2.0e
|
||||
LLViewerInventoryCategory* RlvInventory::getSharedFolder(const std::string& strPath) const
|
||||
LLViewerInventoryCategory* RlvInventory::getSharedFolder(const std::string& strPath, bool fMatchPartial) const
|
||||
{
|
||||
// Sanity check - no shared root => no shared folder
|
||||
LLViewerInventoryCategory* pRlvRoot = getSharedRoot(), *pFolder = pRlvRoot;
|
||||
@@ -313,7 +305,7 @@ LLViewerInventoryCategory* RlvInventory::getSharedFolder(const std::string& strP
|
||||
boost_tokenizer tokens(strPath, boost::char_separator<char>("/", "", boost::drop_empty_tokens));
|
||||
for (boost_tokenizer::const_iterator itToken = tokens.begin(); itToken != tokens.end(); ++itToken)
|
||||
{
|
||||
pFolder = getSharedFolder(pFolder->getUUID(), *itToken);
|
||||
pFolder = getSharedFolder(pFolder->getUUID(), *itToken, fMatchPartial);
|
||||
if (!pFolder)
|
||||
return NULL; // No such folder
|
||||
}
|
||||
@@ -503,7 +495,109 @@ void RlvRenameOnWearObserver::onCategoryCreate(const LLSD& sdData, void* pParam)
|
||||
// "Give to #RLV" helper classes
|
||||
//
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Added: RLVa-1.2.0e
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
bool RlvGiveToRLVOffer::createDestinationFolder(const std::string& strPath)
|
||||
{
|
||||
// NOTE: derived classes will delete the instance in their onDestinationCreated override, so don't do anything after triggering the callback
|
||||
|
||||
m_DestPath.clear();
|
||||
if (0 == strPath.find(RLV_PUTINV_PREFIX))
|
||||
{
|
||||
boost::split(m_DestPath, strPath, boost::is_any_of(std::string(RLV_PUTINV_SEPARATOR)));
|
||||
}
|
||||
|
||||
if ( (m_DestPath.size() >= 2) && (m_DestPath.size() <= RLV_PUTINV_MAXDEPTH) )
|
||||
{
|
||||
const std::string strFolder = m_DestPath.front();
|
||||
if (RLV_ROOT_FOLDER == strFolder)
|
||||
{
|
||||
m_DestPath.pop_front();
|
||||
|
||||
const LLUUID& idRlvRoot = RlvInventory::instance().getSharedRootID();
|
||||
if (idRlvRoot.notNull())
|
||||
{
|
||||
onCategoryCreateCallback(LLSD().with("folder_id", idRlvRoot), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
const LLUUID idTemp = gInventory.createNewCategory(gInventory.getRootFolderID(), LLFolderType::FT_NONE, RLV_ROOT_FOLDER, onCategoryCreateCallback, (void*)this);
|
||||
if (idTemp.notNull())
|
||||
onCategoryCreateCallback(LLSD().with("folder_id", idTemp), this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
m_DestPath.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
void RlvGiveToRLVOffer::onCategoryCreateCallback(const LLSD& sdData, void* pInstance)
|
||||
{
|
||||
RlvGiveToRLVOffer* pThis = (RlvGiveToRLVOffer*)pInstance;
|
||||
|
||||
LLUUID idFolder = sdData["folder_id"].asUUID();
|
||||
if (idFolder.isNull())
|
||||
{
|
||||
// Problem encountered, abort move
|
||||
pThis->onDestinationCreated(LLUUID::null, LLStringUtil::null);
|
||||
return;
|
||||
}
|
||||
|
||||
while (pThis->m_DestPath.size() > 1)
|
||||
{
|
||||
std::string strFolder = pThis->m_DestPath.front();
|
||||
pThis->m_DestPath.pop_front();
|
||||
|
||||
const LLViewerInventoryCategory* pFolder = RlvInventory::instance().getSharedFolder(idFolder, strFolder, false);
|
||||
if (pFolder)
|
||||
{
|
||||
idFolder = pFolder->getUUID();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLInventoryObject::correctInventoryName(strFolder);
|
||||
const LLUUID idTemp = gInventory.createNewCategory(idFolder, LLFolderType::FT_NONE, strFolder, onCategoryCreateCallback, pInstance);
|
||||
if (idTemp.notNull())
|
||||
onCategoryCreateCallback(LLSD().with("folder_id", idTemp), pInstance);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Destination folder should exist at this point (we'll be deallocated when the function returns)
|
||||
pThis->onDestinationCreated(idFolder, pThis->m_DestPath.front());
|
||||
}
|
||||
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
void RlvGiveToRLVOffer::moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName)
|
||||
{
|
||||
const LLViewerInventoryCategory* pDest = gInventory.getCategory(idDestination);
|
||||
const LLViewerInventoryCategory* pFolder = gInventory.getCategory(idFolder);
|
||||
if ( (pDest) && (pFolder) )
|
||||
{
|
||||
LLPointer<LLViewerInventoryCategory> pNewFolder = new LLViewerInventoryCategory(pFolder);
|
||||
if (pDest->getUUID() != pFolder->getParentUUID())
|
||||
{
|
||||
LLInventoryModel::update_list_t update;
|
||||
LLInventoryModel::LLCategoryUpdate updOldParent(pFolder->getParentUUID(), -1);
|
||||
update.push_back(updOldParent);
|
||||
LLInventoryModel::LLCategoryUpdate updNewParent(pDest->getUUID(), 1);
|
||||
update.push_back(updNewParent);
|
||||
gInventory.accountForUpdate(update);
|
||||
|
||||
pNewFolder->setParent(pDest->getUUID());
|
||||
pNewFolder->updateParentOnServer(FALSE);
|
||||
}
|
||||
|
||||
pNewFolder->rename(strName);
|
||||
pNewFolder->updateServer(FALSE);
|
||||
gInventory.updateCategory(pNewFolder);
|
||||
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
||||
void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
||||
{
|
||||
if (mask & LLInventoryObserver::ADD)
|
||||
@@ -513,10 +607,10 @@ void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
||||
{
|
||||
LLUUID idTransaction;
|
||||
pMsg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, idTransaction);
|
||||
if(m_idTransaction == idTransaction)
|
||||
if (m_idTransaction == idTransaction)
|
||||
{
|
||||
LLUUID idInvObject;
|
||||
for(S32 idxBlock = 0, cntBlock = pMsg->getNumberOfBlocksFast(_PREHASH_FolderData); idxBlock < cntBlock; idxBlock++)
|
||||
for (S32 idxBlock = 0, cntBlock = pMsg->getNumberOfBlocksFast(_PREHASH_FolderData); idxBlock < cntBlock; idxBlock++)
|
||||
{
|
||||
pMsg->getUUIDFast(_PREHASH_FolderData, _PREHASH_FolderID, idInvObject, idxBlock);
|
||||
if ( (idInvObject.notNull()) && (std::find(m_Folders.begin(), m_Folders.end(), idInvObject) == m_Folders.end()) )
|
||||
@@ -529,7 +623,7 @@ void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
||||
}
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Added: RLVa-1.2.0e
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
||||
void RlvGiveToRLVTaskOffer::done()
|
||||
{
|
||||
gInventory.removeObserver(this);
|
||||
@@ -538,37 +632,28 @@ void RlvGiveToRLVTaskOffer::done()
|
||||
doOnIdleOneTime(boost::bind(&RlvGiveToRLVTaskOffer::doneIdle, this));
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Added: RLVa-1.2.0e
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
void RlvGiveToRLVTaskOffer::doneIdle()
|
||||
{
|
||||
const LLViewerInventoryCategory* pRlvRoot = RlvInventory::instance().getSharedRoot();
|
||||
if (pRlvRoot)
|
||||
const LLViewerInventoryCategory* pFolder = (m_Folders.size()) ? gInventory.getCategory(m_Folders.front()) : NULL;
|
||||
if ( (!pFolder) || (!createDestinationFolder(pFolder->getName())) )
|
||||
delete this;
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Added: RLVa-1.2.0e
|
||||
void RlvGiveToRLVTaskOffer::onDestinationCreated(const LLUUID& idFolder, const std::string& strName)
|
||||
{
|
||||
const LLViewerInventoryCategory* pTarget = (idFolder.notNull()) ? gInventory.getCategory(idFolder) : NULL;
|
||||
if (pTarget)
|
||||
{
|
||||
for (folder_ref_t::const_iterator itFolder = m_Folders.begin(); itFolder != m_Folders.end(); ++itFolder)
|
||||
{
|
||||
const LLViewerInventoryCategory* pFolder = gInventory.getCategory(*itFolder);
|
||||
if (!pFolder)
|
||||
continue;
|
||||
|
||||
std::string strFolder = pFolder->getName();
|
||||
if ( (pRlvRoot->getUUID() == pFolder->getParentUUID() ) && (strFolder.find(RLV_PUTINV_PREFIX) == 0))
|
||||
{
|
||||
LLPointer<LLViewerInventoryCategory> pNewFolder = new LLViewerInventoryCategory(pFolder);
|
||||
pNewFolder->rename(strFolder.erase(0, strFolder.find(RLV_FOLDER_PREFIX_PUTINV)));
|
||||
pNewFolder->updateServer(FALSE);
|
||||
gInventory.updateCategory(pNewFolder);
|
||||
|
||||
RlvBehaviourNotifyHandler::sendNotification("accepted_in_rlv inv_offer " + pNewFolder->getName());
|
||||
|
||||
gInventory.notifyObservers();
|
||||
break;
|
||||
}
|
||||
}
|
||||
const LLUUID& idOfferedFolder = m_Folders.front();
|
||||
moveAndRename(idOfferedFolder, idFolder, strName);
|
||||
RlvBehaviourNotifyHandler::sendNotification("accepted_in_rlv inv_offer " + RlvInventory::instance().getSharedPath(idOfferedFolder));
|
||||
}
|
||||
delete this;
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Modified: RLVa-1.2.0e
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
void RlvGiveToRLVAgentOffer::done()
|
||||
{
|
||||
gInventory.removeObserver(this);
|
||||
@@ -577,33 +662,19 @@ void RlvGiveToRLVAgentOffer::done()
|
||||
doOnIdleOneTime(boost::bind(&RlvGiveToRLVAgentOffer::doneIdle, this));
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Modified: RLVa-1.2.0e
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
void RlvGiveToRLVAgentOffer::doneIdle()
|
||||
{
|
||||
const LLViewerInventoryCategory* pRlvRoot = RlvInventory::instance().getSharedRoot();
|
||||
const LLViewerInventoryCategory* pFolder = (mComplete.size()) ? gInventory.getCategory(mComplete[0]) : NULL;
|
||||
if ( (pRlvRoot) && (pFolder) )
|
||||
{
|
||||
std::string strName = pFolder->getName();
|
||||
if (strName.find(RLV_PUTINV_PREFIX) == 0)
|
||||
{
|
||||
LLInventoryModel::update_list_t update;
|
||||
LLInventoryModel::LLCategoryUpdate updOldParent(pFolder->getParentUUID(), -1);
|
||||
update.push_back(updOldParent);
|
||||
LLInventoryModel::LLCategoryUpdate updNewParent(pRlvRoot->getUUID(), 1);
|
||||
update.push_back(updNewParent);
|
||||
gInventory.accountForUpdate(update);
|
||||
const LLViewerInventoryCategory* pFolder = (mComplete.size()) ? gInventory.getCategory(mComplete.front()) : NULL;
|
||||
if ( (!pFolder) || (!createDestinationFolder(pFolder->getName())) )
|
||||
delete this;
|
||||
}
|
||||
|
||||
LLPointer<LLViewerInventoryCategory> pNewFolder = new LLViewerInventoryCategory(pFolder);
|
||||
pNewFolder->setParent(pRlvRoot->getUUID());
|
||||
pNewFolder->updateParentOnServer(FALSE);
|
||||
pNewFolder->rename(strName.erase(0, strName.find(RLV_FOLDER_PREFIX_PUTINV)));
|
||||
pNewFolder->updateServer(FALSE);
|
||||
gInventory.updateCategory(pNewFolder);
|
||||
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
}
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
||||
void RlvGiveToRLVAgentOffer::onDestinationCreated(const LLUUID& idFolder, const std::string& strName)
|
||||
{
|
||||
if ( (idFolder.notNull()) && (mComplete.size()) )
|
||||
moveAndRename(mComplete[0], idFolder, strName);
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user