diff options
author | Kitty Barnett <develop@catznip.com> | 2024-09-02 01:57:34 +0200 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-05-11 16:28:04 +0800 |
commit | de4d49e8c70d040dd2735d16997dbc4b48438c30 (patch) | |
tree | bfb023d3becb090b195c9daea8c40764a3ae254c /indra/newview/rlvhandler.cpp | |
parent | 838a398036ec96f2fd2149c0560182913e00860b (diff) |
Add the @getcommand command query reply command
Diffstat (limited to 'indra/newview/rlvhandler.cpp')
-rw-r--r-- | indra/newview/rlvhandler.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 3d7f73937f..8b2620cf48 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -9,6 +9,8 @@ #include "rlvhandler.h" #include "rlvhelper.h" +#include <boost/algorithm/string.hpp> + using namespace Rlv; // ============================================================================ @@ -143,6 +145,35 @@ ECmdRet CommandHandlerBaseImpl<EParamType::Reply>::processCommand(const RlvComma return eRet; } +// Handles: @getcommand[:<behaviour>[;<type>[;<separator>]]]=<channel> +template<> template<> +ECmdRet ReplyHandler<EBehaviour::GetCommand>::onCommand(const RlvCommand& rlvCmd, std::string& strReply) +{ + std::vector<std::string> optionList; + Util::parseStringList(rlvCmd.getOption(), optionList); + + // If a second parameter is present it'll specify the command type + EParamType eType = EParamType::Unknown; + if (optionList.size() >= 2) + { + if (optionList[1] == "any" || optionList[1].empty()) + eType = EParamType::Unknown; + else if (optionList[1] == "add") + eType = EParamType::AddRem; + else if (optionList[1] == "force") + eType = EParamType::Force; + else if (optionList[1] == "reply") + eType = EParamType::Reply; + else + return ECmdRet::FailedOption; + } + + std::list<std::string> cmdList; + if (BehaviourDictionary::instance().getCommands(!optionList.empty() ? optionList[0] : LLStringUtil::null, eType, cmdList)) + strReply = boost::algorithm::join(cmdList, optionList.size() >= 3 ? optionList[2] : Constants::OptionSeparator); + return ECmdRet::Success; +} + // Handles: @version=<chnannel> and @versionnew=<channel> template<> template<> ECmdRet VersionReplyHandler::onCommand(const RlvCommand& rlvCmd, std::string& strReply) |