summaryrefslogtreecommitdiff
path: root/indra/newview/llautoreplace.cpp
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2012-12-14 16:02:15 -0800
committerGilbert Gonzales <gilbert@lindenlab.com>2012-12-14 16:02:15 -0800
commit080a77a0d98905b2eccf9a0a30dbcd691dab83bd (patch)
tree77d083e0b837c7a6000b651a3e11015f74824347 /indra/newview/llautoreplace.cpp
parent68b61bdec620014f30d6e9c63726d96fa7f4382a (diff)
parent56b23a8727af34d950e217affa784d322b737cc3 (diff)
mergiing in latest changes
Diffstat (limited to 'indra/newview/llautoreplace.cpp')
-rw-r--r--indra/newview/llautoreplace.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp
index 0f1ce2bcd0..d71cf290d6 100644
--- a/indra/newview/llautoreplace.cpp
+++ b/indra/newview/llautoreplace.cpp
@@ -536,6 +536,46 @@ LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::addList(const LLSD&
return result;
}
+LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::replaceList(const LLSD& newList)
+{
+ AddListResult result = AddListInvalidList;
+ if ( listIsValid( newList ) )
+ {
+ std::string listName = newList[AUTOREPLACE_LIST_NAME].asString();
+ bool listFound = false;
+ S32 search_index;
+ LLSD targetList;
+ // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30
+ for ( search_index = 0, targetList = mLists[0];
+ !listFound && search_index < mLists.size();
+ search_index += 1, targetList = mLists[search_index]
+ )
+ {
+ if ( targetList.isMap() )
+ {
+ if ( listNameMatches( targetList, listName) )
+ {
+ LL_DEBUGS("AutoReplace")<<"list to replace found at "<<search_index<<LL_ENDL;
+ mLists.erase(search_index);
+ mLists.insert(search_index, newList);
+ listFound = true;
+ result = AddListOk;
+ }
+ }
+ }
+
+ if ( ! listFound )
+ {
+ LL_WARNS("AutoReplace") << "attempt to replace unconfigured list" << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS("AutoReplace") << "attempt to add invalid list" << LL_ENDL;
+ }
+ return result;
+}
+
bool LLAutoReplaceSettings::removeReplacementList(std::string listName)
{
bool found = false;