/** * * Copyright (c) 2009-2011, 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; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt * * By copying, modifying or distributing this software, you acknowledge that * you have read and understood your obligations described above, and agree to * abide by those obligations. * */ #include "llviewerprecompiledheaders.h" #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" #include "llattachmentsmgr.h" #include "llgesturemgr.h" #include "llnotificationsutil.h" #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llwlparammanager.h" #include "rlvhelper.h" #include "rlvhandler.h" #include "rlvinventory.h" #include // ============================================================================ // RlvCommmand // RlvCommand::bhvr_map_t RlvCommand::m_BhvrMap; // Checked: 2009-12-27 (RLVa-1.1.0k) | Modified: RLVa-1.1.0k RlvCommand::RlvCommand(const LLUUID& idObj, const std::string& strCommand) : m_fValid(false), m_idObj(idObj), m_eBehaviour(RLV_BHVR_UNKNOWN), m_fStrict(false), m_eParamType(RLV_TYPE_UNKNOWN), m_eRet(RLV_RET_UNKNOWN) { if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam))) { S32 nTemp = 0; if ( ("n" == m_strParam) || ("add" == m_strParam) ) m_eParamType = RLV_TYPE_ADD; else if ( ("y" == m_strParam) || ("rem" == m_strParam) ) m_eParamType = RLV_TYPE_REMOVE; else if (m_strBehaviour == "clear") // clear is the odd one out so just make it its own type m_eParamType = RLV_TYPE_CLEAR; else if ("force" == m_strParam) m_eParamType = RLV_TYPE_FORCE; else if (LLStringUtil::convertToS32(m_strParam, nTemp)) // Assume it's a reply command if we can convert to an S32 m_eParamType = RLV_TYPE_REPLY; else { m_eParamType = RLV_TYPE_UNKNOWN; m_fValid = false; } } if (!m_fValid) { m_strBehaviour = m_strOption = m_strParam = ""; return; } // HACK: all those @*overorreplace synonyms are rather tedious (and error-prone) to deal with so replace them their equivalent if ( (RLV_TYPE_FORCE == m_eParamType) && (m_strBehaviour.length() > 13) && (m_strBehaviour.length() - 13 == m_strBehaviour.rfind("overorreplace")) ) { m_strBehaviour.erase(m_strBehaviour.length() - 13, 13); } // HACK: all those @addoutfit* synonyms are rather tedious (and error-prone) to deal with so replace them their @attach* equivalent if ( (RLV_TYPE_FORCE == m_eParamType) && (0 == m_strBehaviour.find("addoutfit")) ) { m_strBehaviour.replace(0, 9, "attach"); } m_eBehaviour = getBehaviourFromString(m_strBehaviour, &m_fStrict); } bool RlvCommand::parseCommand(const std::string& strCommand, std::string& strBehaviour, std::string& strOption, std::string& strParam) { // (See behaviour notes for the command parsing truth table) // Format: [: