Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

iar_mods
Dan Lake 2012-02-02 17:44:11 -08:00
commit 3257dbe76d
23 changed files with 271 additions and 138 deletions

View File

@ -681,7 +681,7 @@ VALUES
using (SqlCommand cmd = new SqlCommand(sql, conn)) using (SqlCommand cmd = new SqlCommand(sql, conn))
{ {
conn.Open(); conn.Open();
foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) foreach (LandAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList)
{ {
cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID)); cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID));
@ -1453,7 +1453,7 @@ VALUES
_Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
} }
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); newData.ParcelAccessList = new List<LandAccessEntry>();
return newData; return newData;
} }
@ -1463,12 +1463,12 @@ VALUES
/// </summary> /// </summary>
/// <param name="row">datarecord with landaccess data</param> /// <param name="row">datarecord with landaccess data</param>
/// <returns></returns> /// <returns></returns>
private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row) private static LandAccessEntry BuildLandAccessData(IDataRecord row)
{ {
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = new UUID((Guid)row["AccessUUID"]); entry.AgentID = new UUID((Guid)row["AccessUUID"]);
entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
entry.Time = new DateTime(); entry.Expires = 0;
return entry; return entry;
} }
@ -1851,7 +1851,7 @@ VALUES
/// <param name="parcelAccessEntry">parcel access entry.</param> /// <param name="parcelAccessEntry">parcel access entry.</param>
/// <param name="parcelID">parcel ID.</param> /// <param name="parcelID">parcel ID.</param>
/// <returns></returns> /// <returns></returns>
private SqlParameter[] CreateLandAccessParameters(ParcelManager.ParcelAccessEntry parcelAccessEntry, UUID parcelID) private SqlParameter[] CreateLandAccessParameters(LandAccessEntry parcelAccessEntry, UUID parcelID)
{ {
List<SqlParameter> parameters = new List<SqlParameter>(); List<SqlParameter> parameters = new List<SqlParameter>();

View File

@ -700,10 +700,10 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear(); cmd.Parameters.Clear();
cmd.CommandText = "insert into landaccesslist (LandUUID, " + cmd.CommandText = "insert into landaccesslist (LandUUID, " +
"AccessUUID, Flags) values (?LandUUID, ?AccessUUID, " + "AccessUUID, Flags, Expires) values (?LandUUID, ?AccessUUID, " +
"?Flags)"; "?Flags, ?Expires)";
foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList)
{ {
FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID); FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID);
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
@ -1377,7 +1377,7 @@ namespace OpenSim.Data.MySQL
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); newData.ParcelAccessList = new List<LandAccessEntry>();
return newData; return newData;
} }
@ -1387,12 +1387,12 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row) private static LandAccessEntry BuildLandAccessData(IDataReader row)
{ {
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = DBGuid.FromDB(row["AccessUUID"]); entry.AgentID = DBGuid.FromDB(row["AccessUUID"]);
entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]); entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]);
entry.Time = new DateTime(); entry.Expires = Convert.ToInt32(row["Expires"]);
return entry; return entry;
} }
@ -1697,11 +1697,12 @@ namespace OpenSim.Data.MySQL
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="entry"></param> /// <param name="entry"></param>
/// <param name="parcelID"></param> /// <param name="parcelID"></param>
private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID) private static void FillLandAccessCommand(MySqlCommand cmd, LandAccessEntry entry, UUID parcelID)
{ {
cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString()); cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString());
cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString()); cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString());
cmd.Parameters.AddWithValue("Flags", entry.Flags); cmd.Parameters.AddWithValue("Flags", entry.Flags);
cmd.Parameters.AddWithValue("Expires", entry.Expires.ToString());
} }
/// <summary> /// <summary>

View File

@ -863,3 +863,9 @@ BEGIN;
ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT; COMMIT;
:VERSION 41 #---------------- Timed bans/access
BEGIN;
ALTER TABLE `landaccesslist` ADD COLUMN `Expires` INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -759,7 +759,7 @@ namespace OpenSim.Data.SQLite
landaccesslist.Rows.Remove(rowsToDelete[iter]); landaccesslist.Rows.Remove(rowsToDelete[iter]);
} }
rowsToDelete.Clear(); rowsToDelete.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) foreach (LandAccessEntry entry in parcel.LandData.ParcelAccessList)
{ {
DataRow newAccessRow = landaccesslist.NewRow(); DataRow newAccessRow = landaccesslist.NewRow();
fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID); fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID);
@ -1456,7 +1456,7 @@ namespace OpenSim.Data.SQLite
newData.UserLocation = Vector3.Zero; newData.UserLocation = Vector3.Zero;
newData.UserLookAt = Vector3.Zero; newData.UserLookAt = Vector3.Zero;
} }
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); newData.ParcelAccessList = new List<LandAccessEntry>();
UUID authBuyerID = UUID.Zero; UUID authBuyerID = UUID.Zero;
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
@ -1519,12 +1519,12 @@ namespace OpenSim.Data.SQLite
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) private static LandAccessEntry buildLandAccessData(DataRow row)
{ {
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = new UUID((string) row["AccessUUID"]); entry.AgentID = new UUID((string) row["AccessUUID"]);
entry.Flags = (AccessList) row["Flags"]; entry.Flags = (AccessList) row["Flags"];
entry.Time = new DateTime(); entry.Expires = 0;
return entry; return entry;
} }
@ -1787,7 +1787,7 @@ namespace OpenSim.Data.SQLite
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="entry"></param> /// <param name="entry"></param>
/// <param name="parcelID"></param> /// <param name="parcelID"></param>
private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID) private static void fillLandAccessRow(DataRow row, LandAccessEntry entry, UUID parcelID)
{ {
row["LandUUID"] = parcelID.ToString(); row["LandUUID"] = parcelID.ToString();
row["AccessUUID"] = entry.AgentID.ToString(); row["AccessUUID"] = entry.AgentID.ToString();

View File

@ -177,7 +177,7 @@ namespace OpenSim.Framework
public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags, public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags,
int landLocalID, UUID transactionID, int sequenceID, int landLocalID, UUID transactionID, int sequenceID,
int sections, List<ParcelManager.ParcelAccessEntry> entries, int sections, List<LandAccessEntry> entries,
IClientAPI remote_client); IClientAPI remote_client);
public delegate void ParcelPropertiesRequest( public delegate void ParcelPropertiesRequest(
@ -1251,7 +1251,7 @@ namespace OpenSim.Framework
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity,
uint regionFlags); uint regionFlags);
void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID); void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID);
void SendForceClientSelectObjects(List<uint> objectIDs); void SendForceClientSelectObjects(List<uint> objectIDs);
void SendCameraConstraint(Vector4 ConstraintPlane); void SendCameraConstraint(Vector4 ConstraintPlane);
void SendLandObjectOwners(LandData land, List<UUID> groups, Dictionary<UUID, int> ownersAndCount); void SendLandObjectOwners(LandData land, List<UUID> groups, Dictionary<UUID, int> ownersAndCount);

View File

@ -73,9 +73,9 @@ namespace OpenSim.Framework
bool IsRestrictedFromLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar);
void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(IClientAPI remote_client);
void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
List<UUID> CreateAccessListArrayByFlag(AccessList flag); List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag);
void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List<LandAccessEntry> entries, IClientAPI remote_client);
void UpdateLandBitmapByteArray(); void UpdateLandBitmapByteArray();
void SetLandBitmapFromByteArray(); void SetLandBitmapFromByteArray();
bool[,] GetLandBitmap(); bool[,] GetLandBitmap();

View File

@ -34,6 +34,13 @@ using OpenMetaverse;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public struct LandAccessEntry
{
public UUID AgentID;
public int Expires;
public AccessList Flags;
}
/// <summary> /// <summary>
/// Details of a Parcel of land /// Details of a Parcel of land
/// </summary> /// </summary>
@ -73,7 +80,7 @@ namespace OpenSim.Framework
private string _mediaURL = String.Empty; private string _mediaURL = String.Empty;
private string _musicURL = String.Empty; private string _musicURL = String.Empty;
private UUID _ownerID = UUID.Zero; private UUID _ownerID = UUID.Zero;
private List<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); private List<LandAccessEntry> _parcelAccessList = new List<LandAccessEntry>();
private float _passHours = 0; private float _passHours = 0;
private int _passPrice = 0; private int _passPrice = 0;
private int _salePrice = 0; //Unemeplemented. Parcels price. private int _salePrice = 0; //Unemeplemented. Parcels price.
@ -450,7 +457,7 @@ namespace OpenSim.Framework
/// <summary> /// <summary>
/// List of access data for the parcel. User data, some bitflags, and a time /// List of access data for the parcel. User data, some bitflags, and a time
/// </summary> /// </summary>
public List<ParcelManager.ParcelAccessEntry> ParcelAccessList { public List<LandAccessEntry> ParcelAccessList {
get { get {
return _parcelAccessList; return _parcelAccessList;
} }
@ -638,12 +645,12 @@ namespace OpenSim.Framework
landData._simwidePrims = _simwidePrims; landData._simwidePrims = _simwidePrims;
landData._parcelAccessList.Clear(); landData._parcelAccessList.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) foreach (LandAccessEntry entry in _parcelAccessList)
{ {
ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry(); LandAccessEntry newEntry = new LandAccessEntry();
newEntry.AgentID = entry.AgentID; newEntry.AgentID = entry.AgentID;
newEntry.Flags = entry.Flags; newEntry.Flags = entry.Flags;
newEntry.Time = entry.Time; newEntry.Expires = entry.Expires;
landData._parcelAccessList.Add(newEntry); landData._parcelAccessList.Add(newEntry);
} }
@ -668,4 +675,4 @@ namespace OpenSim.Framework
return land; return land;
} }
} }
} }

View File

@ -90,7 +90,7 @@ namespace OpenSim.Framework.Serialization.External
landData.MusicURL = xtr.ReadElementString("MusicURL"); landData.MusicURL = xtr.ReadElementString("MusicURL");
landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID")); landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID"));
landData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); landData.ParcelAccessList = new List<LandAccessEntry>();
xtr.Read(); xtr.Read();
if (xtr.Name != "ParcelAccessList") if (xtr.Name != "ParcelAccessList")
throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name)); throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name));
@ -99,11 +99,14 @@ namespace OpenSim.Framework.Serialization.External
{ {
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
{ {
ParcelManager.ParcelAccessEntry pae = new ParcelManager.ParcelAccessEntry(); LandAccessEntry pae = new LandAccessEntry();
xtr.ReadStartElement("ParcelAccessEntry"); xtr.ReadStartElement("ParcelAccessEntry");
pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID")); pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID"));
pae.Time = Convert.ToDateTime( xtr.ReadElementString("Time")); // We really don't care about temp vs perm here and this
// would break on old oars. Assume all bans are perm
xtr.ReadElementString("Time");
pae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList")); pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList"));
xtr.ReadEndElement(); xtr.ReadEndElement();
@ -162,11 +165,11 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("OwnerID", landData.OwnerID.ToString()); xtw.WriteElementString("OwnerID", landData.OwnerID.ToString());
xtw.WriteStartElement("ParcelAccessList"); xtw.WriteStartElement("ParcelAccessList");
foreach (ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList) foreach (LandAccessEntry pal in landData.ParcelAccessList)
{ {
xtw.WriteStartElement("ParcelAccessEntry"); xtw.WriteStartElement("ParcelAccessEntry");
xtw.WriteElementString("AgentID", pal.AgentID.ToString()); xtw.WriteElementString("AgentID", pal.AgentID.ToString());
xtw.WriteElementString("Time", pal.Time.ToString("s")); xtw.WriteElementString("Time", pal.Expires.ToString());
xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags)); xtw.WriteElementString("AccessList", Convert.ToString((uint)pal.Flags));
xtw.WriteEndElement(); xtw.WriteEndElement();
} }

View File

@ -42,7 +42,7 @@ namespace OpenSim.Framework.Serialization.Tests
private LandData landWithParcelAccessList; private LandData landWithParcelAccessList;
private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>2009-10-01T00:00:00</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>2010-10-20T00:00:00</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>"; private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>0</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>0</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation>&lt;0, 0, 0&gt;</UserLocation>\n <UserLookAt>&lt;0, 0, 0&gt;</UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
[SetUp] [SetUp]
public void setup() public void setup()
@ -73,16 +73,16 @@ namespace OpenSim.Framework.Serialization.Tests
this.landWithParcelAccessList = this.land.Copy(); this.landWithParcelAccessList = this.land.Copy();
this.landWithParcelAccessList.ParcelAccessList.Clear(); this.landWithParcelAccessList.ParcelAccessList.Clear();
ParcelManager.ParcelAccessEntry pae0 = new ParcelManager.ParcelAccessEntry(); LandAccessEntry pae0 = new LandAccessEntry();
pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c"); pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c");
pae0.Flags = AccessList.Ban; pae0.Flags = AccessList.Ban;
pae0.Time = new DateTime(2009, 10, 01); pae0.Expires = 0;
this.landWithParcelAccessList.ParcelAccessList.Add(pae0); this.landWithParcelAccessList.ParcelAccessList.Add(pae0);
ParcelManager.ParcelAccessEntry pae1 = new ParcelManager.ParcelAccessEntry(); LandAccessEntry pae1 = new LandAccessEntry();
pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e"); pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
pae1.Flags = AccessList.Access; pae1.Flags = AccessList.Access;
pae1.Time = new DateTime(2010, 10, 20); pae1.Expires = 0;
this.landWithParcelAccessList.ParcelAccessList.Add(pae1); this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
} }
@ -128,4 +128,4 @@ namespace OpenSim.Framework.Serialization.Tests
"Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)");
} }
} }
} }

View File

@ -65,6 +65,7 @@ namespace OpenSim.Framework
private int _permsMask; private int _permsMask;
private int _type = 0; private int _type = 0;
private UUID _oldID; private UUID _oldID;
private UUID _loadedID = UUID.Zero;
private bool _ownerChanged = false; private bool _ownerChanged = false;
@ -231,6 +232,15 @@ namespace OpenSim.Framework
} }
} }
public UUID LoadedItemID {
get {
return _loadedID;
}
set {
_loadedID = value;
}
}
public UUID LastOwnerID { public UUID LastOwnerID {
get { get {
return _lastOwnerID; return _lastOwnerID;
@ -347,6 +357,7 @@ namespace OpenSim.Framework
/// <param name="partID">The new part ID to which this item belongs</param> /// <param name="partID">The new part ID to which this item belongs</param>
public void ResetIDs(UUID partID) public void ResetIDs(UUID partID)
{ {
LoadedItemID = OldItemID;
OldItemID = ItemID; OldItemID = ItemID;
ItemID = UUID.Random(); ItemID = UUID.Random();
ParentPartID = partID; ParentPartID = partID;

View File

@ -4623,7 +4623,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID)
{ {
ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
replyPacket.Data.AgentID = AgentId; replyPacket.Data.AgentID = AgentId;
@ -4632,12 +4632,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
replyPacket.Data.SequenceID = 0; replyPacket.Data.SequenceID = 0;
List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>();
foreach (UUID avatar in avatars) foreach (LandAccessEntry entry in accessList)
{ {
ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock(); ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock();
block.Flags = accessFlag; block.Flags = accessFlag;
block.ID = avatar; block.ID = entry.AgentID;
block.Time = 0; block.Time = entry.Expires;
list.Add(block); list.Add(block);
} }
@ -8577,13 +8577,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
#endregion #endregion
List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>(); List<LandAccessEntry> entries = new List<LandAccessEntry>();
foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
{ {
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = block.ID; entry.AgentID = block.ID;
entry.Flags = (AccessList)block.Flags; entry.Flags = (AccessList)block.Flags;
entry.Time = Util.ToDateTime(block.Time); entry.Expires = block.Time;
entries.Add(entry); entries.Add(entry);
} }

View File

@ -550,7 +550,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void ClientOnParcelAccessListUpdateRequest(UUID agentID, public void ClientOnParcelAccessListUpdateRequest(UUID agentID,
uint flags, int landLocalID, UUID transactionID, int sequenceID, uint flags, int landLocalID, UUID transactionID, int sequenceID,
int sections, List<ParcelManager.ParcelAccessEntry> entries, int sections, List<LandAccessEntry> entries,
IClientAPI remote_client) IClientAPI remote_client)
{ {
// Flags is the list to update, it can mean either the ban or // Flags is the list to update, it can mean either the ban or
@ -1712,4 +1712,4 @@ namespace OpenSim.Region.CoreModules.World.Land
MainConsole.Instance.Output(report.ToString()); MainConsole.Instance.Output(report.ToString());
} }
} }
} }

View File

@ -418,13 +418,21 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool IsBannedFromLand(UUID avatar) public bool IsBannedFromLand(UUID avatar)
{ {
if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) ExpireAccessList();
if (m_scene.Permissions.IsAdministrator(avatar))
return false;
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
return false;
if (avatar == LandData.OwnerID)
return false; return false;
if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
{ {
if (LandData.ParcelAccessList.FindIndex( if (LandData.ParcelAccessList.FindIndex(
delegate(ParcelManager.ParcelAccessEntry e) delegate(LandAccessEntry e)
{ {
if (e.AgentID == avatar && e.Flags == AccessList.Ban) if (e.AgentID == avatar && e.Flags == AccessList.Ban)
return true; return true;
@ -439,13 +447,21 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool IsRestrictedFromLand(UUID avatar) public bool IsRestrictedFromLand(UUID avatar)
{ {
if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) ExpireAccessList();
if (m_scene.Permissions.IsAdministrator(avatar))
return false;
if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar))
return false;
if (avatar == LandData.OwnerID)
return false; return false;
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
{ {
if (LandData.ParcelAccessList.FindIndex( if (LandData.ParcelAccessList.FindIndex(
delegate(ParcelManager.ParcelAccessEntry e) delegate(LandAccessEntry e)
{ {
if (e.AgentID == avatar && e.Flags == AccessList.Access) if (e.AgentID == avatar && e.Flags == AccessList.Access)
return true; return true;
@ -511,19 +527,24 @@ namespace OpenSim.Region.CoreModules.World.Land
#region AccessList Functions #region AccessList Functions
public List<UUID> CreateAccessListArrayByFlag(AccessList flag) public List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag)
{ {
List<UUID> list = new List<UUID>(); ExpireAccessList();
foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList)
List<LandAccessEntry> list = new List<LandAccessEntry>();
foreach (LandAccessEntry entry in LandData.ParcelAccessList)
{ {
if (entry.Flags == flag) if (entry.Flags == flag)
{ list.Add(entry);
list.Add(entry.AgentID);
}
} }
if (list.Count == 0) if (list.Count == 0)
{ {
list.Add(UUID.Zero); LandAccessEntry e = new LandAccessEntry();
e.AgentID = UUID.Zero;
e.Flags = 0;
e.Expires = 0;
list.Add(e);
} }
return list; return list;
@ -535,20 +556,20 @@ namespace OpenSim.Region.CoreModules.World.Land
if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both)
{ {
List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Access);
remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); remote_client.SendLandAccessListData(accessEntries,(uint) AccessList.Access,LandData.LocalID);
} }
if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both)
{ {
List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Ban);
remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); remote_client.SendLandAccessListData(accessEntries, (uint)AccessList.Ban, LandData.LocalID);
} }
} }
public void UpdateAccessList(uint flags, UUID transactionID, public void UpdateAccessList(uint flags, UUID transactionID,
int sequenceID, int sections, int sequenceID, int sections,
List<ParcelManager.ParcelAccessEntry> entries, List<LandAccessEntry> entries,
IClientAPI remote_client) IClientAPI remote_client)
{ {
LandData newData = LandData.Copy(); LandData newData = LandData.Copy();
@ -558,16 +579,16 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
m_listTransactions[flags] = transactionID; m_listTransactions[flags] = transactionID;
List<ParcelManager.ParcelAccessEntry> toRemove = List<LandAccessEntry> toRemove =
new List<ParcelManager.ParcelAccessEntry>(); new List<LandAccessEntry>();
foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) foreach (LandAccessEntry entry in newData.ParcelAccessList)
{ {
if (entry.Flags == (AccessList)flags) if (entry.Flags == (AccessList)flags)
toRemove.Add(entry); toRemove.Add(entry);
} }
foreach (ParcelManager.ParcelAccessEntry entry in toRemove) foreach (LandAccessEntry entry in toRemove)
{ {
newData.ParcelAccessList.Remove(entry); newData.ParcelAccessList.Remove(entry);
} }
@ -582,13 +603,13 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
foreach (ParcelManager.ParcelAccessEntry entry in entries) foreach (LandAccessEntry entry in entries)
{ {
ParcelManager.ParcelAccessEntry temp = LandAccessEntry temp =
new ParcelManager.ParcelAccessEntry(); new LandAccessEntry();
temp.AgentID = entry.AgentID; temp.AgentID = entry.AgentID;
temp.Time = entry.Time; temp.Expires = entry.Expires;
temp.Flags = (AccessList)flags; temp.Flags = (AccessList)flags;
newData.ParcelAccessList.Add(temp); newData.ParcelAccessList.Add(temp);
@ -1105,5 +1126,20 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
#endregion #endregion
private void ExpireAccessList()
{
List<LandAccessEntry> delete = new List<LandAccessEntry>();
foreach (LandAccessEntry entry in LandData.ParcelAccessList)
{
if (entry.Expires != 0 && entry.Expires < Util.UnixTimeSinceEpoch())
delete.Add(entry);
}
foreach (LandAccessEntry entry in delete)
LandData.ParcelAccessList.Remove(entry);
m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this);
}
} }
} }

View File

@ -307,14 +307,15 @@ namespace OpenSim.Region.Framework.Scenes
else else
{ {
if (m_part.ParentGroup.m_savedScriptState != null) if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID); item.OldItemID = RestoreSavedScriptState(item.LoadedItemID, item.OldItemID, item.ItemID);
lock (m_items) lock (m_items)
{ {
m_items[item.ItemID].OldItemID = item.OldItemID;
m_items[item.ItemID].PermsMask = 0; m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero; m_items[item.ItemID].PermsGranter = UUID.Zero;
} }
string script = Utils.BytesToString(asset.Data); string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript( m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
@ -324,17 +325,20 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
private void RestoreSavedScriptState(UUID oldID, UUID newID) private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID)
{ {
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines.Length == 0) // No engine at all if (engines.Length == 0) // No engine at all
return; return oldID;
if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID)) UUID stateID = oldID;
if (!m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
stateID = loadedID;
if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID))
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.LoadXml(m_part.ParentGroup.m_savedScriptState[oldID]); doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]);
////////// CRUFT WARNING /////////////////////////////////// ////////// CRUFT WARNING ///////////////////////////////////
// //
@ -351,7 +355,7 @@ namespace OpenSim.Region.Framework.Scenes
XmlElement rootN = newDoc.CreateElement("", "State", ""); XmlElement rootN = newDoc.CreateElement("", "State", "");
XmlAttribute uuidA = newDoc.CreateAttribute("", "UUID", ""); XmlAttribute uuidA = newDoc.CreateAttribute("", "UUID", "");
uuidA.Value = oldID.ToString(); uuidA.Value = stateID.ToString();
rootN.Attributes.Append(uuidA); rootN.Attributes.Append(uuidA);
XmlAttribute engineA = newDoc.CreateAttribute("", "Engine", ""); XmlAttribute engineA = newDoc.CreateAttribute("", "Engine", "");
engineA.Value = "XEngine"; engineA.Value = "XEngine";
@ -365,20 +369,22 @@ namespace OpenSim.Region.Framework.Scenes
// This created document has only the minimun data // This created document has only the minimun data
// necessary for XEngine to parse it successfully // necessary for XEngine to parse it successfully
m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml;
} }
foreach (IScriptModule e in engines) foreach (IScriptModule e in engines)
{ {
if (e != null) if (e != null)
{ {
if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[oldID])) if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[stateID]))
break; break;
} }
} }
m_part.ParentGroup.m_savedScriptState.Remove(oldID); m_part.ParentGroup.m_savedScriptState.Remove(stateID);
} }
return stateID;
} }
/// <summary> /// <summary>

View File

@ -794,10 +794,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
{ {
Util.ReadUUID(reader, "OldItemID"); item.OldItemID = Util.ReadUUID(reader, "OldItemID");
// On deserialization, the old item id MUST BE UUID.Zero!!!!!
// Setting this to the saved value will BREAK script persistence!
// item.OldItemID = Util.ReadUUID(reader, "OldItemID");
} }
private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)

View File

@ -1253,7 +1253,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID)
{ {
} }

View File

@ -940,7 +940,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{ {
} }
public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID)
{ {
} }
public void SendForceClientSelectObjects(List<uint> objectIDs) public void SendForceClientSelectObjects(List<uint> objectIDs)

View File

@ -5714,16 +5714,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llEjectFromLand(string pest) public void llEjectFromLand(string pest)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID agentId = new UUID(); UUID agentID = new UUID();
if (UUID.TryParse(pest, out agentId)) if (UUID.TryParse(pest, out agentID))
{ {
ScenePresence presence = World.GetScenePresence(agentId); ScenePresence presence = World.GetScenePresence(agentID);
if (presence != null) if (presence != null)
{ {
// agent must be over the owners land // agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject( ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) if (land == null)
World.TeleportClientHome(agentId, presence.ControllingClient); return;
if (m_host.OwnerID == land.LandData.OwnerID)
{
World.TeleportClientHome(agentID, presence.ControllingClient);
}
} }
} }
ScriptSleep(5000); ScriptSleep(5000);
@ -6408,24 +6413,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID key; UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
{ {
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); int expires = 0;
if (hours != 0)
expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours);
if (UUID.TryParse(avatar, out key)) if (UUID.TryParse(avatar, out key))
{ {
if (land.LandData.ParcelAccessList.FindIndex( int idx = land.LandData.ParcelAccessList.FindIndex(
delegate(ParcelManager.ParcelAccessEntry e) delegate(LandAccessEntry e)
{ {
if (e.AgentID == key && e.Flags == AccessList.Access) if (e.AgentID == key && e.Flags == AccessList.Access)
return true; return true;
return false; return false;
}) == -1) });
{
entry.AgentID = key; if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires)))
entry.Flags = AccessList.Access; return;
entry.Time = DateTime.Now.AddHours(hours);
land.LandData.ParcelAccessList.Add(entry); if (idx != -1)
} land.LandData.ParcelAccessList.RemoveAt(idx);
LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = key;
entry.Flags = AccessList.Access;
entry.Expires = expires;
land.LandData.ParcelAccessList.Add(entry);
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
} }
} }
ScriptSleep(100); ScriptSleep(100);
@ -9679,22 +9697,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
{ {
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); int expires = 0;
if (hours != 0)
expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours);
if (UUID.TryParse(avatar, out key)) if (UUID.TryParse(avatar, out key))
{ {
if (land.LandData.ParcelAccessList.FindIndex( int idx = land.LandData.ParcelAccessList.FindIndex(
delegate(ParcelManager.ParcelAccessEntry e) delegate(LandAccessEntry e)
{ {
if (e.AgentID == key && e.Flags == AccessList.Ban) if (e.AgentID == key && e.Flags == AccessList.Ban)
return true; return true;
return false; return false;
}) == -1) });
{
entry.AgentID = key; if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires)))
entry.Flags = AccessList.Ban; return;
entry.Time = DateTime.Now.AddHours(hours);
land.LandData.ParcelAccessList.Add(entry); if (idx != -1)
} land.LandData.ParcelAccessList.RemoveAt(idx);
LandAccessEntry entry = new LandAccessEntry();
entry.AgentID = key;
entry.Flags = AccessList.Ban;
entry.Expires = expires;
land.LandData.ParcelAccessList.Add(entry);
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
} }
} }
ScriptSleep(100); ScriptSleep(100);
@ -9710,7 +9741,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (UUID.TryParse(avatar, out key)) if (UUID.TryParse(avatar, out key))
{ {
int idx = land.LandData.ParcelAccessList.FindIndex( int idx = land.LandData.ParcelAccessList.FindIndex(
delegate(ParcelManager.ParcelAccessEntry e) delegate(LandAccessEntry e)
{ {
if (e.AgentID == key && e.Flags == AccessList.Access) if (e.AgentID == key && e.Flags == AccessList.Access)
return true; return true;
@ -9718,7 +9749,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}); });
if (idx != -1) if (idx != -1)
{
land.LandData.ParcelAccessList.RemoveAt(idx); land.LandData.ParcelAccessList.RemoveAt(idx);
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
}
} }
} }
ScriptSleep(100); ScriptSleep(100);
@ -9734,7 +9768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (UUID.TryParse(avatar, out key)) if (UUID.TryParse(avatar, out key))
{ {
int idx = land.LandData.ParcelAccessList.FindIndex( int idx = land.LandData.ParcelAccessList.FindIndex(
delegate(ParcelManager.ParcelAccessEntry e) delegate(LandAccessEntry e)
{ {
if (e.AgentID == key && e.Flags == AccessList.Ban) if (e.AgentID == key && e.Flags == AccessList.Ban)
return true; return true;
@ -9742,7 +9776,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}); });
if (idx != -1) if (idx != -1)
{
land.LandData.ParcelAccessList.RemoveAt(idx); land.LandData.ParcelAccessList.RemoveAt(idx);
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
}
} }
} }
ScriptSleep(100); ScriptSleep(100);
@ -9997,7 +10034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
if (land.OwnerID == m_host.OwnerID) if (land.OwnerID == m_host.OwnerID)
{ {
foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) foreach (LandAccessEntry entry in land.ParcelAccessList)
{ {
if (entry.Flags == AccessList.Ban) if (entry.Flags == AccessList.Ban)
{ {
@ -10014,7 +10051,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
if (land.OwnerID == m_host.OwnerID) if (land.OwnerID == m_host.OwnerID)
{ {
foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) foreach (LandAccessEntry entry in land.ParcelAccessList)
{ {
if (entry.Flags == AccessList.Access) if (entry.Flags == AccessList.Access)
{ {

View File

@ -138,7 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Key llGetLinkKey(int linknum); LSL_Key llGetLinkKey(int linknum);
LSL_String llGetLinkName(int linknum); LSL_String llGetLinkName(int linknum);
LSL_Integer llGetLinkNumber(); LSL_Integer llGetLinkNumber();
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); LSL_Integer llGetLinkNumberOfSides(int link);
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
LSL_Integer llGetListEntryType(LSL_List src, int index); LSL_Integer llGetListEntryType(LSL_List src, int index);
LSL_Integer llGetListLength(LSL_List src); LSL_Integer llGetListLength(LSL_List src);
LSL_Vector llGetLocalPos(); LSL_Vector llGetLocalPos();

View File

@ -539,6 +539,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetLinkNumber(); return m_LSL_Functions.llGetLinkNumber();
} }
public LSL_Integer llGetLinkNumberOfSides(int link)
{
return m_LSL_Functions.llGetLinkNumberOfSides(link);
}
public LSL_Integer llGetListEntryType(LSL_List src, int index) public LSL_Integer llGetListEntryType(LSL_List src, int index)
{ {
return m_LSL_Functions.llGetListEntryType(src, index); return m_LSL_Functions.llGetListEntryType(src, index);

View File

@ -63,7 +63,7 @@ namespace OpenSim.Server.Handlers.Authentication
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(authService, args); m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userService, args);
// Handler for OpenID user identity pages // Handler for OpenID user identity pages
server.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", m_UserAccountService, m_AuthenticationService)); server.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", m_UserAccountService, m_AuthenticationService));

View File

@ -980,7 +980,7 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID)
{ {
} }

View File

@ -59,33 +59,60 @@ namespace OpenSim.Tests.Torture
// } // }
[Test] [Test]
public void Test0001TenThousandObjects() public void Test0001_10K_1PrimObjects()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
TestAddObjects(10000); TestAddObjects(1, 10000);
} }
[Test] [Test]
public void Test0002OneHundredThousandObjects() public void Test0002_100K_1PrimObjects()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
TestAddObjects(100000); TestAddObjects(1, 100000);
} }
[Test] [Test]
public void Test0003TwoHundredThousandObjects() public void Test0003_200K_1PrimObjects()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
TestAddObjects(200000); TestAddObjects(1, 200000);
} }
private void TestAddObjects(int objectsToAdd) [Test]
public void Test0011_100_100PrimObjects()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
TestAddObjects(100, 100);
}
[Test]
public void Test0012_1K_100PrimObjects()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
TestAddObjects(100, 1000);
}
[Test]
public void Test0013_2K_100PrimObjects()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
TestAddObjects(100, 2000);
}
private void TestAddObjects(int primsInEachObject, int objectsToAdd)
{ {
UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000"); UUID ownerId = new UUID("F0000000-0000-0000-0000-000000000000");
@ -98,7 +125,7 @@ namespace OpenSim.Tests.Torture
for (int i = 1; i <= objectsToAdd; i++) for (int i = 1; i <= objectsToAdd; i++)
{ {
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId, "part_", i); SceneObjectGroup so = SceneHelpers.CreateSceneObject(primsInEachObject, ownerId, "part_", i);
Assert.That(scene.AddNewSceneObject(so, false), Is.True, string.Format("Object {0} was not created", i)); Assert.That(scene.AddNewSceneObject(so, false), Is.True, string.Format("Object {0} was not created", i));
} }
@ -114,13 +141,9 @@ namespace OpenSim.Tests.Torture
string.Format("Object {0} could not be retrieved", i)); string.Format("Object {0} could not be retrieved", i));
} }
// Console.WriteLine(
// "Took {0}ms, {1}MB to create {2} single prim scene objects",
// elapsed.Milliseconds, processGcAlloc / 1024 / 1024, objectsToAdd);
Console.WriteLine( Console.WriteLine(
"Took {0}MB to create {1} single prim scene objects", "Took {0}ms, {1}MB to create {2} objects each containing {3} prim(s)",
processGcAlloc / 1024 / 1024, objectsToAdd); Math.Round(elapsed.TotalMilliseconds), processGcAlloc / 1024 / 1024, objectsToAdd, primsInEachObject);
} }
} }
} }