diff options
author | Kent Quirk <q@lindenlab.com> | 2007-11-15 19:10:29 +0000 |
---|---|---|
committer | Kent Quirk <q@lindenlab.com> | 2007-11-15 19:10:29 +0000 |
commit | 138bf17c3c51cbf3826a05887d73c49908025f95 (patch) | |
tree | d47a36708813b3f93b4049d822f966c48de4e576 | |
parent | c1920e3c1c60fb792cf091750b05de618b355878 (diff) |
merge of age verification changes from QAR-76 to release; changes were originally made on the age_verification_2007xxxx branches; final changes were QA'd on age_verification_20071112.
27 files changed, 1901 insertions, 1911 deletions
diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h index c62cae2fad..4ba664287d 100644 --- a/indra/llcommon/llavatarconstants.h +++ b/indra/llcommon/llavatarconstants.h @@ -49,6 +49,7 @@ const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature" const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known. +const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified static const std::string VISIBILITY_DEFAULT("default"); static const std::string VISIBILITY_HIDDEN("hidden"); diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 7cc3e578e5..b6a90b64e8 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -1,33 +1,33 @@ /** - * @file llparcel.cpp - * @brief A land parcel. - * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ +* @file llparcel.cpp +* @brief A land parcel. +* +* $LicenseInfo:firstyear=2002&license=viewergpl$ +* +* Copyright (c) 2002-2007, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlife.com/developers/opensource/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at http://secondlife.com/developers/opensource/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ #include "linden_common.h" @@ -49,9 +49,9 @@ static const F32 SOME_BIG_NUMBER = 1000.0f; static const F32 SOME_BIG_NEG_NUMBER = -1000.0f; static const char* PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT] = { - "leased", - "lease_pending", - "abandoned" + "leased", + "lease_pending", + "abandoned" }; // NOTE: Adding parcel categories also requires updating: @@ -59,52 +59,52 @@ static const char* PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT] = // * Web site "create event" tools static const char* PARCEL_CATEGORY_STRING[LLParcel::C_COUNT] = { - "none", - "linden", - "adult", - "arts", - "store", // "business" legacy name - "educational", - "game", // "gaming" legacy name - "gather", // "hangout" legacy name - "newcomer", - "park", - "home", // "residential" legacy name - "shopping", - "stage", - "other", + "none", + "linden", + "adult", + "arts", + "store", // "business" legacy name + "educational", + "game", // "gaming" legacy name + "gather", // "hangout" legacy name + "newcomer", + "park", + "home", // "residential" legacy name + "shopping", + "stage", + "other", }; static const char* PARCEL_CATEGORY_UI_STRING[LLParcel::C_COUNT + 1] = { - "None", - "Linden Location", - "Adult", - "Arts & Culture", - "Business", - "Educational", - "Gaming", - "Hangout", - "Newcomer Friendly", - "Parks & Nature", - "Residential", - "Shopping", - "Stage", - "Other", - "Any", // valid string for parcel searches + "None", + "Linden Location", + "Adult", + "Arts & Culture", + "Business", + "Educational", + "Gaming", + "Hangout", + "Newcomer Friendly", + "Parks & Nature", + "Residential", + "Shopping", + "Stage", + "Other", + "Any", // valid string for parcel searches }; static const char* PARCEL_ACTION_STRING[LLParcel::A_COUNT + 1] = { - "create", - "release", - "absorb", - "absorbed", - "divide", - "division", - "acquire", - "relinquish", - "confirm", - "unknown" + "create", + "release", + "absorb", + "absorbed", + "divide", + "division", + "acquire", + "relinquish", + "confirm", + "unknown" }; // Timeouts for parcels @@ -142,369 +142,365 @@ LLParcel::ECategory category_ui_string_to_category(const char* s); LLParcel::LLParcel() { - init(LLUUID::null, TRUE, FALSE, FALSE, 0, 0, 0, 0, 0, 1.f, 0); + init(LLUUID::null, TRUE, FALSE, FALSE, 0, 0, 0, 0, 0, 1.f, 0); } LLParcel::LLParcel(const LLUUID &owner_id, - BOOL modify, BOOL terraform, BOOL damage, - time_t claim_date, S32 claim_price_per_meter, - S32 rent_price_per_meter, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, - BOOL is_group_owned) + BOOL modify, BOOL terraform, BOOL damage, + time_t claim_date, S32 claim_price_per_meter, + S32 rent_price_per_meter, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, + BOOL is_group_owned) { - init( owner_id, modify, terraform, damage, claim_date, - claim_price_per_meter, rent_price_per_meter, area, sim_object_limit, parcel_object_bonus, - is_group_owned); + init( owner_id, modify, terraform, damage, claim_date, + claim_price_per_meter, rent_price_per_meter, area, sim_object_limit, parcel_object_bonus, + is_group_owned); } // virtual LLParcel::~LLParcel() { - // user list cleaned up by LLDynamicArray destructor. + // user list cleaned up by LLDynamicArray destructor. } void LLParcel::init(const LLUUID &owner_id, - BOOL modify, BOOL terraform, BOOL damage, - time_t claim_date, S32 claim_price_per_meter, - S32 rent_price_per_meter, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, - BOOL is_group_owned) + BOOL modify, BOOL terraform, BOOL damage, + time_t claim_date, S32 claim_price_per_meter, + S32 rent_price_per_meter, S32 area, S32 sim_object_limit, F32 parcel_object_bonus, + BOOL is_group_owned) { - mID.setNull(); - mOwnerID = owner_id; - mGroupOwned = is_group_owned; - mClaimDate = claim_date; - mClaimPricePerMeter = claim_price_per_meter; - mRentPricePerMeter = rent_price_per_meter; - mArea = area; - mDiscountRate = 1.0f; - mDrawDistance = 512.f; - - mUserLookAt.setVec(0.0f, 0.f, 0.f); - // Default to using the parcel's landing point, if any. - mLandingType = L_LANDING_POINT; - - // *FIX: if owner_id != null, should be owned or sale pending, - // investigate init callers. - mStatus = OS_NONE; - mCategory = C_NONE; - mAuthBuyerID.setNull(); - //mBuyerID.setNull(); - //mJoinNeighbors = 0x0; - mSaleTimerExpires.setTimerExpirySec(0); - mSaleTimerExpires.stop(); - mGraceExtension = 0; - //mExpireAction = STEA_REVERT; - mRecordTransaction = FALSE; - - mAuctionID = 0; - mInEscrow = false; - - mParcelFlags = PF_DEFAULT; - setParcelFlag(PF_CREATE_OBJECTS, modify); - setParcelFlag(PF_ALLOW_TERRAFORM, terraform); - setParcelFlag(PF_ALLOW_DAMAGE, damage); - - mSalePrice = 10000; - setName(NULL); - setDesc(NULL); - setMusicURL(NULL); - setMediaURL(NULL); - mMediaID.setNull(); - mMediaAutoScale = 0; - - mGroupID.setNull(); - - mPassPrice = PARCEL_PASS_PRICE_DEFAULT; - mPassHours = PARCEL_PASS_HOURS_DEFAULT; - - mAABBMin.setVec(SOME_BIG_NUMBER, SOME_BIG_NUMBER, SOME_BIG_NUMBER); - mAABBMax.setVec(SOME_BIG_NEG_NUMBER, SOME_BIG_NEG_NUMBER, SOME_BIG_NEG_NUMBER); - - mLocalID = 0; - - //mSimWidePrimCorrection = 0; - setMaxPrimCapacity((S32)(sim_object_limit * area / (F32)(REGION_WIDTH_METERS * REGION_WIDTH_METERS))); - setSimWideMaxPrimCapacity(0); - setSimWidePrimCount(0); - setOwnerPrimCount(0); - setGroupPrimCount(0); - setOtherPrimCount(0); - setSelectedPrimCount(0); - setTempPrimCount(0); - setCleanOtherTime(0); - setParcelPrimBonus(parcel_object_bonus); - - setPreviousOwnerID(LLUUID::null); - setPreviouslyGroupOwned(FALSE); + mID.setNull(); + mOwnerID = owner_id; + mGroupOwned = is_group_owned; + mClaimDate = claim_date; + mClaimPricePerMeter = claim_price_per_meter; + mRentPricePerMeter = rent_price_per_meter; + mArea = area; + mDiscountRate = 1.0f; + mDrawDistance = 512.f; + + mUserLookAt.setVec(0.0f, 0.f, 0.f); + // Default to using the parcel's landing point, if any. + mLandingType = L_LANDING_POINT; + + // *FIX: if owner_id != null, should be owned or sale pending, + // investigate init callers. + mStatus = OS_NONE; + mCategory = C_NONE; + mAuthBuyerID.setNull(); + //mBuyerID.setNull(); + //mJoinNeighbors = 0x0; + mSaleTimerExpires.setTimerExpirySec(0); + mSaleTimerExpires.stop(); + mGraceExtension = 0; + //mExpireAction = STEA_REVERT; + mRecordTransaction = FALSE; + + mAuctionID = 0; + mInEscrow = false; + + mParcelFlags = PF_DEFAULT; + setParcelFlag(PF_CREATE_OBJECTS, modify); + setParcelFlag(PF_ALLOW_TERRAFORM, terraform); + setParcelFlag(PF_ALLOW_DAMAGE, damage); + + mSalePrice = 10000; + setName(NULL); + setDesc(NULL); + setMusicURL(NULL); + setMediaURL(NULL); + mMediaID.setNull(); + mMediaAutoScale = 0; + + mGroupID.setNull(); + + mPassPrice = PARCEL_PASS_PRICE_DEFAULT; + mPassHours = PARCEL_PASS_HOURS_DEFAULT; + + mAABBMin.setVec(SOME_BIG_NUMBER, SOME_BIG_NUMBER, SOME_BIG_NUMBER); + mAABBMax.setVec(SOME_BIG_NEG_NUMBER, SOME_BIG_NEG_NUMBER, SOME_BIG_NEG_NUMBER); + + mLocalID = 0; + + //mSimWidePrimCorrection = 0; + setMaxPrimCapacity((S32)(sim_object_limit * area / (F32)(REGION_WIDTH_METERS * REGION_WIDTH_METERS))); + setSimWideMaxPrimCapacity(0); + setSimWidePrimCount(0); + setOwnerPrimCount(0); + setGroupPrimCount(0); + setOtherPrimCount(0); + setSelectedPrimCount(0); + setTempPrimCount(0); + setCleanOtherTime(0); + setParcelPrimBonus(parcel_object_bonus); + + setPreviousOwnerID(LLUUID::null); + setPreviouslyGroupOwned(FALSE); } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) { - // Override with system permission (LLUUID::null) - // Overridden parcels have no group - mOwnerID = owner_id; - mGroupOwned = is_group_owned; - if(mGroupOwned) - { - mGroupID = mOwnerID; - } - else - { - mGroupID.setNull(); - } - mInEscrow = false; + // Override with system permission (LLUUID::null) + // Overridden parcels have no group + mOwnerID = owner_id; + mGroupOwned = is_group_owned; + if(mGroupOwned) + { + mGroupID = mOwnerID; + } + else + { + mGroupID.setNull(); + } + mInEscrow = false; } void LLParcel::overrideParcelFlags(U32 flags) { - mParcelFlags = flags; + mParcelFlags = flags; } void LLParcel::setName(const LLString& name) { - // The escaping here must match the escaping in the database - // abstraction layer. - mName = name; - LLStringFn::replace_nonprintable(mName, LL_UNKNOWN_CHAR); + // The escaping here must match the escaping in the database + // abstraction layer. + mName = name; + LLStringFn::replace_nonprintable(mName, LL_UNKNOWN_CHAR); } void LLParcel::setDesc(const LLString& desc) { - // The escaping here must match the escaping in the database - // abstraction layer. - mDesc = desc; - mDesc = rawstr_to_utf8(mDesc); + // The escaping here must match the escaping in the database + // abstraction layer. + mDesc = desc; + mDesc = rawstr_to_utf8(mDesc); } void LLParcel::setMusicURL(const LLString& url) { - mMusicURL = url; - // The escaping here must match the escaping in the database - // abstraction layer. - // This should really filter the url in some way. Other than - // simply requiring non-printable. - LLStringFn::replace_nonprintable(mMusicURL, LL_UNKNOWN_CHAR); + mMusicURL = url; + // The escaping here must match the escaping in the database + // abstraction layer. + // This should really filter the url in some way. Other than + // simply requiring non-printable. + LLStringFn::replace_nonprintable(mMusicURL, LL_UNKNOWN_CHAR); } void LLParcel::setMediaURL(const LLString& url) { - mMediaURL = url; - // The escaping here must match the escaping in the database - // abstraction layer if it's ever added. - // This should really filter the url in some way. Other than - // simply requiring non-printable. - LLStringFn::replace_nonprintable(mMediaURL, LL_UNKNOWN_CHAR); + mMediaURL = url; + // The escaping here must match the escaping in the database + // abstraction layer if it's ever added. + // This should really filter the url in some way. Other than + // simply requiring non-printable. + LLStringFn::replace_nonprintable(mMediaURL, LL_UNKNOWN_CHAR); } // virtual void LLParcel::setLocalID(S32 local_id) { - mLocalID = local_id; + mLocalID = local_id; } void LLParcel::setAllParcelFlags(U32 flags) { - mParcelFlags = flags; + mParcelFlags = flags; } void LLParcel::setParcelFlag(U32 flag, BOOL b) { - if (b) - { - mParcelFlags |= flag; - } - else - { - mParcelFlags &= ~flag; - } + if (b) + { + mParcelFlags |= flag; + } + else + { + mParcelFlags &= ~flag; + } } BOOL LLParcel::allowModifyBy(const LLUUID &agent_id, const LLUUID &group_id) const { - if (agent_id == LLUUID::null) - { - // system always can enter - return TRUE; - } - else if (isPublic()) - { - return TRUE; - } - else if (agent_id == mOwnerID) - { - // owner can always perform operations - return TRUE; - } - else if (mParcelFlags & PF_CREATE_OBJECTS) - { - return TRUE; - } - else if ((mParcelFlags & PF_CREATE_GROUP_OBJECTS) - && group_id.notNull() ) - { - return (getGroupID() == group_id); - } - - return FALSE; + if (agent_id == LLUUID::null) + { + // system always can enter + return TRUE; + } + else if (isPublic()) + { + return TRUE; + } + else if (agent_id == mOwnerID) + { + // owner can always perform operations + return TRUE; + } + else if (mParcelFlags & PF_CREATE_OBJECTS) + { + return TRUE; + } + else if ((mParcelFlags & PF_CREATE_GROUP_OBJECTS) + && group_id.notNull() ) + { + return (getGroupID() == group_id); + } + + return FALSE; } BOOL LLParcel::allowTerraformBy(const LLUUID &agent_id) const { - if (agent_id == LLUUID::null) - { - // system always can enter - return TRUE; - } - else if(OS_LEASED == mStatus) - { - if(agent_id == mOwnerID) - { - // owner can modify leased land - return TRUE; - } - else - { - // otherwise check other people - return mParcelFlags & PF_ALLOW_TERRAFORM; - } - } - else - { - return FALSE; - } + if (agent_id == LLUUID::null) + { + // system always can enter + return TRUE; + } + else if(OS_LEASED == mStatus) + { + if(agent_id == mOwnerID) + { + // owner can modify leased land + return TRUE; + } + else + { + // otherwise check other people + return mParcelFlags & PF_ALLOW_TERRAFORM; + } + } + else + { + return FALSE; + } } bool LLParcel::isAgentBlockedFromParcel(LLParcel* parcelp, - const LLUUID& agent_id, - const std::vector<LLUUID>& group_ids, - const BOOL is_agent_identified, - const BOOL is_agent_transacted) + const LLUUID& agent_id, + const std::vector<LLUUID>& group_ids, + const BOOL is_agent_identified, + const BOOL is_agent_transacted, + const BOOL is_agent_ageverified) { - S32 current_group_access = parcelp->blockAccess(agent_id, LLUUID::null, is_agent_identified, is_agent_transacted); - S32 count; - bool is_allowed = (current_group_access == BA_ALLOWED) ? true: false; - LLUUID group_id; - - count = group_ids.size(); - for (int i = 0; i < count && !is_allowed; i++) - { - group_id = group_ids[i]; - current_group_access = parcelp->blockAccess(agent_id, group_id, is_agent_identified, is_agent_transacted); - - if (current_group_access == BA_ALLOWED) is_allowed = true; - } - - return !is_allowed; + S32 current_group_access = parcelp->blockAccess(agent_id, LLUUID::null, is_agent_identified, is_agent_transacted, is_agent_ageverified); + S32 count; + bool is_allowed = (current_group_access == BA_ALLOWED) ? true: false; + LLUUID group_id; + + count = group_ids.size(); + for (int i = 0; i < count && !is_allowed; i++) + { + group_id = group_ids[i]; + current_group_access = parcelp->blockAccess(agent_id, group_id, is_agent_identified, is_agent_transacted, is_agent_ageverified); + + if (current_group_access == BA_ALLOWED) is_allowed = true; + } + + return !is_allowed; } BOOL LLParcel::isAgentBanned(const LLUUID& agent_id) const { // Test ban list - if (getParcelFlag(PF_USE_BAN_LIST) - && (mBanList.find(agent_id) != mBanList.end())) + if (mBanList.find(agent_id) != mBanList.end()) { return TRUE; } - - return FALSE; + + return FALSE; } + S32 LLParcel::blockAccess(const LLUUID& agent_id, const LLUUID& group_id, - const BOOL is_agent_identified, - const BOOL is_agent_transacted) const + const BOOL is_agent_identified, + const BOOL is_agent_transacted, + const BOOL is_agent_ageverified) const { - // Test ban list - if (isAgentBanned(agent_id)) - { - return BA_BANNED; - } - - // Always allow owner on (unless he banned himself, useful for - // testing). We will also allow estate owners/managers in if they - // are not explicitly banned. - if (agent_id == mOwnerID) - { - return BA_ALLOWED; - } - - // Special case when using pass list where group access is being restricted but not - // using access list. In this case group members are allowed only if they buy a pass. - // We return BA_NOT_IN_LIST if not in list - BOOL passWithGroup = getParcelFlag(PF_USE_PASS_LIST) && !getParcelFlag(PF_USE_ACCESS_LIST) - && getParcelFlag(PF_USE_ACCESS_GROUP) && !mGroupID.isNull() && group_id == mGroupID; - - - // Test group list - if (getParcelFlag(PF_USE_ACCESS_GROUP) - && !mGroupID.isNull() - && group_id == mGroupID - && !passWithGroup) - { - return BA_ALLOWED; - } - - // Test access list - if (getParcelFlag(PF_USE_ACCESS_LIST) || passWithGroup ) - { - if (mAccessList.find(agent_id) != mAccessList.end()) - { - return BA_ALLOWED; - } - - return BA_NOT_ON_LIST; - } - - // If we're not doing any other limitations, all users - // can enter, unless - if ( !getParcelFlag(PF_USE_ACCESS_GROUP) - && !getParcelFlag(PF_USE_ACCESS_LIST)) - { - //If the land is group owned, and you are in the group, bypass these checks - if(getIsGroupOwned() && group_id == mGroupID) - { - return BA_ALLOWED; - } - - // Test for "payment" access levels - // Anonymous - No Payment Info on File - if(getParcelFlag(PF_DENY_ANONYMOUS) && !is_agent_identified && !is_agent_transacted) - { - return BA_NO_ACCESS_LEVEL; - } - // Identified - Payment Info on File - // Must check to make sure we're only banning Identified, since Transacted accounts - // also have their identified flag set - if(getParcelFlag(PF_DENY_IDENTIFIED) && is_agent_identified && !is_agent_transacted) - { - return BA_NO_ACCESS_LEVEL; - } - // Transacted - Payment Info Used - if(getParcelFlag(PF_DENY_TRANSACTED) && is_agent_transacted) - { - return BA_NO_ACCESS_LEVEL; - } - return BA_ALLOWED; - } - - return BA_NOT_IN_GROUP; - + // Test ban list + if (isAgentBanned(agent_id)) + { + return BA_BANNED; + } + + // Always allow owner on (unless he banned himself, useful for + // testing). We will also allow estate owners/managers in if they + // are not explicitly banned. + if (agent_id == mOwnerID) + { + return BA_ALLOWED; + } + + // Special case when using pass list where group access is being restricted but not + // using access list. In this case group members are allowed only if they buy a pass. + // We return BA_NOT_IN_LIST if not in list + BOOL passWithGroup = getParcelFlag(PF_USE_PASS_LIST) && !getParcelFlag(PF_USE_ACCESS_LIST) + && getParcelFlag(PF_USE_ACCESS_GROUP) && !mGroupID.isNull() && group_id == mGroupID; + + + // Test group list + if (getParcelFlag(PF_USE_ACCESS_GROUP) + && !mGroupID.isNull() + && group_id == mGroupID + && !passWithGroup) + { + return BA_ALLOWED; + } + + // Test access list + if (getParcelFlag(PF_USE_ACCESS_LIST) || passWithGroup ) + { + if (mAccessList.find(agent_id) != mAccessList.end()) + { + return BA_ALLOWED; + } + + return BA_NOT_ON_LIST; + } + + // If we're not doing any other limitations, all users + // can enter, unless + if ( !getParcelFlag(PF_USE_ACCESS_GROUP) + && !getParcelFlag(PF_USE_ACCESS_LIST)) + { + //If the land is group owned, and you are in the group, bypass these checks + if(getIsGroupOwned() && group_id == mGroupID) + { + return BA_ALLOWED; + } + + // Test for "payment" access levels + // Anonymous - No Payment Info on File + if(getParcelFlag(PF_DENY_ANONYMOUS) && !is_agent_identified && !is_agent_transacted) + { + return BA_NO_ACCESS_LEVEL; + } + // AgeUnverified - Not Age Verified + if(getParcelFlag(PF_DENY_AGEUNVERIFIED) && !is_agent_ageverified) + { + return BA_NOT_AGE_VERIFIED; + } + + return BA_ALLOWED; + } + + return BA_NOT_IN_GROUP; + } void LLParcel::setArea(S32 area, S32 sim_object_limit) { - mArea = area; - setMaxPrimCapacity((S32)(sim_object_limit * area / (F32)(REGION_WIDTH_METERS * REGION_WIDTH_METERS))); + mArea = area; + setMaxPrimCapacity((S32)(sim_object_limit * area / (F32)(REGION_WIDTH_METERS * REGION_WIDTH_METERS))); } void LLParcel::setDiscountRate(F32 rate) { - // this is to make sure that the rate is at least sane - this is - // not intended to enforce economy rules. It only enfoces that the - // rate is a scaler between 0 and 1. - mDiscountRate = llclampf(rate); + // this is to make sure that the rate is at least sane - this is + // not intended to enforce economy rules. It only enfoces that the + // rate is a scaler between 0 and 1. + mDiscountRate = llclampf(rate); } @@ -516,909 +512,918 @@ void LLParcel::setDiscountRate(F32 rate) // WARNING: Area will be wrong until you calculate it. BOOL LLParcel::importStream(std::istream& input_stream) { - U32 setting; - S32 secs_until_revert = 0; - - skip_to_end_of_next_keyword("{", input_stream); - if (!input_stream.good()) - { - llwarns << "LLParcel::importStream() - bad input_stream" << llendl; - return FALSE; - } - - while (input_stream.good()) - { - skip_comments_and_emptyspace(input_stream); - LLString line, keyword, value; - get_line(line, input_stream, MAX_STRING); - get_keyword_and_value(keyword, value, line); - - if ("}" == keyword) - { - break; - } - else if ("parcel_id" == keyword) - { - mID.set(value.c_str()); - } - else if ("status" == keyword) - { - mStatus = ownership_string_to_status(value.c_str()); - } - else if ("category" == keyword) - { - mCategory = category_string_to_category(value.c_str()); - } - else if ("local_id" == keyword) - { - LLString::convertToS32(value, mLocalID); - } - else if ("name" == keyword) - { - setName( value ); - } - else if ("desc" == keyword) - { - setDesc( value ); - } - else if ("music_url" == keyword) - { - setMusicURL( value ); - } - else if ("media_url" == keyword) - { - setMediaURL( value ); - } - else if ("media_id" == keyword) - { - mMediaID.set( value.c_str() ); - } - else if ("media_auto_scale" == keyword) - { - LLString::convertToU8(value, mMediaAutoScale); - } - else if ("owner_id" == keyword) - { - mOwnerID.set( value.c_str() ); - } - else if ("group_owned" == keyword) - { - LLString::convertToBOOL(value, mGroupOwned); - } - else if ("clean_other_time" == keyword) - { - S32 time; - LLString::convertToS32(value, time); - setCleanOtherTime(time); - } - else if ("auth_buyer_id" == keyword) - { - mAuthBuyerID.set(value.c_str()); - } - else if ("snapshot_id" == keyword) - { - mSnapshotID.set(value.c_str()); - } - else if ("user_location" == keyword) - { - sscanf(value.c_str(), "%f %f %f", - &mUserLocation.mV[VX], - &mUserLocation.mV[VY], - &mUserLocation.mV[VZ]); - } - else if ("user_look_at" == keyword) - { - sscanf(value.c_str(), "%f %f %f", - &mUserLookAt.mV[VX], - &mUserLookAt.mV[VY], - &mUserLookAt.mV[VZ]); - } - else if ("landing_type" == keyword) - { - S32 landing_type = 0; - LLString::convertToS32(value, landing_type); - mLandingType = (ELandingType) landing_type; - } - else if ("join_neighbors" == keyword) - { - llinfos << "found deprecated keyword join_neighbors" << llendl; - } - else if ("revert_sale" == keyword) - { - LLString::convertToS32(value, secs_until_revert); - if (secs_until_revert > 0) - { - mSaleTimerExpires.start(); - mSaleTimerExpires.setTimerExpirySec((F32)secs_until_revert); - } - } - else if("extended_grace" == keyword) - { - LLString::convertToS32(value, mGraceExtension); - } - else if ("user_list_type" == keyword) - { - // deprecated - } - else if("auction_id" == keyword) - { - LLString::convertToU32(value, mAuctionID); - } - else if ("allow_modify" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_CREATE_OBJECTS, setting); - } - else if ("allow_group_modify" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_CREATE_GROUP_OBJECTS, setting); - } - else if ("allow_all_object_entry" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, setting); - } - else if ("allow_group_object_entry" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, setting); - } - else if ("allow_deed_to_group" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_DEED_TO_GROUP, setting); - } - else if("contribute_with_deed" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_CONTRIBUTE_WITH_DEED, setting); - } - else if ("allow_terraform" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_TERRAFORM, setting); - } - else if ("allow_damage" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_DAMAGE, setting); - } - else if ("allow_fly" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_FLY, setting); - } - else if ("allow_landmark" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_LANDMARK, setting); - } - else if ("sound_local" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_SOUND_LOCAL, setting); - } - else if ("allow_group_scripts" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, setting); - } - else if ("allow_voice_chat" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_VOICE_CHAT, setting); - } - else if ("use_estate_voice_chan" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, setting); - } - else if ("allow_scripts" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, setting); - } - else if ("for_sale" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_FOR_SALE, setting); - } - else if ("sell_w_objects" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_SELL_PARCEL_OBJECTS, setting); - } - else if ("use_pass_list" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_USE_PASS_LIST, setting); - } - else if ("show_directory" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_SHOW_DIRECTORY, setting); - } - else if ("allow_publish" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_ALLOW_PUBLISH, setting); - } - else if ("mature_publish" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_MATURE_PUBLISH, setting); - } - else if ("claim_date" == keyword) - { - // BUG: This will fail when time rolls over in 2038. - S32 time; - LLString::convertToS32(value, time); - mClaimDate = time; - } - else if ("claim_price" == keyword) - { - LLString::convertToS32(value, mClaimPricePerMeter); - } - else if ("rent_price" == keyword) - { - LLString::convertToS32(value, mRentPricePerMeter); - } - else if ("discount_rate" == keyword) - { - LLString::convertToF32(value, mDiscountRate); - } - else if ("draw_distance" == keyword) - { - LLString::convertToF32(value, mDrawDistance); - } - else if ("sale_price" == keyword) - { - LLString::convertToS32(value, mSalePrice); - } - else if ("pass_price" == keyword) - { - LLString::convertToS32(value, mPassPrice); - } - else if ("pass_hours" == keyword) - { - LLString::convertToF32(value, mPassHours); - } - else if ("box" == keyword) - { - // deprecated - } - else if ("aabb_min" == keyword) - { - sscanf(value.c_str(), "%f %f %f", - &mAABBMin.mV[VX], &mAABBMin.mV[VY], &mAABBMin.mV[VZ]); - } - else if ("use_access_group" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_USE_ACCESS_GROUP, setting); - } - else if ("use_access_list" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_USE_ACCESS_LIST, setting); - } - else if ("use_ban_list" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_USE_BAN_LIST, setting); - } - else if ("group_name" == keyword) - { - llinfos << "found deprecated keyword group_name" << llendl; - } - else if ("group_id" == keyword) - { - mGroupID.set( value.c_str() ); - } - // TODO: DEPRECATED FLAG - // Flag removed from simstate files in 1.11.1 - // Remove at some point where we have guarenteed this flag - // no longer exists anywhere in simstate files. - else if ("require_identified" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_DENY_ANONYMOUS, setting); - } - // TODO: DEPRECATED FLAG - // Flag removed from simstate files in 1.11.1 - // Remove at some point where we have guarenteed this flag - // no longer exists anywhere in simstate files. - else if ("require_transacted" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_DENY_ANONYMOUS, setting); - setParcelFlag(PF_DENY_IDENTIFIED, setting); - } - else if ("restrict_pushobject" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_RESTRICT_PUSHOBJECT, setting); - } - else if ("deny_anonymous" == keyword) - { - LLString::convertToU32(value, setting); - setParcelFlag(PF_DENY_ANONYMOUS, setting); - } + U32 setting; + S32 secs_until_revert = 0; + + skip_to_end_of_next_keyword("{", input_stream); + if (!input_stream.good()) + { + llwarns << "LLParcel::importStream() - bad input_stream" << llendl; + return FALSE; + } + + while (input_stream.good()) + { + skip_comments_and_emptyspace(input_stream); + LLString line, keyword, value; + get_line(line, input_stream, MAX_STRING); + get_keyword_and_value(keyword, value, line); + + if ("}" == keyword) + { + break; + } + else if ("parcel_id" == keyword) + { + mID.set(value.c_str()); + } + else if ("status" == keyword) + { + mStatus = ownership_string_to_status(value.c_str()); + } + else if ("category" == keyword) + { + mCategory = category_string_to_category(value.c_str()); + } + else if ("local_id" == keyword) + { + LLString::convertToS32(value, mLocalID); + } + else if ("name" == keyword) + { + setName( value ); + } + else if ("desc" == keyword) + { + setDesc( value ); + } + else if ("music_url" == keyword) + { + setMusicURL( value ); + } + else if ("media_url" == keyword) + { + setMediaURL( value ); + } + else if ("media_id" == keyword) + { + mMediaID.set( value.c_str() ); + } + else if ("media_auto_scale" == keyword) + { + LLString::convertToU8(value, mMediaAutoScale); + } + else if ("owner_id" == keyword) + { + mOwnerID.set( value.c_str() ); + } + else if ("group_owned" == keyword) + { + LLString::convertToBOOL(value, mGroupOwned); + } + else if ("clean_other_time" == keyword) + { + S32 time; + LLString::convertToS32(value, time); + setCleanOtherTime(time); + } + else if ("auth_buyer_id" == keyword) + { + mAuthBuyerID.set(value.c_str()); + } + else if ("snapshot_id" == keyword) + { + mSnapshotID.set(value.c_str()); + } + else if ("user_location" == keyword) + { + sscanf(value.c_str(), "%f %f %f", + &mUserLocation.mV[VX], + &mUserLocation.mV[VY], + &mUserLocation.mV[VZ]); + } + else if ("user_look_at" == keyword) + { + sscanf(value.c_str(), "%f %f %f", + &mUserLookAt.mV[VX], + &mUserLookAt.mV[VY], + &mUserLookAt.mV[VZ]); + } + else if ("landing_type" == keyword) + { + S32 landing_type = 0; + LLString::convertToS32(value, landing_type); + mLandingType = (ELandingType) landing_type; + } + else if ("join_neighbors" == keyword) + { + llinfos << "found deprecated keyword join_neighbors" << llendl; + } + else if ("revert_sale" == keyword) + { + LLString::convertToS32(value, secs_until_revert); + if (secs_until_revert > 0) + { + mSaleTimerExpires.start(); + mSaleTimerExpires.setTimerExpirySec((F32)secs_until_revert); + } + } + else if("extended_grace" == keyword) + { + LLString::convertToS32(value, mGraceExtension); + } + else if ("user_list_type" == keyword) + { + // deprecated + } + else if("auction_id" == keyword) + { + LLString::convertToU32(value, mAuctionID); + } + else if ("allow_modify" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_CREATE_OBJECTS, setting); + } + else if ("allow_group_modify" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_CREATE_GROUP_OBJECTS, setting); + } + else if ("allow_all_object_entry" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY, setting); + } + else if ("allow_group_object_entry" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY, setting); + } + else if ("allow_deed_to_group" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_DEED_TO_GROUP, setting); + } + else if("contribute_with_deed" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_CONTRIBUTE_WITH_DEED, setting); + } + else if ("allow_terraform" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_TERRAFORM, setting); + } + else if ("allow_damage" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_DAMAGE, setting); + } + else if ("allow_fly" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_FLY, setting); + } + else if ("allow_landmark" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_LANDMARK, setting); + } + else if ("sound_local" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_SOUND_LOCAL, setting); + } + else if ("allow_group_scripts" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_GROUP_SCRIPTS, setting); + } + else if ("allow_voice_chat" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_VOICE_CHAT, setting); + } + else if ("use_estate_voice_chan" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, setting); + } + else if ("allow_scripts" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_OTHER_SCRIPTS, setting); + } + else if ("for_sale" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_FOR_SALE, setting); + } + else if ("sell_w_objects" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_SELL_PARCEL_OBJECTS, setting); + } + else if ("use_pass_list" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_USE_PASS_LIST, setting); + } + else if ("show_directory" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_SHOW_DIRECTORY, setting); + } + else if ("allow_publish" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_ALLOW_PUBLISH, setting); + } + else if ("mature_publish" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_MATURE_PUBLISH, setting); + } + else if ("claim_date" == keyword) + { + // BUG: This will fail when time rolls over in 2038. + S32 time; + LLString::convertToS32(value, time); + mClaimDate = time; + } + else if ("claim_price" == keyword) + { + LLString::convertToS32(value, mClaimPricePerMeter); + } + else if ("rent_price" == keyword) + { + LLString::convertToS32(value, mRentPricePerMeter); + } + else if ("discount_rate" == keyword) + { + LLString::convertToF32(value, mDiscountRate); + } + else if ("draw_distance" == keyword) + { + LLString::convertToF32(value, mDrawDistance); + } + else if ("sale_price" == keyword) + { + LLString::convertToS32(value, mSalePrice); + } + else if ("pass_price" == keyword) + { + LLString::convertToS32(value, mPassPrice); + } + else if ("pass_hours" == keyword) + { + LLString::convertToF32(value, mPassHours); + } + else if ("box" == keyword) + { + // deprecated + } + else if ("aabb_min" == keyword) + { + sscanf(value.c_str(), "%f %f %f", + &mAABBMin.mV[VX], &mAABBMin.mV[VY], &mAABBMin.mV[VZ]); + } + else if ("use_access_group" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_USE_ACCESS_GROUP, setting); + } + else if ("use_access_list" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_USE_ACCESS_LIST, setting); + } + else if ("use_ban_list" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_USE_BAN_LIST, setting); + } + else if ("group_name" == keyword) + { + llinfos << "found deprecated keyword group_name" << llendl; + } + else if ("group_id" == keyword) + { + mGroupID.set( value.c_str() ); + } + // TODO: DEPRECATED FLAG + // Flag removed from simstate files in 1.11.1 + // Keep if statement until we have guarenteed this flag + // no longer exists anywhere in simstate files. + else if ("require_identified" == keyword) + { +// LLString::convertToU32(value, setting); +// setParcelFlag(PF_DENY_ANONYMOUS, setting); + } + // TODO: DEPRECATED FLAG + // Flag removed from simstate files in 1.11.1 + // Keep if statement until we have guarenteed this flag + // no longer exists anywhere in simstate files. + else if ("require_transacted" == keyword) + { +// LLString::convertToU32(value, setting); +// setParcelFlag(PF_DENY_ANONYMOUS, setting); +// setParcelFlag(PF_DENY_IDENTIFIED, setting); + } + else if ("restrict_pushobject" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_RESTRICT_PUSHOBJECT, setting); + } + else if ("deny_anonymous" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_DENY_ANONYMOUS, setting); + } + // TODO: DEPRECATED FLAG + // Keep if statement until we have guarenteed this flag + // no longer exists anywhere in simstate files. else if ("deny_identified" == keyword) { - LLString::convertToU32(value, setting); - setParcelFlag(PF_DENY_IDENTIFIED, setting); +// LLString::convertToU32(value, setting); +// setParcelFlag(PF_DENY_IDENTIFIED, setting); } else if ("deny_transacted" == keyword) { - LLString::convertToU32(value, setting); - setParcelFlag(PF_DENY_TRANSACTED, setting); - } - else if ("access_list" == keyword) - { - S32 entry_count = 0; - LLString::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mAccessList[entry.mID] = entry; - } - } - } - else if ("ban_list" == keyword) - { - S32 entry_count = 0; - LLString::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mBanList[entry.mID] = entry; - } - } - } - else if ("renter_list" == keyword) - { - /* - S32 entry_count = 0; - LLString::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mRenterList.put(entry); - } - }*/ - } - else if ("pass_list" == keyword) - { - // legacy - put into access list - S32 entry_count = 0; - LLString::convertToS32(value, entry_count); - for (S32 i = 0; i < entry_count; i++) - { - LLAccessEntry entry; - if (importAccessEntry(input_stream, &entry)) - { - mAccessList[entry.mID] = entry; - } - } - } - - else - { - llwarns << "Unknown keyword in parcel section: <" - << keyword << ">" << llendl; - } - } - - // this code block detects if we have loaded a 1.1 simstate file, - // and follows the conversion rules specified in - // design_docs/land/pay_for_parcel.txt. - F32 time_to_expire = 0.0f; - if(mID.isNull()) - { - mID.generate(); - mStatus = OS_LEASE_PENDING; - //mBuyerID = mOwnerID; - if(getIsGroupOwned()) - { - time_to_expire += GROUP_USEC_CONVERSION_TIMEOUT / SEC_TO_MICROSEC; - } - else - { - time_to_expire += DEFAULT_USEC_CONVERSION_TIMEOUT / SEC_TO_MICROSEC; - } - //mExpireAction = STEA_PUBLIC; - mRecordTransaction = TRUE; - } - - // this code block deals with giving an extension to pending - // parcels to the midday of 2004-01-19 if they were originally set - // for some time on 2004-01-12. - if((0 == mGraceExtension) - && (EXTEND_GRACE_IF_MORE_THAN_SEC < secs_until_revert)) - { - const S32 NEW_CONVERSION_DATE = 1074538800; // 2004-01-19T11:00:00 - time_t now = time(NULL); // now in epoch - secs_until_revert = (S32)(NEW_CONVERSION_DATE - now); - time_to_expire = (F32)secs_until_revert; - mGraceExtension = 1; - } - - // This code block adds yet another week to the deadline. :( - if(1 == mGraceExtension) - { - time_to_expire += SEVEN_DAYS_IN_USEC / SEC_TO_MICROSEC; - mGraceExtension = 2; - } - - if (time_to_expire > 0) - { - mSaleTimerExpires.setTimerExpirySec(time_to_expire); - mSaleTimerExpires.start(); - } - - // successful import - return TRUE; +// LLString::convertToU32(value, setting); +// setParcelFlag(PF_DENY_TRANSACTED, setting); + } + else if ("deny_age_unverified" == keyword) + { + LLString::convertToU32(value, setting); + setParcelFlag(PF_DENY_AGEUNVERIFIED, setting); + } + else if ("access_list" == keyword) + { + S32 entry_count = 0; + LLString::convertToS32(value, entry_count); + for (S32 i = 0; i < entry_count; i++) + { + LLAccessEntry entry; + if (importAccessEntry(input_stream, &entry)) + { + mAccessList[entry.mID] = entry; + } + } + } + else if ("ban_list" == keyword) + { + S32 entry_count = 0; + LLString::convertToS32(value, entry_count); + for (S32 i = 0; i < entry_count; i++) + { + LLAccessEntry entry; + if (importAccessEntry(input_stream, &entry)) + { + mBanList[entry.mID] = entry; + } + } + } + else if ("renter_list" == keyword) + { + /* + S32 entry_count = 0; + LLString::convertToS32(value, entry_count); + for (S32 i = 0; i < entry_count; i++) + { + LLAccessEntry entry; + if (importAccessEntry(input_stream, &entry)) + { + mRenterList.put(entry); + } + }*/ + } + else if ("pass_list" == keyword) + { + // legacy - put into access list + S32 entry_count = 0; + LLString::convertToS32(value, entry_count); + for (S32 i = 0; i < entry_count; i++) + { + LLAccessEntry entry; + if (importAccessEntry(input_stream, &entry)) + { + mAccessList[entry.mID] = entry; + } + } + } + + else + { + llwarns << "Unknown keyword in parcel section: <" + << keyword << ">" << llendl; + } + } + + // this code block detects if we have loaded a 1.1 simstate file, + // and follows the conversion rules specified in + // design_docs/land/pay_for_parcel.txt. + F32 time_to_expire = 0.0f; + if(mID.isNull()) + { + mID.generate(); + mStatus = OS_LEASE_PENDING; + //mBuyerID = mOwnerID; + if(getIsGroupOwned()) + { + time_to_expire += GROUP_USEC_CONVERSION_TIMEOUT / SEC_TO_MICROSEC; + } + else + { + time_to_expire += DEFAULT_USEC_CONVERSION_TIMEOUT / SEC_TO_MICROSEC; + } + //mExpireAction = STEA_PUBLIC; + mRecordTransaction = TRUE; + } + + // this code block deals with giving an extension to pending + // parcels to the midday of 2004-01-19 if they were originally set + // for some time on 2004-01-12. + if((0 == mGraceExtension) + && (EXTEND_GRACE_IF_MORE_THAN_SEC < secs_until_revert)) + { + const S32 NEW_CONVERSION_DATE = 1074538800; // 2004-01-19T11:00:00 + time_t now = time(NULL); // now in epoch + secs_until_revert = (S32)(NEW_CONVERSION_DATE - now); + time_to_expire = (F32)secs_until_revert; + mGraceExtension = 1; + } + + // This code block adds yet another week to the deadline. :( + if(1 == mGraceExtension) + { + time_to_expire += SEVEN_DAYS_IN_USEC / SEC_TO_MICROSEC; + mGraceExtension = 2; + } + + if (time_to_expire > 0) + { + mSaleTimerExpires.setTimerExpirySec(time_to_expire); + mSaleTimerExpires.start(); + } + + // successful import + return TRUE; } BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entry) { - skip_to_end_of_next_keyword("{", input_stream); - while (input_stream.good()) - { - skip_comments_and_emptyspace(input_stream); - LLString line, keyword, value; - get_line(line, input_stream, MAX_STRING); - get_keyword_and_value(keyword, value, line); - - if ("}" == keyword) - { - break; - } - else if ("id" == keyword) - { - entry->mID.set( value.c_str() ); - } - else if ("name" == keyword) - { - // deprecated - } - else if ("time" == keyword) - { - S32 when; - LLString::convertToS32(value, when); - entry->mTime = when; - } - else if ("flags" == keyword) - { - U32 setting; - LLString::convertToU32(value, setting); - entry->mFlags = setting; - } - else - { - llwarns << "Unknown keyword in parcel access entry section: <" - << keyword << ">" << llendl; - } - } - return input_stream.good(); + skip_to_end_of_next_keyword("{", input_stream); + while (input_stream.good()) + { + skip_comments_and_emptyspace(input_stream); + LLString line, keyword, value; + get_line(line, input_stream, MAX_STRING); + get_keyword_and_value(keyword, value, line); + + if ("}" == keyword) + { + break; + } + else if ("id" == keyword) + { + entry->mID.set( value.c_str() ); + } + else if ("name" == keyword) + { + // deprecated + } + else if ("time" == keyword) + { + S32 when; + LLString::convertToS32(value, when); + entry->mTime = when; + } + else if ("flags" == keyword) + { + U32 setting; + LLString::convertToU32(value, setting); + entry->mFlags = setting; + } + else + { + llwarns << "Unknown keyword in parcel access entry section: <" + << keyword << ">" << llendl; + } + } + return input_stream.good(); } BOOL LLParcel::exportStream(std::ostream& output_stream) { - S32 setting; - char id_string[MAX_STRING]; /* Flawfinder: ignore */ - - std::ios::fmtflags old_flags = output_stream.flags(); - output_stream.setf(std::ios::showpoint); - output_stream << "\t{\n"; - - mID.toString(id_string); - output_stream << "\t\t parcel_id " << id_string << "\n"; - output_stream << "\t\t status " << ownership_status_to_string(mStatus) << "\n"; - output_stream << "\t\t category " << category_to_string(mCategory) << "\n"; - - output_stream << "\t\t local_id " << mLocalID << "\n"; - - const char* name = (mName.empty() ? "" : mName.c_str() ); - output_stream << "\t\t name " << name << "\n"; - - const char* desc = (mDesc.empty() ? "" : mDesc.c_str() ); - output_stream << "\t\t desc " << desc << "\n"; - - const char* music_url = (mMusicURL.empty() ? "" : mMusicURL.c_str() ); - output_stream << "\t\t music_url " << music_url << "\n"; - - const char* media_url = (mMediaURL.empty() ? "" : mMediaURL.c_str() ); - output_stream << "\t\t media_url " << media_url << "\n"; - - output_stream << "\t\t media_auto_scale " << (mMediaAutoScale ? 1 : 0) << "\n"; - - mMediaID.toString(id_string); - output_stream << "\t\t media_id " << id_string << "\n"; - - mOwnerID.toString(id_string); - output_stream << "\t\t owner_id " << id_string << "\n"; - output_stream << "\t\t group_owned " << (mGroupOwned ? 1 : 0) << "\n"; - output_stream << "\t\t clean_other_time " << getCleanOtherTime() << "\n"; - - if(!mAuthBuyerID.isNull()) - { - mAuthBuyerID.toString(id_string); - output_stream << "\t\t auth_buyer_id " << id_string << "\n"; - } - if (!mSnapshotID.isNull()) - { - mSnapshotID.toString(id_string); - output_stream << "\t\t snapshot_id " << id_string << "\n"; - } - if (!mUserLocation.isExactlyZero()) - { - output_stream << "\t\t user_location " - << (F64)mUserLocation.mV[VX] - << " " << (F64)mUserLocation.mV[VY] - << " " << (F64)mUserLocation.mV[VZ] << "\n"; - output_stream << "\t\t user_look_at " - << (F64)mUserLookAt.mV[VX] - << " " << (F64)mUserLookAt.mV[VY] - << " " << (F64)mUserLookAt.mV[VZ] << "\n"; - } - output_stream << "\t\t landing_type " << mLandingType << "\n"; - //if(mJoinNeighbors) - //{ - // output_stream << "\t\t join_neighbors " << mJoinNeighbors << "\n"; - //} - if(mSaleTimerExpires.getStarted()) - { - S32 dt_sec = (S32) mSaleTimerExpires.getRemainingTimeF32()+60; // Add a minute to prevent race conditions - output_stream << "\t\t revert_sale " << dt_sec << "\n"; - //output_stream << "\t\t revert_action " << revert_action_to_string(mExpireAction) << "\n"; - output_stream << "\t\t extended_grace " << mGraceExtension << "\n"; - } - - if(0 != mAuctionID) - { - output_stream << "\t\t auction_id " << mAuctionID << "\n"; - } - - output_stream << "\t\t allow_modify " << getAllowModify() << "\n"; - output_stream << "\t\t allow_group_modify " << getAllowGroupModify() << "\n"; - output_stream << "\t\t allow_all_object_entry " << getAllowAllObjectEntry() << "\n"; - output_stream << "\t\t allow_group_object_entry " << getAllowGroupObjectEntry() << "\n"; - output_stream << "\t\t allow_terraform " << getAllowTerraform() << "\n"; - output_stream << "\t\t allow_deed_to_group " << getAllowDeedToGroup() << "\n"; - output_stream << "\t\t contribute_with_deed " << getContributeWithDeed() << "\n"; - output_stream << "\t\t allow_damage " << getAllowDamage() << "\n"; - output_stream << "\t\t claim_date " << (S32)mClaimDate << "\n"; - output_stream << "\t\t claim_price " << mClaimPricePerMeter << "\n"; - output_stream << "\t\t rent_price " << mRentPricePerMeter << "\n"; - output_stream << "\t\t discount_rate " << mDiscountRate << "\n"; - output_stream << "\t\t allow_fly " << (getAllowFly() ? 1 : 0) << "\n"; - output_stream << "\t\t allow_landmark " << (getAllowLandmark() ? 1 : 0) << "\n"; - output_stream << "\t\t sound_local " << (getSoundLocal() ? 1 : 0) << "\n"; - output_stream << "\t\t allow_scripts " << (getAllowOtherScripts() ? 1 : 0) << "\n"; - output_stream << "\t\t allow_group_scripts " << (getAllowGroupScripts() ? 1 : 0) << "\n"; - output_stream << "\t\t allow_voice_chat " << (getVoiceEnabled() ? 1 : 0) << "\n"; - output_stream << "\t\t use_estate_voice_chan " << (getVoiceUseEstateChannel() ? 1 : 0) << "\n"; - output_stream << "\t\t for_sale " << (getForSale() ? 1 : 0) << "\n"; - output_stream << "\t\t sell_w_objects " << (getSellWithObjects() ? 1 : 0) << "\n"; - output_stream << "\t\t draw_distance " << mDrawDistance << "\n"; - output_stream << "\t\t sale_price " << mSalePrice << "\n"; - - setting = (getParcelFlag(PF_USE_ACCESS_GROUP) ? 1 : 0); - output_stream << "\t\t use_access_group " << setting << "\n"; - - setting = (getParcelFlag(PF_USE_ACCESS_LIST) ? 1 : 0); - output_stream << "\t\t use_access_list " << setting << "\n"; - - setting = (getParcelFlag(PF_USE_BAN_LIST) ? 1 : 0); - output_stream << "\t\t use_ban_list " << setting << "\n"; - - mGroupID.toString(id_string); - output_stream << "\t\t group_id " << id_string << "\n"; - - //const char* group_name - // = (mGroupName.isEmpty() ? "" : mGroupName.c_str() ); - //output_stream << "\t\t group_name " << group_name << "\n"; - - setting = (getParcelFlag(PF_USE_PASS_LIST) ? 1 : 0); - output_stream << "\t\t use_pass_list " << setting << "\n"; - - output_stream << "\t\t pass_price " << mPassPrice << "\n"; - output_stream << "\t\t pass_hours " << mPassHours << "\n"; - - setting = (getParcelFlag(PF_SHOW_DIRECTORY) ? 1 : 0); - output_stream << "\t\t show_directory " << setting << "\n"; - - setting = (getParcelFlag(PF_ALLOW_PUBLISH) ? 1 : 0); - output_stream << "\t\t allow_publish " << setting << "\n"; - - setting = (getParcelFlag(PF_MATURE_PUBLISH) ? 1 : 0); - output_stream << "\t\t mature_publish " << setting << "\n"; - - setting = (getParcelFlag(PF_DENY_ANONYMOUS) ? 1 : 0); - output_stream << "\t\t deny_anonymous " << setting << "\n"; - - setting = (getParcelFlag(PF_DENY_IDENTIFIED) ? 1 : 0); - output_stream << "\t\t deny_identified " << setting << "\n"; - - setting = (getParcelFlag(PF_DENY_TRANSACTED) ? 1 : 0); - output_stream << "\t\t deny_transacted " << setting << "\n"; - - setting = (getParcelFlag(PF_RESTRICT_PUSHOBJECT) ? 1 : 0); - output_stream << "\t\t restrict_pushobject " << setting << "\n"; - - output_stream << "\t\t aabb_min " - << mAABBMin.mV[VX] - << " " << mAABBMin.mV[VY] - << " " << mAABBMin.mV[VZ] << "\n"; - - if (!mAccessList.empty()) - { - output_stream << "\t\t access_list " << mAccessList.size() << "\n"; - access_map_const_iterator cit = mAccessList.begin(); - access_map_const_iterator end = mAccessList.end(); - - for ( ; cit != end; ++cit) - { - output_stream << "\t\t{\n"; - const LLAccessEntry& entry = (*cit).second; - entry.mID.toString(id_string); - output_stream << "\t\t\tid " << id_string << "\n"; - output_stream << "\t\t\ttime " << entry.mTime << "\n"; - output_stream << "\t\t\tflags " << entry.mFlags << "\n"; - output_stream << "\t\t}\n"; - } - } - - if (!mBanList.empty()) - { - output_stream << "\t\t ban_list " << mBanList.size() << "\n"; - access_map_const_iterator cit = mBanList.begin(); - access_map_const_iterator end = mBanList.end(); - - for ( ; cit != end; ++cit) - { - output_stream << "\t\t{\n"; - const LLAccessEntry& entry = (*cit).second; - entry.mID.toString(id_string); - output_stream << "\t\t\tid " << id_string << "\n"; - output_stream << "\t\t\ttime " << entry.mTime << "\n"; - output_stream << "\t\t\tflags " << entry.mFlags << "\n"; - output_stream << "\t\t}\n"; - } - } - - /*if (mRenterList.count() > 0) - { - output_stream << "\t\t renter_list " << mRenterList.count() << "\n"; - for (i = 0; i < mRenterList.count(); i++) - { - output_stream << "\t\t{\n"; - const LLAccessEntry& entry = mRenterList.get(i); - entry.mID.toString(id_string); - output_stream << "\t\t\tid " << id_string << "\n"; - output_stream << "\t\t\ttime " << entry.mTime << "\n"; - output_stream << "\t\t\tflags " << entry.mFlags << "\n"; - output_stream << "\t\t}\n"; - } - }*/ - - output_stream << "\t}\n"; - output_stream.flags(old_flags); - - return TRUE; + S32 setting; + char id_string[MAX_STRING]; /* Flawfinder: ignore */ + + std::ios::fmtflags old_flags = output_stream.flags(); + output_stream.setf(std::ios::showpoint); + output_stream << "\t{\n"; + + mID.toString(id_string); + output_stream << "\t\t parcel_id " << id_string << "\n"; + output_stream << "\t\t status " << ownership_status_to_string(mStatus) << "\n"; + output_stream << "\t\t category " << category_to_string(mCategory) << "\n"; + + output_stream << "\t\t local_id " << mLocalID << "\n"; + + const char* name = (mName.empty() ? "" : mName.c_str() ); + output_stream << "\t\t name " << name << "\n"; + + const char* desc = (mDesc.empty() ? "" : mDesc.c_str() ); + output_stream << "\t\t desc " << desc << "\n"; + + const char* music_url = (mMusicURL.empty() ? "" : mMusicURL.c_str() ); + output_stream << "\t\t music_url " << music_url << "\n"; + + const char* media_url = (mMediaURL.empty() ? "" : mMediaURL.c_str() ); + output_stream << "\t\t media_url " << media_url << "\n"; + + output_stream << "\t\t media_auto_scale " << (mMediaAutoScale ? 1 : 0) << "\n"; + + mMediaID.toString(id_string); + output_stream << "\t\t media_id " << id_string << "\n"; + + mOwnerID.toString(id_string); + output_stream << "\t\t owner_id " << id_string << "\n"; + output_stream << "\t\t group_owned " << (mGroupOwned ? 1 : 0) << "\n"; + output_stream << "\t\t clean_other_time " << getCleanOtherTime() << "\n"; + + if(!mAuthBuyerID.isNull()) + { + mAuthBuyerID.toString(id_string); + output_stream << "\t\t auth_buyer_id " << id_string << "\n"; + } + if (!mSnapshotID.isNull()) + { + mSnapshotID.toString(id_string); + output_stream << "\t\t snapshot_id " << id_string << "\n"; + } + if (!mUserLocation.isExactlyZero()) + { + output_stream << "\t\t user_location " + << (F64)mUserLocation.mV[VX] + << " " << (F64)mUserLocation.mV[VY] + << " " << (F64)mUserLocation.mV[VZ] << "\n"; + output_stream << "\t\t user_look_at " + << (F64)mUserLookAt.mV[VX] + << " " << (F64)mUserLookAt.mV[VY] + << " " << (F64)mUserLookAt.mV[VZ] << "\n"; + } + output_stream << "\t\t landing_type " << mLandingType << "\n"; + //if(mJoinNeighbors) + //{ + // output_stream << "\t\t join_neighbors " << mJoinNeighbors << "\n"; + //} + if(mSaleTimerExpires.getStarted()) + { + S32 dt_sec = (S32) mSaleTimerExpires.getRemainingTimeF32()+60; // Add a minute to prevent race conditions + output_stream << "\t\t revert_sale " << dt_sec << "\n"; + //output_stream << "\t\t revert_action " << revert_action_to_string(mExpireAction) << "\n"; + output_stream << "\t\t extended_grace " << mGraceExtension << "\n"; + } + + if(0 != mAuctionID) + { + output_stream << "\t\t auction_id " << mAuctionID << "\n"; + } + + output_stream << "\t\t allow_modify " << getAllowModify() << "\n"; + output_stream << "\t\t allow_group_modify " << getAllowGroupModify() << "\n"; + output_stream << "\t\t allow_all_object_entry " << getAllowAllObjectEntry() << "\n"; + output_stream << "\t\t allow_group_object_entry " << getAllowGroupObjectEntry() << "\n"; + output_stream << "\t\t allow_terraform " << getAllowTerraform() << "\n"; + output_stream << "\t\t allow_deed_to_group " << getAllowDeedToGroup() << "\n"; + output_stream << "\t\t contribute_with_deed " << getContributeWithDeed() << "\n"; + output_stream << "\t\t allow_damage " << getAllowDamage() << "\n"; + output_stream << "\t\t claim_date " << (S32)mClaimDate << "\n"; + output_stream << "\t\t claim_price " << mClaimPricePerMeter << "\n"; + output_stream << "\t\t rent_price " << mRentPricePerMeter << "\n"; + output_stream << "\t\t discount_rate " << mDiscountRate << "\n"; + output_stream << "\t\t allow_fly " << (getAllowFly() ? 1 : 0) << "\n"; + output_stream << "\t\t allow_landmark " << (getAllowLandmark() ? 1 : 0) << "\n"; + output_stream << "\t\t sound_local " << (getSoundLocal() ? 1 : 0) << "\n"; + output_stream << "\t\t allow_scripts " << (getAllowOtherScripts() ? 1 : 0) << "\n"; + output_stream << "\t\t allow_group_scripts " << (getAllowGroupScripts() ? 1 : 0) << "\n"; + output_stream << "\t\t allow_voice_chat " << (getVoiceEnabled() ? 1 : 0) << "\n"; + output_stream << "\t\t use_estate_voice_chan " << (getVoiceUseEstateChannel() ? 1 : 0) << "\n"; + output_stream << "\t\t for_sale " << (getForSale() ? 1 : 0) << "\n"; + output_stream << "\t\t sell_w_objects " << (getSellWithObjects() ? 1 : 0) << "\n"; + output_stream << "\t\t draw_distance " << mDrawDistance << "\n"; + output_stream << "\t\t sale_price " << mSalePrice << "\n"; + + setting = (getParcelFlag(PF_USE_ACCESS_GROUP) ? 1 : 0); + output_stream << "\t\t use_access_group " << setting << "\n"; + + setting = (getParcelFlag(PF_USE_ACCESS_LIST) ? 1 : 0); + output_stream << "\t\t use_access_list " << setting << "\n"; + + setting = (getParcelFlag(PF_USE_BAN_LIST) ? 1 : 0); + output_stream << "\t\t use_ban_list " << setting << "\n"; + + mGroupID.toString(id_string); + output_stream << "\t\t group_id " << id_string << "\n"; + + //const char* group_name + // = (mGroupName.isEmpty() ? "" : mGroupName.c_str() ); + //output_stream << "\t\t group_name " << group_name << "\n"; + + setting = (getParcelFlag(PF_USE_PASS_LIST) ? 1 : 0); + output_stream << "\t\t use_pass_list " << setting << "\n"; + + output_stream << "\t\t pass_price " << mPassPrice << "\n"; + output_stream << "\t\t pass_hours " << mPassHours << "\n"; + + setting = (getParcelFlag(PF_SHOW_DIRECTORY) ? 1 : 0); + output_stream << "\t\t show_directory " << setting << "\n"; + + setting = (getParcelFlag(PF_ALLOW_PUBLISH) ? 1 : 0); + output_stream << "\t\t allow_publish " << setting << "\n"; + + setting = (getParcelFlag(PF_MATURE_PUBLISH) ? 1 : 0); + output_stream << "\t\t mature_publish " << setting << "\n"; + + setting = (getParcelFlag(PF_DENY_ANONYMOUS) ? 1 : 0); + output_stream << "\t\t deny_anonymous " << setting << "\n"; + +// setting = (getParcelFlag(PF_DENY_IDENTIFIED) ? 1 : 0); +// output_stream << "\t\t deny_identified " << setting << "\n"; + +// setting = (getParcelFlag(PF_DENY_TRANSACTED) ? 1 : 0); +// output_stream << "\t\t deny_transacted " << setting << "\n"; + + setting = (getParcelFlag(PF_DENY_AGEUNVERIFIED) ? 1 : 0); + output_stream << "\t\t deny_age_unverified " << setting << "\n"; + + setting = (getParcelFlag(PF_RESTRICT_PUSHOBJECT) ? 1 : 0); + output_stream << "\t\t restrict_pushobject " << setting << "\n"; + + output_stream << "\t\t aabb_min " + << mAABBMin.mV[VX] + << " " << mAABBMin.mV[VY] + << " " << mAABBMin.mV[VZ] << "\n"; + + if (!mAccessList.empty()) + { + output_stream << "\t\t access_list " << mAccessList.size() << "\n"; + access_map_const_iterator cit = mAccessList.begin(); + access_map_const_iterator end = mAccessList.end(); + + for ( ; cit != end; ++cit) + { + output_stream << "\t\t{\n"; + const LLAccessEntry& entry = (*cit).second; + entry.mID.toString(id_string); + output_stream << "\t\t\tid " << id_string << "\n"; + output_stream << "\t\t\ttime " << entry.mTime << "\n"; + output_stream << "\t\t\tflags " << entry.mFlags << "\n"; + output_stream << "\t\t}\n"; + } + } + + if (!mBanList.empty()) + { + output_stream << "\t\t ban_list " << mBanList.size() << "\n"; + access_map_const_iterator cit = mBanList.begin(); + access_map_const_iterator end = mBanList.end(); + + for ( ; cit != end; ++cit) + { + output_stream << "\t\t{\n"; + const LLAccessEntry& entry = (*cit).second; + entry.mID.toString(id_string); + output_stream << "\t\t\tid " << id_string << "\n"; + output_stream << "\t\t\ttime " << entry.mTime << "\n"; + output_stream << "\t\t\tflags " << entry.mFlags << "\n"; + output_stream << "\t\t}\n"; + } + } + + /*if (mRenterList.count() > 0) + { + output_stream << "\t\t renter_list " << mRenterList.count() << "\n"; + for (i = 0; i < mRenterList.count(); i++) + { + output_stream << "\t\t{\n"; + const LLAccessEntry& entry = mRenterList.get(i); + entry.mID.toString(id_string); + output_stream << "\t\t\tid " << id_string << "\n"; + output_stream << "\t\t\ttime " << entry.mTime << "\n"; + output_stream << "\t\t\tflags " << entry.mFlags << "\n"; + output_stream << "\t\t}\n"; + } + }*/ + + output_stream << "\t}\n"; + output_stream.flags(old_flags); + + return TRUE; } // Assumes we are in a block "ParcelData" void LLParcel::packMessage(LLMessageSystem* msg) { - msg->addU32Fast( _PREHASH_ParcelFlags, getParcelFlags() ); - msg->addS32Fast( _PREHASH_SalePrice, getSalePrice() ); - msg->addStringFast( _PREHASH_Name, getName() ); - msg->addStringFast( _PREHASH_Desc, getDesc() ); - msg->addStringFast( _PREHASH_MusicURL, getMusicURL() ); - msg->addStringFast( _PREHASH_MediaURL, getMediaURL() ); - msg->addU8 ( "MediaAutoScale", getMediaAutoScale () ); - msg->addUUIDFast( _PREHASH_MediaID, getMediaID() ); - msg->addUUIDFast( _PREHASH_GroupID, getGroupID() ); - msg->addS32Fast( _PREHASH_PassPrice, mPassPrice ); - msg->addF32Fast( _PREHASH_PassHours, mPassHours ); - msg->addU8Fast( _PREHASH_Category, (U8)mCategory); - msg->addUUIDFast( _PREHASH_AuthBuyerID, mAuthBuyerID); - msg->addUUIDFast( _PREHASH_SnapshotID, mSnapshotID); - msg->addVector3Fast(_PREHASH_UserLocation, mUserLocation); - msg->addVector3Fast(_PREHASH_UserLookAt, mUserLookAt); - msg->addU8Fast( _PREHASH_LandingType, (U8)mLandingType); + msg->addU32Fast( _PREHASH_ParcelFlags, getParcelFlags() ); + msg->addS32Fast( _PREHASH_SalePrice, getSalePrice() ); + msg->addStringFast( _PREHASH_Name, getName() ); + msg->addStringFast( _PREHASH_Desc, getDesc() ); + msg->addStringFast( _PREHASH_MusicURL, getMusicURL() ); + msg->addStringFast( _PREHASH_MediaURL, getMediaURL() ); + msg->addU8 ( "MediaAutoScale", getMediaAutoScale () ); + msg->addUUIDFast( _PREHASH_MediaID, getMediaID() ); + msg->addUUIDFast( _PREHASH_GroupID, getGroupID() ); + msg->addS32Fast( _PREHASH_PassPrice, mPassPrice ); + msg->addF32Fast( _PREHASH_PassHours, mPassHours ); + msg->addU8Fast( _PREHASH_Category, (U8)mCategory); + msg->addUUIDFast( _PREHASH_AuthBuyerID, mAuthBuyerID); + msg->addUUIDFast( _PREHASH_SnapshotID, mSnapshotID); + msg->addVector3Fast(_PREHASH_UserLocation, mUserLocation); + msg->addVector3Fast(_PREHASH_UserLookAt, mUserLookAt); + msg->addU8Fast( _PREHASH_LandingType, (U8)mLandingType); } void LLParcel::unpackMessage(LLMessageSystem* msg) { - char buffer[256]; /* Flawfinder: ignore */ - - msg->getU32Fast( _PREHASH_ParcelData,_PREHASH_ParcelFlags, mParcelFlags ); - msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_SalePrice, mSalePrice ); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Name, 256, buffer ); - setName(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Desc, 256, buffer ); - setDesc(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MusicURL, 256, buffer ); - setMusicURL(buffer); - msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MediaURL, 256, buffer ); - setMediaURL(buffer); - - // non-optimized version - msg->getU8 ( "ParcelData", "MediaAutoScale", mMediaAutoScale ); - - msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_MediaID, mMediaID ); - msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_GroupID, mGroupID ); - msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_PassPrice, mPassPrice ); - msg->getF32Fast( _PREHASH_ParcelData,_PREHASH_PassHours, mPassHours ); - U8 category; - msg->getU8Fast( _PREHASH_ParcelData,_PREHASH_Category, category); - mCategory = (ECategory)category; - msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_AuthBuyerID, mAuthBuyerID); - msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_SnapshotID, mSnapshotID); - msg->getVector3Fast(_PREHASH_ParcelData,_PREHASH_UserLocation, mUserLocation); - msg->getVector3Fast(_PREHASH_ParcelData,_PREHASH_UserLookAt, mUserLookAt); - U8 landing_type; - msg->getU8Fast( _PREHASH_ParcelData,_PREHASH_LandingType, landing_type); - mLandingType = (ELandingType)landing_type; + char buffer[256]; /* Flawfinder: ignore */ + + msg->getU32Fast( _PREHASH_ParcelData,_PREHASH_ParcelFlags, mParcelFlags ); + msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_SalePrice, mSalePrice ); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Name, 256, buffer ); + setName(buffer); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_Desc, 256, buffer ); + setDesc(buffer); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MusicURL, 256, buffer ); + setMusicURL(buffer); + msg->getStringFast( _PREHASH_ParcelData,_PREHASH_MediaURL, 256, buffer ); + setMediaURL(buffer); + + // non-optimized version + msg->getU8 ( "ParcelData", "MediaAutoScale", mMediaAutoScale ); + + msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_MediaID, mMediaID ); + msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_GroupID, mGroupID ); + msg->getS32Fast( _PREHASH_ParcelData,_PREHASH_PassPrice, mPassPrice ); + msg->getF32Fast( _PREHASH_ParcelData,_PREHASH_PassHours, mPassHours ); + U8 category; + msg->getU8Fast( _PREHASH_ParcelData,_PREHASH_Category, category); + mCategory = (ECategory)category; + msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_AuthBuyerID, mAuthBuyerID); + msg->getUUIDFast( _PREHASH_ParcelData,_PREHASH_SnapshotID, mSnapshotID); + msg->getVector3Fast(_PREHASH_ParcelData,_PREHASH_UserLocation, mUserLocation); + msg->getVector3Fast(_PREHASH_ParcelData,_PREHASH_UserLookAt, mUserLookAt); + U8 landing_type; + msg->getU8Fast( _PREHASH_ParcelData,_PREHASH_LandingType, landing_type); + mLandingType = (ELandingType)landing_type; } void LLParcel::packAccessEntries(LLMessageSystem* msg, const std::map<LLUUID,LLAccessEntry>& list) { - access_map_const_iterator cit = list.begin(); - access_map_const_iterator end = list.end(); - - if (cit == end) - { - msg->nextBlockFast(_PREHASH_List); - msg->addUUIDFast(_PREHASH_ID, LLUUID::null ); - msg->addS32Fast(_PREHASH_Time, 0 ); - msg->addU32Fast(_PREHASH_Flags, 0 ); - return; - } - - for ( ; cit != end; ++cit) - { - const LLAccessEntry& entry = (*cit).second; - - msg->nextBlockFast(_PREHASH_List); - msg->addUUIDFast(_PREHASH_ID, entry.mID ); - msg->addS32Fast(_PREHASH_Time, entry.mTime ); - msg->addU32Fast(_PREHASH_Flags, entry.mFlags ); - } + access_map_const_iterator cit = list.begin(); + access_map_const_iterator end = list.end(); + + if (cit == end) + { + msg->nextBlockFast(_PREHASH_List); + msg->addUUIDFast(_PREHASH_ID, LLUUID::null ); + msg->addS32Fast(_PREHASH_Time, 0 ); + msg->addU32Fast(_PREHASH_Flags, 0 ); + return; + } + + for ( ; cit != end; ++cit) + { + const LLAccessEntry& entry = (*cit).second; + + msg->nextBlockFast(_PREHASH_List); + msg->addUUIDFast(_PREHASH_ID, entry.mID ); + msg->addS32Fast(_PREHASH_Time, entry.mTime ); + msg->addU32Fast(_PREHASH_Flags, entry.mFlags ); + } } void LLParcel::unpackAccessEntries(LLMessageSystem* msg, - std::map<LLUUID,LLAccessEntry>* list) + std::map<LLUUID,LLAccessEntry>* list) { - LLUUID id; - S32 time; - U32 flags; - - S32 i; - S32 count = msg->getNumberOfBlocksFast(_PREHASH_List); - for (i = 0; i < count; i++) - { - msg->getUUIDFast(_PREHASH_List, _PREHASH_ID, id, i); - msg->getS32Fast( _PREHASH_List, _PREHASH_Time, time, i); - msg->getU32Fast( _PREHASH_List, _PREHASH_Flags, flags, i); - - if (id.notNull()) - { - LLAccessEntry entry; - entry.mID = id; - entry.mTime = time; - entry.mFlags = flags; - - (*list)[entry.mID] = entry; - } - } + LLUUID id; + S32 time; + U32 flags; + + S32 i; + S32 count = msg->getNumberOfBlocksFast(_PREHASH_List); + for (i = 0; i < count; i++) + { + msg->getUUIDFast(_PREHASH_List, _PREHASH_ID, id, i); + msg->getS32Fast( _PREHASH_List, _PREHASH_Time, time, i); + msg->getU32Fast( _PREHASH_List, _PREHASH_Flags, flags, i); + + if (id.notNull()) + { + LLAccessEntry entry; + entry.mID = id; + entry.mTime = time; + entry.mFlags = flags; + + (*list)[entry.mID] = entry; + } + } } void LLParcel::expirePasses(S32 now) { - access_map_iterator itor = mAccessList.begin(); - while (itor != mAccessList.end()) - { - const LLAccessEntry& entry = (*itor).second; - - if (entry.mTime != 0 && entry.mTime < now) - { - mAccessList.erase(itor++); - } - else - { - ++itor; - } - } + access_map_iterator itor = mAccessList.begin(); + while (itor != mAccessList.end()) + { + const LLAccessEntry& entry = (*itor).second; + + if (entry.mTime != 0 && entry.mTime < now) + { + mAccessList.erase(itor++); + } + else + { + ++itor; + } + } } bool LLParcel::operator==(const LLParcel &rhs) const { - if (mOwnerID != rhs.mOwnerID) - return FALSE; - - if (mParcelFlags != rhs.mParcelFlags) - return FALSE; - - if (mClaimDate != rhs.mClaimDate) - return FALSE; - - if (mClaimPricePerMeter != rhs.mClaimPricePerMeter) - return FALSE; - - if (mRentPricePerMeter != rhs.mRentPricePerMeter) - return FALSE; - - return TRUE; + if (mOwnerID != rhs.mOwnerID) + return FALSE; + + if (mParcelFlags != rhs.mParcelFlags) + return FALSE; + + if (mClaimDate != rhs.mClaimDate) + return FALSE; + + if (mClaimPricePerMeter != rhs.mClaimPricePerMeter) + return FALSE; + + if (mRentPricePerMeter != rhs.mRentPricePerMeter) + return FALSE; + + return TRUE; } // Calculate rent S32 LLParcel::getTotalRent() const { - return (S32)floor(0.5f + (F32)mArea * (F32)mRentPricePerMeter * (1.0f - mDiscountRate)); + return (S32)floor(0.5f + (F32)mArea * (F32)mRentPricePerMeter * (1.0f - mDiscountRate)); } F32 LLParcel::getAdjustedRentPerMeter() const { - return ((F32)mRentPricePerMeter * (1.0f - mDiscountRate)); + return ((F32)mRentPricePerMeter * (1.0f - mDiscountRate)); } LLVector3 LLParcel::getCenterpoint() const { - LLVector3 rv; - rv.mV[VX] = (getAABBMin().mV[VX] + getAABBMax().mV[VX]) * 0.5f; - rv.mV[VY] = (getAABBMin().mV[VY] + getAABBMax().mV[VY]) * 0.5f; - rv.mV[VZ] = 0.0f; - return rv; + LLVector3 rv; + rv.mV[VX] = (getAABBMin().mV[VX] + getAABBMax().mV[VX]) * 0.5f; + rv.mV[VY] = (getAABBMin().mV[VY] + getAABBMax().mV[VY]) * 0.5f; + rv.mV[VZ] = 0.0f; + return rv; } void LLParcel::extendAABB(const LLVector3& box_min, const LLVector3& box_max) { - // Patch up min corner of AABB - S32 i; - for (i=0; i<3; i++) - { - if (box_min.mV[i] < mAABBMin.mV[i]) - { - mAABBMin.mV[i] = box_min.mV[i]; - } - } - - // Patch up max corner of AABB - for (i=0; i<3; i++) - { - if (box_max.mV[i] > mAABBMax.mV[i]) - { - mAABBMax.mV[i] = box_max.mV[i]; - } - } + // Patch up min corner of AABB + S32 i; + for (i=0; i<3; i++) + { + if (box_min.mV[i] < mAABBMin.mV[i]) + { + mAABBMin.mV[i] = box_min.mV[i]; + } + } + + // Patch up max corner of AABB + for (i=0; i<3; i++) + { + if (box_max.mV[i] > mAABBMax.mV[i]) + { + mAABBMax.mV[i] = box_max.mV[i]; + } + } } BOOL LLParcel::addToAccessList(const LLUUID& agent_id, S32 time) { - if (!((mParcelFlags & PF_USE_ACCESS_LIST) || (mParcelFlags & PF_USE_PASS_LIST)) - || mAccessList.size() >= (U32) PARCEL_MAX_ACCESS_LIST) + if (mAccessList.size() >= (U32) PARCEL_MAX_ACCESS_LIST) { - // Not using access list, so not a rational thing to do return FALSE; } if (agent_id == getOwnerID()) @@ -1447,21 +1452,20 @@ BOOL LLParcel::addToAccessList(const LLUUID& agent_id, S32 time) ++itor; } } - - removeFromBanList(agent_id); - - LLAccessEntry new_entry; - new_entry.mID = agent_id; - new_entry.mTime = time; - new_entry.mFlags = 0x0; - mAccessList[new_entry.mID] = new_entry; - return TRUE; + + removeFromBanList(agent_id); + + LLAccessEntry new_entry; + new_entry.mID = agent_id; + new_entry.mTime = time; + new_entry.mFlags = 0x0; + mAccessList[new_entry.mID] = new_entry; + return TRUE; } BOOL LLParcel::addToBanList(const LLUUID& agent_id, S32 time) { - if (!(mParcelFlags & PF_USE_BAN_LIST) - || mBanList.size() >= (U32) PARCEL_MAX_ACCESS_LIST) + if (mBanList.size() >= (U32) PARCEL_MAX_ACCESS_LIST) { // Not using ban list, so not a rational thing to do return FALSE; @@ -1471,127 +1475,127 @@ BOOL LLParcel::addToBanList(const LLUUID& agent_id, S32 time) // Can't add owner to these lists return FALSE; } - - access_map_iterator itor = mBanList.begin(); - while (itor != mBanList.end()) - { - const LLAccessEntry& entry = (*itor).second; - if (entry.mID == agent_id) - { - if (time == 0 || (entry.mTime != 0 && entry.mTime < time)) - { - mBanList.erase(itor++); - } - else - { - // existing one expires later - return FALSE; - } - } - else - { - ++itor; - } - } - - removeFromAccessList(agent_id); - - LLAccessEntry new_entry; - new_entry.mID = agent_id; - new_entry.mTime = time; - new_entry.mFlags = 0x0; - mBanList[new_entry.mID] = new_entry; - return TRUE; + + access_map_iterator itor = mBanList.begin(); + while (itor != mBanList.end()) + { + const LLAccessEntry& entry = (*itor).second; + if (entry.mID == agent_id) + { + if (time == 0 || (entry.mTime != 0 && entry.mTime < time)) + { + mBanList.erase(itor++); + } + else + { + // existing one expires later + return FALSE; + } + } + else + { + ++itor; + } + } + + removeFromAccessList(agent_id); + + LLAccessEntry new_entry; + new_entry.mID = agent_id; + new_entry.mTime = time; + new_entry.mFlags = 0x0; + mBanList[new_entry.mID] = new_entry; + return TRUE; } BOOL remove_from_access_array(std::map<LLUUID,LLAccessEntry>* list, - const LLUUID& agent_id) + const LLUUID& agent_id) { - BOOL removed = FALSE; - access_map_iterator itor = list->begin(); - while (itor != list->end()) - { - const LLAccessEntry& entry = (*itor).second; - if (entry.mID == agent_id) - { - list->erase(itor++); - removed = TRUE; - } - else - { - ++itor; - } - } - return removed; + BOOL removed = FALSE; + access_map_iterator itor = list->begin(); + while (itor != list->end()) + { + const LLAccessEntry& entry = (*itor).second; + if (entry.mID == agent_id) + { + list->erase(itor++); + removed = TRUE; + } + else + { + ++itor; + } + } + return removed; } BOOL LLParcel::removeFromAccessList(const LLUUID& agent_id) { - return remove_from_access_array(&mAccessList, agent_id); + return remove_from_access_array(&mAccessList, agent_id); } BOOL LLParcel::removeFromBanList(const LLUUID& agent_id) { - return remove_from_access_array(&mBanList, agent_id); + return remove_from_access_array(&mBanList, agent_id); } // static const char* LLParcel::getOwnershipStatusString(EOwnershipStatus status) { - return ownership_status_to_string(status); + return ownership_status_to_string(status); } // static const char* LLParcel::getCategoryString(ECategory category) { - return category_to_string(category); + return category_to_string(category); } // static const char* LLParcel::getCategoryUIString(ECategory category) { - return category_to_ui_string(category); + return category_to_ui_string(category); } // static LLParcel::ECategory LLParcel::getCategoryFromString(const char* string) { - return category_string_to_category(string); + return category_string_to_category(string); } // static LLParcel::ECategory LLParcel::getCategoryFromUIString(const char* string) { - return category_ui_string_to_category(string); + return category_ui_string_to_category(string); } // static const char* LLParcel::getActionString(LLParcel::EAction action) { - S32 index = 0; - if((action >= 0) && (action < LLParcel::A_COUNT)) - { - index = action; - } - else - { - index = A_COUNT; - } - return PARCEL_ACTION_STRING[index]; + S32 index = 0; + if((action >= 0) && (action < LLParcel::A_COUNT)) + { + index = action; + } + else + { + index = A_COUNT; + } + return PARCEL_ACTION_STRING[index]; } BOOL LLParcel::isSaleTimerExpired(const U64& time) { - if (mSaleTimerExpires.getStarted() == FALSE) - { - return FALSE; - } - BOOL expired = mSaleTimerExpires.checkExpirationAndReset(0.0); - if (expired) - { - mSaleTimerExpires.stop(); - } - return expired; + if (mSaleTimerExpires.getStarted() == FALSE) + { + return FALSE; + } + BOOL expired = mSaleTimerExpires.checkExpirationAndReset(0.0); + if (expired) + { + mSaleTimerExpires.stop(); + } + return expired; } @@ -1623,22 +1627,22 @@ void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) void LLParcel::expireSale(U32& type, U8& flags, LLUUID& from_id, LLUUID& to_id) { - mSaleTimerExpires.setTimerExpirySec(0.0); - mSaleTimerExpires.stop(); - setPreviousOwnerID(LLUUID::null); - setPreviouslyGroupOwned(FALSE); - setSellWithObjects(FALSE); - type = TRANS_LAND_RELEASE; - mStatus = OS_NONE; - flags = pack_transaction_flags(mGroupOwned, FALSE); - mAuthBuyerID.setNull(); - from_id = mOwnerID; - mOwnerID.setNull(); - to_id.setNull(); + mSaleTimerExpires.setTimerExpirySec(0.0); + mSaleTimerExpires.stop(); + setPreviousOwnerID(LLUUID::null); + setPreviouslyGroupOwned(FALSE); + setSellWithObjects(FALSE); + type = TRANS_LAND_RELEASE; + mStatus = OS_NONE; + flags = pack_transaction_flags(mGroupOwned, FALSE); + mAuthBuyerID.setNull(); + from_id = mOwnerID; + mOwnerID.setNull(); + to_id.setNull(); } void LLParcel::completeSale(U32& type, U8& flags, - LLUUID& to_id) + LLUUID& to_id) { mSaleTimerExpires.setTimerExpirySec(0.0); mSaleTimerExpires.stop(); @@ -1660,7 +1664,6 @@ void LLParcel::completeSale(U32& type, U8& flags, //should be cleared on sale. mAccessList.clear(); mBanList.clear(); - } void LLParcel::clearSale() @@ -1685,143 +1688,144 @@ void LLParcel::clearSale() BOOL LLParcel::isPublic() const { - return (mOwnerID.isNull()); + return (mOwnerID.isNull()); } BOOL LLParcel::isBuyerAuthorized(const LLUUID& buyer_id) const { - if(mAuthBuyerID.isNull()) - { - return TRUE; - } - return (mAuthBuyerID == buyer_id); + if(mAuthBuyerID.isNull()) + { + return TRUE; + } + return (mAuthBuyerID == buyer_id); } void LLParcel::clearParcel() { - overrideParcelFlags(PF_DEFAULT); - setName(NULL); - setDesc(NULL); - setMusicURL(NULL); - setMediaURL(NULL); - setMediaID(LLUUID::null); - setMediaAutoScale(0); - setInEscrow(FALSE); - setAuthorizedBuyerID(LLUUID::null); - setCategory(C_NONE); - setSnapshotID(LLUUID::null); - setUserLocation(LLVector3::zero); - setUserLookAt(LLVector3::x_axis); - setLandingType(L_LANDING_POINT); - setAuctionID(0); - setGroupID(LLUUID::null); - setPassPrice(0); - setPassHours(0.f); - mAccessList.clear(); - mBanList.clear(); - //mRenterList.reset(); + overrideParcelFlags(PF_DEFAULT); + setName(NULL); + setDesc(NULL); + setMusicURL(NULL); + setMediaURL(NULL); + setMediaID(LLUUID::null); + setMediaAutoScale(0); + setInEscrow(FALSE); + setAuthorizedBuyerID(LLUUID::null); + setCategory(C_NONE); + setSnapshotID(LLUUID::null); + setUserLocation(LLVector3::zero); + setUserLookAt(LLVector3::x_axis); + setLandingType(L_LANDING_POINT); + setAuctionID(0); + setGroupID(LLUUID::null); + setPassPrice(0); + setPassHours(0.f); + mAccessList.clear(); + mBanList.clear(); + //mRenterList.reset(); } void LLParcel::dump() { - llinfos << "parcel " << mLocalID << " area " << mArea << llendl; - llinfos << " name <" << mName << ">" << llendl; - llinfos << " desc <" << mDesc << ">" << llendl; + llinfos << "parcel " << mLocalID << " area " << mArea << llendl; + llinfos << " name <" << mName << ">" << llendl; + llinfos << " desc <" << mDesc << ">" << llendl; } const char* ownership_status_to_string(LLParcel::EOwnershipStatus status) { - if(status >= 0 && status < LLParcel::OS_COUNT) - { - return PARCEL_OWNERSHIP_STATUS_STRING[status]; - } - return "none"; + if(status >= 0 && status < LLParcel::OS_COUNT) + { + return PARCEL_OWNERSHIP_STATUS_STRING[status]; + } + return "none"; } LLParcel::EOwnershipStatus ownership_string_to_status(const char* s) { - for(S32 i = 0; i < LLParcel::OS_COUNT; ++i) - { - if(0 == strcmp(s, PARCEL_OWNERSHIP_STATUS_STRING[i])) - { - return (LLParcel::EOwnershipStatus)i; - } - } - return LLParcel::OS_NONE; + for(S32 i = 0; i < LLParcel::OS_COUNT; ++i) + { + if(0 == strcmp(s, PARCEL_OWNERSHIP_STATUS_STRING[i])) + { + return (LLParcel::EOwnershipStatus)i; + } + } + return LLParcel::OS_NONE; } //const char* revert_action_to_string(LLParcel::ESaleTimerExpireAction action) //{ -// S32 index = 0; -// if(action >= 0 && action < LLParcel::STEA_COUNT) -// { -// index = action; -// } -// return PARCEL_SALE_TIMER_ACTION[index]; +// S32 index = 0; +// if(action >= 0 && action < LLParcel::STEA_COUNT) +// { +// index = action; +// } +// return PARCEL_SALE_TIMER_ACTION[index]; //} - + //LLParcel::ESaleTimerExpireAction revert_string_to_action(const char* s) //{ -// for(S32 i = 0; i < LLParcel::STEA_COUNT; ++i) -// { -// if(0 == strcmp(s, PARCEL_SALE_TIMER_ACTION[i])) -// { -// return (LLParcel::ESaleTimerExpireAction)i; -// } -// } -// return LLParcel::STEA_REVERT; +// for(S32 i = 0; i < LLParcel::STEA_COUNT; ++i) +// { +// if(0 == strcmp(s, PARCEL_SALE_TIMER_ACTION[i])) +// { +// return (LLParcel::ESaleTimerExpireAction)i; +// } +// } +// return LLParcel::STEA_REVERT; //} - + const char* category_to_string(LLParcel::ECategory category) { - S32 index = 0; - if((category >= 0) && (category < LLParcel::C_COUNT)) - { - index = category; - } - return PARCEL_CATEGORY_STRING[index]; + S32 index = 0; + if((category >= 0) && (category < LLParcel::C_COUNT)) + { + index = category; + } + return PARCEL_CATEGORY_STRING[index]; } const char* category_to_ui_string(LLParcel::ECategory category) { - S32 index = 0; - if((category >= 0) && (category < LLParcel::C_COUNT)) - { - index = category; - } - else - { - // C_ANY = -1 , but the "Any" string is at the end of the list - index = ((S32) LLParcel::C_COUNT); - } - return PARCEL_CATEGORY_UI_STRING[index]; + S32 index = 0; + if((category >= 0) && (category < LLParcel::C_COUNT)) + { + index = category; + } + else + { + // C_ANY = -1 , but the "Any" string is at the end of the list + index = ((S32) LLParcel::C_COUNT); + } + return PARCEL_CATEGORY_UI_STRING[index]; } LLParcel::ECategory category_string_to_category(const char* s) { - for(S32 i = 0; i < LLParcel::C_COUNT; ++i) - { - if(0 == strcmp(s, PARCEL_CATEGORY_STRING[i])) - { - return (LLParcel::ECategory)i; - } - } - llwarns << "Parcel category outside of possibilities " << s << llendl; - return LLParcel::C_NONE; + for(S32 i = 0; i < LLParcel::C_COUNT; ++i) + { + if(0 == strcmp(s, PARCEL_CATEGORY_STRING[i])) + { + return (LLParcel::ECategory)i; + } + } + llwarns << "Parcel category outside of possibilities " << s << llendl; + return LLParcel::C_NONE; } LLParcel::ECategory category_ui_string_to_category(const char* s) { - for(S32 i = 0; i < LLParcel::C_COUNT; ++i) - { - if(0 == strcmp(s, PARCEL_CATEGORY_UI_STRING[i])) - { - return (LLParcel::ECategory)i; - } - } - // "Any" is a valid category for searches, and - // is a distinct option from "None" and "Other" - return LLParcel::C_ANY; + for(S32 i = 0; i < LLParcel::C_COUNT; ++i) + { + if(0 == strcmp(s, PARCEL_CATEGORY_UI_STRING[i])) + { + return (LLParcel::ECategory)i; + } + } + // "Any" is a valid category for searches, and + // is a distinct option from "None" and "Other" + return LLParcel::C_ANY; } + diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 3af1824645..a8143f27dc 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -253,8 +253,7 @@ public: void setForSale(BOOL b) { setParcelFlag(PF_FOR_SALE, b); } void setSoundOnly(BOOL b) { setParcelFlag(PF_SOUND_LOCAL, b); } void setDenyAnonymous(BOOL b) { setParcelFlag(PF_DENY_ANONYMOUS, b); } - void setDenyIdentified(BOOL b) { setParcelFlag(PF_DENY_IDENTIFIED, b); } - void setDenyTransacted(BOOL b) { setParcelFlag(PF_DENY_TRANSACTED, b); } + void setDenyAgeUnverified(BOOL b) { setParcelFlag(PF_DENY_AGEUNVERIFIED, b); } void setRestrictPushObject(BOOL b) { setParcelFlag(PF_RESTRICT_PUSHOBJECT, b); } void setDrawDistance(F32 dist) { mDrawDistance = dist; } @@ -444,10 +443,8 @@ public: { return mRegionPushOverride; } BOOL getRegionDenyAnonymousOverride() const { return mRegionDenyAnonymousOverride; } - BOOL getRegionDenyIdentifiedOverride() const - { return mRegionDenyIdentifiedOverride; } - BOOL getRegionDenyTransactedOverride() const - { return mRegionDenyTransactedOverride; } + BOOL getRegionDenyAgeUnverifiedOverride() const + { return mRegionDenyAgeUnverifiedOverride; } F32 getDrawDistance() const { return mDrawDistance; } S32 getSalePrice() const { return mSalePrice; } @@ -471,7 +468,11 @@ public: BOOL allowTerraformBy(const LLUUID &agent_id) const; // Returns 0 if access is OK, otherwise a BA_ return code above. - S32 blockAccess(const LLUUID& agent_id, const LLUUID& group_id, const BOOL is_agent_identified, const BOOL is_agent_transacted) const; + S32 blockAccess(const LLUUID& agent_id, + const LLUUID& group_id, + const BOOL is_agent_identified, + const BOOL is_agent_transacted, + const BOOL is_agent_ageverified) const; // Only checks if the agent is explicitly banned from this parcel BOOL isAgentBanned(const LLUUID& agent_id) const; @@ -480,7 +481,8 @@ public: const LLUUID& agent_id, const std::vector<LLUUID>& group_ids, const BOOL is_agent_identified, - const BOOL is_agent_transacted); + const BOOL is_agent_transacted, + const BOOL is_agent_ageverified); bool operator==(const LLParcel &rhs) const; @@ -524,8 +526,7 @@ public: void setCleanOtherTime(S32 time) { mCleanOtherTime = time; } void setRegionPushOverride(BOOL override) {mRegionPushOverride = override; } void setRegionDenyAnonymousOverride(BOOL override) { mRegionDenyAnonymousOverride = override; } - void setRegionDenyIdentifiedOverride(BOOL override) { mRegionDenyIdentifiedOverride = override; } - void setRegionDenyTransactedOverride(BOOL override) { mRegionDenyTransactedOverride = override; } + void setRegionDenyAgeUnverifiedOverride(BOOL override) { mRegionDenyAgeUnverifiedOverride = override; } // Accessors for parcel sellWithObjects void setPreviousOwnerID(LLUUID prev_owner) { mPreviousOwnerID = prev_owner; } @@ -594,8 +595,7 @@ protected: S32 mCleanOtherTime; BOOL mRegionPushOverride; BOOL mRegionDenyAnonymousOverride; - BOOL mRegionDenyIdentifiedOverride; - BOOL mRegionDenyTransactedOverride; + BOOL mRegionDenyAgeUnverifiedOverride; public: diff --git a/indra/llinventory/llparcelflags.h b/indra/llinventory/llparcelflags.h index d691d4d6f2..1806142c17 100644 --- a/indra/llinventory/llparcelflags.h +++ b/indra/llinventory/llparcelflags.h @@ -58,16 +58,20 @@ const U32 PF_URL_WEB_PAGE = 1 << 19; // The "media URL" is an HTML page const U32 PF_URL_RAW_HTML = 1 << 20; // The "media URL" is a raw HTML string like <H1>Foo</H1> const U32 PF_RESTRICT_PUSHOBJECT = 1 << 21; // Restrict push object to either on agent or on scripts owned by parcel owner const U32 PF_DENY_ANONYMOUS = 1 << 22; // Deny all non identified/transacted accounts -const U32 PF_DENY_IDENTIFIED = 1 << 23; // Deny identified accounts -const U32 PF_DENY_TRANSACTED = 1 << 24; // Deny identified accounts +// const U32 PF_DENY_IDENTIFIED = 1 << 23; // Deny identified accounts +// const U32 PF_DENY_TRANSACTED = 1 << 24; // Deny identified accounts const U32 PF_ALLOW_GROUP_SCRIPTS = 1 << 25; // Allow scripts owned by group const U32 PF_CREATE_GROUP_OBJECTS = 1 << 26; // Allow object creation by group members or objects const U32 PF_ALLOW_ALL_OBJECT_ENTRY = 1 << 27; // Allow all objects to enter a parcel const U32 PF_ALLOW_GROUP_OBJECT_ENTRY = 1 << 28; // Only allow group (and owner) objects to enter the parcel const U32 PF_ALLOW_VOICE_CHAT = 1 << 29; // Allow residents to use voice chat on this parcel const U32 PF_USE_ESTATE_VOICE_CHAN = 1 << 30; +const U32 PF_DENY_AGEUNVERIFIED = 1 << 31; // Prevent residents who aren't age-verified +// NOTE: At one point we have used all of the bits. +// We have deprecated two of them in 1.19.0 which *could* be reused, +// but only after we are certain there are no simstates using those bits. -const U32 PF_RESERVED = 1U << 31; +//const U32 PF_RESERVED = 1U << 31; // If any of these are true the parcel is restricting access in some maner. const U32 PF_USE_RESTRICTED_ACCESS = PF_USE_ACCESS_GROUP @@ -75,8 +79,7 @@ const U32 PF_USE_RESTRICTED_ACCESS = PF_USE_ACCESS_GROUP | PF_USE_BAN_LIST | PF_USE_PASS_LIST | PF_DENY_ANONYMOUS - | PF_DENY_IDENTIFIED - | PF_DENY_TRANSACTED; + | PF_DENY_AGEUNVERIFIED; const U32 PF_NONE = 0x00000000; const U32 PF_ALL = 0x7FFFFFFF; const U32 PF_DEFAULT = PF_ALLOW_FLY @@ -104,6 +107,7 @@ const S32 BA_NOT_IN_GROUP = 1; const S32 BA_NOT_ON_LIST = 2; const S32 BA_BANNED = 3; const S32 BA_NO_ACCESS_LEVEL = 4; +const S32 BA_NOT_AGE_VERIFIED = 5; // ParcelRelease flags const U32 PR_NONE = 0x0; diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 72272c0df6..5f3fad8b8c 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -84,8 +84,8 @@ const U32 REGION_FLAGS_ESTATE_SKIP_SCRIPTS = (1 << 21); const U32 REGION_FLAGS_RESTRICT_PUSHOBJECT = (1 << 22); const U32 REGION_FLAGS_DENY_ANONYMOUS = (1 << 23); -const U32 REGION_FLAGS_DENY_IDENTIFIED = (1 << 24); -const U32 REGION_FLAGS_DENY_TRANSACTED = (1 << 25); +// const U32 REGION_FLAGS_DENY_IDENTIFIED = (1 << 24); +// const U32 REGION_FLAGS_DENY_TRANSACTED = (1 << 25); const U32 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26); @@ -94,6 +94,7 @@ const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27); const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28); const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); +const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30); const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | @@ -110,8 +111,7 @@ const U32 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE | REGION_FLAGS_PUBLIC_ALLOWED | REGION_FLAGS_SUN_FIXED | REGION_FLAGS_DENY_ANONYMOUS - | REGION_FLAGS_DENY_IDENTIFIED - | REGION_FLAGS_DENY_TRANSACTED; + | REGION_FLAGS_DENY_AGEUNVERIFIED; inline BOOL is_prelude( U32 flags ) { diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 0185c0fea9..0b614d8d90 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -1369,6 +1369,9 @@ char * _PREHASH_AvatarNotesReply; char * _PREHASH_CacheID; char * _PREHASH_OwnerMask; char * _PREHASH_TransferInventoryAck; +char * _PREHASH_RegionDenyAgeUnverified; +char * _PREHASH_AgeVerificationBlock; + void init_prehash_data() { @@ -2702,4 +2705,6 @@ void init_prehash_data() _PREHASH_CacheID = gMessageStringTable.getString("CacheID"); _PREHASH_OwnerMask = gMessageStringTable.getString("OwnerMask"); _PREHASH_TransferInventoryAck = gMessageStringTable.getString("TransferInventoryAck"); + _PREHASH_RegionDenyAgeUnverified = gMessageStringTable.getString("RegionDenyAgeUnverified"); + _PREHASH_AgeVerificationBlock = gMessageStringTable.getString("AgeVerificationBlock"); } diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 2cea924ff2..4210665a84 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -1369,6 +1369,8 @@ extern char * _PREHASH_AvatarNotesReply; extern char * _PREHASH_CacheID; extern char * _PREHASH_OwnerMask; extern char * _PREHASH_TransferInventoryAck; +extern char * _PREHASH_RegionDenyAgeUnverified; +extern char * _PREHASH_AgeVerificationBlock; void init_prehash_data(); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 3a0ee9b013..ca1bc9c525 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -982,6 +982,16 @@ BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LL return FALSE; } +BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text) +{ + LLView* child = getChildByName(id, true); + if (child) + { + return child->setToolTipArg(key, text); + } + return FALSE; +} + void LLPanel::childSetMinValue(const LLString& id, LLSD min_value) { LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index dfd7a51529..78aa7cfc21 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -194,6 +194,7 @@ public: // Not implemented for all types, defaults to noop, returns FALSE if not applicaple BOOL childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text); BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text); + BOOL childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text); // LLSlider / LLSpinCtrl void childSetMinValue(const LLString& id, LLSD min_value); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index ef91d9c85e..4d3bdaed98 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -224,11 +224,17 @@ void LLView::setMouseOpaque(BOOL b) mMouseOpaque = b; } -void LLView::setToolTip(const LLString& msg) +void LLView::setToolTip(const LLStringExplicit& msg) { mToolTipMsg = msg; } +BOOL LLView::setToolTipArg(const LLStringExplicit& key, const LLStringExplicit& text) +{ + mToolTipMsg.setArg(key, text); + return TRUE; +} + // virtual void LLView::setRect(const LLRect& rect) { @@ -288,7 +294,7 @@ void LLView::setSpanChildren( BOOL span_children ) const LLString& LLView::getToolTip() { - return mToolTipMsg; + return mToolTipMsg.getString(); } // virtual @@ -883,18 +889,14 @@ BOOL LLView::handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_scre } } - if (LLUI::sShowXUINames && (mToolTipMsg.find(".xml", 0) == LLString::npos) && + tool_tip = mToolTipMsg.getString(); + if (LLUI::sShowXUINames && (tool_tip.find(".xml", 0) == LLString::npos) && (mName.find("Drag", 0) == LLString::npos)) { tool_tip = getShowNamesToolTip(); } - else - { - tool_tip = mToolTipMsg; - } - BOOL showNamesTextBox = LLUI::sShowXUINames && (getWidgetType() == WIDGET_TYPE_TEXT_BOX); if( !handled && (mMouseOpaque || showNamesTextBox) && pointInView( x, y ) && !tool_tip.empty()) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 63c1efc296..8248d50d9d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -45,6 +45,7 @@ #include "llstring.h" #include "llrect.h" #include "llui.h" +#include "lluistring.h" #include "lluixmltags.h" #include "llviewquery.h" #include "llxmlnode.h" @@ -154,7 +155,7 @@ protected: BOOL mEnabled; // Enabled means "accepts input that has an effect on the state of the application." // A disabled view, for example, may still have a scrollbar that responds to mouse events. BOOL mMouseOpaque; // Opaque views handle all mouse events that are over their rect. - LLString mToolTipMsg; // isNull() is true if none. + LLUIString mToolTipMsg; // isNull() is true if none. U8 mSoundFlags; BOOL mSaveToXML; @@ -214,7 +215,8 @@ public: // MANIPULATORS // void setMouseOpaque( BOOL b ); - void setToolTip( const LLString& msg ); + void setToolTip( const LLStringExplicit& msg ); + BOOL setToolTipArg( const LLStringExplicit& key, const LLStringExplicit& text ); virtual void setRect(const LLRect &rect); void setFollows(U32 flags); diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 57aef07e18..715ce600a1 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -19,7 +19,7 @@ FS (f|F) #include "lscript_typecheck.h" #include "lscript_resource.h" #if LL_WINDOWS -#include "ytab.h" +#include "ytab.hpp" #else #include "indra.y.h" #endif diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index c763ff928c..fc8d44e990 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1137,6 +1137,7 @@ bool LLAppViewer::init() ui_audio_callback, &LLUI::sGLScaleFactor); + LLWeb::initClass(); // do this after LLUI gUICtrlFactory->setupPaths(); // update paths with correct language set ///////////////////////////////////////////////// diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 904f47de3c..64dc96807c 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -110,7 +110,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp, if (id == IMG_DEFAULT_AVATAR) { ctrl->setImageAssetID(LLUUID::null); - ctrl->setToolTip("IMG_DEFAULT_AVATAR"); + ctrl->setToolTip(LLString("IMG_DEFAULT_AVATAR")); } else { diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 283b3f45fa..543dd94f3b 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -239,7 +239,6 @@ LLFloaterLand::LLFloaterLand() factory_map["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); factory_map["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); factory_map["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); - factory_map["land_ban_panel"] = LLCallbackMap(createPanelLandBan, this); gUICtrlFactory->buildFloater(this, "floater_about_land.xml", &factory_map); @@ -271,7 +270,6 @@ void LLFloaterLand::refresh() mPanelOptions->refresh(); mPanelMedia->refresh(); mPanelAccess->refresh(); - mPanelBan->refresh(); } @@ -326,15 +324,6 @@ void* LLFloaterLand::createPanelLandAccess(void* data) return self->mPanelAccess; } -// static -void* LLFloaterLand::createPanelLandBan(void* data) -{ - LLFloaterLand* self = (LLFloaterLand*)data; - self->mPanelBan = new LLPanelLandBan(self->mParcel); - return self->mPanelBan; -} - - //--------------------------------------------------------------------------- // LLPanelLandGeneral //--------------------------------------------------------------------------- @@ -2558,35 +2547,27 @@ LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) BOOL LLPanelLandAccess::postBuild() { - - - mCheckGroup = LLUICtrlFactory::getCheckBoxByName(this, "GroupCheck"); + childSetCommitCallback("public_access", onCommitAny, this); + childSetCommitCallback("limit_payment", onCommitAny, this); + childSetCommitCallback("limit_age_verified", onCommitAny, this); childSetCommitCallback("GroupCheck", onCommitAny, this); - - mCheckAccess = LLUICtrlFactory::getCheckBoxByName(this, "AccessCheck"); - childSetCommitCallback("AccessCheck", onCommitAny, this); - - mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList"); - mListAccess->sortByColumn(0, TRUE); // ascending - - mBtnAddAccess = LLUICtrlFactory::getButtonByName(this, "Add..."); - - mBtnAddAccess->setClickedCallback(onClickAdd, this); - - mBtnRemoveAccess = LLUICtrlFactory::getButtonByName(this, "Remove"); - - mBtnRemoveAccess->setClickedCallback(onClickRemove, this); - - mCheckPass = LLUICtrlFactory::getCheckBoxByName(this, "PassCheck"); childSetCommitCallback("PassCheck", onCommitAny, this); - - - mSpinPrice = LLUICtrlFactory::getSpinnerByName(this, "PriceSpin"); + childSetCommitCallback("pass_combo", onCommitAny, this); childSetCommitCallback("PriceSpin", onCommitAny, this); - - mSpinHours = LLUICtrlFactory::getSpinnerByName(this, "HoursSpin"); childSetCommitCallback("HoursSpin", onCommitAny, this); + childSetAction("add_allowed", onClickAddAccess, this); + childSetAction("remove_allowed", onClickRemoveAccess, this); + childSetAction("add_banned", onClickAddBanned, this); + childSetAction("remove_banned", onClickRemoveBanned, this); + + mListAccess = LLUICtrlFactory::getNameListByName(this, "AccessList"); + if (mListAccess) + mListAccess->sortByColumn(0, TRUE); // ascending + + mListBanned = LLUICtrlFactory::getNameListByName(this, "BannedList"); + if (mListBanned) + mListBanned->sortByColumn(0, TRUE); // ascending return TRUE; } @@ -2598,106 +2579,241 @@ LLPanelLandAccess::~LLPanelLandAccess() void LLPanelLandAccess::refresh() { - mListAccess->deleteAllItems(); - + if (mListAccess) + mListAccess->deleteAllItems(); + if (mListBanned) + mListBanned->deleteAllItems(); + LLParcel *parcel = mParcel->getParcel(); - + + // Display options if (parcel) { - // Display options + BOOL use_access_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST); BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP); - mCheckGroup->set( use_group ); + BOOL public_access = !use_access_list && !use_group; + + childSetValue("public_access", public_access ); + childSetValue("GroupCheck", use_group ); char group_name[MAX_STRING]; /*Flawfinder: ignore*/ gCacheName->getGroupName(parcel->getGroupID(), group_name); - mCheckGroup->setLabelArg( "[GROUP]", LLString(group_name) ); - - S32 count = parcel->mAccessList.size(); - - BOOL use_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST); - mCheckAccess->set( use_list ); - mCheckAccess->setLabelArg( "[LISTED]", llformat("%d",count)); - mCheckAccess->setLabelArg( "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - - access_map_const_iterator cit = parcel->mAccessList.begin(); - access_map_const_iterator end = parcel->mAccessList.end(); - - for (; cit != end; ++cit) + childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name) ); + + // Allow list { - const LLAccessEntry& entry = (*cit).second; - LLString suffix; - if (entry.mTime != 0) + S32 count = parcel->mAccessList.size(); + childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",count)); + childSetToolTipArg("AccessList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); + + // *TODO: Translate + for (access_map_const_iterator cit = parcel->mAccessList.begin(); + cit != parcel->mAccessList.end(); ++cit) { - S32 now = time(NULL); - S32 seconds = entry.mTime - now; - if (seconds < 0) seconds = 0; - suffix.assign(" ("); - if (seconds >= 120) + const LLAccessEntry& entry = (*cit).second; + LLString suffix; + if (entry.mTime != 0) { - char buf[30]; /*Flawfinder: ignore*/ - snprintf(buf, sizeof(buf), "%d minutes", (seconds/60)); /* Flawfinder: ignore */ - suffix.append(buf); + S32 now = time(NULL); + S32 seconds = entry.mTime - now; + if (seconds < 0) seconds = 0; + suffix.assign(" ("); + if (seconds >= 120) + { + std::string buf = llformat("%d minutes", (seconds/60)); + suffix.append(buf); + } + else if (seconds >= 60) + { + suffix.append("1 minute"); + } + else + { + std::string buf = llformat("%d seconds", seconds); + suffix.append(buf); + } + suffix.append(" remaining)"); } - else if (seconds >= 60) - { - suffix.append("1 minute"); - } - else - { - char buf[30]; /*Flawfinder: ignore*/ - snprintf(buf, sizeof(buf), "%d seconds", seconds); /* Flawfinder: ignore */ - suffix.append(buf); - } - suffix.append(" remaining)"); + if (mListAccess) + mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); } - mListAccess->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); } - BOOL can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); - - BOOL enable_add = can_manage_allowed && (count < PARCEL_MAX_ACCESS_LIST); - mBtnAddAccess->setEnabled(enable_add); + // Ban List + { + S32 count = parcel->mBanList.size(); - BOOL enable_remove = can_manage_allowed && (count > 0); - mBtnRemoveAccess->setEnabled(enable_remove); + childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",count)); + childSetToolTipArg("BannedList", "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - // Can only sell passes when limiting the access. - BOOL can_manage_passes = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_PASSES); - mCheckPass->setEnabled( (use_group || use_list) && can_manage_passes ); + for (access_map_const_iterator cit = parcel->mBanList.begin(); + cit != parcel->mBanList.end(); ++cit) + { + const LLAccessEntry& entry = (*cit).second; + LLString suffix; + if (entry.mTime != 0) + { + S32 now = time(NULL); + S32 seconds = entry.mTime - now; + if (seconds < 0) seconds = 0; + suffix.assign(" ("); + if (seconds >= 120) + { + std::string buf = llformat("%d minutes", (seconds/60)); + suffix.append(buf); + } + else if (seconds >= 60) + { + suffix.append("1 minute"); + } + else + { + std::string buf = llformat("%d seconds", seconds); + suffix.append(buf); + } + suffix.append(" remaining)"); + } + mListBanned->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); + } + } + if(parcel->getRegionDenyAnonymousOverride()) + { + childSetValue("limit_payment", TRUE); + } + else + { + childSetValue("limit_payment", (parcel->getParcelFlag(PF_DENY_ANONYMOUS))); + } + if(parcel->getRegionDenyAgeUnverifiedOverride()) + { + childSetValue("limit_age_verified", TRUE); + } + else + { + childSetValue("limit_age_verified", (parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); + } + BOOL use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); - mCheckPass->set( use_pass ); - - BOOL enable_pass = can_manage_passes && use_pass; - mSpinPrice->setEnabled( enable_pass ); - mSpinHours->setEnabled( enable_pass ); - + childSetValue("PassCheck", use_pass ); + LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo"); + if (passcombo) + { + if (public_access || !use_pass || !use_group) + { + passcombo->selectByValue("anyone"); + } + } + S32 pass_price = parcel->getPassPrice(); - mSpinPrice->set( F32(pass_price) ); + childSetValue( "PriceSpin", (F32)pass_price ); F32 pass_hours = parcel->getPassHours(); - mSpinHours->set( pass_hours ); - - mCheckGroup->setEnabled( can_manage_allowed ); - mCheckAccess->setEnabled( can_manage_allowed ); - + childSetValue( "HoursSpin", pass_hours ); } else { - mCheckGroup->set(FALSE); - mCheckGroup->setLabelArg( "[GROUP]", LLString::null ); - mCheckAccess->set(FALSE); - mCheckAccess->setLabelArg( "[LISTED]", llformat("%d",0)); - mBtnAddAccess->setEnabled(FALSE); - mBtnRemoveAccess->setEnabled(FALSE); - mSpinPrice->set((F32)PARCEL_PASS_PRICE_DEFAULT); - mSpinPrice->setEnabled(FALSE); - mSpinHours->set( PARCEL_PASS_HOURS_DEFAULT ); - mSpinHours->setEnabled(FALSE); - mCheckGroup->setEnabled(FALSE); - mCheckAccess->setEnabled(FALSE); + childSetValue("public_access", FALSE); + childSetValue("limit_payment", FALSE); + childSetValue("limit_age_verified", FALSE); + childSetValue("GroupCheck", FALSE); + childSetLabelArg("GroupCheck", "[GROUP]", LLString::null ); + childSetValue("PassCheck", FALSE); + childSetValue("PriceSpin", (F32)PARCEL_PASS_PRICE_DEFAULT); + childSetValue( "HoursSpin", PARCEL_PASS_HOURS_DEFAULT ); + childSetToolTipArg("AccessList", "[LISTED]", llformat("%d",0)); + childSetToolTipArg("AccessList", "[MAX]", llformat("%d",0)); + childSetToolTipArg("BannedList", "[LISTED]", llformat("%d",0)); + childSetToolTipArg("BannedList", "[MAX]", llformat("%d",0)); + } +} + +void LLPanelLandAccess::refresh_ui() +{ + childSetEnabled("public_access", FALSE); + childSetEnabled("limit_payment", FALSE); + childSetEnabled("limit_age_verified", FALSE); + childSetEnabled("GroupCheck", FALSE); + childSetEnabled("PassCheck", FALSE); + childSetEnabled("pass_combo", FALSE); + childSetEnabled("PriceSpin", FALSE); + childSetEnabled("HoursSpin", FALSE); + childSetEnabled("AccessList", FALSE); + childSetEnabled("BannedList", FALSE); + + LLParcel *parcel = mParcel->getParcel(); + if (parcel) + { + BOOL can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); + BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED); + + childSetEnabled("public_access", can_manage_allowed); + BOOL public_access = childGetValue("public_access").asBoolean(); + if (public_access) + { + bool override = false; + if(parcel->getRegionDenyAnonymousOverride()) + { + override = true; + childSetEnabled("limit_payment", FALSE); + } + else + { + childSetEnabled("limit_payment", can_manage_allowed); + } + if(parcel->getRegionDenyAgeUnverifiedOverride()) + { + override = true; + childSetEnabled("limit_age_verified", FALSE); + } + else + { + childSetEnabled("limit_age_verified", can_manage_allowed); + } + if (override) + { + childSetToolTip("Only Allow", getUIString("estate_override")); + } + else + { + childSetToolTip("Only Allow", LLString()); + } + childSetEnabled("GroupCheck", FALSE); + childSetEnabled("PassCheck", FALSE); + childSetEnabled("pass_combo", FALSE); + childSetEnabled("AccessList", FALSE); + } + else + { + childSetEnabled("limit_payment", FALSE); + childSetEnabled("limit_age_verified", FALSE); + char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + if (gCacheName->getGroupName(parcel->getGroupID(), group_name)) + { + childSetEnabled("GroupCheck", can_manage_allowed); + } + BOOL group_access = childGetValue("GroupCheck").asBoolean(); + BOOL sell_passes = childGetValue("PassCheck").asBoolean(); + childSetEnabled("PassCheck", can_manage_allowed); + if (sell_passes) + { + childSetEnabled("pass_combo", group_access && can_manage_allowed); + childSetEnabled("PriceSpin", can_manage_allowed); + childSetEnabled("HoursSpin", can_manage_allowed); + } + } + childSetEnabled("AccessList", can_manage_allowed); + S32 allowed_list_count = parcel->mAccessList.size(); + childSetEnabled("add_allowed", can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); + childSetEnabled("remove_allowed", can_manage_allowed && allowed_list_count > 0); + + childSetEnabled("BannedList", can_manage_banned); + S32 banned_list_count = parcel->mBanList.size(); + childSetEnabled("add_banned", can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); + childSetEnabled("remove_banned", can_manage_banned && banned_list_count > 0); } } + // public void LLPanelLandAccess::refreshNames() @@ -2709,23 +2825,19 @@ void LLPanelLandAccess::refreshNames() { gCacheName->getGroupName(parcel->getGroupID(), group_name); } - mCheckGroup->setLabelArg("[GROUP]", LLString(group_name)); + childSetLabelArg("GroupCheck", "[GROUP]", LLString(group_name)); } // virtual void LLPanelLandAccess::draw() { + refresh_ui(); refreshNames(); LLPanel::draw(); } -void LLPanelLandAccess::onAccessLevelChange(LLUICtrl*, void *userdata) -{ - LLPanelLandAccess::onCommitAny(NULL, userdata); -} - // static void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) { @@ -2738,27 +2850,53 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } // Extract data from UI - BOOL use_access_group = self->mCheckGroup->get(); - BOOL use_access_list = self->mCheckAccess->get(); - BOOL use_pass_list = self->mCheckPass->get(); - - - - // Must be limiting access to sell passes - if (!use_access_group && !use_access_list) + BOOL public_access = self->childGetValue("public_access").asBoolean(); + BOOL limit_payment = FALSE, limit_age_verified = FALSE; + BOOL use_access_group = FALSE; + BOOL use_access_list = FALSE; + BOOL use_pass_list = FALSE; + if (public_access) { - use_pass_list = FALSE; + use_access_list = FALSE; + limit_payment = self->childGetValue("limit_payment").asBoolean(); + limit_age_verified = self->childGetValue("limit_age_verified").asBoolean(); + } + else + { + use_access_list = TRUE; + use_access_group = self->childGetValue("GroupCheck").asBoolean(); + use_pass_list = self->childGetValue("PassCheck").asBoolean(); + if (use_access_group) + { + char group_name[MAX_STRING]; /*Flawfinder: ignore*/ + if (!gCacheName->getGroupName(parcel->getGroupID(), group_name)) + { + use_access_group = FALSE; + } + if (use_pass_list) + { + LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); + if (passcombo) + { + if (passcombo->getSimpleSelectedValue().asString() == "group") + { + use_access_list = FALSE; + } + } + } + } } - S32 pass_price = llfloor(self->mSpinPrice->get()); - F32 pass_hours = self->mSpinHours->get(); - - // Validate extracted data + S32 pass_price = llfloor((F32)self->childGetValue("PriceSpin").asReal()); + F32 pass_hours = (F32)self->childGetValue("HoursSpin").asReal(); // Push data into current parcel parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); parcel->setParcelFlag(PF_USE_ACCESS_LIST, use_access_list); parcel->setParcelFlag(PF_USE_PASS_LIST, use_pass_list); + parcel->setParcelFlag(PF_USE_BAN_LIST, TRUE); + parcel->setParcelFlag(PF_DENY_ANONYMOUS, limit_payment); + parcel->setParcelFlag(PF_DENY_AGEUNVERIFIED, limit_age_verified); parcel->setPassPrice( pass_price ); parcel->setPassHours( pass_hours ); @@ -2771,287 +2909,100 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } // static -void LLPanelLandAccess::onClickAdd(void* data) +void LLPanelLandAccess::onClickAddAccess(void* data) { LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, data) ); -} - -// static -void LLPanelLandAccess::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) -{ - LLPanelLandAccess* self = (LLPanelLandAccess*)userdata; - if (names.empty() || ids.empty()) return; - self->addAvatar(ids[0]); -} - - -void LLPanelLandAccess::addAvatar(LLUUID id) -{ - LLParcel* parcel = mParcel->getParcel(); - if (!parcel) return; - - parcel->addToAccessList(id, 0); - - gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); - - refresh(); + if (panelp) + { + gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBAccess, data) ); + } } - // static -void LLPanelLandAccess::onClickRemove(void* data) +void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) { - LLPanelLandAccess* self = (LLPanelLandAccess*)data; - if (!self) return; - - LLScrollListItem* item = self->mListAccess->getFirstSelected(); - if (!item) return; - - LLParcel* parcel = self->mParcel->getParcel(); - if (!parcel) return; - - const LLUUID& agent_id = item->getUUID(); - - parcel->removeFromAccessList(agent_id); - - gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); - - self->refresh(); -} - - - -//--------------------------------------------------------------------------- -// LLPanelLandBan -//--------------------------------------------------------------------------- -LLPanelLandBan::LLPanelLandBan(LLParcelSelectionHandle& parcel) -: LLPanel("land_ban_panel"), mParcel(parcel) -{ - -} - - - -BOOL LLPanelLandBan::postBuild() -{ - - mCheck = LLUICtrlFactory::getCheckBoxByName(this, "LandBanCheck"); - childSetCommitCallback("LandBanCheck", onCommitAny, this); - - mList = LLUICtrlFactory::getNameListByName(this, "LandBanList"); - mList->sortByColumn(0, TRUE); // ascending - - mBtnAdd = LLUICtrlFactory::getButtonByName(this, "Add..."); - - mBtnAdd->setClickedCallback(onClickAdd, this); - - mBtnRemove = LLUICtrlFactory::getButtonByName(this, "Remove"); - - mBtnRemove->setClickedCallback(onClickRemove, this); - - mCheckDenyAnonymous = LLUICtrlFactory::getCheckBoxByName(this, "DenyAnonymousCheck"); - childSetCommitCallback("DenyAnonymousCheck", onCommitAny, this); - - mCheckDenyIdentified = LLUICtrlFactory::getCheckBoxByName(this, "DenyIdentifiedCheck"); - childSetCommitCallback("DenyIdentifiedCheck", onCommitAny, this); - - mCheckDenyTransacted = LLUICtrlFactory::getCheckBoxByName(this, "DenyTransactedCheck"); - childSetCommitCallback("DenyTransactedCheck", onCommitAny, this); - - return TRUE; - -} - - -LLPanelLandBan::~LLPanelLandBan() -{ } - -void LLPanelLandBan::refresh() -{ - mList->deleteAllItems(); - - LLParcel *parcel = mParcel->getParcel(); - - if (parcel) + LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata; + if (!names.empty() && !ids.empty()) { - // Display options - - S32 count = parcel->mBanList.size(); - - BOOL use_ban = parcel->getParcelFlag(PF_USE_BAN_LIST); - mCheck->set( use_ban ); - mCheck->setLabelArg( "[LISTED]", llformat("%d",count)); - mCheck->setLabelArg( "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - - access_map_const_iterator cit = parcel->mBanList.begin(); - access_map_const_iterator end = parcel->mBanList.end(); - for ( ; cit != end; ++cit) - { - const LLAccessEntry& entry = (*cit).second; - LLString suffix; - if (entry.mTime != 0) - { - S32 now = time(NULL); - S32 seconds = entry.mTime - now; - if (seconds < 0) seconds = 0; - suffix.assign(" ("); - if (seconds >= 120) - { - char buf[30]; /*Flawfinder: ignore*/ - snprintf(buf, sizeof(buf), "%d minutes", (seconds/60)); /* Flawfinder: ignore */ - suffix.append(buf); - } - else if (seconds >= 60) - { - suffix.append("1 minute"); - } - else - { - char buf[30]; /*Flawfinder: ignore*/ - snprintf(buf, sizeof(buf), "%d seconds", seconds); /* Flawfinder: ignore */ - suffix.append(buf); - } - suffix.append(" remaining)"); - } - mList->addNameItem(entry.mID, ADD_SORTED, TRUE, suffix); - } - - BOOL can_manage_banned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_BANNED); - mCheck->setEnabled( can_manage_banned ); - mCheckDenyAnonymous->setEnabled( FALSE ); - mCheckDenyIdentified->setEnabled( FALSE ); - mCheckDenyTransacted->setEnabled( FALSE ); - - if(parcel->getRegionDenyAnonymousOverride()) - { - mCheckDenyAnonymous->set(TRUE); - } - else if(can_manage_banned) - { - mCheckDenyAnonymous->setEnabled(TRUE); - mCheckDenyAnonymous->set(parcel->getParcelFlag(PF_DENY_ANONYMOUS)); - } - if(parcel->getRegionDenyIdentifiedOverride()) - { - mCheckDenyIdentified->set(TRUE); - } - else if(can_manage_banned) - { - mCheckDenyIdentified->setEnabled(TRUE); - mCheckDenyIdentified->set(parcel->getParcelFlag(PF_DENY_IDENTIFIED)); - } - if(parcel->getRegionDenyTransactedOverride()) - { - mCheckDenyTransacted->set(TRUE); - } - else if(can_manage_banned) + LLUUID id = ids[0]; + LLParcel* parcel = panelp->mParcel->getParcel(); + if (parcel) { - mCheckDenyTransacted->setEnabled(TRUE); - mCheckDenyTransacted->set(parcel->getParcelFlag(PF_DENY_TRANSACTED)); + parcel->addToAccessList(id, 0); + gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); + panelp->refresh(); } - - - BOOL enable_add = can_manage_banned && (count < PARCEL_MAX_ACCESS_LIST); - mBtnAdd->setEnabled(enable_add); - - BOOL enable_remove = can_manage_banned && (count > 0); - mBtnRemove->setEnabled(enable_remove); - } - else - { - mCheck->set(FALSE); - mCheck->setLabelArg( "[LISTED]", llformat("%d",0)); - mCheck->setEnabled(FALSE); - mBtnAdd->setEnabled(FALSE); - mBtnRemove->setEnabled(FALSE); - mCheckDenyAnonymous->set(FALSE); - mCheckDenyAnonymous->setEnabled(FALSE); - mCheckDenyIdentified->set(FALSE); - mCheckDenyIdentified->setEnabled(FALSE); - mCheckDenyTransacted->set(FALSE); - mCheckDenyTransacted->setEnabled(FALSE); } } // static -void LLPanelLandBan::onCommitAny(LLUICtrl *ctrl, void *userdata) +void LLPanelLandAccess::onClickRemoveAccess(void* data) { - LLPanelLandBan *self = (LLPanelLandBan*)userdata; - - LLParcel* parcel = self->mParcel->getParcel(); - if (!parcel) + LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; + if (panelp && panelp->mListAccess) { - return; + LLParcel* parcel = panelp->mParcel->getParcel(); + if (parcel) + { + std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected(); + for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); + iter != names.end(); ) + { + LLScrollListItem* item = *iter++; + const LLUUID& agent_id = item->getUUID(); + parcel->removeFromAccessList(agent_id); + } + gParcelMgr->sendParcelAccessListUpdate(AL_ACCESS); + panelp->refresh(); + } } - - // Extract data from UI - BOOL use_ban_list = self->mCheck->get(); - BOOL deny_access_anonymous = self->mCheckDenyAnonymous->get(); - BOOL deny_access_identified = self->mCheckDenyIdentified->get(); - BOOL deny_access_transacted = self->mCheckDenyTransacted->get(); - - // Push data into current parcel - parcel->setParcelFlag(PF_USE_BAN_LIST, use_ban_list); - parcel->setParcelFlag(PF_DENY_ANONYMOUS, deny_access_anonymous); - parcel->setParcelFlag(PF_DENY_IDENTIFIED, deny_access_identified); - parcel->setParcelFlag(PF_DENY_TRANSACTED, deny_access_transacted); - - // Send current parcel data upstream to server - gParcelMgr->sendParcelPropertiesUpdate( parcel ); - - // Might have changed properties, so let's redraw! - self->refresh(); } // static -void LLPanelLandBan::onClickAdd(void* data) +void LLPanelLandAccess::onClickAddBanned(void* data) { - LLPanelLandBan* panelp = (LLPanelLandBan*)data; - gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, data) ); + LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; + gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBBanned, data) ); } // static -void LLPanelLandBan::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) +void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) { - LLPanelLandBan* self = (LLPanelLandBan*)userdata; - if (names.empty() || ids.empty()) return; - self->addAvatar(ids[0]); -} - - -void LLPanelLandBan::addAvatar(LLUUID id) -{ - LLParcel* parcel = mParcel->getParcel(); - if (!parcel) return; - - parcel->addToBanList(id, 0); - - gParcelMgr->sendParcelAccessListUpdate(AL_BAN); - - refresh(); + LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata; + if (!names.empty() && !ids.empty()) + { + LLUUID id = ids[0]; + LLParcel* parcel = panelp->mParcel->getParcel(); + if (parcel) + { + parcel->addToBanList(id, 0); + gParcelMgr->sendParcelAccessListUpdate(AL_BAN); + panelp->refresh(); + } + } } - // static -void LLPanelLandBan::onClickRemove(void* data) +void LLPanelLandAccess::onClickRemoveBanned(void* data) { - LLPanelLandBan* self = (LLPanelLandBan*)data; - if (!self) return; - - LLScrollListItem* item = self->mList->getFirstSelected(); - if (!item) return; - - LLParcel* parcel = self->mParcel->getParcel(); - if (!parcel) return; - - const LLUUID& agent_id = item->getUUID(); - - parcel->removeFromBanList(agent_id); - - gParcelMgr->sendParcelAccessListUpdate(AL_BAN); - - self->refresh(); + LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; + if (panelp && panelp->mListBanned) + { + LLParcel* parcel = panelp->mParcel->getParcel(); + if (parcel) + { + std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected(); + for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); + iter != names.end(); ) + { + LLScrollListItem* item = *iter++; + const LLUUID& agent_id = item->getUUID(); + parcel->removeFromBanList(agent_id); + } + gParcelMgr->sendParcelAccessListUpdate(AL_BAN); + panelp->refresh(); + } + } } //--------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index d8b7ecfe88..9be813f8fd 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -112,7 +112,6 @@ protected: LLPanelLandOptions* mPanelOptions; LLPanelLandMedia* mPanelMedia; LLPanelLandAccess* mPanelAccess; - LLPanelLandBan* mPanelBan; LLPanelLandCovenant* mPanelCovenant; LLHandle<LLParcelSelection> mParcel; @@ -392,93 +391,28 @@ public: LLPanelLandAccess(LLHandle<LLParcelSelection>& parcelp); virtual ~LLPanelLandAccess(); void refresh(); + void refresh_ui(); void refreshNames(); virtual void draw(); - void addAvatar(LLUUID id); - static void onCommitAny(LLUICtrl* ctrl, void *userdata); - static void onClickAdd(void*); - static void onClickRemove(void*); - static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); - static void onAccessLevelChange(LLUICtrl* ctrl, void* userdata); + static void onClickAddAccess(void*); + static void callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); + static void onClickRemoveAccess(void*); + static void onClickAddBanned(void*); + static void callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); + static void onClickRemoveBanned(void*); virtual BOOL postBuild(); protected: - LLTextBox* mLabelTitle; - - LLCheckBoxCtrl* mCheckGroup; - - LLCheckBoxCtrl* mCheckAccess; LLNameListCtrl* mListAccess; - LLButton* mBtnAddAccess; - LLButton* mBtnRemoveAccess; - - LLCheckBoxCtrl* mCheckPass; - LLSpinCtrl* mSpinPrice; - LLSpinCtrl* mSpinHours; - - LLCheckBoxCtrl* mCheckIdentified; - LLCheckBoxCtrl* mCheckTransacted; - LLRadioGroup* mCheckStatusLevel; + LLNameListCtrl* mListBanned; LLHandle<LLParcelSelection>& mParcel; }; -class LLPanelLandBan -: public LLPanel -{ -public: - LLPanelLandBan(LLHandle<LLParcelSelection>& parcelp); - virtual ~LLPanelLandBan(); - void refresh(); - - void addAvatar(LLUUID id); - - static void onCommitAny(LLUICtrl* ctrl, void *userdata); - static void onClickAdd(void*); - static void onClickRemove(void*); - static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); - - virtual BOOL postBuild(); - -protected: - LLTextBox* mLabelTitle; - - LLCheckBoxCtrl* mCheck; - LLNameListCtrl* mList; - LLButton* mBtnAdd; - LLButton* mBtnRemove; - LLCheckBoxCtrl* mCheckDenyAnonymous; - LLCheckBoxCtrl* mCheckDenyIdentified; - LLCheckBoxCtrl* mCheckDenyTransacted; - - LLHandle<LLParcelSelection>& mParcel; -}; - - -class LLPanelLandRenters -: public LLPanel -{ -public: - LLPanelLandRenters(LLHandle<LLParcelSelection>& parcelp); - virtual ~LLPanelLandRenters(); - void refresh(); - - static void onClickAdd(void*); - static void onClickRemove(void*); - -protected: - LLCheckBoxCtrl* mCheckRenters; - LLNameListCtrl* mListRenters; - LLButton* mBtnAddRenter; - LLButton* mBtnRemoveRenter; - - LLHandle<LLParcelSelection>& mParcel; -}; - class LLPanelLandCovenant : public LLPanel { diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 20f3192939..3306142856 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -408,6 +408,15 @@ void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) region)); } +// public +void LLFloaterRegionInfo::refresh() +{ + for(info_panels_t::iterator iter = mInfoPanels.begin(); + iter != mInfoPanels.end(); ++iter) + { + (*iter)->refresh(); + } +} ///---------------------------------------------------------------------------- @@ -447,6 +456,7 @@ void LLPanelRegionInfo::onChangeAnything(LLUICtrl* ctrl, void* user_data) if(panel) { panel->enableButton("apply_btn"); + panel->refresh(); } } @@ -455,6 +465,7 @@ BOOL LLPanelRegionInfo::postBuild() { childSetAction("apply_btn", onBtnSet, this); childDisable("apply_btn"); + refresh(); return TRUE; } @@ -716,6 +727,8 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() body["allow_land_resell"] = childGetValue("allow_land_resell_check"); body["agent_limit"] = childGetValue("agent_limit_spin"); body["prim_bonus"] = childGetValue("object_bonus_spin"); + // the combo box stores strings "Mature" and "PG", but we have to convert back to a number, + // because the sim doesn't know from strings for this stuff body["sim_access"] = LLViewerRegion::stringToAccess(childGetValue("access_combo").asString().c_str()); body["restrict_pushobject"] = childGetValue("restrict_pushobject"); body["allow_parcel_changes"] = childGetValue("allow_parcel_changes_check"); @@ -1907,6 +1920,7 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) BOOL owner = (region && (region->getOwner() == gAgent.getID())); BOOL manager = (region && region->isEstateManager()); setCtrlsEnabled(god || owner || manager); + childDisable("apply_btn"); childSetEnabled("add_allowed_avatar_btn", god || owner || manager); childSetEnabled("remove_allowed_avatar_btn", god || owner || manager); @@ -1942,8 +1956,7 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings); - - + refresh(); return rv; } @@ -1974,9 +1987,8 @@ BOOL LLPanelEstateInfo::postBuild() initCtrl("use_global_time_check"); initCtrl("fixed_sun_check"); initCtrl("allow_direct_teleport"); - initCtrl("deny_anonymous"); - initCtrl("deny_identified"); - initCtrl("deny_transacted"); + initCtrl("limit_payment"); + initCtrl("limit_age_verified"); initCtrl("voice_chat_check"); initHelpBtn("estate_manager_help", "HelpEstateEstateManager"); @@ -2043,6 +2055,19 @@ BOOL LLPanelEstateInfo::postBuild() return LLPanelRegionInfo::postBuild(); } +void LLPanelEstateInfo::refresh() +{ + bool public_access = childGetValue("externally_visible_check").asBoolean(); + childSetEnabled("Only Allow", public_access); + childSetEnabled("limit_payment", public_access); + childSetEnabled("limit_age_verified", public_access); + // if this is set to false, then the limit fields are meaningless and should be turned off + if (public_access == false) + { + childSetValue("limit_payment", false); + childSetValue("limit_age_verified", false); + } +} BOOL LLPanelEstateInfo::sendUpdate() { @@ -2157,10 +2182,11 @@ void LLPanelEstateInfo::setEstateFlags(U32 flags) "voice_chat_check", LLSD(flags & REGION_FLAGS_ALLOW_VOICE ? TRUE : FALSE)); childSetValue("allow_direct_teleport", LLSD(flags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT ? TRUE : FALSE) ); - childSetValue("deny_anonymous", LLSD(flags & REGION_FLAGS_DENY_ANONYMOUS ? TRUE : FALSE) ); - childSetValue("deny_identified", LLSD(flags & REGION_FLAGS_DENY_IDENTIFIED ? TRUE : FALSE) ); - childSetValue("deny_transacted", LLSD(flags & REGION_FLAGS_DENY_TRANSACTED ? TRUE : FALSE) ); + childSetValue("limit_payment", LLSD(flags & REGION_FLAGS_DENY_ANONYMOUS ? TRUE : FALSE) ); + childSetValue("limit_age_verified", LLSD(flags & REGION_FLAGS_DENY_AGEUNVERIFIED ? TRUE : FALSE) ); childSetVisible("abuse_email_text", flags & REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER); + + refresh(); } U32 LLPanelEstateInfo::computeEstateFlags() @@ -2187,20 +2213,16 @@ U32 LLPanelEstateInfo::computeEstateFlags() flags |= REGION_FLAGS_SUN_FIXED; } - if (childGetValue("deny_anonymous").asBoolean()) + if (childGetValue("limit_payment").asBoolean()) { flags |= REGION_FLAGS_DENY_ANONYMOUS; } - if (childGetValue("deny_identified").asBoolean()) + if (childGetValue("limit_age_verified").asBoolean()) { - flags |= REGION_FLAGS_DENY_IDENTIFIED; + flags |= REGION_FLAGS_DENY_AGEUNVERIFIED; } - if (childGetValue("deny_transacted").asBoolean()) - { - flags |= REGION_FLAGS_DENY_TRANSACTED; - } return flags; } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 656583b276..abf4789b6d 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -79,6 +79,9 @@ public: static LLPanelEstateInfo* getPanelEstate(); static LLPanelEstateCovenant* getPanelCovenant(); + // from LLPanel + virtual void refresh(); + protected: LLFloaterRegionInfo(const LLRect& rect); void refreshFromRegion(LLViewerRegion* region); @@ -294,6 +297,7 @@ public: // LLPanel virtual BOOL postBuild(); virtual void updateChild(LLUICtrl* child_ctrl); + virtual void refresh(); U32 computeEstateFlags(); void setEstateFlags(U32 flags); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 706e05328c..5b43497f03 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -1788,6 +1788,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) //BOOL mature = FALSE; BOOL identified = FALSE; BOOL transacted = FALSE; + BOOL age_verified = FALSE; BOOL online = FALSE; char profile_url[DB_USER_PROFILE_URL_BUF_SIZE]; /*Flawfinder: ignore*/ @@ -1825,6 +1826,7 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) identified = (flags & AVATAR_IDENTIFIED); transacted = (flags & AVATAR_TRANSACTED); + age_verified = (flags & AVATAR_AGEVERIFIED); allow_publish = (flags & AVATAR_ALLOW_PUBLISH); online = (flags & AVATAR_ONLINE); @@ -1874,6 +1876,12 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) payment_text = "NoPaymentInfoOnFile"; } args["[PAYMENTINFO]"] = self->mPanelSecondLife->childGetValue(payment_text).asString(); + LLString age_text = "NotAgeVerified"; + if(age_verified) + { + age_text = "AgeVerified"; + } + args["[PAYMENTINFO]"] += self->mPanelSecondLife->childGetValue(age_text).asString(); } else { diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 27081d15dc..856943da6e 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -256,7 +256,7 @@ void LLStatusBar::refresh() << std::setfill('0') << std::setw(2) << internal_time->tm_mday << " " << sMonths[internal_time->tm_mon] << " " << internal_time->tm_year + 1900; - mTextTime->setToolTip(date.str().c_str()); + mTextTime->setToolTip(date.str()); LLRect r; const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index b961053799..706587abb0 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1037,19 +1037,21 @@ void LLTextureCtrl::setVisible( BOOL visible ) void LLTextureCtrl::setEnabled( BOOL enabled ) { + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); if( enabled ) { - setToolTip( "Click to choose a picture" ); + LLString tooltip; + if (floaterp) tooltip = floaterp->getUIString("choose_picture"); + setToolTip( tooltip ); } else { - setToolTip( "" ); + setToolTip( LLString() ); // *TODO: would be better to keep floater open and show // disabled state. closeFloater(); } - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); if( floaterp ) { floaterp->setActive(enabled); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ce3a3f1ae9..2fdc040684 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4064,18 +4064,18 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data) process_alert_core(buffer, modal); } -void process_alert_core(const char* buffer, BOOL modal) +void process_alert_core(const std::string& message, BOOL modal) { // make sure the cursor is back to the usual default since the // alert is probably due to some kind of error. gViewerWindow->getWindow()->resetBusyCount(); - // HACK -- handle callbacks for specific alerts - if( !strcmp( buffer, "You died and have been teleported to your home location" ) ) + // HACK -- handle callbacks for specific alerts + if ( message == "You died and have been teleported to your home location") { gViewerStats->incStat(LLViewerStats::ST_KILLED_COUNT); } - else if( !strcmp( buffer, "Home position set." ) ) + else if( message == "Home position set." ) { // save the home location image to disk LLString snap_filename = gDirUtilp->getLindenUserDir(); @@ -4084,19 +4084,26 @@ void process_alert_core(const char* buffer, BOOL modal) gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidth(), gViewerWindow->getWindowHeight(), FALSE, FALSE); } - const char ALERT_PREFIX[] = "ALERT: "; - const size_t ALERT_PREFIX_LEN = sizeof(ALERT_PREFIX) - 1; - if (!strncmp(buffer, ALERT_PREFIX, ALERT_PREFIX_LEN)) + const std::string ALERT_PREFIX("ALERT: "); + const std::string NOTIFY_PREFIX("NOTIFY: "); + if (message.find(ALERT_PREFIX) == 0) { // Allow the server to spawn a named alert so that server alerts can be - // translated out of English. JC - std::string alert_name(buffer + ALERT_PREFIX_LEN); + // translated out of English. + std::string alert_name(message.substr(ALERT_PREFIX.length())); LLAlertDialog::showXml(alert_name); } - else if (buffer[0] == '/') + else if (message.find(NOTIFY_PREFIX) == 0) + { + // Allow the server to spawn a named notification so that server notifications can be + // translated out of English. + std::string notify_name(message.substr(NOTIFY_PREFIX.length())); + LLNotifyBox::showXml(notify_name); + } + else if (message[0] == '/') { // System message is important, show in upper-right box not tip - LLString text(buffer+1); + LLString text(message.substr(1)); LLString::format_map_t args; if (text.substr(0,17) == "RESTART_X_MINUTES") { @@ -4123,14 +4130,14 @@ void process_alert_core(const char* buffer, BOOL modal) { // *TODO:translate LLString::format_map_t args; - args["[ERROR_MESSAGE]"] = buffer; + args["[ERROR_MESSAGE]"] = message; gViewerWindow->alertXml("ErrorMessage", args); } else { // *TODO:translate LLString::format_map_t args; - args["[MESSAGE]"] = buffer; + args["[MESSAGE]"] = message; LLNotifyBox::showXml("SystemMessageTip", args); } } diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 2cbd16377d..2c5005c167 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -110,7 +110,7 @@ void process_adjust_balance(LLMessageSystem* msg_system, void**); void process_alert_message(LLMessageSystem* msg, void**); void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data); -void process_alert_core(const char* buffer, BOOL modal); +void process_alert_core(const std::string& message, BOOL modal); // "Mean" or player-vs-player abuse void handle_show_mean_events(void *); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index d5fc9fa381..f0d6fd11c3 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1398,8 +1398,9 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use F32 parcel_prim_bonus = 1.f; BOOL region_push_override = false; BOOL region_deny_anonymous_override = false; - BOOL region_deny_identified_override = false; - BOOL region_deny_transacted_override = false; + BOOL region_deny_identified_override = false; // Deprecated + BOOL region_deny_transacted_override = false; // Deprecated + BOOL region_deny_age_unverified_override = false; S32 other_clean_time = 0; @@ -1474,8 +1475,9 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use msg->getF32Fast(_PREHASH_ParcelData, _PREHASH_ParcelPrimBonus, parcel_prim_bonus ); msg->getBOOLFast(_PREHASH_ParcelData, _PREHASH_RegionPushOverride, region_push_override ); msg->getBOOLFast(_PREHASH_ParcelData, _PREHASH_RegionDenyAnonymous, region_deny_anonymous_override ); - msg->getBOOLFast(_PREHASH_ParcelData, _PREHASH_RegionDenyIdentified, region_deny_identified_override ); - msg->getBOOLFast(_PREHASH_ParcelData, _PREHASH_RegionDenyTransacted, region_deny_transacted_override ); + msg->getBOOLFast(_PREHASH_ParcelData, _PREHASH_RegionDenyIdentified, region_deny_identified_override ); // Deprecated + msg->getBOOLFast(_PREHASH_ParcelData, _PREHASH_RegionDenyTransacted, region_deny_transacted_override ); // Deprecated + msg->getBOOLFast(_PREHASH_AgeVerificationBlock, _PREHASH_RegionDenyAgeUnverified, region_deny_age_unverified_override ); msg->getS32("ParcelData", "OtherCleanTime", other_clean_time ); @@ -1505,8 +1507,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use parcel->setCleanOtherTime(other_clean_time); parcel->setRegionPushOverride(region_push_override); parcel->setRegionDenyAnonymousOverride(region_deny_anonymous_override); - parcel->setRegionDenyIdentifiedOverride(region_deny_identified_override); - parcel->setRegionDenyTransactedOverride(region_deny_transacted_override); + parcel->setRegionDenyAgeUnverifiedOverride(region_deny_age_unverified_override); parcel->unpackMessage(msg); if (parcel == gParcelMgr->mAgentParcel) diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 7ee4869153..eac24cebf5 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -40,14 +40,20 @@ #include "llviewercontrol.h" // static -void LLWeb::loadURL(std::string url) +void LLWeb::initClass() +{ + LLAlertDialog::setURLLoader(&sAlertURLLoader); +} + +// static +void LLWeb::loadURL(const std::string& url) { loadURLExternal(url); } // static -void LLWeb::loadURLExternal(std::string url) +void LLWeb::loadURLExternal(const std::string& url) { std::string escaped_url = escapeURL(url); #if LL_LIBXUL_ENABLED @@ -57,7 +63,7 @@ void LLWeb::loadURLExternal(std::string url) // static -std::string LLWeb::escapeURL(std::string url) +std::string LLWeb::escapeURL(const std::string& url) { // The CURL curl_escape() function escapes colons, slashes, // and all characters but A-Z and 0-9. Do a cheesy mini-escape. @@ -81,3 +87,12 @@ std::string LLWeb::escapeURL(std::string url) } return escaped_url; } + +// virtual +void LLWeb::URLLoader::load(const std::string& url) +{ + loadURL(url); +} + +// static +LLWeb::URLLoader LLWeb::sAlertURLLoader; diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index b339f2d8fd..318410bb3b 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -34,21 +34,31 @@ #define LL_LLWEB_H #include <string> +#include "llalertdialog.h" class LLWeb { public: + static void initClass(); + // Loads unescaped url in either internal web browser or external // browser, depending on user settings. - static void loadURL(std::string url); + static void loadURL(const std::string& url); static void loadURL(const char* url) { loadURL( std::string(url) ); } // Loads unescaped url in external browser. - static void loadURLExternal(std::string url); + static void loadURLExternal(const std::string& url); // Returns escaped (eg, " " to "%20") url - static std::string escapeURL(std::string url); + static std::string escapeURL(const std::string& url); + + class URLLoader : public LLAlertDialog::URLLoader + { + virtual void load(const std::string& url); + }; + + static URLLoader sAlertURLLoader; }; #endif diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg index 8d6d551a1b..07215180f5 100644 --- a/scripts/messages/message_template.msg +++ b/scripts/messages/message_template.msg @@ -4349,6 +4349,10 @@ version 2.0 { RegionDenyIdentified BOOL } { RegionDenyTransacted BOOL } } + { + AgeVerificationBlock Single + { RegionDenyAgeUnverified BOOL } + } } // ParcelPropertiesUpdate |