From 7402fe6412e98e4b295ee3e04874f379c752f7a0 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 2 Sep 2024 01:39:17 +0200 Subject: Add basic scaffolding to support reply commands and handle @versionXXX as an illustration --- indra/newview/rlvcommon.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'indra/newview/rlvcommon.cpp') 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; +} + +// ============================================================================ -- cgit v1.2.3