diff options
author | Kitty Barnett <develop@catznip.com> | 2024-09-01 01:21:00 +0200 |
---|---|---|
committer | Kitty Barnett <develop@catznip.com> | 2024-09-01 01:27:54 +0200 |
commit | b82e9b73d35e41ed51063905dd31ccced9e97266 (patch) | |
tree | b506aafc05c6cb3ae069d01ae22d2978b24da709 /indra/newview/rlvhandler.cpp | |
parent | c820bb2929a37fb222ce0d7368d699e81f5edc00 (diff) |
Add owner say chat hook
Diffstat (limited to 'indra/newview/rlvhandler.cpp')
-rw-r--r-- | indra/newview/rlvhandler.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 3315ed1999..bf78a0a38a 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1,10 +1,12 @@ #include "llviewerprecompiledheaders.h" #include "llappviewer.h" #include "llstartup.h" +#include "llviewercontrol.h" +#include "llviewerobject.h" -#include "rlvdefines.h" #include "rlvcommon.h" #include "rlvhandler.h" +#include "rlvhelper.h" using namespace Rlv; @@ -15,6 +17,46 @@ using namespace Rlv; bool RlvHandler::mIsEnabled = false; // ============================================================================ +// Command processing functions +// + +bool RlvHandler::handleSimulatorChat(std::string& message, const LLChat& chat, const LLViewerObject* chatObj) +{ + static LLCachedControl<bool> enable_temp_attach(gSavedSettings, Settings::EnableTempAttach); + static LLCachedControl<bool> show_debug_output(gSavedSettings, Settings::Debug); + static LLCachedControl<bool> hide_unset_dupes(gSavedSettings, Settings::DebugHideUnsetDup); + + if ( message.length() <= 3 || Rlv::Constants::CmdPrefix != message[0] || CHAT_TYPE_OWNER != chat.mChatType || + (chatObj && chatObj->isTempAttachment() && !enable_temp_attach()) ) + { + return false; + } + + message.erase(0, 1); + LLStringUtil::toLower(message); + CommandDbgOut cmdDbgOut(message); + + boost_tokenizer tokens(message, boost::char_separator<char>(",", "", boost::drop_empty_tokens)); + for (const std::string& strCmd : tokens) + { + ECmdRet eRet = (ECmdRet)processCommand(chat.mFromID, strCmd, true); + if ( show_debug_output() && + (!hide_unset_dupes() || (ECmdRet::SuccessUnset != eRet && ECmdRet::SuccessDuplicate != eRet)) ) + { + cmdDbgOut.add(strCmd, eRet); + } + } + + message = cmdDbgOut.get(); + return true; +} + +ECmdRet RlvHandler::processCommand(const LLUUID& idObj, const std::string& strCmd, bool fromObj) +{ + return ECmdRet::FailedNoProcessor; +} + +// ============================================================================ // Initialization helper functions // |