diff options
author | Kitty Barnett <develop@catznip.com> | 2024-09-02 01:39:17 +0200 |
---|---|---|
committer | Kitty Barnett <develop@catznip.com> | 2024-09-02 01:39:17 +0200 |
commit | 7402fe6412e98e4b295ee3e04874f379c752f7a0 (patch) | |
tree | 65b3bfb411094953f7e2cac6df9d0c73462cb49e /indra/newview/rlvcommon.cpp | |
parent | b82e9b73d35e41ed51063905dd31ccced9e97266 (diff) |
Add basic scaffolding to support reply commands and handle @versionXXX as an illustration
Diffstat (limited to 'indra/newview/rlvcommon.cpp')
-rw-r--r-- | indra/newview/rlvcommon.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index f641d56a85..898df3af42 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -1,5 +1,10 @@ #include "llviewerprecompiledheaders.h" +#include "llagent.h" +#include "llchat.h" +#include "lldbstrings.h" #include "llversioninfo.h" +#include "llviewerstats.h" +#include "message.h" #include "rlvdefines.h" #include "rlvcommon.h" @@ -10,7 +15,7 @@ using namespace Rlv; // RlvStrings // -std::string RlvStrings::getVersion(bool wants_legacy) +std::string Strings::getVersion(bool wants_legacy) { return llformat("%s viewer v%d.%d.%d (RLVa %d.%d.%d)", !wants_legacy ? "RestrainedLove" : "RestrainedLife", @@ -18,23 +23,47 @@ std::string RlvStrings::getVersion(bool wants_legacy) ImplVersion::Major, ImplVersion::Minor, ImplVersion::Patch); } -std::string RlvStrings::getVersionAbout() +std::string Strings::getVersionAbout() { return llformat("RLV v%d.%d.%d / RLVa v%d.%d.%d.%d", SpecVersion::Major, SpecVersion::Minor, SpecVersion::Patch, ImplVersion::Major, ImplVersion::Minor, ImplVersion::Patch, LLVersionInfo::instance().getBuild()); } -std::string RlvStrings::getVersionNum() +std::string Strings::getVersionNum() { return llformat("%d%02d%02d%02d", SpecVersion::Major, SpecVersion::Minor, SpecVersion::Patch, SpecVersion::Build); } -std::string RlvStrings::getVersionImplNum() +std::string Strings::getVersionImplNum() { return llformat("%d%02d%02d%02d", ImplVersion::Major, ImplVersion::Minor, ImplVersion::Patch, ImplVersion::ImplId); } // ============================================================================ +// RlvUtil +// + +bool Util::sendChatReply(S32 nChannel, const std::string& strUTF8Text) +{ + if (!isValidReplyChannel(nChannel)) + return false; + + // Copy/paste from send_chat_from_viewer() + gMessageSystem->newMessageFast(_PREHASH_ChatFromViewer); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gMessageSystem->nextBlockFast(_PREHASH_ChatData); + gMessageSystem->addStringFast(_PREHASH_Message, utf8str_truncate(strUTF8Text, MAX_MSG_STR_LEN)); + gMessageSystem->addU8Fast(_PREHASH_Type, CHAT_TYPE_SHOUT); + gMessageSystem->addS32("Channel", nChannel); + gAgent.sendReliableMessage(); + add(LLStatViewer::CHAT_COUNT, 1); + + return true; +} + +// ============================================================================ |