aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/rlvhelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/rlvhelper.cpp67
1 files changed, 35 insertions, 32 deletions
diff --git a/linden/indra/newview/rlvhelper.cpp b/linden/indra/newview/rlvhelper.cpp
index f495384..c8d430d 100644
--- a/linden/indra/newview/rlvhelper.cpp
+++ b/linden/indra/newview/rlvhelper.cpp
@@ -23,7 +23,7 @@ RlvCommand::RlvBhvrTable RlvCommand::m_BhvrMap;
23 23
24// Checked: 2009-09-10 (RLVa-1.0.3a) | Modified: RLVa-1.0.3a 24// Checked: 2009-09-10 (RLVa-1.0.3a) | Modified: RLVa-1.0.3a
25RlvCommand::RlvCommand(const std::string& strCommand) 25RlvCommand::RlvCommand(const std::string& strCommand)
26 : m_eBehaviour(RLV_BHVR_UNKNOWN), m_eParamType(RLV_TYPE_UNKNOWN) 26 : m_eBehaviour(RLV_BHVR_UNKNOWN), m_fStrict(false), m_eParamType(RLV_TYPE_UNKNOWN)
27{ 27{
28 if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam))) 28 if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam)))
29 { 29 {
@@ -51,8 +51,12 @@ RlvCommand::RlvCommand(const std::string& strCommand)
51 return; 51 return;
52 } 52 }
53 53
54 RlvBhvrTable::const_iterator itBhvr = m_BhvrMap.find(m_strBehaviour); 54 // Check if this is the "strict" (aka "secure") variation of a behaviour
55 if (itBhvr != m_BhvrMap.end()) 55 std::string::size_type idxStrict = m_strBehaviour.find("_sec");
56 m_fStrict = (std::string::npos != idxStrict) && (idxStrict + 4 == m_strBehaviour.length());
57
58 RlvBhvrTable::const_iterator itBhvr = m_BhvrMap.find( (!m_fStrict) ? m_strBehaviour : m_strBehaviour.substr(0, idxStrict));
59 if ( (itBhvr != m_BhvrMap.end()) && ((!m_fStrict) || (hasStrictVariant(itBhvr->second))) )
56 m_eBehaviour = itBhvr->second; 60 m_eBehaviour = itBhvr->second;
57} 61}
58 62
@@ -104,8 +108,8 @@ void RlvCommand::initLookupTable()
104 "remoutfit", "getoutfit", "getattach", "showinv", "viewnote", "unsit", "sit", "sendchannel", "getstatus", "getstatusall", 108 "remoutfit", "getoutfit", "getattach", "showinv", "viewnote", "unsit", "sit", "sendchannel", "getstatus", "getstatusall",
105 "getinv", "getinvworn", "findfolder", "findfolders", "attach", "attachall", "detachall", "getpath", "attachthis", 109 "getinv", "getinvworn", "findfolder", "findfolders", "attach", "attachall", "detachall", "getpath", "attachthis",
106 "attachallthis", "detachthis", "detachallthis", "fartouch", "showworldmap", "showminimap", "showloc", "tpto", "accepttp", 110 "attachallthis", "detachthis", "detachallthis", "fartouch", "showworldmap", "showminimap", "showloc", "tpto", "accepttp",
107 "shownames", "fly", "getsitid", "setdebug", "setenv", "detachme", "showhovertextall", "showhovertextworld", 111 "acceptpermission", "shownames", "fly", "getsitid", "setdebug", "setenv", "detachme", "showhovertextall",
108 "showhovertexthud", "showhovertext", "notify" 112 "showhovertextworld", "showhovertexthud", "showhovertext", "notify", "defaultwear", "versionnum", "permissive"
109 }; 113 };
110 114
111 for (int idxBvhr = 0; idxBvhr < RLV_BHVR_COUNT; idxBvhr++) 115 for (int idxBvhr = 0; idxBvhr < RLV_BHVR_COUNT; idxBvhr++)
@@ -133,12 +137,14 @@ bool RlvObject::addCommand(const RlvCommand& rlvCmd)
133 return false; 137 return false;
134 138
135 // Don't add duplicate commands for this object (ie @detach=n followed by another @detach=n later on) 139 // Don't add duplicate commands for this object (ie @detach=n followed by another @detach=n later on)
136 bool fDuplicate = 140 for (rlv_command_list_t::iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd)
137 (RLV_BHVR_UNKNOWN != rlvCmd.getBehaviourType()) 141 {
138 ? hasBehaviour(rlvCmd.getBehaviourType(), rlvCmd.getOption()) 142 if ( (itCmd->getBehaviour() == rlvCmd.getBehaviour()) && (itCmd->getOption() == rlvCmd.getOption()) &&
139 : hasBehaviour(rlvCmd.getBehaviour(), rlvCmd.getOption()); 143 (itCmd->isStrict() == rlvCmd.isStrict() ) )
140 if (fDuplicate) 144 {
141 return false; 145 return false;
146 }
147 }
142 148
143 // Now that we know it's not a duplicate, add it to the end of the list 149 // Now that we know it's not a duplicate, add it to the end of the list
144 m_Commands.push_back(rlvCmd); 150 m_Commands.push_back(rlvCmd);
@@ -155,7 +161,8 @@ bool RlvObject::removeCommand(const RlvCommand& rlvCmd)
155 for (rlv_command_list_t::iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) 161 for (rlv_command_list_t::iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd)
156 { 162 {
157 //if (*itCmd == rlvCmd) <- commands will never be equal since one is an add and the other is a remove *rolls eyes* 163 //if (*itCmd == rlvCmd) <- commands will never be equal since one is an add and the other is a remove *rolls eyes*
158 if ( (itCmd->getBehaviour() == rlvCmd.getBehaviour()) && (itCmd->getOption() == rlvCmd.getOption()) ) 164 if ( (itCmd->getBehaviour() == rlvCmd.getBehaviour()) && (itCmd->getOption() == rlvCmd.getOption()) &&
165 (itCmd->isStrict() == rlvCmd.isStrict() ) )
159 { 166 {
160 m_Commands.erase(itCmd); 167 m_Commands.erase(itCmd);
161 return true; 168 return true;
@@ -164,34 +171,18 @@ bool RlvObject::removeCommand(const RlvCommand& rlvCmd)
164 return false; // Command was never added so nothing to remove now 171 return false; // Command was never added so nothing to remove now
165} 172}
166 173
167bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour) const 174bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour, bool fStrictOnly) const
168{
169 for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd)
170 if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption().empty()) )
171 return true;
172 return false;
173}
174
175bool RlvObject::hasBehaviour(const std::string& strBehaviour) const
176{
177 for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd)
178 if ( (itCmd->getBehaviour() == strBehaviour) && (itCmd->getOption().empty()) )
179 return true;
180 return false;
181}
182
183bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption) const
184{ 175{
185 for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) 176 for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd)
186 if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption() == strOption) ) 177 if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption().empty()) && ((!fStrictOnly) || (itCmd->isStrict())) )
187 return true; 178 return true;
188 return false; 179 return false;
189} 180}
190 181
191bool RlvObject::hasBehaviour(const std::string& strBehaviour, const std::string& strOption) const 182bool RlvObject::hasBehaviour(ERlvBehaviour eBehaviour, const std::string& strOption, bool fStrictOnly) const
192{ 183{
193 for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd) 184 for (rlv_command_list_t::const_iterator itCmd = m_Commands.begin(); itCmd != m_Commands.end(); ++itCmd)
194 if ( (itCmd->getBehaviour() == strBehaviour) && (itCmd->getOption() == strOption) ) 185 if ( (itCmd->getBehaviourType() == eBehaviour) && (itCmd->getOption() == strOption) && ((!fStrictOnly) || (itCmd->isStrict())) )
195 return true; 186 return true;
196 return false; 187 return false;
197} 188}
@@ -361,6 +352,11 @@ RlvWLSnapshot* RlvWLSnapshot::takeSnapshot()
361 352
362BOOL RlvSettings::fShowNameTags = FALSE; 353BOOL RlvSettings::fShowNameTags = FALSE;
363 354
355BOOL RlvSettings::getEnableWear()
356{
357 return rlvGetSettingBOOL(RLV_SETTING_ENABLEWEAR, TRUE) && (!gRlvHandler.hasBehaviour(RLV_BHVR_DEFAULTWEAR));
358}
359
364#ifdef RLV_EXTENSION_STARTLOCATION 360#ifdef RLV_EXTENSION_STARTLOCATION
365 // Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1d 361 // Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1d
366 void RlvSettings::updateLoginLastLocation() 362 void RlvSettings::updateLoginLastLocation()
@@ -475,6 +471,13 @@ bool rlvCanDeleteOrReturn()
475 return fIsAllowed; 471 return fIsAllowed;
476} 472}
477 473
474// Checked: 2009-10-04 (RLVa-1.0.4b) | Modified: RLVa-1.0.4b
475BOOL rlvEnableWearEnabler(void* pParam)
476{
477 // Visually disables the "Enable Wear" option when restricted from toggling it
478 return (!gRlvHandler.hasBehaviour(RLV_BHVR_DEFAULTWEAR));
479}
480
478// Checked: 2009-05-26 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d 481// Checked: 2009-05-26 (RLVa-0.2.0d) | Modified: RLVa-0.2.0d
479S32 rlvGetDirectDescendentsCount(const LLInventoryCategory* pFolder, LLAssetType::EType type) 482S32 rlvGetDirectDescendentsCount(const LLInventoryCategory* pFolder, LLAssetType::EType type)
480{ 483{