Remove "Dwell" support from core and replace it with calls to methods

on IDwellModule
viewer-2-initial-appearance
Melanie Thielker 2010-09-05 14:16:42 +02:00 committed by Melanie
parent 68f107b27e
commit 6a0a878f7c
10 changed files with 78 additions and 108 deletions

View File

@ -638,9 +638,9 @@ ELSE
//Insert new values
string sql = @"INSERT INTO [land]
([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell])
([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime])
VALUES
(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)";
(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
@ -954,7 +954,6 @@ VALUES
newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
try
{
@ -1357,7 +1356,6 @@ VALUES
parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
return parameters.ToArray();
}

View File

@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL
"MusicURL, PassHours, PassPrice, SnapshotUUID, " +
"UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
"AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " +
@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL
"?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
"?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL
UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
newData.AuthBuyerID = authedbuyer;
newData.SnapshotID = snapshotID;
@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z);
cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
cmd.Parameters.AddWithValue("Dwell", land.Dwell);
cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
cmd.Parameters.AddWithValue("MediaType", land.MediaType);
cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);

View File

@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite
createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthbuyerID", typeof(String));
createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
return newData;
}
@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
row["MediaType"] = land.MediaType;
row["MediaDescription"] = land.MediaDescription;
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();

View File

@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy
createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthbuyerID", typeof(String));
createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
return newData;
}
@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
}
/// <summary>

View File

@ -88,7 +88,6 @@ namespace OpenSim.Framework
private UUID _snapshotID = UUID.Zero;
private Vector3 _userLocation = new Vector3();
private Vector3 _userLookAt = new Vector3();
private int _dwell = 0;
private int _otherCleanTime = 0;
private string _mediaType = "none/none";
private string _mediaDescription = "";
@ -619,18 +618,6 @@ namespace OpenSim.Framework
}
}
/// <summary>
/// Deprecated idea. Number of visitors ~= free money
/// </summary>
public int Dwell {
get {
return _dwell;
}
set {
_dwell = value;
}
}
/// <summary>
/// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
/// the parcel and isn't set to the same 'group' as the parcel.
@ -703,7 +690,6 @@ namespace OpenSim.Framework
landData._userLocation = _userLocation;
landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime;
landData._dwell = _dwell;
landData._mediaType = _mediaType;
landData._mediaDescription = _mediaDescription;
landData._mediaWidth = _mediaWidth;

View File

@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External
landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell"));
// No longer used here
xtr.ReadElementString("Dwell");
landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
xtr.ReadEndElement();
@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell));
xtw.WriteElementString("Dwell", "0");
xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
xtw.WriteEndElement();

View File

@ -57,12 +57,14 @@ namespace OpenSim.Framework.Servers.HttpServer
{
WebRequest request = WebRequest.Create(requestUrl);
request.Method = verb;
string respstring = String.Empty;
using (MemoryStream buffer = new MemoryStream())
{
if ((verb == "POST") || (verb == "PUT"))
{
request.ContentType = "text/www-form-urlencoded";
MemoryStream buffer = new MemoryStream();
int length = 0;
using (StreamWriter writer = new StreamWriter(buffer))
{
@ -85,26 +87,20 @@ namespace OpenSim.Framework.Servers.HttpServer
}
finally
{
// If this is closed, it will be disposed internally,
// but the above write is asynchronous and may hit after
// we're through here. So the thread handling that will
// throw and put us back into the catch above. Isn't
// .NET great?
//if (requestStream != null)
// requestStream.Close();
// Let's not close this
//buffer.Close();
if (requestStream != null)
requestStream.Close();
}
}
string respstring = String.Empty;
try
{
using (WebResponse resp = request.GetResponse())
{
<<<<<<< HEAD:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
if (resp.ContentLength > 0)
=======
using (WebResponse resp = request.GetResponse())
>>>>>>> e593607... Remove "Dwell" support from core and replace it with calls to methods:OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
{
if (resp.ContentLength != 0)
{
Stream respStream = null;
try
@ -132,6 +128,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// This is what happens when there is invalid XML
m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
}
}
return respstring;
}
}

View File

@ -2668,6 +2668,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
{
float dwell = 0.0f;
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
if (dwellModule != null)
dwell = dwellModule.GetDwell(land.GlobalID);
ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply);
reply.AgentData.AgentID = m_agentId;
reply.Data.ParcelID = parcelID;
@ -2692,7 +2696,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
reply.Data.GlobalZ = pos.Z;
reply.Data.SimName = Utils.StringToBytes(info.RegionName);
reply.Data.SnapshotID = land.SnapshotID;
reply.Data.Dwell = land.Dwell;
reply.Data.Dwell = dwell;
reply.Data.SalePrice = land.SalePrice;
reply.Data.AuctionID = (int)land.AuctionID;

View File

@ -163,7 +163,6 @@ namespace OpenSim.Region.CoreModules.World.Land
client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
client.OnParcelReclaim += ClientOnParcelReclaim;
client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
@ -1487,18 +1486,6 @@ namespace OpenSim.Region.CoreModules.World.Land
#endregion
private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient)
{
ILandObject selectedParcel = null;
lock (m_landList)
{
if (!m_landList.TryGetValue(localID, out selectedParcel))
return;
}
remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell);
}
private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
{
if (parcelID == UUID.Zero)

View File

@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
ILandChannel landChannel = m_scene.LandChannel;
List<ILandObject> parcels = landChannel.AllParcels();
IDwellModule dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
if (parcels != null)
{
@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers
xmlparcel.AppendChild(infouuid);
XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", "");
dwell.InnerText = parcel.Dwell.ToString();
if (dwellModule != null)
dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString();
else
dwell.InnerText = "0";
xmlparcel.AppendChild(dwell);
//TODO: figure how to figure out teleport system landData.landingType