diff options
author | Erik Kundiman <erik@megapahit.org> | 2025-07-09 22:11:47 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-07-09 22:11:47 +0800 |
commit | 651df17f2c76b60b52c56a7cc35787a8ea87b246 (patch) | |
tree | 6321fbc042a30e86232dee1fe9dac1024c01e2aa /indra | |
parent | cd60b3e339c28d0cd86ca8a3bde5b2382a4b79b4 (diff) |
Partial @getinv=<channel> command implementation
Returns an empty string if #RLV folder doesn't contain any folder.
Listing sub-folders (folders under any folder under #RLV,
listed on the options) isn't implemented yet in this commit.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/rlvdefines.h | 1 | ||||
-rw-r--r-- | indra/newview/rlvhandler.cpp | 25 | ||||
-rw-r--r-- | indra/newview/rlvhelper.cpp | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index c6ba135f3e..5161e9241c 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -98,6 +98,7 @@ namespace Rlv SitGround, Unsit, Detach, + GetInv, GetCommand, Count, diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 67739ec72f..57275af54a 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -28,6 +28,8 @@ #include "llviewerprecompiledheaders.h" #include "llagent.h" #include "llstartup.h" +#include "llappearancemgr.h" +#include "llinventorymodel.h" #include "llmoveview.h" #include "llviewercontrol.h" #include "llviewermenu.h" @@ -238,6 +240,29 @@ ECmdRet ReplyHandler<EBehaviour::GetSitID>::onCommand(const RlvCommand& rlvCmd, return ECmdRet::Succeeded; } +template<> template<> +ECmdRet ReplyHandler<EBehaviour::GetInv>::onCommand(const RlvCommand& rlvCmd, std::string& strReply) +{ + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; + auto rlvFolderID = findDescendentCategoryIDByName(gInventory.getRootFolderID(), "#RLV"); + if (rlvFolderID == LLUUID::null) + return ECmdRet::FailedNoSharedRoot; + strReply = ""; + gInventory.getDirectDescendentsOf(rlvFolderID, cats, items); + auto iter = cats->begin(); + for(; cats->end() != iter; ++iter) + { + auto name = (*iter)->getName(); + if (name.front() == '.') + continue; + if (iter != cats->begin()) + strReply.append(","); + strReply.append(name); + } + return ECmdRet::Succeeded; +} + // Force ECmdRet CommandHandlerBaseImpl<EParamType::Force>::processCommand(const RlvCommand& rlvCmd, ForceHandlerFunc* pHandler) diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index b4abbc04f3..9f71d81206 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -51,6 +51,7 @@ BehaviourDictionary::BehaviourDictionary() // addEntry(new ReplyProcessor<EBehaviour::GetCommand>("getcommand")); addEntry(new ReplyProcessor<EBehaviour::GetSitID>("getsitid")); + addEntry(new ReplyProcessor<EBehaviour::GetInv>("getinv")); addEntry(new ReplyProcessor<EBehaviour::Version, VersionReplyHandler>("version")); addEntry(new ReplyProcessor<EBehaviour::VersionNew, VersionReplyHandler>("versionnew")); addEntry(new ReplyProcessor<EBehaviour::VersionNum>("versionnum")); |