summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llinventory.cpp55
-rw-r--r--indra/llinventory/llparcel.cpp4
-rw-r--r--indra/llinventory/llparcel.h96
-rw-r--r--indra/llinventory/llpermissions.h4
4 files changed, 86 insertions, 73 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 873f214f70..d220731f6a 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -32,6 +32,7 @@
#include "llinventorydefines.h"
#include "llxorcipher.h"
#include "llsd.h"
+#include "llsdserialize.h"
#include "message.h"
#include <boost/tokenizer.hpp>
@@ -217,7 +218,19 @@ bool LLInventoryObject::importLegacyStream(std::istream& input_stream)
}
else if (0 == strcmp("metadata", keyword))
{
- LLSD metadata(valuestr);
+ LLSD metadata;
+ if (strncmp("<llsd>", valuestr, 6) == 0)
+ {
+ std::istringstream stream(valuestr);
+ LLSDSerialize::fromXML(metadata, stream);
+ }
+ else
+ {
+ // next line likely contains metadata, but at the moment is not supported
+ // can do something like:
+ // LLSDSerialize::fromNotation(metadata, input_stream, -1);
+ }
+
if (metadata.has("thumbnail"))
{
const LLSD& thumbnail = metadata["thumbnail"];
@@ -693,7 +706,19 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream)
}
else if (0 == strcmp("metadata", keyword))
{
- LLSD metadata(valuestr);
+ LLSD metadata;
+ if (strncmp("<llsd>", valuestr, 6) == 0)
+ {
+ std::istringstream stream(valuestr);
+ LLSDSerialize::fromXML(metadata, stream);
+ }
+ else
+ {
+ // next line likely contains metadata, but at the moment is not supported
+ // can do something like:
+ // LLSDSerialize::fromNotation(metadata, input_stream, -1);
+ }
+
if (metadata.has("thumbnail"))
{
const LLSD& thumbnail = metadata["thumbnail"];
@@ -802,9 +827,14 @@ bool LLInventoryItem::exportLegacyStream(std::ostream& output_stream, bool inclu
if (mThumbnailUUID.notNull())
{
+ // Max length is 255 chars, will have to export differently if it gets more data
+ // Ex: use newline and toNotation (uses {}) for unlimited size
LLSD metadata;
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
- output_stream << "\t\tmetadata\t" << metadata << "|\n";
+
+ output_stream << "\t\tmetadata\t";
+ LLSDSerialize::toXML(metadata, output_stream);
+ output_stream << "|\n";
}
// Check for permissions to see the asset id, and if so write it
@@ -1303,7 +1333,19 @@ bool LLInventoryCategory::importLegacyStream(std::istream& input_stream)
}
else if (0 == strcmp("metadata", keyword))
{
- LLSD metadata(valuestr);
+ LLSD metadata;
+ if (strncmp("<llsd>", valuestr, 6) == 0)
+ {
+ std::istringstream stream(valuestr);
+ LLSDSerialize::fromXML(metadata, stream);
+ }
+ else
+ {
+ // next line likely contains metadata, but at the moment is not supported
+ // can do something like:
+ // LLSDSerialize::fromNotation(metadata, input_stream, -1);
+ }
+
if (metadata.has("thumbnail"))
{
const LLSD& thumbnail = metadata["thumbnail"];
@@ -1343,9 +1385,12 @@ bool LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, bool)
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
if (mThumbnailUUID.notNull())
{
+ // Only up to 255 chars
LLSD metadata;
metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID);
- output_stream << "\t\tmetadata\t" << metadata << "|\n";
+ output_stream << "\t\tmetadata\t";
+ LLSDSerialize::toXML(metadata, output_stream);
+ output_stream << "|\n";
}
output_stream << "\t}\n";
return true;
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index 598e28921d..36d9e1c900 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -949,7 +949,7 @@ const std::string& LLParcel::getActionString(LLParcel::EAction action)
bool LLParcel::isSaleTimerExpired(const U64& time)
{
- if (mSaleTimerExpires.getStarted() == false)
+ if (!mSaleTimerExpires.getStarted())
{
return false;
}
@@ -963,7 +963,7 @@ bool LLParcel::isSaleTimerExpired(const U64& time)
bool LLParcel::isMediaResetTimerExpired(const U64& time)
{
- if (mMediaResetTimer.getStarted() == false)
+ if (!mMediaResetTimer.getStarted())
{
return false;
}
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 0311a5bbd5..70522d3682 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -444,82 +444,50 @@ public:
// more accessors
- U32 getParcelFlags() const { return mParcelFlags; }
+ U32 getParcelFlags() const { return mParcelFlags; }
- bool getParcelFlag(U32 flag) const
- { return (mParcelFlags & flag) ? true : false; }
+ bool getParcelFlag(U32 flag) const { return (mParcelFlags & flag) != 0; }
// objects can be added or modified by anyone (only parcel owner if disabled)
- bool getAllowModify() const
- { return (mParcelFlags & PF_CREATE_OBJECTS) ? true : false; }
+ bool getAllowModify() const { return getParcelFlag(PF_CREATE_OBJECTS); }
// objects can be added or modified by group members
- bool getAllowGroupModify() const
- { return (mParcelFlags & PF_CREATE_GROUP_OBJECTS) ? true : false; }
+ bool getAllowGroupModify() const { return getParcelFlag(PF_CREATE_GROUP_OBJECTS); }
// the parcel can be deeded to the group
- bool getAllowDeedToGroup() const
- { return (mParcelFlags & PF_ALLOW_DEED_TO_GROUP) ? true : false; }
+ bool getAllowDeedToGroup() const { return getParcelFlag(PF_ALLOW_DEED_TO_GROUP); }
// Does the owner want to make a contribution along with the deed.
- bool getContributeWithDeed() const
- { return (mParcelFlags & PF_CONTRIBUTE_WITH_DEED) ? true : false; }
+ bool getContributeWithDeed() const { return getParcelFlag(PF_CONTRIBUTE_WITH_DEED); }
// heightfield can be modified
- bool getAllowTerraform() const
- { return (mParcelFlags & PF_ALLOW_TERRAFORM) ? true : false; }
+ bool getAllowTerraform() const { return getParcelFlag(PF_ALLOW_TERRAFORM); }
// avatars can be hurt here
- bool getAllowDamage() const
- { return (mParcelFlags & PF_ALLOW_DAMAGE) ? true : false; }
-
- bool getAllowFly() const
- { return (mParcelFlags & PF_ALLOW_FLY) ? true : false; }
-
- bool getAllowGroupScripts() const
- { return (mParcelFlags & PF_ALLOW_GROUP_SCRIPTS) ? true : false; }
-
- bool getAllowOtherScripts() const
- { return (mParcelFlags & PF_ALLOW_OTHER_SCRIPTS) ? true : false; }
-
- bool getAllowAllObjectEntry() const
- { return (mParcelFlags & PF_ALLOW_ALL_OBJECT_ENTRY) ? true : false; }
-
- bool getAllowGroupObjectEntry() const
- { return (mParcelFlags & PF_ALLOW_GROUP_OBJECT_ENTRY) ? true : false; }
-
- bool getForSale() const
- { return (mParcelFlags & PF_FOR_SALE) ? true : false; }
- bool getSoundLocal() const
- { return (mParcelFlags & PF_SOUND_LOCAL) ? true : false; }
- bool getParcelFlagAllowVoice() const
- { return (mParcelFlags & PF_ALLOW_VOICE_CHAT) ? true : false; }
- bool getParcelFlagUseEstateVoiceChannel() const
- { return (mParcelFlags & PF_USE_ESTATE_VOICE_CHAN) ? true : false; }
- bool getAllowPublish() const
- { return (mParcelFlags & PF_ALLOW_PUBLISH) ? true : false; }
- bool getMaturePublish() const
- { return (mParcelFlags & PF_MATURE_PUBLISH) ? true : false; }
- bool getRestrictPushObject() const
- { return (mParcelFlags & PF_RESTRICT_PUSHOBJECT) ? true : false; }
- bool getRegionPushOverride() const
- { return mRegionPushOverride; }
- bool getRegionDenyAnonymousOverride() const
- { return mRegionDenyAnonymousOverride; }
- bool getRegionDenyAgeUnverifiedOverride() const
- { return mRegionDenyAgeUnverifiedOverride; }
- bool getRegionAllowAccessOverride() const
- { return mRegionAllowAccessoverride; }
- bool getRegionAllowEnvironmentOverride() const
- { return mRegionAllowEnvironmentOverride; }
- S32 getParcelEnvironmentVersion() const
- { return mCurrentEnvironmentVersion; }
-
-
- bool getAllowGroupAVSounds() const { return mAllowGroupAVSounds; }
- bool getAllowAnyAVSounds() const { return mAllowAnyAVSounds; }
-
- bool getObscureMOAP() const { return mObscureMOAP; }
+ bool getAllowDamage() const { return getParcelFlag(PF_ALLOW_DAMAGE); }
+
+ bool getAllowFly() const { return getParcelFlag(PF_ALLOW_FLY); }
+ bool getAllowGroupScripts() const { return getParcelFlag(PF_ALLOW_GROUP_SCRIPTS); }
+ bool getAllowOtherScripts() const { return getParcelFlag(PF_ALLOW_OTHER_SCRIPTS); }
+ bool getAllowAllObjectEntry() const { return getParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY); }
+ bool getAllowGroupObjectEntry() const { return getParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY); }
+ bool getForSale() const { return getParcelFlag(PF_FOR_SALE); }
+ bool getSoundLocal() const { return getParcelFlag(PF_SOUND_LOCAL); }
+ bool getParcelFlagAllowVoice() const { return getParcelFlag(PF_ALLOW_VOICE_CHAT); }
+ bool getParcelFlagUseEstateVoiceChannel() const { return getParcelFlag(PF_USE_ESTATE_VOICE_CHAN); }
+ bool getAllowPublish() const { return getParcelFlag(PF_ALLOW_PUBLISH); }
+ bool getMaturePublish() const { return getParcelFlag(PF_MATURE_PUBLISH); }
+ bool getRestrictPushObject() const { return getParcelFlag(PF_RESTRICT_PUSHOBJECT); }
+
+ bool getRegionPushOverride() const { return mRegionPushOverride; }
+ bool getRegionDenyAnonymousOverride() const { return mRegionDenyAnonymousOverride; }
+ bool getRegionDenyAgeUnverifiedOverride() const { return mRegionDenyAgeUnverifiedOverride; }
+ bool getRegionAllowAccessOverride() const { return mRegionAllowAccessoverride; }
+ bool getRegionAllowEnvironmentOverride() const { return mRegionAllowEnvironmentOverride; }
+ S32 getParcelEnvironmentVersion() const { return mCurrentEnvironmentVersion; }
+ bool getAllowGroupAVSounds() const { return mAllowGroupAVSounds; }
+ bool getAllowAnyAVSounds() const { return mAllowAnyAVSounds; }
+ bool getObscureMOAP() const { return mObscureMOAP; }
F32 getDrawDistance() const { return mDrawDistance; }
S32 getSalePrice() const { return mSalePrice; }
@@ -597,7 +565,7 @@ public:
LLUUID getPreviousOwnerID() const { return mPreviousOwnerID; }
bool getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; }
- bool getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? true : false; }
+ bool getSellWithObjects() const { return getParcelFlag(PF_SELL_PARCEL_OBJECTS); }
protected:
LLUUID mID;
diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h
index f6a3db463d..4f6920f27a 100644
--- a/indra/llinventory/llpermissions.h
+++ b/indra/llinventory/llpermissions.h
@@ -151,10 +151,10 @@ public:
U32 getMaskEveryone() const { return mMaskEveryone; }
U32 getMaskNextOwner() const { return mMaskNextOwner; }
- // return TRUE if the object has any owner
+ // return true if the object has any owner
bool isOwned() const { return (mOwner.notNull() || mIsGroupOwned); }
- // return TRUE if group_id is owner.
+ // return true if group_id is owner.
bool isGroupOwned() const { return mIsGroupOwned; }
// This API returns true if the object is owned at all, and false