summaryrefslogtreecommitdiff
path: root/indra/llinventory/llinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
-rw-r--r--indra/llinventory/llinventory.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 3defad8f3b..c83717fef5 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -61,6 +61,8 @@ static const std::string INV_SALE_INFO_LABEL("sale_info");
static const std::string INV_FLAGS_LABEL("flags");
static const std::string INV_CREATION_DATE_LABEL("created_at");
static const std::string INV_TOGGLED_LABEL("toggled");
+static const std::string INV_SCRIPT_LABEL("script");
+static const std::string INV_RUNTIME_LABEL("runtime");
// key used by agent-inventory-service
static const std::string INV_ASSET_TYPE_LABEL_WS("type_default");
@@ -109,6 +111,7 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other)
mName = other->mName;
mThumbnailUUID = other->mThumbnailUUID;
mFavorite = other->mFavorite;
+ mRuntime = other->mRuntime;
}
const LLUUID& LLInventoryObject::getUUID() const
@@ -131,6 +134,11 @@ bool LLInventoryObject::getIsFavorite() const
return mFavorite;
}
+std::string LLInventoryObject::getRuntime() const
+{
+ return mRuntime;
+}
+
const std::string& LLInventoryObject::getName() const
{
return mName;
@@ -190,6 +198,18 @@ void LLInventoryObject::setFavorite(bool favorite)
mFavorite = favorite;
}
+void LLInventoryObject::setRuntime(std::string_view runtime)
+{
+ if (getType() == LLAssetType::AT_LSL_TEXT)
+ {
+ mRuntime = runtime;
+ }
+ else
+ {
+ mRuntime.clear();
+ }
+}
+
void LLInventoryObject::setType(LLAssetType::EType type)
{
mType = type;
@@ -279,6 +299,15 @@ bool LLInventoryObject::importLegacyStream(std::istream& input_stream)
{
setFavorite(false);
}
+
+ if (metadata.has("script") && metadata["script"].has("runtime"))
+ {
+ setRuntime(metadata["script"]["runtime"].asString());
+ }
+ else
+ {
+ setRuntime(std::string());
+ }
}
else if(0 == strcmp("name", keyword))
{
@@ -421,6 +450,7 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other)
mInventoryType = other->mInventoryType;
mFlags = other->mFlags;
mCreationDate = other->mCreationDate;
+ mRuntime = other->mRuntime;
}
// If this is a linked item, then the UUID of the base object is
@@ -784,6 +814,16 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream)
{
setFavorite(false);
}
+
+ if (metadata.has("script") && metadata["script"].has("runtime"))
+ {
+ setRuntime(metadata["script"]["runtime"].asString());
+ }
+ else
+ {
+ setRuntime(std::string());
+ }
+
}
else if(0 == strcmp("inv_type", keyword))
{
@@ -949,6 +989,11 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const
sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite);
}
+ if (!mRuntime.empty())
+ {
+ sd[INV_SCRIPT_LABEL] = LLSD().with(INV_RUNTIME_LABEL, mRuntime);
+ }
+
U32 mask = mPermissions.getMaskBase();
if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
|| (mAssetUUID.isNull()))
@@ -1052,6 +1097,17 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new)
continue;
}
+ if (i->first == INV_SCRIPT_LABEL)
+ {
+ const LLSD& script_map = i->second;
+ const std::string w = INV_RUNTIME_LABEL;
+ if (script_map.has(w))
+ {
+ mRuntime = script_map[w].asString();
+ }
+ continue;
+ }
+
if (i->first == INV_PERMISSIONS_LABEL)
{
mPermissions.importLLSD(i->second);
@@ -1471,6 +1527,15 @@ bool LLInventoryCategory::importLegacyStream(std::istream& input_stream)
{
setFavorite(false);
}
+ if (metadata.has("script") && metadata["script"].has("runtime"))
+ {
+ setRuntime(metadata["script"]["runtime"].asString());
+ }
+ else
+ {
+ setRuntime(std::string());
+ }
+
}
else
{