diff options
author | Kitty Barnett <develop@catznip.com> | 2024-09-02 01:57:34 +0200 |
---|---|---|
committer | Kitty Barnett <develop@catznip.com> | 2024-09-02 01:57:34 +0200 |
commit | 4f7eb9b12e9c7eeb9f3ee0980bd4616df7d678b6 (patch) | |
tree | 30142af9460e1e75a6259917e338b25924619d4e /indra/newview/rlvhandler.cpp | |
parent | 7402fe6412e98e4b295ee3e04874f379c752f7a0 (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) |