Merge remote branch 'origin' into soprefactor
commit
553f99027d
|
@ -20,6 +20,7 @@
|
|||
<delete dir="${distbindir}/.nant"/>
|
||||
<delete>
|
||||
<fileset basedir="${distbindir}">
|
||||
<include name="compile.bat"/>
|
||||
<include name="BUILDING.txt"/>
|
||||
<include name="Makefile"/>
|
||||
<include name="nant-color"/>
|
||||
|
@ -29,7 +30,7 @@
|
|||
<include name="TESTING.txt"/>
|
||||
<include name="TestResult.xml"/>
|
||||
<include name="bin/OpenSim.Server.ini"/>
|
||||
<include name="bin/Regions/*"/>
|
||||
<include name="bin/Regions/Regions.ini"/>
|
||||
<include name="bin/*.db"/>
|
||||
<include name="**/.git/**"/>
|
||||
<include name=".gitignore"/>
|
||||
|
@ -90,6 +91,11 @@
|
|||
the assembly here as an exec, and you add the fail clause later.
|
||||
This lets all the unit tests run and tells you if they fail at the
|
||||
end, instead of stopping short -->
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests">
|
||||
<arg value="./bin/OpenSim.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Tests.dll" />
|
||||
</exec>
|
||||
|
@ -255,6 +261,11 @@
|
|||
|
||||
<mkdir dir="test-results" failonerror="false" />
|
||||
<!-- Unit Test Assembly -->
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.tests">
|
||||
<arg value="./bin/OpenSim.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Tests.dll-Results.xml" />
|
||||
|
@ -297,6 +308,7 @@
|
|||
<arg value="-xml=test-results/OpenSim.Data.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
|
||||
<!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" /> -->
|
||||
|
|
|
@ -95,6 +95,7 @@ what it is today.
|
|||
* Mic Bowman
|
||||
* Michelle Argus
|
||||
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
|
||||
* Micheil Merlin
|
||||
* Mike Osias (IBM)
|
||||
* Mike Pitman (IBM)
|
||||
* mikkopa/_someone - RealXtend
|
||||
|
|
|
@ -122,7 +122,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||
Thread.CurrentThread.ManagedThreadId.ToString() +
|
||||
")");
|
||||
m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
|
||||
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
if (scene != null)
|
||||
{
|
||||
m_newRegionCreatedHandler = OnNewRegionCreated;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1015,11 +1015,15 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
public void SendTeleportLocationStart()
|
||||
public void SendTeleportStart(uint flags)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
public void SendTeleportProgress(uint flags, string message)
|
||||
{
|
||||
}
|
||||
|
||||
public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
|
@ -1035,11 +1039,6 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
// Minimap function, not used.
|
||||
}
|
||||
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
public void SetChildAgentThrottle(byte[] throttle)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
|
|
|
@ -573,7 +573,12 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
|||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendTeleportLocationStart()
|
||||
public void SendTeleportStart(uint flags)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendTeleportProgress(uint flags, string message)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
@ -593,11 +598,6 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
|||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetChildAgentThrottle(byte[] throttle)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
|
|
@ -579,7 +579,12 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
|||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendTeleportLocationStart()
|
||||
public void SendTeleportStart(uint flags)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendTeleportProgress(uint flags, string message)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
@ -599,11 +604,6 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
|||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetChildAgentThrottle(byte[] throttle)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace OpenSim.Data
|
|||
|
||||
List<RegionData> GetDefaultRegions(UUID scopeID);
|
||||
List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
|
||||
List<RegionData> GetHyperlinks(UUID scopeID);
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
@ -78,4 +79,26 @@ namespace OpenSim.Data
|
|||
Authenticate = 256, // Require authentication
|
||||
Hyperlink = 512 // Record represents a HG link
|
||||
}
|
||||
|
||||
public class RegionDataDistanceCompare : IComparer<RegionData>
|
||||
{
|
||||
private Vector2 m_origin;
|
||||
|
||||
public RegionDataDistanceCompare(int x, int y)
|
||||
{
|
||||
m_origin = new Vector2(x, y);
|
||||
}
|
||||
|
||||
public int Compare(RegionData regionA, RegionData regionB)
|
||||
{
|
||||
Vector2 vectorA = new Vector2(regionA.posX, regionA.posY);
|
||||
Vector2 vectorB = new Vector2(regionB.posX, regionB.posY);
|
||||
return Math.Sign(VectorDistance(m_origin, vectorA) - VectorDistance(m_origin, vectorB));
|
||||
}
|
||||
|
||||
private float VectorDistance(Vector2 x, Vector2 y)
|
||||
{
|
||||
return (x - y).Length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID)
|
|||
ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice,
|
||||
SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem,
|
||||
ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches,
|
||||
LinkNumber = @LinkNumber
|
||||
LinkNumber = @LinkNumber, MediaURL = @MediaURL
|
||||
WHERE UUID = @UUID
|
||||
END
|
||||
ELSE
|
||||
|
@ -342,7 +342,7 @@ ELSE
|
|||
PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX,
|
||||
OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ,
|
||||
ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA,
|
||||
ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber
|
||||
ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL
|
||||
) VALUES (
|
||||
@UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask,
|
||||
@EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX,
|
||||
|
@ -352,7 +352,7 @@ ELSE
|
|||
@PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX,
|
||||
@OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ,
|
||||
@ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA,
|
||||
@ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber
|
||||
@ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL
|
||||
)
|
||||
END";
|
||||
|
||||
|
@ -385,7 +385,7 @@ IF EXISTS (SELECT UUID FROM primshapes WHERE UUID = @UUID)
|
|||
PathSkew = @PathSkew, PathCurve = @PathCurve, PathRadiusOffset = @PathRadiusOffset, PathRevolutions = @PathRevolutions,
|
||||
PathTaperX = @PathTaperX, PathTaperY = @PathTaperY, PathTwist = @PathTwist, PathTwistBegin = @PathTwistBegin,
|
||||
ProfileBegin = @ProfileBegin, ProfileEnd = @ProfileEnd, ProfileCurve = @ProfileCurve, ProfileHollow = @ProfileHollow,
|
||||
Texture = @Texture, ExtraParams = @ExtraParams, State = @State
|
||||
Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media
|
||||
WHERE UUID = @UUID
|
||||
END
|
||||
ELSE
|
||||
|
@ -394,11 +394,11 @@ ELSE
|
|||
primshapes (
|
||||
UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY,
|
||||
PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin,
|
||||
ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State
|
||||
ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media
|
||||
) VALUES (
|
||||
@UUID, @Shape, @ScaleX, @ScaleY, @ScaleZ, @PCode, @PathBegin, @PathEnd, @PathScaleX, @PathScaleY, @PathShearX, @PathShearY,
|
||||
@PathSkew, @PathCurve, @PathRadiusOffset, @PathRevolutions, @PathTaperX, @PathTaperY, @PathTwist, @PathTwistBegin, @ProfileBegin,
|
||||
@ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State
|
||||
@ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media
|
||||
)
|
||||
END";
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ VALUES
|
|||
prim.SitName = (string)primRow["SitName"];
|
||||
prim.TouchName = (string)primRow["TouchName"];
|
||||
// permissions
|
||||
prim.ObjectFlags = Convert.ToUInt32(primRow["ObjectFlags"]);
|
||||
prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
|
||||
prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
|
||||
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
|
||||
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
|
||||
|
@ -1127,6 +1127,9 @@ VALUES
|
|||
if (Convert.ToInt16(primRow["PassTouches"]) != 0)
|
||||
prim.PassTouches = true;
|
||||
prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
|
||||
|
||||
if (!(primRow["MediaURL"] is System.DBNull))
|
||||
prim.MediaUrl = (string)primRow["MediaURL"];
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
@ -1180,6 +1183,9 @@ VALUES
|
|||
{
|
||||
}
|
||||
|
||||
if (!(shapeRow["Media"] is System.DBNull))
|
||||
baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
|
||||
|
||||
return baseShape;
|
||||
}
|
||||
|
||||
|
@ -1402,7 +1408,7 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("SitName", prim.SitName));
|
||||
parameters.Add(_Database.CreateParameter("TouchName", prim.TouchName));
|
||||
// permissions
|
||||
parameters.Add(_Database.CreateParameter("ObjectFlags", prim.ObjectFlags));
|
||||
parameters.Add(_Database.CreateParameter("ObjectFlags", (uint)prim.Flags));
|
||||
parameters.Add(_Database.CreateParameter("CreatorID", prim.CreatorID));
|
||||
parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
|
||||
parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
|
||||
|
@ -1509,7 +1515,8 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("PassTouches", 1));
|
||||
else
|
||||
parameters.Add(_Database.CreateParameter("PassTouches", 0));
|
||||
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
||||
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
|
||||
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
@ -1557,6 +1564,7 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry));
|
||||
parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams));
|
||||
parameters.Add(_Database.CreateParameter("State", s.State));
|
||||
parameters.Add(_Database.CreateParameter("Media", null == s.Media ? null : s.Media.ToXml()));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
|
|
@ -310,23 +310,26 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
public List<RegionData> GetDefaultRegions(UUID scopeID)
|
||||
{
|
||||
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 1) <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " AND ScopeID = @scopeID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
conn.Open();
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
|
||||
return Get((int)RegionFlags.DefaultRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||
{
|
||||
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 2) <> 0";
|
||||
List<RegionData> regions = Get((int)RegionFlags.FallbackRegion, scopeID);
|
||||
RegionDataDistanceCompare distanceComparer = new RegionDataDistanceCompare(x, y);
|
||||
regions.Sort(distanceComparer);
|
||||
|
||||
return regions;
|
||||
}
|
||||
|
||||
public List<RegionData> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.Hyperlink, scopeID);
|
||||
}
|
||||
|
||||
private List<RegionData> Get(int regionFlags, UUID scopeID)
|
||||
{
|
||||
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
sql += " AND ScopeID = @scopeID";
|
||||
|
||||
|
@ -335,7 +338,6 @@ namespace OpenSim.Data.MSSQL
|
|||
{
|
||||
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
|
||||
conn.Open();
|
||||
// TODO: distance-sort results
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
:VERSION 1
|
||||
|
||||
CREATE TABLE [dbo].[prims](
|
||||
|
@ -925,5 +925,12 @@ ALTER TABLE regionsettings ADD loaded_creation_datetime int NOT NULL default 0
|
|||
|
||||
COMMIT
|
||||
|
||||
:VERSION 24
|
||||
-- Added post 0.7
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE prims ADD COLUMN MediaURL varchar(255)
|
||||
ALTER TABLE primshapes ADD COLUMN Media TEXT
|
||||
|
||||
COMMIT
|
|
@ -67,7 +67,6 @@ namespace OpenSim.Data
|
|||
/// really want is the assembly of your database class.
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
public class Migration
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -173,8 +172,6 @@ namespace OpenSim.Data
|
|||
ExecuteScript(_conn, script);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
InitMigrationsTable();
|
||||
|
@ -186,8 +183,8 @@ namespace OpenSim.Data
|
|||
return;
|
||||
|
||||
// to prevent people from killing long migrations.
|
||||
m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]);
|
||||
m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!");
|
||||
m_log.InfoFormat("[MIGRATIONS]: Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]);
|
||||
m_log.Info("[MIGRATIONS]: NOTE - this may take a while, don't interrupt this process!");
|
||||
|
||||
foreach (KeyValuePair<int, string[]> kvp in migrations)
|
||||
{
|
||||
|
@ -206,7 +203,7 @@ namespace OpenSim.Data
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", e.Message.Replace("\n", " "));
|
||||
m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " "));
|
||||
m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.");
|
||||
ExecuteScript("ROLLBACK;");
|
||||
}
|
||||
|
@ -410,9 +407,8 @@ scan_old_style:
|
|||
}
|
||||
|
||||
if (migrations.Count < 1)
|
||||
{
|
||||
m_log.InfoFormat("[MIGRATIONS]: {0} up to date, no migrations to apply", _type);
|
||||
}
|
||||
m_log.DebugFormat("[MIGRATIONS]: {0} data tables already up to date at revision {1}", _type, after);
|
||||
|
||||
return migrations;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace OpenSim.Data.MySQL
|
|||
"ParticleSystem, ClickAction, Material, " +
|
||||
"CollisionSound, CollisionSoundVolume, " +
|
||||
"PassTouches, " +
|
||||
"LinkNumber) values (" + "?UUID, " +
|
||||
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
||||
"?CreationDate, ?Name, ?Text, " +
|
||||
"?Description, ?SitName, ?TouchName, " +
|
||||
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
||||
|
@ -205,7 +205,7 @@ namespace OpenSim.Data.MySQL
|
|||
"?SaleType, ?ColorR, ?ColorG, " +
|
||||
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
||||
"?ClickAction, ?Material, ?CollisionSound, " +
|
||||
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber)";
|
||||
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
||||
|
||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||
|
||||
|
@ -222,7 +222,7 @@ namespace OpenSim.Data.MySQL
|
|||
"PathTaperX, PathTaperY, PathTwist, " +
|
||||
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
||||
"ProfileCurve, ProfileHollow, Texture, " +
|
||||
"ExtraParams, State) values (?UUID, " +
|
||||
"ExtraParams, State, Media) values (?UUID, " +
|
||||
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
||||
"?PCode, ?PathBegin, ?PathEnd, " +
|
||||
"?PathScaleX, ?PathScaleY, " +
|
||||
|
@ -233,7 +233,7 @@ namespace OpenSim.Data.MySQL
|
|||
"?PathTwistBegin, ?ProfileBegin, " +
|
||||
"?ProfileEnd, ?ProfileCurve, " +
|
||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||
"?State)";
|
||||
"?State, ?Media)";
|
||||
|
||||
FillShapeCommand(cmd, prim);
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ namespace OpenSim.Data.MySQL
|
|||
prim.SitName = (string)row["SitName"];
|
||||
prim.TouchName = (string)row["TouchName"];
|
||||
// Permissions
|
||||
prim.ObjectFlags = (uint)(int)row["ObjectFlags"];
|
||||
prim.Flags = (PrimFlags)(int)row["ObjectFlags"];
|
||||
prim.OwnerMask = (uint)(int)row["OwnerMask"];
|
||||
prim.NextOwnerMask = (uint)(int)row["NextOwnerMask"];
|
||||
prim.GroupMask = (uint)(int)row["GroupMask"];
|
||||
|
@ -1184,6 +1184,9 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
prim.PassTouches = ((sbyte)row["PassTouches"] != 0);
|
||||
prim.LinkNum = (int)row["LinkNumber"];
|
||||
|
||||
if (!(row["MediaURL"] is System.DBNull))
|
||||
prim.MediaUrl = (string)row["MediaURL"];
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
@ -1411,7 +1414,7 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("SitName", prim.SitName);
|
||||
cmd.Parameters.AddWithValue("TouchName", prim.TouchName);
|
||||
// permissions
|
||||
cmd.Parameters.AddWithValue("ObjectFlags", prim.ObjectFlags);
|
||||
cmd.Parameters.AddWithValue("ObjectFlags", (uint)prim.Flags);
|
||||
cmd.Parameters.AddWithValue("CreatorID", prim.CreatorID.ToString());
|
||||
cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString());
|
||||
cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString());
|
||||
|
@ -1521,6 +1524,7 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("PassTouches", 0);
|
||||
|
||||
cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
|
||||
cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1700,6 +1704,9 @@ namespace OpenSim.Data.MySQL
|
|||
s.ExtraParams = (byte[])row["ExtraParams"];
|
||||
|
||||
s.State = (byte)(int)row["State"];
|
||||
|
||||
if (!(row["Media"] is System.DBNull))
|
||||
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -1743,6 +1750,7 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("Texture", s.TextureEntry);
|
||||
cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams);
|
||||
cmd.Parameters.AddWithValue("State", s.State);
|
||||
cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
|
||||
}
|
||||
|
||||
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||
|
|
|
@ -210,6 +210,9 @@ namespace OpenSim.Data.MySQL
|
|||
if (data.Data.ContainsKey("locY"))
|
||||
data.Data.Remove("locY");
|
||||
|
||||
if (data.RegionName.Length > 32)
|
||||
data.RegionName = data.RegionName.Substring(0, 32);
|
||||
|
||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
|
@ -281,22 +284,28 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<RegionData> GetDefaultRegions(UUID scopeID)
|
||||
{
|
||||
string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(command);
|
||||
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
return RunCommand(cmd);
|
||||
return Get((int)RegionFlags.DefaultRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||
{
|
||||
string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0";
|
||||
List<RegionData> regions = Get((int)RegionFlags.FallbackRegion, scopeID);
|
||||
RegionDataDistanceCompare distanceComparer = new RegionDataDistanceCompare(x, y);
|
||||
regions.Sort(distanceComparer);
|
||||
return regions;
|
||||
}
|
||||
|
||||
public List<RegionData> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.Hyperlink, scopeID);
|
||||
}
|
||||
|
||||
private List<RegionData> Get(int regionFlags, UUID scopeID)
|
||||
{
|
||||
string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
|
||||
if (scopeID != UUID.Zero)
|
||||
command += " and ScopeID = ?scopeID";
|
||||
|
||||
|
@ -304,7 +313,6 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
// TODO: distance-sort results
|
||||
return RunCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,14 +64,22 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
if (folder.folderName.Length > 64)
|
||||
folder.folderName = folder.folderName.Substring(0, 64);
|
||||
|
||||
return m_Folders.Store(folder);
|
||||
}
|
||||
|
||||
public bool StoreItem(XInventoryItem item)
|
||||
{
|
||||
if (item.inventoryName.Length > 64)
|
||||
item.inventoryName = item.inventoryName.Substring(0, 64);
|
||||
if (item.inventoryDescription.Length > 128)
|
||||
item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
|
||||
|
||||
return m_Items.Store(item);
|
||||
}
|
||||
|
||||
|
||||
public bool DeleteFolders(string field, string val)
|
||||
{
|
||||
return m_Folders.Delete(field, val);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
:VERSION 1 #---------------------
|
||||
|
||||
BEGIN;
|
||||
|
@ -787,8 +787,6 @@ CREATE TABLE `regionwindlight` (
|
|||
PRIMARY KEY (`region_id`)
|
||||
);
|
||||
|
||||
ALTER TABLE estate_settings AUTO_INCREMENT = 100;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 33 #---------------------
|
||||
|
||||
|
@ -802,3 +800,10 @@ BEGIN;
|
|||
ALTER TABLE `regionwindlight` CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` FLOAT(4,2) NOT NULL DEFAULT '0.20' AFTER `cloud_detail_density`, CHANGE COLUMN `cloud_scroll_y` `cloud_scroll_y` FLOAT(4,2) NOT NULL DEFAULT '0.01' AFTER `cloud_scroll_x_lock`;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 35 #---------------------
|
||||
-- Added post 0.7
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
|
||||
ALTER TABLE primshapes ADD COLUMN Media TEXT;
|
||||
COMMIT;
|
|
@ -164,34 +164,36 @@ namespace OpenSim.Data.Null
|
|||
|
||||
public List<RegionData> GetDefaultRegions(UUID scopeID)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.GetDefaultRegions(scopeID);
|
||||
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & 1) != 0)
|
||||
ret.Add(r);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return Get((int)RegionFlags.DefaultRegion, scopeID);
|
||||
}
|
||||
|
||||
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
|
||||
{
|
||||
List<RegionData> regions = Get((int)RegionFlags.FallbackRegion, scopeID);
|
||||
RegionDataDistanceCompare distanceComparer = new RegionDataDistanceCompare(x, y);
|
||||
regions.Sort(distanceComparer);
|
||||
return regions;
|
||||
}
|
||||
|
||||
public List<RegionData> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return Get((int)RegionFlags.Hyperlink, scopeID);
|
||||
}
|
||||
|
||||
private List<RegionData> Get(int regionFlags, UUID scopeID)
|
||||
{
|
||||
if (Instance != this)
|
||||
return Instance.GetFallbackRegions(scopeID, x, y);
|
||||
return Instance.Get(regionFlags, scopeID);
|
||||
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & 2) != 0)
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
|
||||
ret.Add(r);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,19 +3,10 @@
|
|||
<Import assembly="OpenSim.Data.dll" />
|
||||
<Import assembly="OpenSim.Framework.dll" />
|
||||
</Runtime>
|
||||
<ExtensionPoint path = "/OpenSim/GridData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/LogData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/AssetData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/InventoryData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
<ExtensionPoint path = "/OpenSim/UserData">
|
||||
<ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin" />
|
||||
</ExtensionPoint>
|
||||
</Addin>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
BEGIN;
|
||||
|
||||
ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
|
||||
ALTER TABLE primshapes ADD COLUMN Media TEXT;
|
||||
|
||||
COMMIT;
|
|
@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
public EstateSettings LoadEstateSettings(int estateID)
|
||||
{
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID";
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
List<int> result = new List<int>();
|
||||
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName";
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ using System.Reflection;
|
|||
using log4net;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -974,6 +975,8 @@ namespace OpenSim.Data.SQLite
|
|||
createCol(prims, "CollisionSoundVolume", typeof(Double));
|
||||
|
||||
createCol(prims, "VolumeDetect", typeof(Int16));
|
||||
|
||||
createCol(prims, "MediaURL", typeof(String));
|
||||
|
||||
// Add in contraints
|
||||
prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
|
||||
|
@ -1021,6 +1024,7 @@ namespace OpenSim.Data.SQLite
|
|||
// way to specify this as a blob atm
|
||||
createCol(shapes, "Texture", typeof (Byte[]));
|
||||
createCol(shapes, "ExtraParams", typeof (Byte[]));
|
||||
createCol(shapes, "Media", typeof(String));
|
||||
|
||||
shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
|
||||
|
||||
|
@ -1339,6 +1343,12 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
if (Convert.ToInt16(row["VolumeDetect"]) != 0)
|
||||
prim.VolumeDetectActive = true;
|
||||
|
||||
if (!(row["MediaURL"] is System.DBNull))
|
||||
{
|
||||
//m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
|
||||
prim.MediaUrl = (string)row["MediaURL"];
|
||||
}
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
@ -1614,7 +1624,6 @@ namespace OpenSim.Data.SQLite
|
|||
row["PayButton3"] = prim.PayPrice[3];
|
||||
row["PayButton4"] = prim.PayPrice[4];
|
||||
|
||||
|
||||
row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation);
|
||||
row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem);
|
||||
|
||||
|
@ -1674,7 +1683,8 @@ namespace OpenSim.Data.SQLite
|
|||
row["VolumeDetect"] = 1;
|
||||
else
|
||||
row["VolumeDetect"] = 0;
|
||||
|
||||
|
||||
row["MediaURL"] = prim.MediaUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1849,6 +1859,10 @@ namespace OpenSim.Data.SQLite
|
|||
s.TextureEntry = textureEntry;
|
||||
|
||||
s.ExtraParams = (byte[]) row["ExtraParams"];
|
||||
|
||||
if (!(row["Media"] is System.DBNull))
|
||||
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -1892,17 +1906,19 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
row["Texture"] = s.TextureEntry;
|
||||
row["ExtraParams"] = s.ExtraParams;
|
||||
|
||||
if (s.Media != null)
|
||||
row["Media"] = s.Media.ToXml();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Persistently store a prim.
|
||||
/// </summary>
|
||||
/// <param name="prim"></param>
|
||||
/// <param name="sceneGroupID"></param>
|
||||
/// <param name="regionUUID"></param>
|
||||
private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID)
|
||||
{
|
||||
|
||||
DataTable prims = ds.Tables["prims"];
|
||||
DataTable shapes = ds.Tables["primshapes"];
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
if (words.Length == 1)
|
||||
{
|
||||
cmd.CommandText = String.Format("select * from {0} where ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
||||
m_Realm, scopeID.ToString(), words[0]);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -66,11 +66,19 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
if (folder.folderName.Length > 64)
|
||||
folder.folderName = folder.folderName.Substring(0, 64);
|
||||
|
||||
return m_Folders.Store(folder);
|
||||
}
|
||||
|
||||
public bool StoreItem(XInventoryItem item)
|
||||
{
|
||||
if (item.inventoryName.Length > 64)
|
||||
item.inventoryName = item.inventoryName.Substring(0, 64);
|
||||
if (item.inventoryDescription.Length > 128)
|
||||
item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
|
||||
|
||||
return m_Items.Store(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLiteLegacy
|
|||
|
||||
public EstateSettings LoadEstateSettings(int estateID)
|
||||
{
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID";
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLiteLegacy
|
|||
{
|
||||
List<int> result = new List<int>();
|
||||
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName";
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
|
|
|
@ -1187,7 +1187,7 @@ namespace OpenSim.Data.SQLiteLegacy
|
|||
prim.SitName = (String) row["SitName"];
|
||||
prim.TouchName = (String) row["TouchName"];
|
||||
// permissions
|
||||
prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
|
||||
prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]);
|
||||
prim.CreatorID = new UUID((String) row["CreatorID"]);
|
||||
prim.OwnerID = new UUID((String) row["OwnerID"]);
|
||||
prim.GroupID = new UUID((String) row["GroupID"]);
|
||||
|
@ -1521,7 +1521,7 @@ namespace OpenSim.Data.SQLiteLegacy
|
|||
row["SitName"] = prim.SitName;
|
||||
row["TouchName"] = prim.TouchName;
|
||||
// permissions
|
||||
row["ObjectFlags"] = prim.ObjectFlags;
|
||||
row["ObjectFlags"] = (uint)prim.Flags;
|
||||
row["CreatorID"] = prim.CreatorID.ToString();
|
||||
row["OwnerID"] = prim.OwnerID.ToString();
|
||||
row["GroupID"] = prim.GroupID.ToString();
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace OpenSim.Data.Tests
|
|||
sop.CreatorID = creator;
|
||||
sop.InventorySerial = iserial;
|
||||
sop.TaskInventory = dic;
|
||||
sop.ObjectFlags = objf;
|
||||
sop.Flags = (PrimFlags)objf;
|
||||
sop.Name = name;
|
||||
sop.Material = material;
|
||||
sop.ScriptAccessPin = pin;
|
||||
|
@ -350,7 +350,7 @@ namespace OpenSim.Data.Tests
|
|||
// Modified in-class
|
||||
// Assert.That(iserial,Is.EqualTo(sop.InventorySerial), "Assert.That(iserial,Is.EqualTo(sop.InventorySerial))");
|
||||
Assert.That(dic,Is.EqualTo(sop.TaskInventory), "Assert.That(dic,Is.EqualTo(sop.TaskInventory))");
|
||||
Assert.That(objf,Is.EqualTo(sop.ObjectFlags), "Assert.That(objf,Is.EqualTo(sop.ObjectFlags))");
|
||||
Assert.That(objf, Is.EqualTo((uint)sop.Flags), "Assert.That(objf,Is.EqualTo(sop.Flags))");
|
||||
Assert.That(name,Is.EqualTo(sop.Name), "Assert.That(name,Is.EqualTo(sop.Name))");
|
||||
Assert.That(material,Is.EqualTo(sop.Material), "Assert.That(material,Is.EqualTo(sop.Material))");
|
||||
Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin))");
|
||||
|
@ -373,7 +373,7 @@ namespace OpenSim.Data.Tests
|
|||
Assert.That(updatef,Is.EqualTo(sop.UpdateFlag), "Assert.That(updatef,Is.EqualTo(sop.UpdateFlag))");
|
||||
|
||||
// This is necessary or object will not be inserted in DB
|
||||
sop.ObjectFlags = 0;
|
||||
sop.Flags = PrimFlags.None;
|
||||
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
|
||||
|
@ -398,7 +398,7 @@ namespace OpenSim.Data.Tests
|
|||
Assert.That(creator,Is.EqualTo(p.CreatorID), "Assert.That(creator,Is.EqualTo(p.CreatorID))");
|
||||
//Assert.That(iserial,Is.EqualTo(p.InventorySerial), "Assert.That(iserial,Is.EqualTo(p.InventorySerial))");
|
||||
Assert.That(dic,Is.EqualTo(p.TaskInventory), "Assert.That(dic,Is.EqualTo(p.TaskInventory))");
|
||||
//Assert.That(objf,Is.EqualTo(p.ObjectFlags), "Assert.That(objf,Is.EqualTo(p.ObjectFlags))");
|
||||
//Assert.That(objf, Is.EqualTo((uint)p.Flags), "Assert.That(objf,Is.EqualTo(p.Flags))");
|
||||
Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))");
|
||||
Assert.That(material,Is.EqualTo(p.Material), "Assert.That(material,Is.EqualTo(p.Material))");
|
||||
Assert.That(pin,Is.EqualTo(p.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(p.ScriptAccessPin))");
|
||||
|
@ -781,7 +781,7 @@ namespace OpenSim.Data.Tests
|
|||
// Ownership changes when you drop an object into an object
|
||||
// owned by someone else
|
||||
Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))");
|
||||
Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
|
||||
// Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 16), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
|
||||
Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))");
|
||||
Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))");
|
||||
}
|
||||
|
|
|
@ -1,252 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
// ACL Class
|
||||
// Modelled after the structure of the Zend ACL Framework Library
|
||||
// with one key difference - the tree will search for all matching
|
||||
// permissions rather than just the first. Deny permissions will
|
||||
// override all others.
|
||||
|
||||
#region ACL Core Class
|
||||
|
||||
/// <summary>
|
||||
/// Access Control List Engine
|
||||
/// </summary>
|
||||
public class ACL
|
||||
{
|
||||
private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>();
|
||||
private Dictionary<string, Role> Roles = new Dictionary<string, Role>();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new role
|
||||
/// </summary>
|
||||
/// <param name="role"></param>
|
||||
/// <returns></returns>
|
||||
public ACL AddRole(Role role)
|
||||
{
|
||||
if (Roles.ContainsKey(role.Name))
|
||||
throw new AlreadyContainsRoleException(role);
|
||||
|
||||
Roles.Add(role.Name, role);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new resource
|
||||
/// </summary>
|
||||
/// <param name="resource"></param>
|
||||
/// <returns></returns>
|
||||
public ACL AddResource(Resource resource)
|
||||
{
|
||||
Resources.Add(resource.Name, resource);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Permision for user/roll on a resource
|
||||
/// </summary>
|
||||
/// <param name="role"></param>
|
||||
/// <param name="resource"></param>
|
||||
/// <returns></returns>
|
||||
public Permission HasPermission(string role, string resource)
|
||||
{
|
||||
if (!Roles.ContainsKey(role))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
if (!Resources.ContainsKey(resource))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
return Roles[role].RequestPermission(resource);
|
||||
}
|
||||
|
||||
public ACL GrantPermission(string role, string resource)
|
||||
{
|
||||
if (!Roles.ContainsKey(role))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
if (!Resources.ContainsKey(resource))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
Roles[role].GivePermission(resource, Permission.Allow);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ACL DenyPermission(string role, string resource)
|
||||
{
|
||||
if (!Roles.ContainsKey(role))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
if (!Resources.ContainsKey(resource))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
Roles[role].GivePermission(resource, Permission.Deny);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ACL ResetPermission(string role, string resource)
|
||||
{
|
||||
if (!Roles.ContainsKey(role))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
if (!Resources.ContainsKey(resource))
|
||||
throw new KeyNotFoundException();
|
||||
|
||||
Roles[role].GivePermission(resource, Permission.None);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Exceptions
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when an ACL attempts to add a duplicate role.
|
||||
/// </summary>
|
||||
public class AlreadyContainsRoleException : Exception
|
||||
{
|
||||
protected Role m_role;
|
||||
|
||||
public AlreadyContainsRoleException(Role role)
|
||||
{
|
||||
m_role = role;
|
||||
}
|
||||
|
||||
public Role ErrorRole
|
||||
{
|
||||
get { return m_role; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "This ACL already contains a role called '" + m_role.Name + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Roles and Resources
|
||||
|
||||
/// <summary>
|
||||
/// Does this Role have permission to access a specified Resource?
|
||||
/// </summary>
|
||||
public enum Permission
|
||||
{
|
||||
Deny,
|
||||
None,
|
||||
Allow
|
||||
} ;
|
||||
|
||||
/// <summary>
|
||||
/// A role class, for use with Users or Groups
|
||||
/// </summary>
|
||||
public class Role
|
||||
{
|
||||
private string m_name;
|
||||
private Role[] m_parents;
|
||||
private Dictionary<string, Permission> m_resources = new Dictionary<string, Permission>();
|
||||
|
||||
public Role(string name)
|
||||
{
|
||||
m_name = name;
|
||||
m_parents = null;
|
||||
}
|
||||
|
||||
public Role(string name, Role[] parents)
|
||||
{
|
||||
m_name = name;
|
||||
m_parents = parents;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
}
|
||||
|
||||
public Permission RequestPermission(string resource)
|
||||
{
|
||||
return RequestPermission(resource, Permission.None);
|
||||
}
|
||||
|
||||
public Permission RequestPermission(string resource, Permission current)
|
||||
{
|
||||
// Deny permissions always override any others
|
||||
if (current == Permission.Deny)
|
||||
return current;
|
||||
|
||||
Permission temp = Permission.None;
|
||||
|
||||
// Pickup non-None permissions
|
||||
if (m_resources.ContainsKey(resource) && m_resources[resource] != Permission.None)
|
||||
temp = m_resources[resource];
|
||||
|
||||
if (m_parents != null)
|
||||
{
|
||||
foreach (Role parent in m_parents)
|
||||
{
|
||||
temp = parent.RequestPermission(resource, temp);
|
||||
}
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
public void GivePermission(string resource, Permission perm)
|
||||
{
|
||||
m_resources[resource] = perm;
|
||||
}
|
||||
}
|
||||
|
||||
public class Resource
|
||||
{
|
||||
private string m_name;
|
||||
|
||||
public Resource(string name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
|
@ -34,8 +34,23 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public class AvatarWearable
|
||||
{
|
||||
public UUID AssetID = new UUID("00000000-0000-0000-0000-000000000000");
|
||||
public UUID ItemID = new UUID("00000000-0000-0000-0000-000000000000");
|
||||
public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
|
||||
public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
|
||||
public static readonly UUID DEFAULT_HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66");
|
||||
public static readonly UUID DEFAULT_HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
|
||||
|
||||
public static readonly UUID DEFAULT_SKIN_ITEM = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9");
|
||||
public static readonly UUID DEFAULT_SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
|
||||
|
||||
public static readonly UUID DEFAULT_SHIRT_ITEM = new UUID("77c41e39-38f9-f75a-0000-585989bf0000");
|
||||
public static readonly UUID DEFAULT_SHIRT_ASSET = new UUID("00000000-38f9-1111-024e-222222111110");
|
||||
|
||||
public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
|
||||
public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120");
|
||||
|
||||
public UUID AssetID;
|
||||
public UUID ItemID;
|
||||
|
||||
public AvatarWearable()
|
||||
{
|
||||
|
@ -58,24 +73,24 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
// Body
|
||||
defaultWearables[0].ItemID = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
|
||||
defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
defaultWearables[0].ItemID = DEFAULT_BODY_ITEM;
|
||||
defaultWearables[0].AssetID = DEFAULT_BODY_ASSET;
|
||||
|
||||
// Hair
|
||||
defaultWearables[2].ItemID = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66");
|
||||
defaultWearables[2].AssetID = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
|
||||
defaultWearables[2].ItemID = DEFAULT_HAIR_ITEM;
|
||||
defaultWearables[2].AssetID = DEFAULT_HAIR_ASSET;
|
||||
|
||||
// Skin
|
||||
defaultWearables[1].ItemID = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9");
|
||||
defaultWearables[1].AssetID = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
|
||||
defaultWearables[1].ItemID = DEFAULT_SKIN_ITEM;
|
||||
defaultWearables[1].AssetID = DEFAULT_SKIN_ASSET;
|
||||
|
||||
// Shirt
|
||||
defaultWearables[4].ItemID = new UUID("77c41e39-38f9-f75a-0000-585989bf0000");
|
||||
defaultWearables[4].AssetID = new UUID("00000000-38f9-1111-024e-222222111110");
|
||||
defaultWearables[4].ItemID = DEFAULT_SHIRT_ITEM;
|
||||
defaultWearables[4].AssetID = DEFAULT_SHIRT_ASSET;
|
||||
|
||||
// Pants
|
||||
defaultWearables[5].ItemID = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
|
||||
defaultWearables[5].AssetID = new UUID("00000000-38f9-1111-024e-222222111120");
|
||||
defaultWearables[5].ItemID = DEFAULT_PANTS_ITEM;
|
||||
defaultWearables[5].AssetID = DEFAULT_PANTS_ASSET;
|
||||
|
||||
return defaultWearables;
|
||||
}
|
||||
|
|
|
@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(client))
|
||||
if (!mm.UploadCovered(client, mm.UploadCharge))
|
||||
{
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
|
|
|
@ -265,6 +265,46 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public class ControllerData
|
||||
{
|
||||
public UUID ItemID;
|
||||
public uint IgnoreControls;
|
||||
public uint EventControls;
|
||||
|
||||
public ControllerData(UUID item, uint ignore, uint ev)
|
||||
{
|
||||
ItemID = item;
|
||||
IgnoreControls = ignore;
|
||||
EventControls = ev;
|
||||
}
|
||||
|
||||
public ControllerData(OSDMap args)
|
||||
{
|
||||
UnpackUpdateMessage(args);
|
||||
}
|
||||
|
||||
public OSDMap PackUpdateMessage()
|
||||
{
|
||||
OSDMap controldata = new OSDMap();
|
||||
controldata["item"] = OSD.FromUUID(ItemID);
|
||||
controldata["ignore"] = OSD.FromInteger(IgnoreControls);
|
||||
controldata["event"] = OSD.FromInteger(EventControls);
|
||||
|
||||
return controldata;
|
||||
}
|
||||
|
||||
|
||||
public void UnpackUpdateMessage(OSDMap args)
|
||||
{
|
||||
if (args["item"] != null)
|
||||
ItemID = args["item"].AsUUID();
|
||||
if (args["ignore"] != null)
|
||||
IgnoreControls = (uint)args["ignore"].AsInteger();
|
||||
if (args["event"] != null)
|
||||
EventControls = (uint)args["event"].AsInteger();
|
||||
}
|
||||
}
|
||||
|
||||
public class AgentData : IAgentData
|
||||
{
|
||||
private UUID m_id;
|
||||
|
@ -313,6 +353,9 @@ namespace OpenSim.Framework
|
|||
public UUID[] Wearables;
|
||||
public AttachmentData[] Attachments;
|
||||
|
||||
// Scripted
|
||||
public ControllerData[] Controllers;
|
||||
|
||||
public string CallbackURI;
|
||||
|
||||
public virtual OSDMap Pack()
|
||||
|
@ -403,6 +446,14 @@ namespace OpenSim.Framework
|
|||
args["attachments"] = attachs;
|
||||
}
|
||||
|
||||
if ((Controllers != null) && (Controllers.Length > 0))
|
||||
{
|
||||
OSDArray controls = new OSDArray(Controllers.Length);
|
||||
foreach (ControllerData ctl in Controllers)
|
||||
controls.Add(ctl.PackUpdateMessage());
|
||||
args["controllers"] = controls;
|
||||
}
|
||||
|
||||
|
||||
if ((CallbackURI != null) && (!CallbackURI.Equals("")))
|
||||
args["callback_uri"] = OSD.FromString(CallbackURI);
|
||||
|
@ -559,6 +610,20 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
|
||||
{
|
||||
OSDArray controls = (OSDArray)(args["controllers"]);
|
||||
Controllers = new ControllerData[controls.Count];
|
||||
int i = 0;
|
||||
foreach (OSD o in controls)
|
||||
{
|
||||
if (o.Type == OSDType.Map)
|
||||
{
|
||||
Controllers[i++] = new ControllerData((OSDMap)o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (args["callback_uri"] != null)
|
||||
CallbackURI = args["callback_uri"].AsString();
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace OpenSim.Framework.Console
|
|||
// (Done with no echo and suitable for passwords)
|
||||
public string PasswdPrompt(string p)
|
||||
{
|
||||
return ReadLine(p, false, false);
|
||||
return ReadLine(String.Format("{0}: ", p), false, false);
|
||||
}
|
||||
|
||||
public virtual string ReadLine(string p, bool isCommand, bool e)
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace OpenSim.Framework.Console
|
|||
{
|
||||
public int last;
|
||||
public long lastLineSeen;
|
||||
public bool newConnection = true;
|
||||
}
|
||||
|
||||
// A console that uses REST interfaces
|
||||
|
@ -424,6 +425,12 @@ namespace OpenSim.Framework.Console
|
|||
XmlElement rootElement = xmldoc.CreateElement("", "ConsoleSession",
|
||||
"");
|
||||
|
||||
if (c.newConnection)
|
||||
{
|
||||
c.newConnection = false;
|
||||
Output("+++" + DefaultPrompt);
|
||||
}
|
||||
|
||||
lock (m_Scrollback)
|
||||
{
|
||||
long startLine = m_LineNumber - m_Scrollback.Count;
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class FriendRegionInfo
|
||||
{
|
||||
public bool isOnline;
|
||||
public ulong regionHandle;
|
||||
public UUID regionID;
|
||||
}
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class GridConfig:ConfigBase
|
||||
{
|
||||
public string AllowForcefulBanlines = "TRUE";
|
||||
public bool AllowRegionRegistration = true;
|
||||
public string AssetRecvKey = String.Empty;
|
||||
public string AssetSendKey = String.Empty;
|
||||
|
||||
public string DatabaseProvider = String.Empty;
|
||||
public string DatabaseConnect = String.Empty;
|
||||
public string DefaultAssetServer = String.Empty;
|
||||
public string DefaultUserServer = String.Empty;
|
||||
public uint HttpPort = ConfigSettings.DefaultGridServerHttpPort;
|
||||
public string SimRecvKey = String.Empty;
|
||||
public string SimSendKey = String.Empty;
|
||||
public string UserRecvKey = String.Empty;
|
||||
public string UserSendKey = String.Empty;
|
||||
public string ConsoleUser = String.Empty;
|
||||
public string ConsolePass = String.Empty;
|
||||
|
||||
public GridConfig(string description, string filename)
|
||||
{
|
||||
m_configMember =
|
||||
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
|
||||
m_configMember.performConfigurationRetrieve();
|
||||
}
|
||||
|
||||
public void loadConfigurationOptions()
|
||||
{
|
||||
m_configMember.addConfigurationOption("default_asset_server",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Default Asset Server URI",
|
||||
"http://127.0.0.1:" + ConfigSettings.DefaultAssetServerHttpPort.ToString() + "/",
|
||||
false);
|
||||
m_configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to send to asset server", "null", false);
|
||||
m_configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to expect from asset server", "null", false);
|
||||
|
||||
m_configMember.addConfigurationOption("default_user_server",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Default User Server URI",
|
||||
"http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString() + "/", false);
|
||||
m_configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to send to user server", "null", false);
|
||||
m_configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to expect from user server", "null", false);
|
||||
|
||||
m_configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to send to a simulator", "null", false);
|
||||
m_configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to expect from a simulator", "null", false);
|
||||
m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"DLL for database provider", "OpenSim.Data.MySQL.dll", false);
|
||||
m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Database connect string", "", false);
|
||||
|
||||
m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Http Listener port", ConfigSettings.DefaultGridServerHttpPort.ToString(), false);
|
||||
|
||||
m_configMember.addConfigurationOption("allow_forceful_banlines",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Allow Forceful Banlines", "TRUE", true);
|
||||
|
||||
m_configMember.addConfigurationOption("allow_region_registration",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||
"Allow regions to register immediately upon grid server startup? true/false",
|
||||
"True",
|
||||
false);
|
||||
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access user name [Default: disabled]", "", false);
|
||||
|
||||
m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access password [Default: disabled]", "", false);
|
||||
|
||||
}
|
||||
|
||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||
{
|
||||
switch (configuration_key)
|
||||
{
|
||||
case "default_asset_server":
|
||||
DefaultAssetServer = (string) configuration_result;
|
||||
break;
|
||||
case "asset_send_key":
|
||||
AssetSendKey = (string) configuration_result;
|
||||
break;
|
||||
case "asset_recv_key":
|
||||
AssetRecvKey = (string) configuration_result;
|
||||
break;
|
||||
case "default_user_server":
|
||||
DefaultUserServer = (string) configuration_result;
|
||||
break;
|
||||
case "user_send_key":
|
||||
UserSendKey = (string) configuration_result;
|
||||
break;
|
||||
case "user_recv_key":
|
||||
UserRecvKey = (string) configuration_result;
|
||||
break;
|
||||
case "sim_send_key":
|
||||
SimSendKey = (string) configuration_result;
|
||||
break;
|
||||
case "sim_recv_key":
|
||||
SimRecvKey = (string) configuration_result;
|
||||
break;
|
||||
case "database_provider":
|
||||
DatabaseProvider = (string) configuration_result;
|
||||
break;
|
||||
case "database_connect":
|
||||
DatabaseConnect = (string) configuration_result;
|
||||
break;
|
||||
case "http_port":
|
||||
HttpPort = (uint) configuration_result;
|
||||
break;
|
||||
case "allow_forceful_banlines":
|
||||
AllowForcefulBanlines = (string) configuration_result;
|
||||
break;
|
||||
case "allow_region_registration":
|
||||
AllowRegionRegistration = (bool)configuration_result;
|
||||
break;
|
||||
case "console_user":
|
||||
ConsoleUser = (string)configuration_result;
|
||||
break;
|
||||
case "console_pass":
|
||||
ConsolePass = (string)configuration_result;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Net;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class HGNetworkServersInfo
|
||||
{
|
||||
|
||||
public readonly string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI;
|
||||
|
||||
private static HGNetworkServersInfo m_singleton;
|
||||
public static HGNetworkServersInfo Singleton
|
||||
{
|
||||
get { return m_singleton; }
|
||||
}
|
||||
|
||||
public static void Init(string assetserver, string inventoryserver, string userserver)
|
||||
{
|
||||
m_singleton = new HGNetworkServersInfo(assetserver, inventoryserver, userserver);
|
||||
|
||||
}
|
||||
|
||||
private HGNetworkServersInfo(string a, string i, string u)
|
||||
{
|
||||
LocalAssetServerURI = ServerURI(a);
|
||||
LocalInventoryServerURI = ServerURI(i);
|
||||
LocalUserServerURI = ServerURI(u);
|
||||
}
|
||||
|
||||
public bool IsLocalUser(string userserver)
|
||||
{
|
||||
string userServerURI = ServerURI(userserver);
|
||||
bool ret = (((userServerURI == null) || (userServerURI == "") || (userServerURI == LocalUserServerURI)));
|
||||
//m_log.Debug("-------------> HGNetworkServersInfo.IsLocalUser? " + ret + "(userServer=" + userServerURI + "; localuserserver=" + LocalUserServerURI + ")");
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool IsLocalUser(UserProfileData userData)
|
||||
{
|
||||
if (userData != null)
|
||||
{
|
||||
if (userData is ForeignUserProfileData)
|
||||
return IsLocalUser(((ForeignUserProfileData)userData).UserServerURI);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
// Something fishy; ignore it
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string ServerURI(string uri)
|
||||
{
|
||||
// Get rid of eventual slashes at the end
|
||||
try
|
||||
{
|
||||
if (uri.EndsWith("/"))
|
||||
uri = uri.Substring(0, uri.Length - 1);
|
||||
}
|
||||
catch { }
|
||||
|
||||
IPAddress ipaddr1 = null;
|
||||
string port1 = "";
|
||||
try
|
||||
{
|
||||
ipaddr1 = Util.GetHostFromURL(uri);
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
port1 = uri.Split(new char[] { ':' })[2];
|
||||
}
|
||||
catch { }
|
||||
|
||||
// We tried our best to convert the domain names to IP addresses
|
||||
return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Framework
|
|||
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
|
||||
|
||||
public delegate void ObjectAttach(
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent);
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
|
||||
|
||||
public delegate void ModifyTerrain(UUID user,
|
||||
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
|
||||
|
@ -1011,13 +1011,14 @@ namespace OpenSim.Framework
|
|||
uint flags, string capsURL);
|
||||
|
||||
void SendTeleportFailed(string reason);
|
||||
void SendTeleportLocationStart();
|
||||
void SendTeleportStart(uint flags);
|
||||
void SendTeleportProgress(uint flags, string message);
|
||||
|
||||
void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance);
|
||||
void SendPayPrice(UUID objectID, int[] payPrice);
|
||||
|
||||
void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
|
||||
|
||||
void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID);
|
||||
void SetChildAgentThrottle(byte[] throttle);
|
||||
|
||||
void SendAvatarDataImmediate(ISceneEntity avatar);
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public delegate void UploadComplete(string filename, UUID fileID, ulong transferID, byte[] fileData, IClientAPI remoteClient);
|
||||
public delegate void UploadAborted(string filename, UUID fileID, ulong transferID, IClientAPI remoteClient);
|
||||
|
||||
public interface IClientFileTransfer
|
||||
{
|
||||
bool RequestUpload(string clientFileName, UploadComplete uploadCompleteCallback, UploadAborted abortCallback);
|
||||
bool RequestUpload(UUID fileID, UploadComplete uploadCompleteCallback, UploadAborted abortCallback);
|
||||
}
|
||||
}
|
|
@ -35,35 +35,15 @@ namespace OpenSim.Framework
|
|||
bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
|
||||
int amount);
|
||||
|
||||
int GetBalance(IClientAPI client);
|
||||
void ApplyUploadCharge(UUID agentID);
|
||||
bool UploadCovered(IClientAPI client);
|
||||
void ApplyGroupCreationCharge(UUID agentID);
|
||||
bool GroupCreationCovered(IClientAPI client);
|
||||
int GetBalance(UUID agentID);
|
||||
bool UploadCovered(IClientAPI client, int amount);
|
||||
bool AmountCovered(IClientAPI client, int amount);
|
||||
void ApplyCharge(UUID agentID, int amount, string text);
|
||||
void ApplyUploadCharge(UUID agentID, int amount, string text);
|
||||
|
||||
EconomyData GetEconomyData();
|
||||
int UploadCharge { get; }
|
||||
int GroupCreationCharge { get; }
|
||||
|
||||
event ObjectPaid OnObjectPaid;
|
||||
}
|
||||
|
||||
public struct EconomyData
|
||||
{
|
||||
public int ObjectCapacity;
|
||||
public int ObjectCount;
|
||||
public int PriceEnergyUnit;
|
||||
public int PriceGroupCreate;
|
||||
public int PriceObjectClaim;
|
||||
public float PriceObjectRent;
|
||||
public float PriceObjectScaleFactor;
|
||||
public int PriceParcelClaim;
|
||||
public float PriceParcelClaimFactor;
|
||||
public int PriceParcelRent;
|
||||
public int PricePublicObjectDecay;
|
||||
public int PricePublicObjectDelete;
|
||||
public int PriceRentLight;
|
||||
public int PriceUpload;
|
||||
public int TeleportMinPrice;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// Message Server Config - Configuration of the Message Server
|
||||
/// </summary>
|
||||
public class MessageServerConfig:ConfigBase
|
||||
{
|
||||
public string DatabaseProvider = String.Empty;
|
||||
public string DatabaseConnect = String.Empty;
|
||||
public string GridCommsProvider = String.Empty;
|
||||
public string GridRecvKey = String.Empty;
|
||||
public string GridSendKey = String.Empty;
|
||||
public string GridServerURL = String.Empty;
|
||||
public uint HttpPort = ConfigSettings.DefaultMessageServerHttpPort;
|
||||
public bool HttpSSL = ConfigSettings.DefaultMessageServerHttpSSL;
|
||||
public string MessageServerIP = String.Empty;
|
||||
public string UserRecvKey = String.Empty;
|
||||
public string UserSendKey = String.Empty;
|
||||
public string UserServerURL = String.Empty;
|
||||
public string ConsoleUser = String.Empty;
|
||||
public string ConsolePass = String.Empty;
|
||||
|
||||
public MessageServerConfig(string description, string filename)
|
||||
{
|
||||
m_configMember =
|
||||
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
|
||||
m_configMember.performConfigurationRetrieve();
|
||||
}
|
||||
|
||||
public void loadConfigurationOptions()
|
||||
{
|
||||
m_configMember.addConfigurationOption("default_user_server",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Default User Server URI",
|
||||
"http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString() + "/", false);
|
||||
m_configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to send to user server", "null", false);
|
||||
m_configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to expect from user server", "null", false);
|
||||
m_configMember.addConfigurationOption("default_grid_server",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Default Grid Server URI",
|
||||
"http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort.ToString() + "/", false);
|
||||
m_configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to send to grid server", "null", false);
|
||||
m_configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to expect from grid server", "null", false);
|
||||
|
||||
m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Connection String for Database", "", false);
|
||||
|
||||
m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"DLL for database provider", "OpenSim.Data.MySQL.dll", false);
|
||||
|
||||
m_configMember.addConfigurationOption("region_comms_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"DLL for comms provider", "OpenSim.Region.Communications.OGS1.dll", false);
|
||||
|
||||
m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Http Listener port", ConfigSettings.DefaultMessageServerHttpPort.ToString(), false);
|
||||
m_configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||
"Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false);
|
||||
m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"My Published IP Address", "127.0.0.1", false);
|
||||
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access user name [Default: disabled]", "", false);
|
||||
|
||||
m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access password [Default: disabled]", "", false);
|
||||
|
||||
}
|
||||
|
||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||
{
|
||||
switch (configuration_key)
|
||||
{
|
||||
case "default_user_server":
|
||||
UserServerURL = (string) configuration_result;
|
||||
break;
|
||||
case "user_send_key":
|
||||
UserSendKey = (string) configuration_result;
|
||||
break;
|
||||
case "user_recv_key":
|
||||
UserRecvKey = (string) configuration_result;
|
||||
break;
|
||||
case "default_grid_server":
|
||||
GridServerURL = (string) configuration_result;
|
||||
break;
|
||||
case "grid_send_key":
|
||||
GridSendKey = (string) configuration_result;
|
||||
break;
|
||||
case "grid_recv_key":
|
||||
GridRecvKey = (string) configuration_result;
|
||||
break;
|
||||
case "database_provider":
|
||||
DatabaseProvider = (string) configuration_result;
|
||||
break;
|
||||
case "database_connect":
|
||||
DatabaseConnect = (string)configuration_result;
|
||||
break;
|
||||
case "http_port":
|
||||
HttpPort = (uint) configuration_result;
|
||||
break;
|
||||
case "http_ssl":
|
||||
HttpSSL = (bool) configuration_result;
|
||||
break;
|
||||
case "region_comms_provider":
|
||||
GridCommsProvider = (string) configuration_result;
|
||||
break;
|
||||
case "published_ip":
|
||||
MessageServerIP = (string) configuration_result;
|
||||
break;
|
||||
case "console_user":
|
||||
ConsoleUser = (string)configuration_result;
|
||||
break;
|
||||
case "console_pass":
|
||||
ConsolePass = (string)configuration_result;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ using System.Net.Sockets;
|
|||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
|
@ -180,8 +181,16 @@ namespace OpenSim.Framework
|
|||
throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client");
|
||||
}
|
||||
|
||||
static IPAddress externalIPAddress;
|
||||
|
||||
static NetworkUtil()
|
||||
{
|
||||
try
|
||||
{
|
||||
externalIPAddress = GetExternalIP();
|
||||
}
|
||||
catch { /* ignore */ }
|
||||
|
||||
try
|
||||
{
|
||||
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
|
||||
|
@ -244,5 +253,80 @@ namespace OpenSim.Framework
|
|||
}
|
||||
return defaultHostname;
|
||||
}
|
||||
|
||||
public static IPAddress GetExternalIPOf(IPAddress user)
|
||||
{
|
||||
if (externalIPAddress == null)
|
||||
return user;
|
||||
|
||||
if (user.ToString() == "127.0.0.1")
|
||||
{
|
||||
m_log.Info("[NetworkUtil] 127.0.0.1 user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
|
||||
return externalIPAddress;
|
||||
}
|
||||
// Check if we're accessing localhost.
|
||||
foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName()))
|
||||
{
|
||||
if (host.Equals(user) && host.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
m_log.Info("[NetworkUtil] Localhost user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
|
||||
return externalIPAddress;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for same LAN segment
|
||||
foreach (KeyValuePair<IPAddress, IPAddress> subnet in m_subnets)
|
||||
{
|
||||
byte[] subnetBytes = subnet.Value.GetAddressBytes();
|
||||
byte[] localBytes = subnet.Key.GetAddressBytes();
|
||||
byte[] destBytes = user.GetAddressBytes();
|
||||
|
||||
if (subnetBytes.Length != destBytes.Length || subnetBytes.Length != localBytes.Length)
|
||||
return user;
|
||||
|
||||
bool valid = true;
|
||||
|
||||
for (int i = 0; i < subnetBytes.Length; i++)
|
||||
{
|
||||
if ((localBytes[i] & subnetBytes[i]) != (destBytes[i] & subnetBytes[i]))
|
||||
{
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (subnet.Key.AddressFamily != AddressFamily.InterNetwork)
|
||||
valid = false;
|
||||
|
||||
if (valid)
|
||||
{
|
||||
m_log.Info("[NetworkUtil] Local LAN user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
|
||||
return externalIPAddress;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, return user address
|
||||
return user;
|
||||
}
|
||||
|
||||
private static IPAddress GetExternalIP()
|
||||
{
|
||||
string whatIsMyIp = "http://www.whatismyip.com/automation/n09230945.asp";
|
||||
WebClient wc = new WebClient();
|
||||
UTF8Encoding utf8 = new UTF8Encoding();
|
||||
string requestHtml = "";
|
||||
try
|
||||
{
|
||||
requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp));
|
||||
}
|
||||
catch (WebException we)
|
||||
{
|
||||
m_log.Info("[NetworkUtil]: Exception in GetExternalIP: " + we.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
IPAddress externalIp = IPAddress.Parse(requestHtml);
|
||||
return externalIp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,17 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
|
@ -170,6 +175,13 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entries to store media textures on each face
|
||||
/// </summary>
|
||||
/// Do not change this value directly - always do it through an IMoapModule.
|
||||
/// Lock before manipulating.
|
||||
public MediaList Media { get; set; }
|
||||
|
||||
public PrimitiveBaseShape()
|
||||
{
|
||||
|
@ -1207,5 +1219,104 @@ namespace OpenSim.Framework
|
|||
|
||||
return prim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encapsulates a list of media entries.
|
||||
/// </summary>
|
||||
/// This class is necessary because we want to replace auto-serialization of MediaEntry with something more
|
||||
/// OSD like and less vulnerable to change.
|
||||
public class MediaList : List<MediaEntry>, IXmlSerializable
|
||||
{
|
||||
public const string MEDIA_TEXTURE_TYPE = "sl";
|
||||
|
||||
public MediaList() : base() {}
|
||||
public MediaList(IEnumerable<MediaEntry> collection) : base(collection) {}
|
||||
public MediaList(int capacity) : base(capacity) {}
|
||||
|
||||
public XmlSchema GetSchema()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string ToXml()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using (XmlTextWriter xtw = new XmlTextWriter(sw))
|
||||
{
|
||||
xtw.WriteStartElement("OSMedia");
|
||||
xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE);
|
||||
xtw.WriteAttributeString("version", "0.1");
|
||||
|
||||
OSDArray meArray = new OSDArray();
|
||||
foreach (MediaEntry me in this)
|
||||
{
|
||||
OSD osd = (null == me ? new OSD() : me.GetOSD());
|
||||
meArray.Add(osd);
|
||||
}
|
||||
|
||||
xtw.WriteStartElement("OSData");
|
||||
xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray));
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.Flush();
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteXml(XmlWriter writer)
|
||||
{
|
||||
writer.WriteRaw(ToXml());
|
||||
}
|
||||
|
||||
public static MediaList FromXml(string rawXml)
|
||||
{
|
||||
MediaList ml = new MediaList();
|
||||
ml.ReadXml(rawXml);
|
||||
return ml;
|
||||
}
|
||||
|
||||
public void ReadXml(string rawXml)
|
||||
{
|
||||
using (StringReader sr = new StringReader(rawXml))
|
||||
{
|
||||
using (XmlTextReader xtr = new XmlTextReader(sr))
|
||||
{
|
||||
xtr.MoveToContent();
|
||||
|
||||
string type = xtr.GetAttribute("type");
|
||||
//m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type);
|
||||
|
||||
if (type != MEDIA_TEXTURE_TYPE)
|
||||
return;
|
||||
|
||||
xtr.ReadStartElement("OSMedia");
|
||||
|
||||
OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
|
||||
foreach (OSD osdMe in osdMeArray)
|
||||
{
|
||||
MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
|
||||
Add(me);
|
||||
}
|
||||
|
||||
xtr.ReadEndElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ReadXml(XmlReader reader)
|
||||
{
|
||||
if (reader.IsEmptyElement)
|
||||
return;
|
||||
|
||||
ReadXml(reader.ReadInnerXml());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,14 +29,15 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class RegionLightShareData : ICloneable
|
||||
|
@ -96,10 +97,9 @@ namespace OpenSim.Framework
|
|||
|
||||
[Serializable]
|
||||
public class SimpleRegionInfo
|
||||
{
|
||||
// private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
|
||||
/// </summary>
|
||||
|
@ -327,8 +327,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public class RegionInfo
|
||||
{
|
||||
// private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public bool commFailTF = false;
|
||||
public ConfigurationMember configMember;
|
||||
|
@ -772,9 +771,16 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
if (externalName == "SYSTEMIP")
|
||||
{
|
||||
m_externalHostName = Util.GetLocalHost().ToString();
|
||||
m_log.InfoFormat(
|
||||
"[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
|
||||
m_externalHostName, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_externalHostName = externalName;
|
||||
}
|
||||
|
||||
m_regionType = config.GetString("RegionType", String.Empty);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Serialization
|
||||
|
@ -171,6 +172,30 @@ namespace OpenSim.Framework.Serialization
|
|||
public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
|
||||
{
|
||||
return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract a plain path from an IAR path
|
||||
/// </summary>
|
||||
/// <param name="iarPath"></param>
|
||||
/// <returns></returns>
|
||||
public static string ExtractPlainPathFromIarPath(string iarPath)
|
||||
{
|
||||
List<string> plainDirs = new List<string>();
|
||||
|
||||
string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (string iarDir in iarDirs)
|
||||
{
|
||||
if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
|
||||
plainDirs.Add(iarDir);
|
||||
|
||||
int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
|
||||
|
||||
plainDirs.Add(iarDir.Remove(i));
|
||||
}
|
||||
|
||||
return string.Join("/", plainDirs.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -310,7 +310,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(string.Format("[BASE HTTP SERVER]: OnRequest() failed with "), e);
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,6 +319,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
OSHttpRequest req = new OSHttpRequest(context, request);
|
||||
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
||||
HandleRequest(req, resp);
|
||||
|
||||
// !!!HACK ALERT!!!
|
||||
// There seems to be a bug in the underlying http code that makes subsequent requests
|
||||
// come up with trash in Accept headers. Until that gets fixed, we're cleaning them up here.
|
||||
if (request.AcceptTypes != null)
|
||||
for (int i = 0; i < request.AcceptTypes.Length; i++)
|
||||
request.AcceptTypes[i] = string.Empty;
|
||||
}
|
||||
|
||||
// public void ConvertIHttpClientContextToOSHttp(object stateinfo)
|
||||
|
@ -362,7 +369,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
string path = request.RawUrl;
|
||||
string handlerKey = GetHandlerKey(request.HttpMethod, path);
|
||||
|
||||
//m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
|
||||
// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
|
||||
|
||||
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
||||
{
|
||||
|
|
|
@ -73,7 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
||||
{
|
||||
StreamReader str = new StreamReader(req.Request.Body);
|
||||
StreamReader str;
|
||||
try
|
||||
{
|
||||
str = new StreamReader(req.Request.Body);
|
||||
}
|
||||
catch (System.ArgumentException)
|
||||
{
|
||||
// Stream was not readable means a child agent
|
||||
// was closed due to logout, leaving the
|
||||
// Event Queue request orphaned.
|
||||
continue;
|
||||
}
|
||||
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
m_server.DoHTTPGruntWork(responsedata,
|
||||
|
@ -106,4 +117,4 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
m_request.Enqueue(pPollServiceHttpRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -390,36 +390,41 @@ Asset service request failures: {3}" + Environment.NewLine,
|
|||
public override string XReport(string uptime, string version)
|
||||
{
|
||||
OSDMap args = new OSDMap(30);
|
||||
args["AssetsInCache"] = OSD.FromReal(AssetsInCache);
|
||||
args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0);
|
||||
args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests);
|
||||
args["AssetServiceRequestFailures"] = OSD.FromReal(AssetServiceRequestFailures);
|
||||
args["abnormalClientThreadTerminations"] = OSD.FromReal(abnormalClientThreadTerminations);
|
||||
args["InventoryServiceRetrievalFailures"] = OSD.FromReal(InventoryServiceRetrievalFailures);
|
||||
args["Dilatn"] = OSD.FromReal(timeDilation);
|
||||
args["SimFPS"] = OSD.FromReal(simFps);
|
||||
args["PhyFPS"] = OSD.FromReal(physicsFps);
|
||||
args["AgntUp"] = OSD.FromReal(agentUpdates);
|
||||
args["RootAg"] = OSD.FromReal(rootAgents);
|
||||
args["ChldAg"] = OSD.FromReal(childAgents);
|
||||
args["Prims"] = OSD.FromReal(totalPrims);
|
||||
args["AtvPrm"] = OSD.FromReal(activePrims);
|
||||
args["AtvScr"] = OSD.FromReal(activeScripts);
|
||||
args["ScrLPS"] = OSD.FromReal(scriptLinesPerSecond);
|
||||
args["PktsIn"] = OSD.FromReal(inPacketsPerSecond);
|
||||
args["PktOut"] = OSD.FromReal(outPacketsPerSecond);
|
||||
args["PendDl"] = OSD.FromReal(pendingDownloads);
|
||||
args["PendUl"] = OSD.FromReal(pendingUploads);
|
||||
args["UnackB"] = OSD.FromReal(unackedBytes);
|
||||
args["TotlFt"] = OSD.FromReal(totalFrameTime);
|
||||
args["NetFt"] = OSD.FromReal(netFrameTime);
|
||||
args["PhysFt"] = OSD.FromReal(physicsFrameTime);
|
||||
args["OthrFt"] = OSD.FromReal(otherFrameTime);
|
||||
args["AgntFt"] = OSD.FromReal(agentFrameTime);
|
||||
args["ImgsFt"] = OSD.FromReal(imageFrameTime);
|
||||
args["Memory"] = OSD.FromString(base.XReport(uptime, version));
|
||||
args["Uptime"] = OSD.FromString(uptime);
|
||||
args["Version"] = OSD.FromString(version);
|
||||
args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
|
||||
args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0));
|
||||
args["BlockedMissingTextureRequests"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
BlockedMissingTextureRequests));
|
||||
args["AssetServiceRequestFailures"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
AssetServiceRequestFailures));
|
||||
args["abnormalClientThreadTerminations"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
abnormalClientThreadTerminations));
|
||||
args["InventoryServiceRetrievalFailures"] = OSD.FromString (String.Format ("{0:0.##}",
|
||||
InventoryServiceRetrievalFailures));
|
||||
args["Dilatn"] = OSD.FromString (String.Format ("{0:0.##}", timeDilation));
|
||||
args["SimFPS"] = OSD.FromString (String.Format ("{0:0.##}", simFps));
|
||||
args["PhyFPS"] = OSD.FromString (String.Format ("{0:0.##}", physicsFps));
|
||||
args["AgntUp"] = OSD.FromString (String.Format ("{0:0.##}", agentUpdates));
|
||||
args["RootAg"] = OSD.FromString (String.Format ("{0:0.##}", rootAgents));
|
||||
args["ChldAg"] = OSD.FromString (String.Format ("{0:0.##}", childAgents));
|
||||
args["Prims"] = OSD.FromString (String.Format ("{0:0.##}", totalPrims));
|
||||
args["AtvPrm"] = OSD.FromString (String.Format ("{0:0.##}", activePrims));
|
||||
args["AtvScr"] = OSD.FromString (String.Format ("{0:0.##}", activeScripts));
|
||||
args["ScrLPS"] = OSD.FromString (String.Format ("{0:0.##}", scriptLinesPerSecond));
|
||||
args["PktsIn"] = OSD.FromString (String.Format ("{0:0.##}", inPacketsPerSecond));
|
||||
args["PktOut"] = OSD.FromString (String.Format ("{0:0.##}", outPacketsPerSecond));
|
||||
args["PendDl"] = OSD.FromString (String.Format ("{0:0.##}", pendingDownloads));
|
||||
args["PendUl"] = OSD.FromString (String.Format ("{0:0.##}", pendingUploads));
|
||||
args["UnackB"] = OSD.FromString (String.Format ("{0:0.##}", unackedBytes));
|
||||
args["TotlFt"] = OSD.FromString (String.Format ("{0:0.##}", totalFrameTime));
|
||||
args["NetFt"] = OSD.FromString (String.Format ("{0:0.##}", netFrameTime));
|
||||
args["PhysFt"] = OSD.FromString (String.Format ("{0:0.##}", physicsFrameTime));
|
||||
args["OthrFt"] = OSD.FromString (String.Format ("{0:0.##}", otherFrameTime));
|
||||
args["AgntFt"] = OSD.FromString (String.Format ("{0:0.##}", agentFrameTime));
|
||||
args["ImgsFt"] = OSD.FromString (String.Format ("{0:0.##}", imageFrameTime));
|
||||
args["Memory"] = OSD.FromString (base.XReport (uptime, version));
|
||||
args["Uptime"] = OSD.FromString (uptime);
|
||||
args["Version"] = OSD.FromString (version);
|
||||
|
||||
string strBuffer = "";
|
||||
strBuffer = OSDParser.SerializeJsonString(args);
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace OpenSim.Framework.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ACLTest
|
||||
{
|
||||
#region Tests
|
||||
|
||||
/// <summary>
|
||||
/// ACL Test class
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void ACLTest01()
|
||||
{
|
||||
ACL acl = new ACL();
|
||||
|
||||
Role Guests = new Role("Guests");
|
||||
acl.AddRole(Guests);
|
||||
|
||||
Role[] parents = new Role[1];
|
||||
parents[0] = Guests;
|
||||
|
||||
Role JoeGuest = new Role("JoeGuest", parents);
|
||||
acl.AddRole(JoeGuest);
|
||||
|
||||
Resource CanBuild = new Resource("CanBuild");
|
||||
acl.AddResource(CanBuild);
|
||||
|
||||
|
||||
acl.GrantPermission("Guests", "CanBuild");
|
||||
|
||||
Permission perm = acl.HasPermission("JoeGuest", "CanBuild");
|
||||
Assert.That(perm == Permission.Allow, "JoeGuest should have permission to build");
|
||||
perm = Permission.None;
|
||||
try
|
||||
{
|
||||
perm = acl.HasPermission("unknownGuest", "CanBuild");
|
||||
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Assert.That(false,"Exception thrown should have been KeyNotFoundException");
|
||||
}
|
||||
Assert.That(perm == Permission.None,"Permission None should be set because exception should have been thrown");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void KnownButPermissionDenyAndPermissionNoneUserTest()
|
||||
{
|
||||
ACL acl = new ACL();
|
||||
|
||||
Role Guests = new Role("Guests");
|
||||
acl.AddRole(Guests);
|
||||
Role Administrators = new Role("Administrators");
|
||||
acl.AddRole(Administrators);
|
||||
Role[] Guestparents = new Role[1];
|
||||
Role[] Adminparents = new Role[1];
|
||||
|
||||
Guestparents[0] = Guests;
|
||||
Adminparents[0] = Administrators;
|
||||
|
||||
Role JoeGuest = new Role("JoeGuest", Guestparents);
|
||||
acl.AddRole(JoeGuest);
|
||||
|
||||
Resource CanBuild = new Resource("CanBuild");
|
||||
acl.AddResource(CanBuild);
|
||||
|
||||
Resource CanScript = new Resource("CanScript");
|
||||
acl.AddResource(CanScript);
|
||||
|
||||
Resource CanRestart = new Resource("CanRestart");
|
||||
acl.AddResource(CanRestart);
|
||||
|
||||
acl.GrantPermission("Guests", "CanBuild");
|
||||
acl.DenyPermission("Guests", "CanRestart");
|
||||
|
||||
acl.GrantPermission("Administrators", "CanScript");
|
||||
|
||||
acl.GrantPermission("Administrators", "CanRestart");
|
||||
Permission setPermission = acl.HasPermission("JoeGuest", "CanRestart");
|
||||
Assert.That(setPermission == Permission.Deny, "Guests Should not be able to restart");
|
||||
Assert.That(acl.HasPermission("JoeGuest", "CanScript") == Permission.None,
|
||||
"No Explicit Permissions set so should be Permission.None");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,231 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// UserConfig -- For User Server Configuration
|
||||
/// </summary>
|
||||
public class UserConfig:ConfigBase
|
||||
{
|
||||
public string DatabaseProvider = String.Empty;
|
||||
public string DatabaseConnect = String.Empty;
|
||||
public string DefaultStartupMsg = String.Empty;
|
||||
public uint DefaultX = 1000;
|
||||
public uint DefaultY = 1000;
|
||||
public string GridRecvKey = String.Empty;
|
||||
public string GridSendKey = String.Empty;
|
||||
public uint HttpPort = ConfigSettings.DefaultUserServerHttpPort;
|
||||
public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL;
|
||||
public uint DefaultUserLevel = 0;
|
||||
public string LibraryXmlfile = "";
|
||||
public string ConsoleUser = String.Empty;
|
||||
public string ConsolePass = String.Empty;
|
||||
|
||||
private Uri m_inventoryUrl;
|
||||
|
||||
public Uri InventoryUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_inventoryUrl;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_inventoryUrl = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Uri m_authUrl;
|
||||
public Uri AuthUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_authUrl;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_authUrl = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Uri m_gridServerURL;
|
||||
|
||||
public Uri GridServerURL
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_gridServerURL;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_gridServerURL = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableLLSDLogin = true;
|
||||
|
||||
public bool EnableHGLogin = true;
|
||||
|
||||
public UserConfig()
|
||||
{
|
||||
// weird, but UserManagerBase needs this.
|
||||
}
|
||||
public UserConfig(string description, string filename)
|
||||
{
|
||||
m_configMember =
|
||||
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
|
||||
m_configMember.performConfigurationRetrieve();
|
||||
}
|
||||
|
||||
public void loadConfigurationOptions()
|
||||
{
|
||||
m_configMember.addConfigurationOption("default_startup_message",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Default Startup Message", "Welcome to OGS", false);
|
||||
|
||||
m_configMember.addConfigurationOption("default_grid_server",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Default Grid Server URI",
|
||||
"http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort + "/", false);
|
||||
m_configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to send to grid server", "null", false);
|
||||
m_configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Key to expect from grid server", "null", false);
|
||||
|
||||
m_configMember.addConfigurationOption("default_inventory_server",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Default Inventory Server URI",
|
||||
"http://127.0.0.1:" + ConfigSettings.DefaultInventoryServerHttpPort + "/",
|
||||
false);
|
||||
m_configMember.addConfigurationOption("default_authentication_server",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"User Server (this) External URI for authentication keys",
|
||||
"http://localhost:" + ConfigSettings.DefaultUserServerHttpPort + "/",
|
||||
false);
|
||||
m_configMember.addConfigurationOption("library_location",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Path to library control file",
|
||||
string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar), false);
|
||||
|
||||
m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"DLL for database provider", "OpenSim.Data.MySQL.dll", false);
|
||||
m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Connection String for Database", "", false);
|
||||
|
||||
m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Http Listener port", ConfigSettings.DefaultUserServerHttpPort.ToString(), false);
|
||||
m_configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||
"Use SSL? true/false", ConfigSettings.DefaultUserServerHttpSSL.ToString(), false);
|
||||
m_configMember.addConfigurationOption("default_X", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Known good region X", "1000", false);
|
||||
m_configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Known good region Y", "1000", false);
|
||||
m_configMember.addConfigurationOption("enable_llsd_login", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||
"Enable LLSD login support [Currently used by libsl based clients/bots]? true/false", true.ToString(), false);
|
||||
|
||||
m_configMember.addConfigurationOption("enable_hg_login", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||
"Enable Hypergrid login support [Currently used by GridSurfer-proxied clients]? true/false", true.ToString(), false);
|
||||
|
||||
m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Minimum Level a user should have to login [0 default]", "0", false);
|
||||
|
||||
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access user name [Default: disabled]", "", false);
|
||||
|
||||
m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access password [Default: disabled]", "", false);
|
||||
|
||||
}
|
||||
|
||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||
{
|
||||
switch (configuration_key)
|
||||
{
|
||||
case "default_startup_message":
|
||||
DefaultStartupMsg = (string) configuration_result;
|
||||
break;
|
||||
case "default_grid_server":
|
||||
GridServerURL = new Uri((string) configuration_result);
|
||||
break;
|
||||
case "grid_send_key":
|
||||
GridSendKey = (string) configuration_result;
|
||||
break;
|
||||
case "grid_recv_key":
|
||||
GridRecvKey = (string) configuration_result;
|
||||
break;
|
||||
case "default_inventory_server":
|
||||
InventoryUrl = new Uri((string) configuration_result);
|
||||
break;
|
||||
case "default_authentication_server":
|
||||
AuthUrl = new Uri((string)configuration_result);
|
||||
break;
|
||||
case "database_provider":
|
||||
DatabaseProvider = (string) configuration_result;
|
||||
break;
|
||||
case "database_connect":
|
||||
DatabaseConnect = (string) configuration_result;
|
||||
break;
|
||||
case "http_port":
|
||||
HttpPort = (uint) configuration_result;
|
||||
break;
|
||||
case "http_ssl":
|
||||
HttpSSL = (bool) configuration_result;
|
||||
break;
|
||||
case "default_X":
|
||||
DefaultX = (uint) configuration_result;
|
||||
break;
|
||||
case "default_Y":
|
||||
DefaultY = (uint) configuration_result;
|
||||
break;
|
||||
case "enable_llsd_login":
|
||||
EnableLLSDLogin = (bool)configuration_result;
|
||||
break;
|
||||
case "enable_hg_login":
|
||||
EnableHGLogin = (bool)configuration_result;
|
||||
break;
|
||||
case "default_loginLevel":
|
||||
DefaultUserLevel = (uint)configuration_result;
|
||||
break;
|
||||
case "library_location":
|
||||
LibraryXmlfile = (string)configuration_result;
|
||||
break;
|
||||
case "console_user":
|
||||
ConsoleUser = (string)configuration_result;
|
||||
break;
|
||||
case "console_pass":
|
||||
ConsolePass = (string)configuration_result;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1171,6 +1171,16 @@ namespace OpenSim.Framework
|
|||
|
||||
}
|
||||
|
||||
public static uint ConvertAccessLevelToMaturity(byte maturity)
|
||||
{
|
||||
if (maturity <= 13)
|
||||
return 0;
|
||||
else if (maturity <= 21)
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Produces an OSDMap from its string representation on a stream
|
||||
/// </summary>
|
||||
|
@ -1486,4 +1496,4 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("GET from URL " + url + " failed: " + ex.Message);
|
||||
m_log.Warn(httpVerb + " on URL " + url + " failed: " + ex.Message);
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,9 @@ namespace OpenSim.Framework
|
|||
request.ContentLength = requestData.Length;
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
|
||||
using (Stream requestStream = request.GetRequestStream())
|
||||
requestStream.Write(requestData, 0, requestData.Length);
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(requestData, 0, requestData.Length);
|
||||
requestStream.Close();
|
||||
|
||||
using (WebResponse response = request.GetResponse())
|
||||
{
|
||||
|
@ -169,7 +170,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Warn("POST to URL " + url + " failed: " + ex.Message);
|
||||
m_log.Warn("POST to URL " + url + " failed: " + ex);
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,17 @@ namespace OpenSim
|
|||
else
|
||||
{
|
||||
string basepath = Path.GetFullPath(Util.configDir());
|
||||
string path = Path.Combine(basepath, file);
|
||||
// Resolve relative paths with wildcards
|
||||
string chunkWithoutWildcards = file;
|
||||
string chunkWithWildcards = string.Empty;
|
||||
int wildcardIndex = file.IndexOfAny(new char[] { '*', '?' });
|
||||
if (wildcardIndex != -1)
|
||||
{
|
||||
chunkWithoutWildcards = file.Substring(0, wildcardIndex);
|
||||
chunkWithWildcards = file.Substring(wildcardIndex);
|
||||
}
|
||||
string path = Path.Combine(basepath, chunkWithoutWildcards);
|
||||
path = Path.GetFullPath(path) + chunkWithWildcards;
|
||||
string[] paths = Util.Glob(path);
|
||||
foreach (string p in paths)
|
||||
{
|
||||
|
@ -307,21 +317,6 @@ namespace OpenSim
|
|||
config.Set("EventQueue", true);
|
||||
}
|
||||
|
||||
{
|
||||
IConfig config = defaultConfig.Configs["StandAlone"];
|
||||
|
||||
if (null == config)
|
||||
config = defaultConfig.AddConfig("StandAlone");
|
||||
|
||||
config.Set("accounts_authenticate", true);
|
||||
config.Set("welcome_message", "Welcome to OpenSimulator");
|
||||
config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
|
||||
config.Set("inventory_source", "");
|
||||
config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
|
||||
config.Set("user_source", "");
|
||||
config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar));
|
||||
}
|
||||
|
||||
{
|
||||
IConfig config = defaultConfig.Configs["Network"];
|
||||
|
||||
|
|
|
@ -192,9 +192,7 @@ namespace OpenSim
|
|||
// Hook up to the watchdog timer
|
||||
Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
|
||||
|
||||
PrintFileToConsole("startuplogo.txt");
|
||||
|
||||
m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString());
|
||||
PrintFileToConsole("startuplogo.txt");
|
||||
|
||||
// For now, start at the 'root' level by default
|
||||
if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
|
||||
|
@ -420,7 +418,7 @@ namespace OpenSim
|
|||
{
|
||||
MainConsole.Instance.Output(
|
||||
String.Format(
|
||||
"Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}",
|
||||
"Kicking user: {0,-16} {1,-16} {2,-37} in region: {3,-16}",
|
||||
presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName));
|
||||
|
||||
// kick client...
|
||||
|
@ -532,7 +530,10 @@ namespace OpenSim
|
|||
regionFile = cmd[3];
|
||||
|
||||
IScene scene;
|
||||
CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene);
|
||||
RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source);
|
||||
PopulateRegionEstateInfo(regInfo);
|
||||
CreateRegion(regInfo, true, out scene);
|
||||
regInfo.EstateSettings.Save();
|
||||
}
|
||||
else if (cmd[3].EndsWith(".ini"))
|
||||
{
|
||||
|
@ -543,7 +544,10 @@ namespace OpenSim
|
|||
regionFile = cmd[3];
|
||||
|
||||
IScene scene;
|
||||
CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]), true, out scene);
|
||||
RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]);
|
||||
PopulateRegionEstateInfo(regInfo);
|
||||
CreateRegion(regInfo, true, out scene);
|
||||
regInfo.EstateSettings.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -863,7 +867,7 @@ namespace OpenSim
|
|||
MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count));
|
||||
|
||||
MainConsole.Instance.Output(
|
||||
String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", "Firstname", "Lastname",
|
||||
String.Format("{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}", "Firstname", "Lastname",
|
||||
"Agent ID", "Root/Child", "Region", "Position"));
|
||||
|
||||
foreach (ScenePresence presence in agents)
|
||||
|
@ -882,7 +886,7 @@ namespace OpenSim
|
|||
|
||||
MainConsole.Instance.Output(
|
||||
String.Format(
|
||||
"{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}",
|
||||
"{0,-16} {1,-16} {2,-37} {3,-11} {4,-16} {5,-30}",
|
||||
presence.Firstname,
|
||||
presence.Lastname,
|
||||
presence.UUID,
|
||||
|
|
|
@ -347,9 +347,13 @@ namespace OpenSim
|
|||
// Prims have to be loaded after module configuration since some modules may be invoked during the load
|
||||
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
|
||||
|
||||
// moved these here as the terrain texture has to be created after the modules are initialized
|
||||
// moved these here as the map texture has to be created after the modules are initialized
|
||||
// and has to happen before the region is registered with the grid.
|
||||
scene.CreateTerrainTexture();
|
||||
IWorldMapModule mapModule = scene.RequestModuleInterface<IWorldMapModule>();
|
||||
if (mapModule != null)
|
||||
mapModule.GenerateMaptile();
|
||||
else
|
||||
m_log.WarnFormat("[STARTUP]: No map module available to generate map tile");
|
||||
|
||||
// TODO : Try setting resource for region xstats here on scene
|
||||
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));
|
||||
|
@ -367,13 +371,13 @@ namespace OpenSim
|
|||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
// We need to do this after we've initialized the
|
||||
// scripting engines.
|
||||
scene.CreateScriptInstances();
|
||||
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
m_sceneManager.Add(scene);
|
||||
|
||||
if (m_autoCreateClientStack)
|
||||
|
@ -786,6 +790,60 @@ namespace OpenSim
|
|||
{
|
||||
regionnum = m_sceneManager.Scenes.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the estate information for the provided RegionInfo object.
|
||||
/// </summary>
|
||||
/// <param name="regInfo">
|
||||
/// A <see cref="RegionInfo"/>
|
||||
/// </param>
|
||||
public void PopulateRegionEstateInfo(RegionInfo regInfo)
|
||||
{
|
||||
if (m_storageManager.EstateDataStore != null)
|
||||
{
|
||||
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false);
|
||||
}
|
||||
|
||||
if (regInfo.EstateSettings.EstateID == 0) // No record at all
|
||||
{
|
||||
MainConsole.Instance.Output("Your region is not part of an estate.");
|
||||
while (true)
|
||||
{
|
||||
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
|
||||
if (response == "no")
|
||||
{
|
||||
// Create a new estate
|
||||
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true);
|
||||
|
||||
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
|
||||
//regInfo.EstateSettings.Save();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
|
||||
if (response == "None")
|
||||
continue;
|
||||
|
||||
List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
|
||||
if (estateIDs.Count < 1)
|
||||
{
|
||||
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
|
||||
continue;
|
||||
}
|
||||
|
||||
int estateID = estateIDs[0];
|
||||
|
||||
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
|
||||
|
||||
if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID))
|
||||
break;
|
||||
|
||||
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public IJ2KDecoder J2KDecoder;
|
||||
public IAssetService AssetService;
|
||||
public UUID AgentID;
|
||||
public IHyperAssetService HyperAssets;
|
||||
public IInventoryAccessModule InventoryAccessModule;
|
||||
public OpenJPEG.J2KLayerInfo[] Layers;
|
||||
public bool IsDecoded;
|
||||
public bool HasAsset;
|
||||
|
@ -375,14 +375,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
UUID assetID = UUID.Zero;
|
||||
if (asset != null)
|
||||
assetID = asset.FullID;
|
||||
else if ((HyperAssets != null) && (sender != HyperAssets))
|
||||
else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
|
||||
{
|
||||
// Try the user's inventory, but only if it's different from the regions'
|
||||
string userAssets = HyperAssets.GetUserAssetServer(AgentID);
|
||||
if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer()))
|
||||
// Unfortunately we need this here, there's no other way.
|
||||
// This is due to the fact that textures opened directly from the agent's inventory
|
||||
// don't have any distinguishing feature. As such, in order to serve those when the
|
||||
// foreign user is visiting, we need to try again after the first fail to the local
|
||||
// asset service.
|
||||
string assetServerURL = string.Empty;
|
||||
if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
|
||||
{
|
||||
m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
|
||||
AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived);
|
||||
AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,6 +314,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private int m_cachedTextureSerial;
|
||||
private PriorityQueue m_entityUpdates;
|
||||
private Prioritizer m_prioritizer;
|
||||
private bool m_disableFacelights = false;
|
||||
|
||||
/// <value>
|
||||
/// List used in construction of data blocks for an object update packet. This is to stop us having to
|
||||
|
@ -357,7 +358,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
protected uint m_agentFOVCounter;
|
||||
|
||||
protected IAssetService m_assetService;
|
||||
private IHyperAssetService m_hyperAssets;
|
||||
private const bool m_checkPackets = true;
|
||||
|
||||
private Timer m_propertiesPacketTimer;
|
||||
|
@ -408,6 +408,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
set { m_IsLoggingOut = value; }
|
||||
}
|
||||
|
||||
public bool DisableFacelights
|
||||
{
|
||||
get { return m_disableFacelights; }
|
||||
set { m_disableFacelights = value; }
|
||||
}
|
||||
|
||||
public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
|
||||
|
||||
#endregion Properties
|
||||
|
@ -432,7 +438,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// m_attachmentsSent = new HashSet<uint>();
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
|
||||
m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
|
||||
m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
|
||||
m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion());
|
||||
|
@ -1427,16 +1432,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SendTeleportLocationStart()
|
||||
public void SendTeleportStart(uint flags)
|
||||
{
|
||||
//TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart);
|
||||
TeleportStartPacket tpStart = new TeleportStartPacket();
|
||||
tpStart.Info.TeleportFlags = 16; // Teleport via location
|
||||
TeleportStartPacket tpStart = (TeleportStartPacket)PacketPool.Instance.GetPacket(PacketType.TeleportStart);
|
||||
//TeleportStartPacket tpStart = new TeleportStartPacket();
|
||||
tpStart.Info.TeleportFlags = flags; //16; // Teleport via location
|
||||
|
||||
// Hack to get this out immediately and skip throttles
|
||||
OutPacket(tpStart, ThrottleOutPacketType.Unknown);
|
||||
}
|
||||
|
||||
public void SendTeleportProgress(uint flags, string message)
|
||||
{
|
||||
TeleportProgressPacket tpProgress = (TeleportProgressPacket)PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
|
||||
tpProgress.AgentData.AgentID = this.AgentId;
|
||||
tpProgress.Info.TeleportFlags = flags;
|
||||
tpProgress.Info.Message = Util.StringToBytes256(message);
|
||||
|
||||
// Hack to get this out immediately and skip throttles
|
||||
OutPacket(tpProgress, ThrottleOutPacketType.Unknown);
|
||||
}
|
||||
|
||||
public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
|
||||
{
|
||||
MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket)PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply);
|
||||
|
@ -2658,7 +2674,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
// Bit 0: Mature, bit 7: on sale, other bits: no idea
|
||||
reply.Data.Flags = (byte)(
|
||||
((land.Flags & (uint)ParcelFlags.MaturePublish) != 0 ? (1 << 0) : 0) +
|
||||
(info.AccessLevel > 13 ? (1 << 0) : 0) +
|
||||
((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0));
|
||||
|
||||
Vector3 pos = land.UserLocation;
|
||||
|
@ -2666,8 +2682,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
pos = (land.AABBMax + land.AABBMin) * 0.5f;
|
||||
}
|
||||
reply.Data.GlobalX = info.RegionLocX * Constants.RegionSize + x;
|
||||
reply.Data.GlobalY = info.RegionLocY * Constants.RegionSize + y;
|
||||
reply.Data.GlobalX = info.RegionLocX + x;
|
||||
reply.Data.GlobalY = info.RegionLocY + y;
|
||||
reply.Data.GlobalZ = pos.Z;
|
||||
reply.Data.SimName = Utils.StringToBytes(info.RegionName);
|
||||
reply.Data.SnapshotID = land.SnapshotID;
|
||||
|
@ -3489,6 +3505,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
EntityUpdate update;
|
||||
while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
|
||||
{
|
||||
if (update.Entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
||||
|
||||
if (part.ParentGroup.IsAttachment && m_disableFacelights)
|
||||
{
|
||||
if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
|
||||
part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
|
||||
{
|
||||
part.Shape.LightEntry = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++updatesThisCall;
|
||||
|
||||
#region UpdateFlags to packet type conversion
|
||||
|
@ -3680,30 +3710,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
#endregion Primitive Packet/Data Sending Methods
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <param name="attachPoint"></param>
|
||||
public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
|
||||
{
|
||||
if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD
|
||||
return;
|
||||
|
||||
ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
attach.AgentData.AgentID = AgentId;
|
||||
attach.AgentData.SessionID = m_sessionId;
|
||||
attach.AgentData.AttachmentPoint = attachPoint;
|
||||
attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
|
||||
attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
|
||||
attach.ObjectData[0].ObjectLocalID = localID;
|
||||
attach.ObjectData[0].Rotation = rotation;
|
||||
attach.Header.Zerocoded = true;
|
||||
OutPacket(attach, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
|
||||
{
|
||||
if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
|
||||
|
@ -4314,8 +4320,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
public void SendLandObjectOwners(LandData land, List<UUID> groups, Dictionary<UUID, int> ownersAndCount)
|
||||
{
|
||||
|
||||
|
||||
int notifyCount = ownersAndCount.Count;
|
||||
ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
|
||||
|
||||
|
@ -4587,6 +4591,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
update.TextureEntry = data.Shape.TextureEntry ?? Utils.EmptyBytes;
|
||||
update.Scale = data.Shape.Scale;
|
||||
update.Text = Util.StringToBytes256(data.Text);
|
||||
update.MediaURL = Util.StringToBytes256(data.MediaUrl);
|
||||
|
||||
#region PrimFlags
|
||||
|
||||
|
@ -4605,6 +4610,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}",
|
||||
// data.Name, update.FullID, flags, update.ID);
|
||||
|
||||
update.UpdateFlags = (uint)flags;
|
||||
|
||||
#endregion PrimFlags
|
||||
|
@ -4737,7 +4746,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
|
||||
AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
|
||||
AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate);
|
||||
AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage);
|
||||
|
||||
// Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once,
|
||||
// some clients will send out a separate ObjectImage packet for each face
|
||||
AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false);
|
||||
|
||||
AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false);
|
||||
AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false);
|
||||
AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab);
|
||||
|
@ -5733,7 +5746,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
if (att.ObjectData.Length > 0)
|
||||
{
|
||||
handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false);
|
||||
handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6293,7 +6306,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
#endregion
|
||||
|
||||
ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
|
||||
// ObjectDuplicatePacket.AgentDataBlock AgentandGroupData = dupe.AgentData;
|
||||
|
||||
ObjectDuplicate handlerObjectDuplicate = null;
|
||||
|
||||
|
@ -6303,8 +6316,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (handlerObjectDuplicate != null)
|
||||
{
|
||||
handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
|
||||
dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
|
||||
AgentandGroupData.GroupID);
|
||||
dupe.SharedData.DuplicateFlags, AgentId,
|
||||
m_activeGroupID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6894,7 +6907,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (handlerObjectDuplicateOnRay != null)
|
||||
{
|
||||
handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
|
||||
dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
|
||||
AgentId, m_activeGroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
|
||||
dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
|
||||
dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
|
||||
}
|
||||
|
@ -7196,59 +7209,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else // Agent
|
||||
{
|
||||
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
|
||||
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
|
||||
assetRequestItem = invService.GetItem(assetRequestItem);
|
||||
if (assetRequestItem == null)
|
||||
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
if (invAccess != null)
|
||||
{
|
||||
ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>();
|
||||
if (lib != null)
|
||||
assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
|
||||
if (assetRequestItem == null)
|
||||
return true;
|
||||
}
|
||||
if (!invAccess.GetAgentInventoryItem(this, itemID, requestID))
|
||||
return false;
|
||||
|
||||
// At this point, we need to apply perms
|
||||
// only to notecards and scripts. All
|
||||
// other asset types are always available
|
||||
//
|
||||
if (assetRequestItem.AssetType == (int)AssetType.LSLText)
|
||||
{
|
||||
if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
|
||||
{
|
||||
SendAgentAlertMessage("Insufficient permissions to view script", false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
|
||||
{
|
||||
if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
|
||||
{
|
||||
SendAgentAlertMessage("Insufficient permissions to view notecard", false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
if (assetRequestItem.AssetID != requestID)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
|
||||
Name, requestID, itemID, assetRequestItem.AssetID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//m_assetCache.AddAssetRequest(this, transfer);
|
||||
|
||||
MakeAssetRequest(transfer, taskID);
|
||||
|
||||
/* RequestAsset = OnRequestAsset;
|
||||
if (RequestAsset != null)
|
||||
{
|
||||
RequestAsset(this, transfer);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11459,15 +11435,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
{
|
||||
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
|
||||
//m_log.Debug("[XXX] inventory asset request " + requestID);
|
||||
//if (taskID == UUID.Zero) // Agent
|
||||
// if (m_scene is HGScene)
|
||||
// {
|
||||
// m_log.Debug("[XXX] hg asset request " + requestID);
|
||||
// // We may need to fetch the asset from the user's asset server into the local asset server
|
||||
// HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
|
||||
// mapper.Get(requestID, AgentId);
|
||||
// }
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
|
||||
|
@ -11483,49 +11450,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="asset"></param>
|
||||
protected void AssetReceived(string id, Object sender, AssetBase asset)
|
||||
{
|
||||
if (asset == null)
|
||||
return;
|
||||
|
||||
TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
|
||||
|
||||
UUID requestID = UUID.Zero;
|
||||
byte source = (byte)SourceType.Asset;
|
||||
|
||||
if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|
||||
|| (transferRequest.TransferInfo.SourceType == 2222))
|
||||
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|
||||
{
|
||||
requestID = new UUID(transferRequest.TransferInfo.Params, 0);
|
||||
}
|
||||
else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
|| (transferRequest.TransferInfo.SourceType == 3333))
|
||||
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
{
|
||||
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
|
||||
source = (byte)SourceType.SimInventoryItem;
|
||||
//m_log.Debug("asset request " + requestID);
|
||||
}
|
||||
|
||||
if (null == asset)
|
||||
{
|
||||
if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000))
|
||||
{
|
||||
// Try the user's inventory, but only if it's different from the regions'
|
||||
string userAssets = m_hyperAssets.GetUserAssetServer(AgentId);
|
||||
if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
|
||||
{
|
||||
m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
|
||||
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|
||||
transferRequest.TransferInfo.SourceType = 2222; // marker
|
||||
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|
||||
transferRequest.TransferInfo.SourceType = 3333; // marker
|
||||
|
||||
m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
|
||||
|
||||
// FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
|
||||
return;
|
||||
}
|
||||
|
||||
// Scripts cannot be retrieved by direct request
|
||||
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10)
|
||||
return;
|
||||
|
@ -11736,8 +11679,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("[");
|
||||
if (this.priority != null)
|
||||
sb.Append(this.priority.ToString());
|
||||
sb.Append(this.priority.ToString());
|
||||
sb.Append(",");
|
||||
if (this.value != null)
|
||||
sb.Append(this.value.ToString());
|
||||
|
|
|
@ -1,367 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
/// <summary>
|
||||
/// A work in progress, to contain the SL specific file transfer code that is currently in various region modules
|
||||
/// This file currently contains multiple classes that need to be split out into their own files.
|
||||
/// </summary>
|
||||
public class LLFileTransfer : IClientFileTransfer
|
||||
{
|
||||
protected IClientAPI m_clientAPI;
|
||||
|
||||
/// Dictionary of handlers for uploading files from client
|
||||
/// TODO: Need to add cleanup code to remove handlers that have completed their upload
|
||||
protected Dictionary<ulong, XferUploadHandler> m_uploadHandlers;
|
||||
protected object m_uploadHandlersLock = new object();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of files ready to be sent to clients
|
||||
/// </summary>
|
||||
protected static Dictionary<string, byte[]> m_files;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of Download Transfers in progess
|
||||
/// </summary>
|
||||
protected Dictionary<ulong, XferDownloadHandler> m_downloadHandlers = new Dictionary<ulong, XferDownloadHandler>();
|
||||
|
||||
|
||||
public LLFileTransfer(IClientAPI clientAPI)
|
||||
{
|
||||
m_uploadHandlers = new Dictionary<ulong, XferUploadHandler>();
|
||||
m_clientAPI = clientAPI;
|
||||
|
||||
m_clientAPI.OnXferReceive += XferReceive;
|
||||
m_clientAPI.OnAbortXfer += AbortXferUploadHandler;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (m_clientAPI != null)
|
||||
{
|
||||
m_clientAPI.OnXferReceive -= XferReceive;
|
||||
m_clientAPI.OnAbortXfer -= AbortXferUploadHandler;
|
||||
m_clientAPI = null;
|
||||
}
|
||||
}
|
||||
|
||||
#region Upload Handling
|
||||
|
||||
public bool RequestUpload(string clientFileName, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
|
||||
{
|
||||
if ((String.IsNullOrEmpty(clientFileName)) || (uploadCompleteCallback == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
XferUploadHandler uploader = new XferUploadHandler(m_clientAPI, clientFileName);
|
||||
|
||||
return StartUpload(uploader, uploadCompleteCallback, abortCallback);
|
||||
}
|
||||
|
||||
public bool RequestUpload(UUID fileID, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
|
||||
{
|
||||
if ((fileID == UUID.Zero) || (uploadCompleteCallback == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
XferUploadHandler uploader = new XferUploadHandler(m_clientAPI, fileID);
|
||||
|
||||
return StartUpload(uploader, uploadCompleteCallback, abortCallback);
|
||||
}
|
||||
|
||||
private bool StartUpload(XferUploadHandler uploader, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
|
||||
{
|
||||
uploader.UploadDone += uploadCompleteCallback;
|
||||
uploader.UploadDone += RemoveXferUploadHandler;
|
||||
|
||||
if (abortCallback != null)
|
||||
{
|
||||
uploader.UploadAborted += abortCallback;
|
||||
}
|
||||
|
||||
lock (m_uploadHandlersLock)
|
||||
{
|
||||
if (!m_uploadHandlers.ContainsKey(uploader.XferID))
|
||||
{
|
||||
m_uploadHandlers.Add(uploader.XferID, uploader);
|
||||
uploader.RequestStartXfer(m_clientAPI);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// something went wrong with the xferID allocation
|
||||
uploader.UploadDone -= uploadCompleteCallback;
|
||||
uploader.UploadDone -= RemoveXferUploadHandler;
|
||||
if (abortCallback != null)
|
||||
{
|
||||
uploader.UploadAborted -= abortCallback;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void AbortXferUploadHandler(IClientAPI remoteClient, ulong xferID)
|
||||
{
|
||||
lock (m_uploadHandlersLock)
|
||||
{
|
||||
if (m_uploadHandlers.ContainsKey(xferID))
|
||||
{
|
||||
m_uploadHandlers[xferID].AbortUpload(remoteClient);
|
||||
m_uploadHandlers.Remove(xferID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
|
||||
{
|
||||
lock (m_uploadHandlersLock)
|
||||
{
|
||||
if (m_uploadHandlers.ContainsKey(xferID))
|
||||
{
|
||||
m_uploadHandlers[xferID].XferReceive(remoteClient, xferID, packetID, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void RemoveXferUploadHandler(string filename, UUID fileID, ulong transferID, byte[] fileData, IClientAPI remoteClient)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class XferUploadHandler
|
||||
{
|
||||
private AssetBase m_asset;
|
||||
|
||||
public event UploadComplete UploadDone;
|
||||
public event UploadAborted UploadAborted;
|
||||
|
||||
private sbyte type = 0;
|
||||
|
||||
public ulong mXferID;
|
||||
private UploadComplete handlerUploadDone;
|
||||
private UploadAborted handlerAbort;
|
||||
|
||||
private bool m_complete = false;
|
||||
|
||||
public bool UploadComplete
|
||||
{
|
||||
get { return m_complete; }
|
||||
}
|
||||
|
||||
public XferUploadHandler(IClientAPI pRemoteClient, string pClientFilename)
|
||||
{
|
||||
Initialise(UUID.Zero, pClientFilename);
|
||||
}
|
||||
|
||||
public XferUploadHandler(IClientAPI pRemoteClient, UUID fileID)
|
||||
{
|
||||
Initialise(fileID, String.Empty);
|
||||
}
|
||||
|
||||
private void Initialise(UUID fileID, string fileName)
|
||||
{
|
||||
m_asset = new AssetBase(fileID, fileName, type, UUID.Zero.ToString());
|
||||
m_asset.Data = new byte[0];
|
||||
m_asset.Description = "empty";
|
||||
m_asset.Local = true;
|
||||
m_asset.Temporary = true;
|
||||
mXferID = Util.GetNextXferID();
|
||||
}
|
||||
|
||||
public ulong XferID
|
||||
{
|
||||
get { return mXferID; }
|
||||
}
|
||||
|
||||
public void RequestStartXfer(IClientAPI pRemoteClient)
|
||||
{
|
||||
m_asset.Metadata.CreatorID = pRemoteClient.AgentId.ToString();
|
||||
|
||||
if (!String.IsNullOrEmpty(m_asset.Name))
|
||||
{
|
||||
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, new byte[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process transfer data received from the client.
|
||||
/// </summary>
|
||||
/// <param name="xferID"></param>
|
||||
/// <param name="packetID"></param>
|
||||
/// <param name="data"></param>
|
||||
public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
|
||||
{
|
||||
if (mXferID == xferID)
|
||||
{
|
||||
if (m_asset.Data.Length > 1)
|
||||
{
|
||||
byte[] destinationArray = new byte[m_asset.Data.Length + data.Length];
|
||||
Array.Copy(m_asset.Data, 0, destinationArray, 0, m_asset.Data.Length);
|
||||
Array.Copy(data, 0, destinationArray, m_asset.Data.Length, data.Length);
|
||||
m_asset.Data = destinationArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] buffer2 = new byte[data.Length - 4];
|
||||
Array.Copy(data, 4, buffer2, 0, data.Length - 4);
|
||||
m_asset.Data = buffer2;
|
||||
}
|
||||
|
||||
remoteClient.SendConfirmXfer(xferID, packetID);
|
||||
|
||||
if ((packetID & 0x80000000) != 0)
|
||||
{
|
||||
SendCompleteMessage(remoteClient);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void SendCompleteMessage(IClientAPI remoteClient)
|
||||
{
|
||||
m_complete = true;
|
||||
handlerUploadDone = UploadDone;
|
||||
if (handlerUploadDone != null)
|
||||
{
|
||||
handlerUploadDone(m_asset.Name, m_asset.FullID, mXferID, m_asset.Data, remoteClient);
|
||||
}
|
||||
}
|
||||
|
||||
public void AbortUpload(IClientAPI remoteClient)
|
||||
{
|
||||
handlerAbort = UploadAborted;
|
||||
if (handlerAbort != null)
|
||||
{
|
||||
handlerAbort(m_asset.Name, m_asset.FullID, mXferID, remoteClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class XferDownloadHandler
|
||||
{
|
||||
public IClientAPI Client;
|
||||
private bool complete;
|
||||
public byte[] Data = new byte[0];
|
||||
public int DataPointer = 0;
|
||||
public string FileName = String.Empty;
|
||||
public uint Packet = 0;
|
||||
public uint Serial = 1;
|
||||
public ulong XferID = 0;
|
||||
|
||||
public XferDownloadHandler(string fileName, byte[] data, ulong xferID, IClientAPI client)
|
||||
{
|
||||
FileName = fileName;
|
||||
Data = data;
|
||||
XferID = xferID;
|
||||
Client = client;
|
||||
}
|
||||
|
||||
public XferDownloadHandler()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start a transfer
|
||||
/// </summary>
|
||||
/// <returns>True if the transfer is complete, false if not</returns>
|
||||
public bool StartSend()
|
||||
{
|
||||
if (Data.Length < 1000)
|
||||
{
|
||||
// for now (testing) we only support files under 1000 bytes
|
||||
byte[] transferData = new byte[Data.Length + 4];
|
||||
Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
||||
Array.Copy(Data, 0, transferData, 4, Data.Length);
|
||||
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
|
||||
|
||||
complete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] transferData = new byte[1000 + 4];
|
||||
Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
|
||||
Array.Copy(Data, 0, transferData, 4, 1000);
|
||||
Client.SendXferPacket(XferID, 0, transferData);
|
||||
Packet++;
|
||||
DataPointer = 1000;
|
||||
}
|
||||
|
||||
return complete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Respond to an ack packet from the client
|
||||
/// </summary>
|
||||
/// <param name="packet"></param>
|
||||
/// <returns>True if the transfer is complete, false otherwise</returns>
|
||||
public bool AckPacket(uint packet)
|
||||
{
|
||||
if (!complete)
|
||||
{
|
||||
if ((Data.Length - DataPointer) > 1000)
|
||||
{
|
||||
byte[] transferData = new byte[1000];
|
||||
Array.Copy(Data, DataPointer, transferData, 0, 1000);
|
||||
Client.SendXferPacket(XferID, Packet, transferData);
|
||||
Packet++;
|
||||
DataPointer += 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] transferData = new byte[Data.Length - DataPointer];
|
||||
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
|
||||
uint endPacket = Packet |= (uint)0x80000000;
|
||||
Client.SendXferPacket(XferID, endPacket, transferData);
|
||||
Packet++;
|
||||
DataPointer += (Data.Length - DataPointer);
|
||||
|
||||
complete = true;
|
||||
}
|
||||
}
|
||||
|
||||
return complete;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -58,8 +58,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
|
||||
private object m_syncRoot = new object();
|
||||
|
||||
private IHyperAssetService m_hyperAssets;
|
||||
|
||||
public LLClientView Client { get { return m_client; } }
|
||||
public AssetBase MissingImage { get { return m_missingImage; } }
|
||||
|
||||
|
@ -75,7 +73,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
|
||||
|
||||
m_j2kDecodeModule = pJ2kDecodeModule;
|
||||
m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -149,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
imgrequest.J2KDecoder = m_j2kDecodeModule;
|
||||
imgrequest.AssetService = m_assetCache;
|
||||
imgrequest.AgentID = m_client.AgentId;
|
||||
imgrequest.HyperAssets = m_hyperAssets;
|
||||
imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
imgrequest.DiscardLevel = newRequest.DiscardLevel;
|
||||
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
|
||||
imgrequest.Priority = newRequest.Priority;
|
||||
|
|
|
@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
private int m_defaultRTO = 0;
|
||||
private int m_maxRTO = 0;
|
||||
|
||||
private bool m_disableFacelights = false;
|
||||
|
||||
public Socket Server { get { return null; } }
|
||||
|
||||
public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
|
||||
|
@ -190,6 +192,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
m_defaultRTO = config.GetInt("DefaultRTO", 0);
|
||||
m_maxRTO = config.GetInt("MaxRTO", 0);
|
||||
m_disableFacelights = config.GetBoolean("DisableFacelights", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -898,6 +901,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
|
||||
client.OnLogout += LogoutHandler;
|
||||
|
||||
client.DisableFacelights = m_disableFacelights;
|
||||
|
||||
// Start the IClientAPI
|
||||
client.Start();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,11 @@ namespace OpenSim.Region.ClientStack
|
|||
|
||||
protected StorageManager m_storageManager;
|
||||
|
||||
public StorageManager StorageManager
|
||||
{
|
||||
get { return m_storageManager; }
|
||||
}
|
||||
|
||||
protected ClientStackManager m_clientStackManager;
|
||||
|
||||
public SceneManager SceneManager
|
||||
|
|
|
@ -182,7 +182,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
|
||||
if (part.Inventory.UpdateInventoryItem(item))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
if ((InventoryType)item.InvType == InventoryType.Notecard)
|
||||
remoteClient.SendAgentAlertMessage("Notecard saved", false);
|
||||
else if ((InventoryType)item.InvType == InventoryType.LSL)
|
||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||
else
|
||||
remoteClient.SendAgentAlertMessage("Item saved", false);
|
||||
|
||||
part.GetProperties(remoteClient);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
|
||||
if (mm != null)
|
||||
{
|
||||
if (!mm.UploadCovered(remoteClient))
|
||||
if (!mm.UploadCovered(remoteClient, mm.UploadCharge))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -131,6 +131,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
{
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
httpResponse.Send();
|
||||
return null;
|
||||
}
|
||||
SendTexture(httpRequest, httpResponse, texture);
|
||||
}
|
||||
else
|
||||
|
@ -147,6 +153,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
{
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
httpResponse.Send();
|
||||
return null;
|
||||
}
|
||||
SendTexture(httpRequest, httpResponse, texture);
|
||||
}
|
||||
else
|
||||
|
@ -178,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
|||
end = Utils.Clamp(end, 1, texture.Data.Length);
|
||||
start = Utils.Clamp(start, 0, end - 1);
|
||||
|
||||
m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
|
||||
if (end - start < texture.Data.Length)
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
@ -39,37 +40,65 @@ using OpenSim.Region.Framework.Scenes;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
{
|
||||
public class AttachmentsModule : IAttachmentsModule, IRegionModule
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AttachmentsModule")]
|
||||
public class AttachmentsModule : IAttachmentsModule, INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Scene m_scene = null;
|
||||
|
||||
public string Name { get { return "Attachments Module"; } }
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
public void Initialise(IConfigSource source) {}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
scene.RegisterModuleInterface<IAttachmentsModule>(this);
|
||||
m_scene = scene;
|
||||
m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
|
||||
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
|
||||
// TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
|
||||
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
public void RegionLoaded(Scene scene) {}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
RemoveRegion(m_scene);
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
||||
public void SubscribeToClientEvents(IClientAPI client)
|
||||
{
|
||||
get { return "Attachments Module"; }
|
||||
client.OnRezSingleAttachmentFromInv += RezSingleAttachmentFromInventory;
|
||||
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
|
||||
client.OnObjectAttach += AttachObject;
|
||||
client.OnObjectDetach += DetachObject;
|
||||
client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
|
||||
public void UnsubscribeFromClientEvents(IClientAPI client)
|
||||
{
|
||||
get { return false; }
|
||||
client.OnRezSingleAttachmentFromInv -= RezSingleAttachmentFromInventory;
|
||||
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
|
||||
client.OnObjectAttach -= AttachObject;
|
||||
client.OnObjectDetach -= DetachObject;
|
||||
client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
|
||||
}
|
||||
|
||||
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
|
||||
|
||||
/// <summary>
|
||||
/// Called by client
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="objectLocalID"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <param name="silent"></param>
|
||||
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
|
||||
{
|
||||
m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
|
||||
|
||||
|
@ -84,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||
if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false))
|
||||
{
|
||||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
|
@ -106,72 +135,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
}
|
||||
}
|
||||
|
||||
public bool AttachObject(
|
||||
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
|
||||
public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
|
||||
{
|
||||
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
|
||||
if (group != null)
|
||||
Vector3 attachPos = group.AbsolutePosition;
|
||||
|
||||
if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
|
||||
{
|
||||
if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
|
||||
// If the attachment point isn't the same as the one previously used
|
||||
// set it's offset position = 0 so that it appears on the attachment point
|
||||
// and not in a weird location somewhere unknown.
|
||||
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
|
||||
{
|
||||
// If the attachment point isn't the same as the one previously used
|
||||
// set it's offset position = 0 so that it appears on the attachment point
|
||||
// and not in a weird location somewhere unknown.
|
||||
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Check object for stored attachment point
|
||||
AttachmentPt = (uint)group.GetAttachmentPoint();
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Stick it on left hand with Zero Offset from the attachment point.
|
||||
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// Remove any previous attachments
|
||||
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
|
||||
UUID itemID = UUID.Zero;
|
||||
if (sp != null)
|
||||
{
|
||||
foreach(SceneObjectGroup grp in sp.Attachments)
|
||||
{
|
||||
attachPos = Vector3.Zero;
|
||||
if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
|
||||
{
|
||||
itemID = grp.GetFromItemID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (itemID != UUID.Zero)
|
||||
DetachSingleAttachmentToInv(itemID, remoteClient);
|
||||
}
|
||||
|
||||
// AttachmentPt 0 means the client chose to 'wear' the attachment.
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Check object for stored attachment point
|
||||
AttachmentPt = (uint)group.GetAttachmentPoint();
|
||||
}
|
||||
|
||||
// if we still didn't find a suitable attachment point.......
|
||||
if (AttachmentPt == 0)
|
||||
{
|
||||
// Stick it on left hand with Zero Offset from the attachment point.
|
||||
AttachmentPt = (uint)AttachmentPoint.LeftHand;
|
||||
attachPos = Vector3.Zero;
|
||||
}
|
||||
|
||||
group.SetAttachmentPoint((byte)AttachmentPt);
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// Saves and gets itemID
|
||||
UUID itemId;
|
||||
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemId = group.GetFromItemID();
|
||||
}
|
||||
|
||||
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group);
|
||||
|
||||
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
|
||||
|
||||
// In case it is later dropped again, don't let
|
||||
// it get cleaned up
|
||||
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
group.HasGroupChanged = false;
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"You don't have sufficient permissions to attach this object", false);
|
||||
|
||||
return false;
|
||||
itemID = group.GetFromItemID();
|
||||
}
|
||||
|
||||
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
|
||||
|
||||
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
|
||||
|
||||
// In case it is later dropped again, don't let
|
||||
// it get cleaned up
|
||||
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||
group.HasGroupChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: AttachObject found no such scene object {0}", objectLocalID);
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"You don't have sufficient permissions to attach this object", false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -237,16 +272,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
|
||||
tainted = true;
|
||||
|
||||
AttachObject(
|
||||
remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
|
||||
AttachObject(remoteClient, objatt, AttachmentPt, false);
|
||||
//objatt.ScheduleGroupForFullUpdate();
|
||||
|
||||
if (tainted)
|
||||
objatt.HasGroupChanged = true;
|
||||
|
||||
// Fire after attach, so we don't get messy perms dialogs
|
||||
// 3 == AttachedRez
|
||||
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
|
||||
// 4 == AttachedRez
|
||||
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
|
||||
objatt.ResumeScripts();
|
||||
|
||||
// Do this last so that event listeners have access to all the effects of the attachment
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
|||
{
|
||||
string deadAvatarMessage;
|
||||
ScenePresence killingAvatar = null;
|
||||
string killingAvatarMessage;
|
||||
// string killingAvatarMessage;
|
||||
|
||||
if (killerObjectLocalID == 0)
|
||||
deadAvatarMessage = "You committed suicide!";
|
||||
|
@ -118,14 +118,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
|||
deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, deadAvatar.Scene.GetUserName(part.OwnerID));
|
||||
else
|
||||
{
|
||||
killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
|
||||
// killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
|
||||
deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
|
||||
// killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
|
||||
deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,14 +81,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
}
|
||||
|
||||
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
|
||||
{
|
||||
ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
|
||||
if (presence != null && !presence.IsChildAgent)
|
||||
if (presence != null)
|
||||
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
}
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarID);
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels);
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarID);
|
||||
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
|||
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarid);
|
||||
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
if (sp != null)
|
||||
sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid);
|
||||
}
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
UUID principalID = new UUID(im.fromAgentID);
|
||||
UUID friendID = new UUID(im.toAgentID);
|
||||
|
||||
m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID);
|
||||
m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2}", principalID, im.fromAgentName, friendID);
|
||||
|
||||
// This user wants to be friends with the other user.
|
||||
// Let's add the relation backwards, in case the other is not online
|
||||
|
@ -521,6 +521,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
im.imSessionID = im.fromAgentID;
|
||||
|
||||
// Try the local sim
|
||||
UserAccount account = UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, agentID);
|
||||
im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;
|
||||
|
||||
if (LocalFriendshipOffered(friendID, im))
|
||||
return;
|
||||
|
||||
|
@ -765,8 +768,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
|
||||
if (canEditObjectsChanged)
|
||||
friendClient.SendChangeUserRights(userID, friendID, rights);
|
||||
|
||||
}
|
||||
|
||||
// update local cache
|
||||
//m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
|
||||
foreach (FriendInfo finfo in m_Friends[friendID].Friends)
|
||||
if (finfo.Friend == userID.ToString())
|
||||
finfo.TheirFlags = rights;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
|||
m_scene = scene;
|
||||
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
|
||||
m_scene.RegisterModuleInterface<IGodsModule>(this);
|
||||
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
|
||||
}
|
||||
|
||||
public void PostInitialise() {}
|
||||
|
@ -54,6 +55,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
|
|||
public string Name { get { return "Gods Module"; } }
|
||||
public bool IsSharedModule { get { return false; } }
|
||||
|
||||
public void SubscribeToClientEvents(IClientAPI client)
|
||||
{
|
||||
client.OnGodKickUser += KickUser;
|
||||
client.OnRequestGodlikePowers += RequestGodlikePowers;
|
||||
}
|
||||
|
||||
public void UnsubscribeFromClientEvents(IClientAPI client)
|
||||
{
|
||||
client.OnGodKickUser -= KickUser;
|
||||
client.OnRequestGodlikePowers -= RequestGodlikePowers;
|
||||
}
|
||||
|
||||
public void RequestGodlikePowers(
|
||||
UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
|
||||
{
|
||||
|
|
|
@ -162,7 +162,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
delegate(bool success)
|
||||
{
|
||||
if (dialog == (uint)InstantMessageDialog.StartTyping ||
|
||||
dialog == (uint)InstantMessageDialog.StopTyping)
|
||||
dialog == (uint)InstantMessageDialog.StopTyping ||
|
||||
dialog == (uint)InstantMessageDialog.MessageFromObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -185,13 +185,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
{
|
||||
UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
|
||||
|
||||
// If this event has handlers, then the IM will be considered
|
||||
// delivered. This will suppress the error message.
|
||||
// If this event has handlers, then an IM from an agent will be
|
||||
// considered delivered. This will suppress the error message.
|
||||
//
|
||||
if (handlerUndeliveredMessage != null)
|
||||
{
|
||||
handlerUndeliveredMessage(im);
|
||||
result(true);
|
||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
result(true);
|
||||
else
|
||||
result(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -504,14 +507,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
//
|
||||
if (upd.RegionID == prevRegionID)
|
||||
{
|
||||
m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
HandleUndeliveredMessage(im, result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
HandleUndeliveredMessage(im, result);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
private UserAccount m_userInfo;
|
||||
private string m_invPath;
|
||||
|
||||
/// <summary>
|
||||
/// Do we want to merge this load with existing inventory?
|
||||
/// </summary>
|
||||
protected bool m_merge;
|
||||
|
||||
/// <value>
|
||||
/// We only use this to request modules
|
||||
|
@ -66,19 +71,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
private Stream m_loadStream;
|
||||
|
||||
public InventoryArchiveReadRequest(
|
||||
Scene scene, UserAccount userInfo, string invPath, string loadPath)
|
||||
Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge)
|
||||
: this(
|
||||
scene,
|
||||
userInfo,
|
||||
invPath,
|
||||
new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress))
|
||||
new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress),
|
||||
merge)
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryArchiveReadRequest(
|
||||
Scene scene, UserAccount userInfo, string invPath, Stream loadStream)
|
||||
Scene scene, UserAccount userInfo, string invPath, Stream loadStream, bool merge)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_merge = merge;
|
||||
m_userInfo = userInfo;
|
||||
m_invPath = invPath;
|
||||
m_loadStream = loadStream;
|
||||
|
@ -91,38 +98,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// A list of the inventory nodes loaded. If folders were loaded then only the root folders are
|
||||
/// returned
|
||||
/// </returns>
|
||||
public List<InventoryNodeBase> Execute()
|
||||
public HashSet<InventoryNodeBase> Execute()
|
||||
{
|
||||
string filePath = "ERROR";
|
||||
int successfulAssetRestores = 0;
|
||||
int failedAssetRestores = 0;
|
||||
int successfulItemRestores = 0;
|
||||
|
||||
List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
|
||||
|
||||
InventoryFolderBase rootDestinationFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(
|
||||
m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
|
||||
|
||||
if (null == rootDestinationFolder)
|
||||
{
|
||||
// Possibly provide an option later on to automatically create this folder if it does not exist
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
|
||||
|
||||
return loadedNodes;
|
||||
}
|
||||
|
||||
archive = new TarArchiveReader(m_loadStream);
|
||||
|
||||
// In order to load identically named folders, we need to keep track of the folders that we have already
|
||||
// resolved
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
|
||||
|
||||
byte[] data;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
|
||||
try
|
||||
{
|
||||
string filePath = "ERROR";
|
||||
int successfulAssetRestores = 0;
|
||||
int failedAssetRestores = 0;
|
||||
int successfulItemRestores = 0;
|
||||
|
||||
HashSet<InventoryNodeBase> loadedNodes = new HashSet<InventoryNodeBase>();
|
||||
|
||||
List<InventoryFolderBase> folderCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(
|
||||
m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
|
||||
|
||||
if (folderCandidates.Count == 0)
|
||||
{
|
||||
// Possibly provide an option later on to automatically create this folder if it does not exist
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
|
||||
|
||||
return loadedNodes;
|
||||
}
|
||||
|
||||
InventoryFolderBase rootDestinationFolder = folderCandidates[0];
|
||||
archive = new TarArchiveReader(m_loadStream);
|
||||
|
||||
// In order to load identically named folders, we need to keep track of the folders that we have already
|
||||
// resolved
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
|
||||
|
||||
byte[] data;
|
||||
TarArchiveReader.TarEntryType entryType;
|
||||
|
||||
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
|
||||
{
|
||||
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||
|
@ -157,26 +165,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
{
|
||||
successfulItemRestores++;
|
||||
|
||||
// If we're loading an item directly into the given destination folder then we need to record
|
||||
// it separately from any loaded root folders
|
||||
if (rootDestinationFolder == foundFolder)
|
||||
// If we aren't loading the folder containing the item then well need to update the
|
||||
// viewer separately for that item.
|
||||
if (!loadedNodes.Contains(foundFolder))
|
||||
loadedNodes.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
archive.Close();
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
|
||||
successfulAssetRestores, failedAssetRestores);
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
|
||||
|
||||
return loadedNodes;
|
||||
}
|
||||
finally
|
||||
{
|
||||
archive.Close();
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
|
||||
successfulAssetRestores, failedAssetRestores);
|
||||
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
|
||||
|
||||
return loadedNodes;
|
||||
m_loadStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -188,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <summary>
|
||||
/// Replicate the inventory paths in the archive to the user's inventory as necessary.
|
||||
/// </summary>
|
||||
/// <param name="archivePath">The item archive path to replicate</param>
|
||||
/// <param name="iarPath">The item archive path to replicate</param>
|
||||
/// <param name="rootDestinationFolder">The root folder for the inventory load</param>
|
||||
/// <param name="resolvedFolders">
|
||||
/// The folders that we have resolved so far for a given archive path.
|
||||
|
@ -199,24 +209,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// </param>
|
||||
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
||||
public InventoryFolderBase ReplicateArchivePathToUserInventory(
|
||||
string archivePath,
|
||||
string iarPath,
|
||||
InventoryFolderBase rootDestFolder,
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders,
|
||||
List<InventoryNodeBase> loadedNodes)
|
||||
HashSet<InventoryNodeBase> loadedNodes)
|
||||
{
|
||||
string originalArchivePath = archivePath;
|
||||
string iarPathExisting = iarPath;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
|
||||
|
||||
InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref archivePath, resolvedFolders);
|
||||
InventoryFolderBase destFolder
|
||||
= ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
|
||||
// originalArchivePath, archivePath);
|
||||
// iarPath, iarPathExisting);
|
||||
|
||||
string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length);
|
||||
CreateFoldersForPath(destFolder, archivePathSectionToCreate, resolvedFolders, loadedNodes);
|
||||
string iarPathToCreate = iarPath.Substring(iarPathExisting.Length);
|
||||
CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes);
|
||||
|
||||
return destFolder;
|
||||
}
|
||||
|
@ -245,47 +256,58 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
InventoryFolderBase rootDestFolder,
|
||||
ref string archivePath,
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders)
|
||||
{
|
||||
string originalArchivePath = archivePath;
|
||||
{
|
||||
// string originalArchivePath = archivePath;
|
||||
|
||||
InventoryFolderBase destFolder = null;
|
||||
|
||||
if (archivePath.Length > 0)
|
||||
while (archivePath.Length > 0)
|
||||
{
|
||||
while (null == destFolder && archivePath.Length > 0)
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
|
||||
|
||||
if (resolvedFolders.ContainsKey(archivePath))
|
||||
{
|
||||
if (resolvedFolders.ContainsKey(archivePath))
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
|
||||
return resolvedFolders[archivePath];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_merge)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
|
||||
destFolder = resolvedFolders[archivePath];
|
||||
// TODO: Using m_invPath is totally wrong - what we need to do is strip the uuid from the
|
||||
// iar name and try to find that instead.
|
||||
string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath);
|
||||
List<InventoryFolderBase> folderCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(
|
||||
m_scene.InventoryService, m_userInfo.PrincipalID, plainPath);
|
||||
|
||||
if (folderCandidates.Count != 0)
|
||||
{
|
||||
InventoryFolderBase destFolder = folderCandidates[0];
|
||||
resolvedFolders[archivePath] = destFolder;
|
||||
return destFolder;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't include the last slash so find the penultimate one
|
||||
int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
|
||||
|
||||
if (penultimateSlashIndex >= 0)
|
||||
{
|
||||
// Remove the last section of path so that we can see if we've already resolved the parent
|
||||
archivePath = archivePath.Remove(penultimateSlashIndex + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't include the last slash so find the penultimate one
|
||||
int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
|
||||
|
||||
if (penultimateSlashIndex >= 0)
|
||||
{
|
||||
// Remove the last section of path so that we can see if we've already resolved the parent
|
||||
archivePath = archivePath.Remove(penultimateSlashIndex + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
|
||||
originalArchivePath);
|
||||
archivePath = string.Empty;
|
||||
destFolder = rootDestFolder;
|
||||
}
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
|
||||
// originalArchivePath);
|
||||
archivePath = string.Empty;
|
||||
return rootDestFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null == destFolder)
|
||||
destFolder = rootDestFolder;
|
||||
|
||||
return destFolder;
|
||||
return rootDestFolder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -294,8 +316,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="destFolder">
|
||||
/// The root folder from which the creation will take place.
|
||||
/// </param>
|
||||
/// <param name="path">
|
||||
/// The path to create
|
||||
/// <param name="iarPathExisting">
|
||||
/// the part of the iar path that already exists
|
||||
/// </param>
|
||||
/// <param name="iarPathToReplicate">
|
||||
/// The path to replicate in the user's inventory from iar
|
||||
/// </param>
|
||||
/// <param name="resolvedFolders">
|
||||
/// The folders that we have resolved so far for a given archive path.
|
||||
|
@ -304,26 +329,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// Track the inventory nodes created.
|
||||
/// </param>
|
||||
protected void CreateFoldersForPath(
|
||||
InventoryFolderBase destFolder, string path, Dictionary <string, InventoryFolderBase> resolvedFolders,
|
||||
List<InventoryNodeBase> loadedNodes)
|
||||
InventoryFolderBase destFolder,
|
||||
string iarPathExisting,
|
||||
string iarPathToReplicate,
|
||||
Dictionary <string, InventoryFolderBase> resolvedFolders,
|
||||
HashSet<InventoryNodeBase> loadedNodes)
|
||||
{
|
||||
string pathCreated = "";
|
||||
string[] rawDirsToCreate = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
int i = 0;
|
||||
string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
while (i < rawDirsToCreate.Length)
|
||||
for (int i = 0; i < rawDirsToCreate.Length; i++)
|
||||
{
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0} from IAR", rawDirsToCreate[i]);
|
||||
|
||||
if (!rawDirsToCreate[i].Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
|
||||
continue;
|
||||
|
||||
int identicalNameIdentifierIndex
|
||||
= rawDirsToCreate[i].LastIndexOf(
|
||||
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
|
||||
|
||||
if (identicalNameIdentifierIndex < 0)
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
string newFolderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex);
|
||||
|
||||
newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
|
||||
|
@ -340,14 +364,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
m_scene.InventoryService.AddFolder(destFolder);
|
||||
|
||||
// Record that we have now created this folder
|
||||
pathCreated += rawDirsToCreate[i] + "/";
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Created folder {0} from IAR", pathCreated);
|
||||
resolvedFolders[pathCreated] = destFolder;
|
||||
iarPathExisting += rawDirsToCreate[i] + "/";
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Created folder {0} from IAR", iarPathExisting);
|
||||
resolvedFolders[iarPathExisting] = destFolder;
|
||||
|
||||
if (0 == i)
|
||||
loadedNodes.Add(destFolder);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
///
|
||||
/// This method does not handle paths that contain multiple delimitors
|
||||
///
|
||||
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
||||
/// XPath like expression
|
||||
/// FIXME: We have no way of distinguishing folders with the same path
|
||||
///
|
||||
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||
///
|
||||
|
@ -70,14 +69,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// The path to the required folder.
|
||||
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||
/// </param>
|
||||
/// <returns>null if the folder is not found</returns>
|
||||
public static InventoryFolderBase FindFolderByPath(
|
||||
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
|
||||
public static List<InventoryFolderBase> FindFolderByPath(
|
||||
IInventoryService inventoryService, UUID userId, string path)
|
||||
{
|
||||
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
|
||||
|
||||
if (null == rootFolder)
|
||||
return null;
|
||||
return new List<InventoryFolderBase>();
|
||||
|
||||
return FindFolderByPath(inventoryService, rootFolder, path);
|
||||
}
|
||||
|
@ -88,8 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
///
|
||||
/// This method does not handle paths that contain multiple delimitors
|
||||
///
|
||||
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
||||
/// XPath like expression
|
||||
/// FIXME: We have no way of distinguishing folders with the same path.
|
||||
///
|
||||
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||
///
|
||||
|
@ -103,17 +101,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// The path to the required folder.
|
||||
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||
/// </param>
|
||||
/// <returns>null if the folder is not found</returns>
|
||||
public static InventoryFolderBase FindFolderByPath(
|
||||
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
|
||||
public static List<InventoryFolderBase> FindFolderByPath(
|
||||
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
|
||||
{
|
||||
List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>();
|
||||
|
||||
if (path == string.Empty)
|
||||
return startFolder;
|
||||
{
|
||||
foundFolders.Add(startFolder);
|
||||
return foundFolders;
|
||||
}
|
||||
|
||||
path = path.Trim();
|
||||
|
||||
if (path == PATH_DELIMITER.ToString())
|
||||
return startFolder;
|
||||
{
|
||||
foundFolders.Add(startFolder);
|
||||
return foundFolders;
|
||||
}
|
||||
|
||||
string[] components = SplitEscapedPath(path);
|
||||
components[0] = UnescapePath(components[0]);
|
||||
|
@ -127,14 +133,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (folder.Name == components[0])
|
||||
{
|
||||
if (components.Length > 1)
|
||||
return FindFolderByPath(inventoryService, folder, components[1]);
|
||||
foundFolders.AddRange(FindFolderByPath(inventoryService, folder, components[1]));
|
||||
else
|
||||
return folder;
|
||||
foundFolders.Add(folder);
|
||||
}
|
||||
}
|
||||
|
||||
// We didn't find a folder with the right name
|
||||
return null;
|
||||
return foundFolders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -201,11 +206,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
if (components.Length == 1)
|
||||
{
|
||||
// m_log.DebugFormat("FOUND SINGLE COMPONENT [{0}]", components[0]);
|
||||
// m_log.DebugFormat(
|
||||
// "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}",
|
||||
// components[0], startFolder.Name, startFolder.ID);
|
||||
|
||||
List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
|
||||
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count);
|
||||
|
||||
foreach (InventoryItemBase item in items)
|
||||
{
|
||||
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID);
|
||||
|
||||
if (item.Name == components[0])
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -119,22 +119,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
|
||||
{
|
||||
Exception reportedException = null;
|
||||
bool succeeded = true;
|
||||
|
||||
bool succeeded = true;
|
||||
|
||||
try
|
||||
{
|
||||
// We're almost done. Just need to write out the control file now
|
||||
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
|
||||
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
|
||||
|
||||
m_archiveWriter.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_saveStream.Close();
|
||||
reportedException = e;
|
||||
succeeded = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_saveStream.Close();
|
||||
}
|
||||
|
||||
m_module.TriggerInventoryArchiveSaved(
|
||||
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
|
||||
|
@ -213,69 +215,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// </summary>
|
||||
public void Execute()
|
||||
{
|
||||
InventoryFolderBase inventoryFolder = null;
|
||||
InventoryItemBase inventoryItem = null;
|
||||
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
|
||||
|
||||
bool foundStar = false;
|
||||
|
||||
// Eliminate double slashes and any leading / on the path.
|
||||
string[] components
|
||||
= m_invPath.Split(
|
||||
new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
int maxComponentIndex = components.Length - 1;
|
||||
|
||||
// If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
|
||||
// folder itself. This may get more sophisicated later on
|
||||
if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
|
||||
{
|
||||
foundStar = true;
|
||||
maxComponentIndex--;
|
||||
}
|
||||
|
||||
m_invPath = String.Empty;
|
||||
for (int i = 0; i <= maxComponentIndex; i++)
|
||||
{
|
||||
m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
|
||||
}
|
||||
|
||||
// Annoyingly Split actually returns the original string if the input string consists only of delimiters
|
||||
// Therefore if we still start with a / after the split, then we need the root folder
|
||||
if (m_invPath.Length == 0)
|
||||
{
|
||||
inventoryFolder = rootFolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
||||
inventoryFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
//inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
||||
}
|
||||
|
||||
// The path may point to an item instead
|
||||
if (inventoryFolder == null)
|
||||
{
|
||||
inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
//inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
|
||||
}
|
||||
|
||||
if (null == inventoryFolder && null == inventoryItem)
|
||||
{
|
||||
// We couldn't find the path indicated
|
||||
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage);
|
||||
m_module.TriggerInventoryArchiveSaved(
|
||||
m_id, false, m_userInfo, m_invPath, m_saveStream,
|
||||
new Exception(errorMessage));
|
||||
return;
|
||||
}
|
||||
|
||||
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||
|
||||
try
|
||||
{
|
||||
InventoryFolderBase inventoryFolder = null;
|
||||
InventoryItemBase inventoryItem = null;
|
||||
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
|
||||
|
||||
bool foundStar = false;
|
||||
|
||||
// Eliminate double slashes and any leading / on the path.
|
||||
string[] components
|
||||
= m_invPath.Split(
|
||||
new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
int maxComponentIndex = components.Length - 1;
|
||||
|
||||
// If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
|
||||
// folder itself. This may get more sophisicated later on
|
||||
if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
|
||||
{
|
||||
foundStar = true;
|
||||
maxComponentIndex--;
|
||||
}
|
||||
|
||||
m_invPath = String.Empty;
|
||||
for (int i = 0; i <= maxComponentIndex; i++)
|
||||
{
|
||||
m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
|
||||
}
|
||||
|
||||
// Annoyingly Split actually returns the original string if the input string consists only of delimiters
|
||||
// Therefore if we still start with a / after the split, then we need the root folder
|
||||
if (m_invPath.Length == 0)
|
||||
{
|
||||
inventoryFolder = rootFolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
||||
List<InventoryFolderBase> candidateFolders
|
||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
if (candidateFolders.Count > 0)
|
||||
inventoryFolder = candidateFolders[0];
|
||||
}
|
||||
|
||||
// The path may point to an item instead
|
||||
if (inventoryFolder == null)
|
||||
{
|
||||
inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||
//inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
|
||||
}
|
||||
|
||||
if (null == inventoryFolder && null == inventoryItem)
|
||||
{
|
||||
// We couldn't find the path indicated
|
||||
string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
|
||||
Exception e = new InventoryArchiverException(errorMessage);
|
||||
m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
m_archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||
|
||||
if (inventoryFolder != null)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
|
@ -296,16 +297,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
// Don't put all this profile information into the archive right now.
|
||||
//SaveUsers();
|
||||
|
||||
new AssetsRequest(
|
||||
new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_archiveWriter.Close();
|
||||
m_saveStream.Close();
|
||||
throw;
|
||||
}
|
||||
|
||||
new AssetsRequest(
|
||||
new AssetsArchiver(m_archiveWriter), m_assetUuids,
|
||||
m_scene.AssetService, ReceivedAllAssets).Execute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -26,13 +26,15 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
public abstract class ConfigBase
|
||||
{
|
||||
protected ConfigurationMember m_configMember;
|
||||
/// <summary>
|
||||
/// Signals an inventory archiving problem
|
||||
/// </summary>
|
||||
public class InventoryArchiverException : Exception
|
||||
{
|
||||
public InventoryArchiverException(string message) : base(message) {}
|
||||
public InventoryArchiverException(string message, Exception e) : base(message, e) {}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
|
||||
scene.AddCommand(
|
||||
this, "load iar",
|
||||
"load iar <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
"load iar <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
//"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
|
||||
"Load user inventory archive (IAR).",
|
||||
//"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
|
||||
//"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
|
||||
//+ "<first> is user's first name." + Environment.NewLine
|
||||
"<first> is user's first name." + Environment.NewLine
|
||||
"<first> is user's first name." + Environment.NewLine
|
||||
+ "<last> is user's last name." + Environment.NewLine
|
||||
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
|
||||
+ "<password> is the user's password." + Environment.NewLine
|
||||
|
@ -136,16 +136,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (handlerInventoryArchiveSaved != null)
|
||||
handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
|
||||
}
|
||||
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
|
||||
{
|
||||
return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>());
|
||||
}
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
|
||||
{
|
||||
return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Dictionary<string, object> options)
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -184,8 +184,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
}
|
||||
|
||||
public bool ArchiveInventory(
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
|
||||
Dictionary<string, object> options)
|
||||
Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -224,13 +224,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
}
|
||||
|
||||
public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream)
|
||||
{
|
||||
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
{
|
||||
return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
Dictionary<string, object> options)
|
||||
string firstName, string lastName, string invPath, string pass, Stream loadStream,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -241,10 +241,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (CheckPresence(userInfo.PrincipalID))
|
||||
{
|
||||
InventoryArchiveReadRequest request;
|
||||
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
|
||||
|
||||
try
|
||||
{
|
||||
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
|
||||
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge);
|
||||
}
|
||||
catch (EntryPointNotFoundException e)
|
||||
{
|
||||
|
@ -273,8 +274,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
}
|
||||
|
||||
public bool DearchiveInventory(
|
||||
string firstName, string lastName, string invPath, string pass, string loadPath,
|
||||
Dictionary<string, object> options)
|
||||
string firstName, string lastName, string invPath, string pass, string loadPath,
|
||||
Dictionary<string, object> options)
|
||||
{
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
|
@ -285,10 +286,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
if (CheckPresence(userInfo.PrincipalID))
|
||||
{
|
||||
InventoryArchiveReadRequest request;
|
||||
bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
|
||||
|
||||
try
|
||||
{
|
||||
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
|
||||
{
|
||||
request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
|
||||
}
|
||||
catch (EntryPointNotFoundException e)
|
||||
{
|
||||
|
@ -322,34 +324,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="cmdparams"></param>
|
||||
protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
|
||||
{
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
|
||||
|
||||
List<string> mainParams = optionSet.Parse(cmdparams);
|
||||
|
||||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
string firstName = mainParams[2];
|
||||
string lastName = mainParams[3];
|
||||
string invPath = mainParams[4];
|
||||
string pass = mainParams[5];
|
||||
string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
||||
loadPath, invPath, firstName, lastName);
|
||||
|
||||
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
|
||||
try
|
||||
{
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
|
||||
|
||||
List<string> mainParams = optionSet.Parse(cmdparams);
|
||||
|
||||
if (mainParams.Count < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
string firstName = mainParams[2];
|
||||
string lastName = mainParams[3];
|
||||
string invPath = mainParams[4];
|
||||
string pass = mainParams[5];
|
||||
string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
||||
loadPath, firstName, lastName);
|
||||
"[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
|
||||
loadPath, invPath, firstName, lastName);
|
||||
|
||||
if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
|
||||
loadPath, firstName, lastName);
|
||||
}
|
||||
catch (InventoryArchiverException e)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -358,30 +367,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// <param name="cmdparams"></param>
|
||||
protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
|
||||
{
|
||||
if (cmdparams.Length < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
string firstName = cmdparams[2];
|
||||
string lastName = cmdparams[3];
|
||||
string invPath = cmdparams[4];
|
||||
string pass = cmdparams[5];
|
||||
string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
|
||||
savePath, invPath, firstName, lastName);
|
||||
|
||||
Guid id = Guid.NewGuid();
|
||||
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if (cmdparams.Length < 6)
|
||||
{
|
||||
m_log.Error(
|
||||
"[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
string firstName = cmdparams[2];
|
||||
string lastName = cmdparams[3];
|
||||
string invPath = cmdparams[4];
|
||||
string pass = cmdparams[5];
|
||||
string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
|
||||
savePath, invPath, firstName, lastName);
|
||||
|
||||
ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
|
||||
}
|
||||
catch (InventoryArchiverException e)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
|
||||
}
|
||||
|
||||
lock (m_pendingConsoleSaves)
|
||||
m_pendingConsoleSaves.Add(id);
|
||||
m_pendingConsoleSaves.Add(id);
|
||||
}
|
||||
|
||||
private void SaveInvConsoleCommandCompleted(
|
||||
|
@ -454,7 +471,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
/// Notify the client of loaded nodes if they are logged in
|
||||
/// </summary>
|
||||
/// <param name="loadedNodes">Can be empty. In which case, nothing happens</param>
|
||||
private void UpdateClientWithLoadedNodes(UserAccount userInfo, List<InventoryNodeBase> loadedNodes)
|
||||
private void UpdateClientWithLoadedNodes(UserAccount userInfo, HashSet<InventoryNodeBase> loadedNodes)
|
||||
{
|
||||
if (loadedNodes.Count == 0)
|
||||
return;
|
||||
|
|
|
@ -63,13 +63,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet).
|
||||
/// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
|
||||
/// (subject to change since there is no fixed format yet).
|
||||
/// </summary>
|
||||
// Commenting for now! The mock inventory service needs more beef, at least for
|
||||
// GetFolderForType
|
||||
// REFACTORING PROBLEM. This needs to be rewritten.
|
||||
[Test]
|
||||
public void TestSaveIarV0_1()
|
||||
public void TestSavePathToIarV0_1()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -117,7 +115,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
|
||||
|
@ -181,6 +179,123 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
// TODO: Test presence of more files and contents of files.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
|
||||
/// (subject to change since there is no fixed format yet).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSaveItemToIarV0_1()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
|
||||
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
|
||||
|
||||
// Create user
|
||||
string userFirstName = "Jock";
|
||||
string userLastName = "Stirrup";
|
||||
string userPassword = "troll";
|
||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
||||
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1;
|
||||
SceneObjectPart part1;
|
||||
{
|
||||
string partName = "My Little Dog Object";
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
|
||||
Vector3 groupPosition = new Vector3(10, 20, 30);
|
||||
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
|
||||
Vector3 offsetPosition = new Vector3(5, 10, 15);
|
||||
|
||||
part1
|
||||
= new SceneObjectPart(
|
||||
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
|
||||
part1.Name = partName;
|
||||
|
||||
object1 = new SceneObjectGroup(part1);
|
||||
scene.AddNewSceneObject(object1, false);
|
||||
}
|
||||
|
||||
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
||||
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
|
||||
scene.AssetService.Store(asset1);
|
||||
|
||||
// Create item
|
||||
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
|
||||
string item1Name = "My Little Dog";
|
||||
InventoryItemBase item1 = new InventoryItemBase();
|
||||
item1.Name = item1Name;
|
||||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
|
||||
|
||||
mre.Reset();
|
||||
archiverModule.ArchiveInventory(
|
||||
Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
|
||||
mre.WaitOne(60000, false);
|
||||
|
||||
byte[] archive = archiveWriteStream.ToArray();
|
||||
MemoryStream archiveReadStream = new MemoryStream(archive);
|
||||
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||
|
||||
//bool gotControlFile = false;
|
||||
bool gotObject1File = false;
|
||||
//bool gotObject2File = false;
|
||||
string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
|
||||
string expectedObject1FilePath = string.Format(
|
||||
"{0}{1}",
|
||||
ArchiveConstants.INVENTORY_PATH,
|
||||
expectedObject1FileName);
|
||||
|
||||
string filePath;
|
||||
TarArchiveReader.TarEntryType tarEntryType;
|
||||
|
||||
// Console.WriteLine("Reading archive");
|
||||
|
||||
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
|
||||
{
|
||||
Console.WriteLine("Got {0}", filePath);
|
||||
|
||||
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
|
||||
// {
|
||||
// gotControlFile = true;
|
||||
// }
|
||||
|
||||
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
|
||||
{
|
||||
// string fileName = filePath.Remove(0, "Objects/".Length);
|
||||
//
|
||||
// if (fileName.StartsWith(part1.Name))
|
||||
// {
|
||||
Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
|
||||
gotObject1File = true;
|
||||
// }
|
||||
// else if (fileName.StartsWith(part2.Name))
|
||||
// {
|
||||
// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
|
||||
// gotObject2File = true;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Assert.That(gotControlFile, Is.True, "No control file in archive");
|
||||
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
|
||||
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
||||
|
||||
// TODO: Test presence of more files and contents of files.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
/// an account exists with the creator name.
|
||||
|
@ -327,7 +442,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
scene.AddInventoryItem(userId, item1);
|
||||
|
||||
|
@ -508,41 +623,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
public void TestNewIarPath()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||
|
||||
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
||||
HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
|
||||
|
||||
string folder1Name = "a";
|
||||
string folder2Name = "b";
|
||||
string itemName = "c.lsl";
|
||||
string folder1Name = "1";
|
||||
string folder2aName = "2a";
|
||||
string folder2bName = "2b";
|
||||
|
||||
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
|
||||
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
||||
string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
||||
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
|
||||
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
|
||||
|
||||
string itemArchivePath
|
||||
= string.Format(
|
||||
"{0}{1}{2}{3}",
|
||||
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
|
||||
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
|
||||
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
|
||||
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
foldersCreated, nodesLoaded);
|
||||
|
||||
InventoryFolderBase folder1
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a");
|
||||
Assert.That(folder1, Is.Not.Null, "Could not find folder a");
|
||||
InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
|
||||
Assert.That(folder2, Is.Not.Null, "Could not find folder b");
|
||||
{
|
||||
// Test replication of path1
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
foldersCreated, nodesLoaded);
|
||||
|
||||
List<InventoryFolderBase> folder1Candidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
|
||||
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
|
||||
|
||||
InventoryFolderBase folder1 = folder1Candidates[0];
|
||||
List<InventoryFolderBase> folder2aCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
|
||||
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
{
|
||||
// Test replication of path2
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
foldersCreated, nodesLoaded);
|
||||
|
||||
List<InventoryFolderBase> folder1Candidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
|
||||
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
|
||||
|
||||
InventoryFolderBase folder1 = folder1Candidates[0];
|
||||
|
||||
List<InventoryFolderBase> folder2aCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
|
||||
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
|
||||
|
||||
List<InventoryFolderBase> folder2bCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
|
||||
Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test replication of a partly existing archive path to the user's inventory.
|
||||
/// Test replication of a partly existing archive path to the user's inventory. This should create
|
||||
/// a duplicate path without the merge option.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestPartExistingIarPath()
|
||||
|
@ -555,7 +697,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
string folder1ExistingName = "a";
|
||||
string folder2Name = "b";
|
||||
string itemName = "c.lsl";
|
||||
|
||||
InventoryFolderBase folder1
|
||||
= UserInventoryTestUtils.CreateInventoryFolder(
|
||||
|
@ -563,28 +704,73 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
|
||||
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
||||
string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
||||
|
||||
string itemArchivePath
|
||||
= string.Format(
|
||||
"{0}{1}{2}{3}",
|
||||
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
|
||||
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
|
||||
|
||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>());
|
||||
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
|
||||
|
||||
InventoryFolderBase folder1Post
|
||||
List<InventoryFolderBase> folder1PostCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
|
||||
Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
|
||||
/*
|
||||
InventoryFolderBase folder2
|
||||
Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
|
||||
|
||||
// FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
|
||||
InventoryFolderBase folder1Post = null;
|
||||
foreach (InventoryFolderBase folder in folder1PostCandidates)
|
||||
{
|
||||
if (folder.ID != folder1.ID)
|
||||
{
|
||||
folder1Post = folder;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
|
||||
|
||||
List<InventoryFolderBase> folder2PostCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
|
||||
Assert.That(folder2, Is.Not.Null);
|
||||
InventoryItemBase item = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, folder2, itemName);
|
||||
Assert.That(item, Is.Not.Null);
|
||||
*/
|
||||
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test replication of a partly existing archive path to the user's inventory. This should create
|
||||
/// a merged path.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestMergeIarPath()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||
|
||||
string folder1ExistingName = "a";
|
||||
string folder2Name = "b";
|
||||
|
||||
InventoryFolderBase folder1
|
||||
= UserInventoryTestUtils.CreateInventoryFolder(
|
||||
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
|
||||
|
||||
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
|
||||
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
||||
|
||||
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
|
||||
|
||||
new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
|
||||
.ReplicateArchivePathToUserInventory(
|
||||
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
|
||||
|
||||
List<InventoryFolderBase> folder1PostCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
|
||||
Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
|
||||
Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
|
||||
|
||||
List<InventoryFolderBase> folder2PostCandidates
|
||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
|
||||
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -82,6 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||
scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
@ -98,9 +99,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
scene.EventManager.OnNewClient -= OnNewClient;
|
||||
scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
||||
scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
@ -108,6 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
scene.EventManager.OnNewClient -= OnNewClient;
|
||||
scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
||||
scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
|
||||
m_Scenelist.Remove(scene);
|
||||
}
|
||||
|
||||
|
@ -136,6 +138,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
// Inventory giving is conducted via instant message
|
||||
client.OnInstantMessage += OnInstantMessage;
|
||||
}
|
||||
|
||||
protected void OnSetRootAgentScene(UUID id, Scene scene)
|
||||
{
|
||||
m_AgentRegions[id] = scene;
|
||||
}
|
||||
|
||||
private Scene FindClientScene(UUID agentId)
|
||||
{
|
||||
|
@ -160,7 +167,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
if (scene == null) // Something seriously wrong here.
|
||||
return;
|
||||
|
||||
|
||||
if (im.dialog == (byte) InstantMessageDialog.InventoryOffered)
|
||||
{
|
||||
//m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0]));
|
||||
|
@ -346,11 +352,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
}
|
||||
}
|
||||
|
||||
public void SetRootAgentScene(UUID agentID, Scene scene)
|
||||
{
|
||||
m_AgentRegions[agentID] = scene;
|
||||
}
|
||||
|
||||
public bool NeedSceneCacheClear(UUID agentID, Scene scene)
|
||||
{
|
||||
if (!m_AgentRegions.ContainsKey(agentID))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -174,9 +174,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
position.Z = newPosZ;
|
||||
}
|
||||
|
||||
// Only send this if the event queue is null
|
||||
if (eq == null)
|
||||
sp.ControllingClient.SendTeleportLocationStart();
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
|
||||
sp.Teleport(position);
|
||||
|
@ -257,9 +255,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
ulong destinationHandle = finalDestination.RegionHandle;
|
||||
|
||||
if (eq == null)
|
||||
sp.ControllingClient.SendTeleportLocationStart();
|
||||
|
||||
// Let's do DNS resolution only once in this process, please!
|
||||
// This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
|
||||
// it's actually doing a lot of work.
|
||||
|
@ -277,6 +272,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return;
|
||||
}
|
||||
|
||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||
|
||||
// the avatar.Close below will clear the child region list. We need this below for (possibly)
|
||||
// closing the child agents, so save it here (we need a copy as it is Clear()-ed).
|
||||
//List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList());
|
||||
|
@ -307,7 +304,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
string reason = String.Empty;
|
||||
|
||||
// Let's create an agent there if one doesn't exist yet.
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason))
|
||||
bool logout = false;
|
||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
|
||||
reason));
|
||||
|
@ -319,6 +317,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
{
|
||||
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
|
||||
|
||||
#region IP Translation for NAT
|
||||
IClientIPEndpoint ipepClient;
|
||||
if (sp.ClientView.TryGet(out ipepClient))
|
||||
|
@ -396,6 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.Position = position;
|
||||
SetCallbackURL(agent, sp.Scene.RegionInfo);
|
||||
|
||||
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent...");
|
||||
|
||||
if (!UpdateAgent(reg, finalDestination, agent))
|
||||
{
|
||||
// Region doesn't take it
|
||||
|
@ -434,8 +436,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
|
||||
|
||||
// Well, this is it. The agent is over there.
|
||||
|
||||
KillEntity(sp.Scene, sp.LocalId);
|
||||
|
||||
// May need to logout or other cleanup
|
||||
AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
|
||||
|
||||
// Now let's make it officially a child agent
|
||||
sp.MakeChildAgent();
|
||||
|
||||
|
@ -483,8 +490,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
}
|
||||
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
{
|
||||
logout = false;
|
||||
return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
||||
}
|
||||
|
||||
|
@ -500,6 +508,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
}
|
||||
|
||||
protected virtual void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
{
|
||||
}
|
||||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
{
|
||||
scene.SendKillObject(localID);
|
||||
|
@ -1265,18 +1277,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return handles;
|
||||
}
|
||||
|
||||
private void Dump(string msg, List<ulong> handles)
|
||||
{
|
||||
m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg);
|
||||
foreach (ulong handle in handles)
|
||||
{
|
||||
uint x, y;
|
||||
Utils.LongToUInts(handle, out x, out y);
|
||||
x = x / Constants.RegionSize;
|
||||
y = y / Constants.RegionSize;
|
||||
m_log.InfoFormat("({0}, {1})", x, y);
|
||||
}
|
||||
}
|
||||
// private void Dump(string msg, List<ulong> handles)
|
||||
// {
|
||||
// m_log.InfoFormat("-------------- HANDLE DUMP ({0}) ---------", msg);
|
||||
// foreach (ulong handle in handles)
|
||||
// {
|
||||
// uint x, y;
|
||||
// Utils.LongToUInts(handle, out x, out y);
|
||||
// x = x / Constants.RegionSize;
|
||||
// y = y / Constants.RegionSize;
|
||||
// m_log.InfoFormat("({0}, {1})", x, y);
|
||||
// }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -140,9 +140,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return false;
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
protected override void AgentHasMovedAway(UUID sessionID, bool logout)
|
||||
{
|
||||
if (logout)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(sessionID);
|
||||
}
|
||||
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||
{
|
||||
reason = string.Empty;
|
||||
logout = false;
|
||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||
{
|
||||
|
@ -152,9 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
||||
IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver);
|
||||
bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
|
||||
if (success)
|
||||
// Log them out of this grid
|
||||
m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID);
|
||||
logout = success; // flag for later logout from this grid; this is an HG TP
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -54,12 +54,10 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
|||
}
|
||||
|
||||
private static byte[] uintToByteArray(uint uIntValue)
|
||||
{
|
||||
byte[] resultbytes = Utils.UIntToBytes(uIntValue);
|
||||
if (BitConverter.IsLittleEndian)
|
||||
Array.Reverse(resultbytes);
|
||||
|
||||
return resultbytes;
|
||||
{
|
||||
byte[] result = new byte[4];
|
||||
Utils.UIntToBytesBig(uIntValue, result, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static OSD buildEvent(string eventName, OSD eventBody)
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
try
|
||||
{
|
||||
asset1.ID = url + "/" + asset.ID;
|
||||
UUID temp = UUID.Zero;
|
||||
// UUID temp = UUID.Zero;
|
||||
// TODO: if the creator is local, stick this grid's URL in front
|
||||
//if (UUID.TryParse(asset.Metadata.CreatorID, out temp))
|
||||
// asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID;
|
||||
|
@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
if (ids.ContainsKey(assetID))
|
||||
ids.Remove(assetID);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
FetchAsset(userAssetURL, uuid);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
get { return m_assMapper; }
|
||||
}
|
||||
|
||||
private bool m_Initialized = false;
|
||||
// private bool m_Initialized = false;
|
||||
|
||||
#region INonSharedRegionModule
|
||||
|
||||
|
@ -131,6 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return ret;
|
||||
}
|
||||
|
||||
// DO NOT OVERRIDE THE BASE METHOD
|
||||
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
||||
SceneObjectGroup objectGroup, IClientAPI remoteClient)
|
||||
{
|
||||
|
@ -138,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
if (!assetID.Equals(UUID.Zero))
|
||||
{
|
||||
UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
|
||||
if (remoteClient != null)
|
||||
UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
|
||||
}
|
||||
else
|
||||
m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
|
||||
|
@ -191,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
m_assMapper.Post(item.AssetID, receiver, userAssetServer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||
public override bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||
{
|
||||
assetServerURL = string.Empty;
|
||||
UserAccount account = null;
|
||||
|
@ -216,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
||||
{
|
||||
InventoryItemBase item = base.GetItem(agentID, itemID);
|
||||
|
||||
string userAssetServer = string.Empty;
|
||||
if (IsForeignUser(agentID, out userAssetServer))
|
||||
m_assMapper.Get(item.AssetID, agentID, userAssetServer);
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -286,23 +286,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
// Deleting someone else's item
|
||||
//
|
||||
|
||||
|
||||
if (remoteClient == null ||
|
||||
objectGroup.OwnerID != remoteClient.AgentId)
|
||||
{
|
||||
// Folder skeleton may not be loaded and we
|
||||
// have to wait for the inventory to find
|
||||
// the destination folder
|
||||
//
|
||||
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume inventory skeleton was loaded during login
|
||||
// and all folders can be found
|
||||
//
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
}
|
||||
}
|
||||
else if (action == DeRezAction.Return)
|
||||
|
@ -330,9 +322,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
}
|
||||
|
||||
// Override and put into where it came from, if it came
|
||||
// from anywhere in inventory
|
||||
//
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||
{
|
||||
if (objectGroup.RootPart.FromFolderID != UUID.Zero)
|
||||
{
|
||||
InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID);
|
||||
folder = m_Scene.InventoryService.GetFolder(f);
|
||||
}
|
||||
}
|
||||
|
||||
if (folder == null) // None of the above
|
||||
{
|
||||
//folder = userInfo.RootFolder.FindFolder(folderID);
|
||||
folder = new InventoryFolderBase(folderID);
|
||||
|
||||
if (folder == null) // Nowhere to put it
|
||||
|
@ -378,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
|
||||
// Make sure all bits but the ones we want are clear
|
||||
// on take.
|
||||
// This will be applied to the current perms, so
|
||||
// it will do what we want.
|
||||
objectGroup.RootPart.NextOwnerMask &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify);
|
||||
objectGroup.RootPart.NextOwnerMask |=
|
||||
(uint)PermissionMask.Move;
|
||||
|
||||
item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = item.BasePermissions;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
|
||||
item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
|
||||
// Magic number badness. Maybe this deserves an enum.
|
||||
// bit 4 (16) is the "Slam" bit, it means treat as passed
|
||||
// and apply next owner perms on rez
|
||||
item.CurrentPermissions |= 16; // Slam!
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -393,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
item.GroupPermissions = objectGroup.RootPart.GroupMask;
|
||||
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.CurrentPermissions &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify |
|
||||
(uint)PermissionMask.Move |
|
||||
7); // Preserve folded permissions
|
||||
}
|
||||
|
||||
// TODO: add the new fields (Flags, Sale info, etc)
|
||||
|
@ -494,6 +517,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
SceneObjectGroup group
|
||||
= SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
|
||||
|
||||
group.RootPart.FromFolderID = item.Folder;
|
||||
|
||||
// If it's rezzed in world, select it. Much easier to
|
||||
// find small items.
|
||||
//
|
||||
if (!attachment)
|
||||
group.RootPart.CreateSelected = true;
|
||||
|
||||
if (!m_Scene.Permissions.CanRezObject(
|
||||
group.Children.Count, remoteClient.AgentId, pos)
|
||||
&& !attachment)
|
||||
|
@ -512,7 +543,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
if (attachment)
|
||||
{
|
||||
group.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom;
|
||||
group.RootPart.Flags |= PrimFlags.Phantom;
|
||||
group.RootPart.IsAttachment = true;
|
||||
}
|
||||
|
||||
|
@ -566,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
||||
|
||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||
if (rootPart.OwnerID != item.Owner)
|
||||
if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
//Need to kill the for sale here
|
||||
rootPart.ObjectSaleType = 0;
|
||||
|
@ -574,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
if (m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
if ((item.CurrentPermissions & 8) != 0)
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
|
||||
group.ApplyNextOwnerPermissions();
|
||||
|
@ -590,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if (part.OwnerID != item.Owner)
|
||||
if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.Owner;
|
||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||
}
|
||||
else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
|
||||
part.GroupMask = 0; // DO NOT propagate here
|
||||
}
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
|
@ -648,6 +672,57 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
}
|
||||
|
||||
public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
|
||||
{
|
||||
InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
|
||||
if (assetRequestItem == null)
|
||||
{
|
||||
ILibraryService lib = m_Scene.RequestModuleInterface<ILibraryService>();
|
||||
if (lib != null)
|
||||
assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
|
||||
if (assetRequestItem == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
// At this point, we need to apply perms
|
||||
// only to notecards and scripts. All
|
||||
// other asset types are always available
|
||||
//
|
||||
if (assetRequestItem.AssetType == (int)AssetType.LSLText)
|
||||
{
|
||||
if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
|
||||
{
|
||||
if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (assetRequestItem.AssetID != requestID)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
|
||||
Name, requestID, itemID, assetRequestItem.AssetID);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public virtual bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||
{
|
||||
assetServerURL = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
|
@ -670,6 +745,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return asset;
|
||||
}
|
||||
|
||||
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
||||
{
|
||||
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
|
||||
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
|
||||
assetRequestItem = invService.GetItem(assetRequestItem);
|
||||
return assetRequestItem;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
|
|||
private static bool m_HasRunOnce = false;
|
||||
|
||||
private bool m_Enabled = false;
|
||||
private string m_LibraryName = "OpenSim Library";
|
||||
// private string m_LibraryName = "OpenSim Library";
|
||||
private Scene m_Scene;
|
||||
|
||||
private ILibraryService m_Library;
|
||||
|
@ -173,16 +173,16 @@ namespace OpenSim.Region.CoreModules.Framework.Library
|
|||
m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName);
|
||||
simpleName = GetInventoryPathFromName(simpleName);
|
||||
|
||||
InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName);
|
||||
InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName, false);
|
||||
try
|
||||
{
|
||||
List<InventoryNodeBase> nodes = archread.Execute();
|
||||
HashSet<InventoryNodeBase> nodes = archread.Execute();
|
||||
if (nodes != null && nodes.Count == 0)
|
||||
{
|
||||
// didn't find the subfolder with the given name; place it on the top
|
||||
m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName);
|
||||
archread.Close();
|
||||
archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName);
|
||||
archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false);
|
||||
archread.Execute();
|
||||
}
|
||||
foreach (InventoryNodeBase node in nodes)
|
||||
|
@ -212,13 +212,13 @@ namespace OpenSim.Region.CoreModules.Framework.Library
|
|||
}
|
||||
}
|
||||
|
||||
private void DumpLibrary()
|
||||
{
|
||||
InventoryFolderImpl lib = m_Library.LibraryRootFolder;
|
||||
|
||||
m_log.DebugFormat(" - folder {0}", lib.Name);
|
||||
DumpFolder(lib);
|
||||
}
|
||||
// private void DumpLibrary()
|
||||
// {
|
||||
// InventoryFolderImpl lib = m_Library.LibraryRootFolder;
|
||||
//
|
||||
// m_log.DebugFormat(" - folder {0}", lib.Name);
|
||||
// DumpFolder(lib);
|
||||
// }
|
||||
//
|
||||
// private void DumpLibrary()
|
||||
// {
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BinaryLoggingModule")]
|
||||
public class BinaryLoggingModule : INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected bool m_collectStats;
|
||||
protected Scene m_scene = null;
|
||||
|
||||
public string Name { get { return "Binary Statistics Logging Module"; } }
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
try
|
||||
{
|
||||
IConfig statConfig = source.Configs["Statistics.Binary"];
|
||||
if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled"))
|
||||
{
|
||||
if (statConfig.Contains("collect_region_stats"))
|
||||
{
|
||||
if (statConfig.GetBoolean("collect_region_stats"))
|
||||
{
|
||||
m_collectStats = true;
|
||||
}
|
||||
}
|
||||
if (statConfig.Contains("region_stats_period_seconds"))
|
||||
{
|
||||
m_statLogPeriod = TimeSpan.FromSeconds(statConfig.GetInt("region_stats_period_seconds"));
|
||||
}
|
||||
if (statConfig.Contains("stats_dir"))
|
||||
{
|
||||
m_statsDir = statConfig.GetString("stats_dir");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// if it doesn't work, we don't collect anything
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_collectStats)
|
||||
m_scene.StatsReporter.OnSendStatsResult += LogSimStats;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public class StatLogger
|
||||
{
|
||||
public DateTime StartTime;
|
||||
public string Path;
|
||||
public System.IO.BinaryWriter Log;
|
||||
}
|
||||
|
||||
static StatLogger m_statLog = null;
|
||||
static TimeSpan m_statLogPeriod = TimeSpan.FromSeconds(300);
|
||||
static string m_statsDir = String.Empty;
|
||||
static Object m_statLockObject = new Object();
|
||||
|
||||
private void LogSimStats(SimStats stats)
|
||||
{
|
||||
SimStatsPacket pack = new SimStatsPacket();
|
||||
pack.Region = new SimStatsPacket.RegionBlock();
|
||||
pack.Region.RegionX = stats.RegionX;
|
||||
pack.Region.RegionY = stats.RegionY;
|
||||
pack.Region.RegionFlags = stats.RegionFlags;
|
||||
pack.Region.ObjectCapacity = stats.ObjectCapacity;
|
||||
//pack.Region = //stats.RegionBlock;
|
||||
pack.Stat = stats.StatsBlock;
|
||||
pack.Header.Reliable = false;
|
||||
|
||||
// note that we are inside the reporter lock when called
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
// hide some time information into the packet
|
||||
pack.Header.Sequence = (uint)now.Ticks;
|
||||
|
||||
lock (m_statLockObject) // m_statLog is shared so make sure there is only executer here
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_statLog == null || now > m_statLog.StartTime + m_statLogPeriod)
|
||||
{
|
||||
// First log file or time has expired, start writing to a new log file
|
||||
if (m_statLog != null && m_statLog.Log != null)
|
||||
{
|
||||
m_statLog.Log.Close();
|
||||
}
|
||||
m_statLog = new StatLogger();
|
||||
m_statLog.StartTime = now;
|
||||
m_statLog.Path = (m_statsDir.Length > 0 ? m_statsDir + System.IO.Path.DirectorySeparatorChar.ToString() : "")
|
||||
+ String.Format("stats-{0}.log", now.ToString("yyyyMMddHHmmss"));
|
||||
m_statLog.Log = new BinaryWriter(File.Open(m_statLog.Path, FileMode.Append, FileAccess.Write));
|
||||
}
|
||||
|
||||
// Write the serialized data to disk
|
||||
if (m_statLog != null && m_statLog.Log != null)
|
||||
m_statLog.Log.Write(pack.ToBytes());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error("statistics gathering failed: " + ex.Message, ex);
|
||||
if (m_statLog != null && m_statLog.Log != null)
|
||||
{
|
||||
m_statLog.Log.Close();
|
||||
}
|
||||
m_statLog = null;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
|||
private string httpsCN = "";
|
||||
private bool httpSSL = false;
|
||||
private uint httpsslport = 0;
|
||||
private bool GridMode = false;
|
||||
// private bool GridMode = false;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
|
@ -126,10 +126,10 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
|||
|
||||
}
|
||||
|
||||
if (startupcfg != null)
|
||||
{
|
||||
GridMode = enabled = startupcfg.GetBoolean("gridmode", false);
|
||||
}
|
||||
// if (startupcfg != null)
|
||||
// {
|
||||
// GridMode = enabled = startupcfg.GetBoolean("gridmode", false);
|
||||
// }
|
||||
|
||||
if (cfg != null)
|
||||
{
|
||||
|
@ -1213,18 +1213,19 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
|||
}
|
||||
}
|
||||
|
||||
private string CreateRandomStr(int len)
|
||||
{
|
||||
Random rnd = new Random(Environment.TickCount);
|
||||
string returnstring = "";
|
||||
string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
returnstring += chars.Substring(rnd.Next(chars.Length), 1);
|
||||
}
|
||||
return returnstring;
|
||||
}
|
||||
// private string CreateRandomStr(int len)
|
||||
// {
|
||||
// Random rnd = new Random(Environment.TickCount);
|
||||
// string returnstring = "";
|
||||
// string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
//
|
||||
// for (int i = 0; i < len; i++)
|
||||
// {
|
||||
// returnstring += chars.Substring(rnd.Next(chars.Length), 1);
|
||||
// }
|
||||
// return returnstring;
|
||||
// }
|
||||
|
||||
// Temporary hack to allow teleporting to and from Vaak
|
||||
private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ using OpenSim.Region.Framework.Scenes;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||
{
|
||||
public class EmailModule : IEmailModule
|
||||
public class EmailModule : IRegionModule, IEmailModule
|
||||
{
|
||||
//
|
||||
// Log
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
|
|||
|
||||
Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" };
|
||||
|
||||
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:HGInventoryServiceInConnector", args);
|
||||
ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:XInventoryInConnector", args);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
|
|||
|
||||
#region ILandService
|
||||
|
||||
public LandData GetLandData(ulong regionHandle, uint x, uint y)
|
||||
public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
{
|
||||
m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}",
|
||||
regionHandle, m_Scenes.Count);
|
||||
|
@ -130,10 +130,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
|
|||
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from");
|
||||
regionAccess = s.RegionInfo.AccessLevel;
|
||||
return s.GetLandData(x, y);
|
||||
}
|
||||
}
|
||||
m_log.DebugFormat("[LAND IN CONNECTOR]: region handle {0} not found", regionHandle);
|
||||
regionAccess = 42;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ using OpenMetaverse;
|
|||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
{
|
||||
public class HGAssetBroker :
|
||||
ISharedRegionModule, IAssetService, IHyperAssetService
|
||||
ISharedRegionModule, IAssetService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
m_aScene = scene;
|
||||
|
||||
scene.RegisterModuleInterface<IAssetService>(this);
|
||||
scene.RegisterModuleInterface<IHyperAssetService>(this);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
|
|
@ -233,6 +233,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
|||
return m_GridService.GetFallbackRegions(scopeID, x, y);
|
||||
}
|
||||
|
||||
public List<GridRegion> GetHyperlinks(UUID scopeID)
|
||||
{
|
||||
return m_GridService.GetHyperlinks(scopeID);
|
||||
}
|
||||
|
||||
public int GetRegionFlags(UUID scopeID, UUID regionID)
|
||||
{
|
||||
return m_GridService.GetRegionFlags(scopeID, regionID);
|
||||
|
|
|
@ -57,6 +57,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
|
||||
config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
|
||||
config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion");
|
||||
config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion");
|
||||
config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion");
|
||||
|
||||
m_LocalConnector = new LocalGridServicesConnector(config);
|
||||
}
|
||||
|
@ -69,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
{
|
||||
SetUp();
|
||||
|
||||
// Create 3 regions
|
||||
// Create 4 regions
|
||||
GridRegion r1 = new GridRegion();
|
||||
r1.RegionName = "Test Region 1";
|
||||
r1.RegionID = new UUID(1);
|
||||
|
@ -82,7 +86,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
s.RegionInfo.RegionID = r1.RegionID;
|
||||
m_LocalConnector.AddRegion(s);
|
||||
|
||||
|
||||
GridRegion r2 = new GridRegion();
|
||||
r2.RegionName = "Test Region 2";
|
||||
r2.RegionID = new UUID(2);
|
||||
|
@ -107,11 +110,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
s.RegionInfo.RegionID = r3.RegionID;
|
||||
m_LocalConnector.AddRegion(s);
|
||||
|
||||
GridRegion r4 = new GridRegion();
|
||||
r4.RegionName = "Other Region 4";
|
||||
r4.RegionID = new UUID(4);
|
||||
r4.RegionLocX = 1004 * (int)Constants.RegionSize;
|
||||
r4.RegionLocY = 1002 * (int)Constants.RegionSize;
|
||||
r4.ExternalHostName = "127.0.0.1";
|
||||
r4.HttpPort = 9004;
|
||||
r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
|
||||
s = new Scene(new RegionInfo());
|
||||
s.RegionInfo.RegionID = r4.RegionID;
|
||||
m_LocalConnector.AddRegion(s);
|
||||
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r1);
|
||||
|
||||
GridRegion result = m_LocalConnector.GetRegionByName(UUID.Zero, "Test");
|
||||
Assert.IsNotNull(result, "Retrieved GetRegionByName is null");
|
||||
Assert.That(result.RegionName, Is.EqualTo("Test Region 1"), "Retrieved region's name does not match");
|
||||
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r2);
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r3);
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r4);
|
||||
|
||||
result = m_LocalConnector.GetRegionByUUID(UUID.Zero, new UUID(1));
|
||||
Assert.IsNotNull(result, "Retrieved GetRegionByUUID is null");
|
||||
Assert.That(result.RegionID, Is.EqualTo(new UUID(1)), "Retrieved region's UUID does not match");
|
||||
|
@ -120,22 +140,57 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
Assert.IsNotNull(result, "Retrieved GetRegionByPosition is null");
|
||||
Assert.That(result.RegionLocX, Is.EqualTo(1000 * (int)Constants.RegionSize), "Retrieved region's position does not match");
|
||||
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r2);
|
||||
m_LocalConnector.RegisterRegion(UUID.Zero, r3);
|
||||
|
||||
List<GridRegion> results = m_LocalConnector.GetNeighbours(UUID.Zero, new UUID(1));
|
||||
Assert.IsNotNull(results, "Retrieved neighbours list is null");
|
||||
Assert.That(results.Count, Is.EqualTo(1), "Retrieved neighbour collection is greater than expected");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved region's UUID does not match");
|
||||
|
||||
results = m_LocalConnector.GetRegionsByName(UUID.Zero, "Test", 10);
|
||||
Assert.IsNotNull(results, "Retrieved GetRegionsByName list is null");
|
||||
Assert.IsNotNull(results, "Retrieved GetRegionsByName collection is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved neighbour collection is less than expected");
|
||||
|
||||
results = m_LocalConnector.GetRegionRange(UUID.Zero, 900 * (int)Constants.RegionSize, 1002 * (int)Constants.RegionSize,
|
||||
900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize);
|
||||
Assert.IsNotNull(results, "Retrieved GetRegionRange list is null");
|
||||
Assert.IsNotNull(results, "Retrieved GetRegionRange collection is null");
|
||||
Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected");
|
||||
|
||||
results = m_LocalConnector.GetDefaultRegions(UUID.Zero);
|
||||
Assert.IsNotNull(results, "Retrieved GetDefaultRegions collection is null");
|
||||
Assert.That(results.Count, Is.EqualTo(1), "Retrieved default regions collection has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(1)), "Retrieved default region's UUID does not match");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r1.RegionLocX, r1.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 1 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 1 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions for default region are not in the expected order 2-4-3");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r2.RegionLocX, r2.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 2 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 2 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 2-4-3");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r3.RegionLocX, r3.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 3 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 3 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 3-4-2");
|
||||
|
||||
results = m_LocalConnector.GetFallbackRegions(UUID.Zero, r4.RegionLocX, r4.RegionLocY);
|
||||
Assert.IsNotNull(results, "Retrieved GetFallbackRegions collection for region 4 is null");
|
||||
Assert.That(results.Count, Is.EqualTo(3), "Retrieved fallback regions collection for region 4 has not the expected size");
|
||||
Assert.That(results[0].RegionID, Is.EqualTo(new UUID(4)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
Assert.That(results[1].RegionID, Is.EqualTo(new UUID(3)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
Assert.That(results[2].RegionID, Is.EqualTo(new UUID(2)), "Retrieved fallback regions are not in the expected order 4-3-2");
|
||||
|
||||
results = m_LocalConnector.GetHyperlinks(UUID.Zero);
|
||||
Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
|
||||
Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// else put a null; it means that the methods should forward to local grid's inventory
|
||||
m_InventoryURLs.Add(userID, null);
|
||||
}
|
||||
|
||||
private void DropInventoryServiceURL(UUID userID)
|
||||
|
@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (m_InventoryURLs.ContainsKey(userID))
|
||||
return m_InventoryURLs[userID];
|
||||
|
||||
else
|
||||
CacheInventoryServiceURL(userID);
|
||||
CacheInventoryServiceURL(userID);
|
||||
|
||||
return m_InventoryURLs[userID];
|
||||
if (m_InventoryURLs.ContainsKey(userID))
|
||||
return m_InventoryURLs[userID];
|
||||
|
||||
return null; //it means that the methods should forward to local grid's inventory
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
|
||||
//m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
|
||||
//m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||
{
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||
{
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folderIDs.Count == 0)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(ownerID);
|
||||
|
||||
|
@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -384,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -401,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (item == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(item.Owner);
|
||||
|
||||
|
@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (item == null)
|
||||
return false;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(item.Owner);
|
||||
|
||||
|
@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (items.Count == 0)
|
||||
return true;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(ownerID);
|
||||
|
||||
|
@ -451,15 +451,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
|
||||
//m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
|
||||
|
||||
if (itemIDs == null)
|
||||
return false;
|
||||
if (itemIDs.Count == 0)
|
||||
return true;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(ownerID);
|
||||
|
||||
if (invURL == null) // not there, forward to local inventory connector to resolve
|
||||
|
@ -474,7 +472,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(item.Owner);
|
||||
|
||||
|
@ -491,7 +489,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
if (folder == null)
|
||||
return null;
|
||||
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(folder.Owner);
|
||||
|
||||
|
@ -515,7 +513,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
|
||||
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
|
||||
|
||||
string invURL = GetInventoryServiceURL(userID);
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
using OpenSim.Services.Connectors;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -48,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
private bool m_Enabled = false;
|
||||
private bool m_Initialized = false;
|
||||
private Scene m_Scene;
|
||||
// private Scene m_Scene;
|
||||
private InventoryServicesConnector m_RemoteConnector;
|
||||
|
||||
public Type ReplaceableInterface
|
||||
|
@ -105,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
// m_Scene = scene;
|
||||
//m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
|
||||
|
||||
if (!m_Enabled)
|
||||
|
|
|
@ -32,7 +32,6 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
using OpenSim.Services.Connectors;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -48,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
private bool m_Enabled = false;
|
||||
private bool m_Initialized = false;
|
||||
private Scene m_Scene;
|
||||
// private Scene m_Scene;
|
||||
private XInventoryServicesConnector m_RemoteConnector;
|
||||
|
||||
public Type ReplaceableInterface
|
||||
|
@ -109,7 +108,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
// m_Scene = scene;
|
||||
//m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
|
||||
|
||||
if (!m_Enabled)
|
||||
|
|
|
@ -116,8 +116,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
|||
|
||||
#region ILandService
|
||||
|
||||
public LandData GetLandData(ulong regionHandle, uint x, uint y)
|
||||
public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
{
|
||||
regionAccess = 2;
|
||||
m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}",
|
||||
regionHandle, x, y);
|
||||
|
||||
|
@ -126,6 +127,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
|||
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
LandData land = s.GetLandData(x, y);
|
||||
regionAccess = s.RegionInfo.AccessLevel;
|
||||
return land;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
|||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_GridService = scene.GridService;
|
||||
m_LocalService.AddRegion(scene);
|
||||
scene.RegisterModuleInterface<ILandService>(this);
|
||||
}
|
||||
|
@ -103,18 +102,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
m_GridService = scene.GridService;
|
||||
}
|
||||
|
||||
|
||||
#region ILandService
|
||||
|
||||
public override LandData GetLandData(ulong regionHandle, uint x, uint y)
|
||||
public override LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
|
||||
{
|
||||
LandData land = m_LocalService.GetLandData(regionHandle, x, y);
|
||||
LandData land = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess);
|
||||
if (land != null)
|
||||
return land;
|
||||
|
||||
return base.GetLandData(regionHandle, x, y);
|
||||
return base.GetLandData(regionHandle, x, y, out regionAccess);
|
||||
|
||||
}
|
||||
#endregion ILandService
|
||||
|
|
|
@ -343,7 +343,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
{
|
||||
if (!s.IsChildAgent)
|
||||
{
|
||||
s.ControllingClient.SendTeleportLocationStart();
|
||||
m_scene.TeleportClientHome(user, s.ControllingClient);
|
||||
}
|
||||
}
|
||||
|
@ -478,7 +477,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
ScenePresence s = m_scene.GetScenePresence(prey);
|
||||
if (s != null)
|
||||
{
|
||||
s.ControllingClient.SendTeleportLocationStart();
|
||||
m_scene.TeleportClientHome(prey, s.ControllingClient);
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +496,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
// Also make sure they are actually in the region
|
||||
if (p != null && !p.IsChildAgent)
|
||||
{
|
||||
p.ControllingClient.SendTeleportLocationStart();
|
||||
m_scene.TeleportClientHome(p.UUID, p.ControllingClient);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
public LandData LandData;
|
||||
public ulong RegionHandle;
|
||||
public uint X, Y;
|
||||
public byte RegionAccess;
|
||||
}
|
||||
|
||||
public class LandManagementModule : INonSharedRegionModule
|
||||
|
@ -138,12 +139,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
{
|
||||
}
|
||||
|
||||
private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
|
||||
{
|
||||
ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y);
|
||||
reason = "You are not allowed to enter this sim.";
|
||||
return nearestParcel != null;
|
||||
}
|
||||
// private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason)
|
||||
// {
|
||||
// ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y);
|
||||
// reason = "You are not allowed to enter this sim.";
|
||||
// return nearestParcel != null;
|
||||
// }
|
||||
|
||||
void EventManagerOnNewClient(IClientAPI client)
|
||||
{
|
||||
|
@ -1459,13 +1460,15 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData;
|
||||
extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
ILandService landService = m_scene.RequestModuleInterface<ILandService>();
|
||||
extLandData.LandData = landService.GetLandData(extLandData.RegionHandle,
|
||||
extLandData.X,
|
||||
extLandData.Y);
|
||||
extLandData.Y,
|
||||
out extLandData.RegionAccess);
|
||||
if (extLandData.LandData == null)
|
||||
{
|
||||
// we didn't find the region/land => don't cache
|
||||
|
@ -1497,6 +1500,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
r.RegionName = info.RegionName;
|
||||
r.RegionLocX = (uint)info.RegionLocX;
|
||||
r.RegionLocY = (uint)info.RegionLocY;
|
||||
r.RegionSettings.Maturity = (int)Util.ConvertAccessLevelToMaturity(data.RegionAccess);
|
||||
remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
else
|
||||
{
|
||||
// Normal Calculations
|
||||
return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.objectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||
return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||
}
|
||||
}
|
||||
public int GetSimulatorMaxPrimCount(ILandObject thisObject)
|
||||
|
@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
else
|
||||
{
|
||||
//Normal Calculations
|
||||
return m_scene.objectCapacity;
|
||||
return m_scene.RegionInfo.ObjectCapacity;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -283,6 +283,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
public bool IsBannedFromLand(UUID avatar)
|
||||
{
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
|
@ -301,6 +304,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
public bool IsRestrictedFromLand(UUID avatar)
|
||||
{
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
|
|
|
@ -0,0 +1,596 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Messages.Linden;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Media.Moap
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
|
||||
public class MoapModule : INonSharedRegionModule, IMoapModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public string Name { get { return "MoapModule"; } }
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
/// <summary>
|
||||
/// Is this module enabled?
|
||||
/// </summary>
|
||||
protected bool m_isEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// The scene to which this module is attached
|
||||
/// </summary>
|
||||
protected Scene m_scene;
|
||||
|
||||
/// <summary>
|
||||
/// Track the ObjectMedia capabilities given to users keyed by path
|
||||
/// </summary>
|
||||
protected Dictionary<string, UUID> m_omCapUsers = new Dictionary<string, UUID>();
|
||||
|
||||
/// <summary>
|
||||
/// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate.
|
||||
/// </summary>
|
||||
protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Track the ObjectMediaUpdate capabilities given to users keyed by path
|
||||
/// </summary>
|
||||
protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>();
|
||||
|
||||
/// <summary>
|
||||
/// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate
|
||||
/// </summary>
|
||||
protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>();
|
||||
|
||||
public void Initialise(IConfigSource configSource)
|
||||
{
|
||||
IConfig config = configSource.Configs["MediaOnAPrim"];
|
||||
|
||||
if (config != null && !config.GetBoolean("Enabled", false))
|
||||
m_isEnabled = false;
|
||||
// else
|
||||
// m_log.Debug("[MOAP]: Initialised module.")l
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_isEnabled)
|
||||
return;
|
||||
|
||||
m_scene = scene;
|
||||
m_scene.RegisterModuleInterface<IMoapModule>(this);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene) {}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_isEnabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps;
|
||||
m_scene.EventManager.OnSceneObjectPartCopy += OnSceneObjectPartCopy;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (!m_isEnabled)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
||||
m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
|
||||
m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
|
||||
}
|
||||
|
||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID);
|
||||
|
||||
string omCapUrl = "/CAPS/" + UUID.Random();
|
||||
|
||||
lock (m_omCapUsers)
|
||||
{
|
||||
m_omCapUsers[omCapUrl] = agentID;
|
||||
m_omCapUrls[agentID] = omCapUrl;
|
||||
|
||||
// Even though we're registering for POST we're going to get GETS and UPDATES too
|
||||
caps.RegisterHandler(
|
||||
"ObjectMedia", new RestStreamHandler("POST", omCapUrl, HandleObjectMediaMessage));
|
||||
}
|
||||
|
||||
string omuCapUrl = "/CAPS/" + UUID.Random();
|
||||
|
||||
lock (m_omuCapUsers)
|
||||
{
|
||||
m_omuCapUsers[omuCapUrl] = agentID;
|
||||
m_omuCapUrls[agentID] = omuCapUrl;
|
||||
|
||||
// Even though we're registering for POST we're going to get GETS and UPDATES too
|
||||
caps.RegisterHandler(
|
||||
"ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage));
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDeregisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
lock (m_omCapUsers)
|
||||
{
|
||||
string path = m_omCapUrls[agentID];
|
||||
m_omCapUrls.Remove(agentID);
|
||||
m_omCapUsers.Remove(path);
|
||||
}
|
||||
|
||||
lock (m_omuCapUsers)
|
||||
{
|
||||
string path = m_omuCapUrls[agentID];
|
||||
m_omuCapUrls.Remove(agentID);
|
||||
m_omuCapUsers.Remove(path);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
|
||||
{
|
||||
if (original.Shape.Media != null)
|
||||
{
|
||||
PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList();
|
||||
lock (original.Shape.Media)
|
||||
{
|
||||
foreach (MediaEntry me in original.Shape.Media)
|
||||
{
|
||||
if (me != null)
|
||||
dupeMedia.Add(MediaEntry.FromOSD(me.GetOSD()));
|
||||
else
|
||||
dupeMedia.Add(null);
|
||||
}
|
||||
}
|
||||
|
||||
copy.Shape.Media = dupeMedia;
|
||||
}
|
||||
}
|
||||
|
||||
public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
|
||||
{
|
||||
MediaEntry me = null;
|
||||
|
||||
CheckFaceParam(part, face);
|
||||
|
||||
List<MediaEntry> media = part.Shape.Media;
|
||||
|
||||
if (null == media)
|
||||
{
|
||||
me = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (media)
|
||||
me = media[face];
|
||||
|
||||
// TODO: Really need a proper copy constructor down in libopenmetaverse
|
||||
if (me != null)
|
||||
me = MediaEntry.FromOSD(me.GetOSD());
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[MOAP]: GetMediaEntry for {0} face {1} found {2}", part.Name, face, me);
|
||||
|
||||
return me;
|
||||
}
|
||||
|
||||
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
|
||||
{
|
||||
CheckFaceParam(part, face);
|
||||
|
||||
if (null == part.Shape.Media)
|
||||
part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
|
||||
|
||||
lock (part.Shape.Media)
|
||||
part.Shape.Media[face] = me;
|
||||
|
||||
UpdateMediaUrl(part, UUID.Zero);
|
||||
part.ScheduleFullUpdate();
|
||||
part.TriggerScriptChangedEvent(Changed.MEDIA);
|
||||
}
|
||||
|
||||
public void ClearMediaEntry(SceneObjectPart part, int face)
|
||||
{
|
||||
SetMediaEntry(part, face, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets or gets per face media textures.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest"></param>
|
||||
/// <param name="httpResponse"></param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaMessage(
|
||||
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
|
||||
|
||||
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
ObjectMediaMessage omm = new ObjectMediaMessage();
|
||||
omm.Deserialize(osd);
|
||||
|
||||
if (omm.Request is ObjectMediaRequest)
|
||||
return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest);
|
||||
else if (omm.Request is ObjectMediaUpdate)
|
||||
return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
|
||||
|
||||
throw new Exception(
|
||||
string.Format(
|
||||
"[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}",
|
||||
omm.Request.GetType()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle a fetch request for media textures
|
||||
/// </summary>
|
||||
/// <param name="omr"></param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
|
||||
{
|
||||
UUID primId = omr.PrimID;
|
||||
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
|
||||
|
||||
if (null == part)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[MOAP]: Received a GET ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
|
||||
primId, m_scene.RegionInfo.RegionName);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (null == part.Shape.Media)
|
||||
return string.Empty;
|
||||
|
||||
ObjectMediaResponse resp = new ObjectMediaResponse();
|
||||
|
||||
resp.PrimID = primId;
|
||||
|
||||
lock (part.Shape.Media)
|
||||
resp.FaceMedia = part.Shape.Media.ToArray();
|
||||
|
||||
resp.Version = part.MediaUrl;
|
||||
|
||||
string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize());
|
||||
|
||||
// m_log.DebugFormat("[MOAP]: Got HandleObjectMediaRequestGet raw response is [{0}]", rawResp);
|
||||
|
||||
return rawResp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle an update of media textures.
|
||||
/// </summary>
|
||||
/// <param name="path">Path on which this request was made</param>
|
||||
/// <param name="omu">/param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
|
||||
{
|
||||
UUID primId = omu.PrimID;
|
||||
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
|
||||
|
||||
if (null == part)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
|
||||
primId, m_scene.RegionInfo.RegionName);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
|
||||
|
||||
// for (int i = 0; i < omu.FaceMedia.Length; i++)
|
||||
// {
|
||||
// MediaEntry me = omu.FaceMedia[i];
|
||||
// string v = (null == me ? "null": OSDParser.SerializeLLSDXmlString(me.GetOSD()));
|
||||
// m_log.DebugFormat("[MOAP]: Face {0} [{1}]", i, v);
|
||||
// }
|
||||
|
||||
if (omu.FaceMedia.Length > part.GetNumberOfSides())
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[MOAP]: Received {0} media entries from client for prim {1} {2} but this prim has only {3} faces. Dropping request.",
|
||||
omu.FaceMedia.Length, part.Name, part.UUID, part.GetNumberOfSides());
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
UUID agentId = default(UUID);
|
||||
|
||||
lock (m_omCapUsers)
|
||||
agentId = m_omCapUsers[path];
|
||||
|
||||
List<MediaEntry> media = part.Shape.Media;
|
||||
|
||||
if (null == media)
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Setting all new media list for {0}", part.Name);
|
||||
part.Shape.Media = new PrimitiveBaseShape.MediaList(omu.FaceMedia);
|
||||
|
||||
for (int i = 0; i < omu.FaceMedia.Length; i++)
|
||||
{
|
||||
if (omu.FaceMedia[i] != null)
|
||||
{
|
||||
// FIXME: Race condition here since some other texture entry manipulator may overwrite/get
|
||||
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
|
||||
// directly.
|
||||
Primitive.TextureEntry te = part.Shape.Textures;
|
||||
Primitive.TextureEntryFace face = te.CreateFace((uint)i);
|
||||
face.MediaFlags = true;
|
||||
part.Shape.Textures = te;
|
||||
// m_log.DebugFormat(
|
||||
// "[MOAP]: Media flags for face {0} is {1}",
|
||||
// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We need to go through the media textures one at a time to make sure that we have permission
|
||||
// to change them
|
||||
|
||||
// FIXME: Race condition here since some other texture entry manipulator may overwrite/get
|
||||
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
|
||||
// directly.
|
||||
Primitive.TextureEntry te = part.Shape.Textures;
|
||||
|
||||
lock (media)
|
||||
{
|
||||
for (int i = 0; i < media.Count; i++)
|
||||
{
|
||||
if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i))
|
||||
{
|
||||
media[i] = omu.FaceMedia[i];
|
||||
|
||||
// When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal
|
||||
// texture update, so we don't need to worry about clearing MediaFlags here.
|
||||
if (null == media[i])
|
||||
continue;
|
||||
|
||||
Primitive.TextureEntryFace face = te.CreateFace((uint)i);
|
||||
face.MediaFlags = true;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[MOAP]: Media flags for face {0} is {1}",
|
||||
// i, face.MediaFlags);
|
||||
// m_log.DebugFormat("[MOAP]: Set media entry for face {0} on {1}", i, part.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part.Shape.Textures = te;
|
||||
|
||||
// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++)
|
||||
// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]);
|
||||
}
|
||||
|
||||
UpdateMediaUrl(part, agentId);
|
||||
|
||||
// Arguably, we could avoid sending a full update to the avatar that just changed the texture.
|
||||
part.ScheduleFullUpdate();
|
||||
|
||||
part.TriggerScriptChangedEvent(Changed.MEDIA);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Received from the viewer if a user has changed the url of a media texture.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <param name="httpRequest">/param>
|
||||
/// <param name="httpResponse">/param>
|
||||
/// <returns></returns>
|
||||
protected string HandleObjectMediaNavigateMessage(
|
||||
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
|
||||
|
||||
OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage();
|
||||
omn.Deserialize(osd);
|
||||
|
||||
UUID primId = omn.PrimID;
|
||||
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
|
||||
|
||||
if (null == part)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}",
|
||||
primId, m_scene.RegionInfo.RegionName);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
UUID agentId = default(UUID);
|
||||
|
||||
lock (m_omuCapUsers)
|
||||
agentId = m_omuCapUsers[path];
|
||||
|
||||
if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
|
||||
return string.Empty;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[MOAP]: Received request to update media entry for face {0} on prim {1} {2} to {3}",
|
||||
// omn.Face, part.Name, part.UUID, omn.URL);
|
||||
|
||||
// If media has never been set for this prim, then just return.
|
||||
if (null == part.Shape.Media)
|
||||
return string.Empty;
|
||||
|
||||
MediaEntry me = null;
|
||||
|
||||
lock (part.Shape.Media)
|
||||
me = part.Shape.Media[omn.Face];
|
||||
|
||||
// Do the same if media has not been set up for a specific face
|
||||
if (null == me)
|
||||
return string.Empty;
|
||||
|
||||
if (me.EnableWhiteList)
|
||||
{
|
||||
if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[MOAP]: Blocking change of face {0} on prim {1} {2} to {3} since it's not on the enabled whitelist",
|
||||
// omn.Face, part.Name, part.UUID, omn.URL);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
me.CurrentURL = omn.URL;
|
||||
|
||||
UpdateMediaUrl(part, agentId);
|
||||
|
||||
part.ScheduleFullUpdate();
|
||||
|
||||
part.TriggerScriptChangedEvent(Changed.MEDIA);
|
||||
|
||||
return OSDParser.SerializeLLSDXmlString(new OSD());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check that the face number is valid for the given prim.
|
||||
/// </summary>
|
||||
/// <param name="part"></param>
|
||||
/// <param name="face"></param>
|
||||
protected void CheckFaceParam(SceneObjectPart part, int face)
|
||||
{
|
||||
if (face < 0)
|
||||
throw new ArgumentException("Face cannot be less than zero");
|
||||
|
||||
int maxFaces = part.GetNumberOfSides() - 1;
|
||||
if (face > maxFaces)
|
||||
throw new ArgumentException(
|
||||
string.Format("Face argument was {0} but max is {1}", face, maxFaces));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the media url of the given part
|
||||
/// </summary>
|
||||
/// <param name="part"></param>
|
||||
/// <param name="updateId">
|
||||
/// The id to attach to this update. Normally, this is the user that changed the
|
||||
/// texture
|
||||
/// </param>
|
||||
protected void UpdateMediaUrl(SceneObjectPart part, UUID updateId)
|
||||
{
|
||||
if (null == part.MediaUrl)
|
||||
{
|
||||
// TODO: We can't set the last changer until we start tracking which cap we give to which agent id
|
||||
part.MediaUrl = "x-mv:0000000000/" + updateId;
|
||||
}
|
||||
else
|
||||
{
|
||||
string rawVersion = part.MediaUrl.Substring(5, 10);
|
||||
int version = int.Parse(rawVersion);
|
||||
part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check the given url against the given whitelist.
|
||||
/// </summary>
|
||||
/// <param name="rawUrl"></param>
|
||||
/// <param name="whitelist"></param>
|
||||
/// <returns>true if the url matches an entry on the whitelist, false otherwise</returns>
|
||||
protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist)
|
||||
{
|
||||
Uri url = new Uri(rawUrl);
|
||||
|
||||
foreach (string origWlUrl in whitelist)
|
||||
{
|
||||
string wlUrl = origWlUrl;
|
||||
|
||||
// Deal with a line-ending wildcard
|
||||
if (wlUrl.EndsWith("*"))
|
||||
wlUrl = wlUrl.Remove(wlUrl.Length - 1);
|
||||
|
||||
// m_log.DebugFormat("[MOAP]: Checking whitelist URL pattern {0}", origWlUrl);
|
||||
|
||||
// Handle a line starting wildcard slightly differently since this can only match the domain, not the path
|
||||
if (wlUrl.StartsWith("*"))
|
||||
{
|
||||
wlUrl = wlUrl.Substring(1);
|
||||
|
||||
if (url.Host.Contains(wlUrl))
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string urlToMatch = url.Authority + url.AbsolutePath;
|
||||
|
||||
if (urlToMatch.StartsWith(wlUrl))
|
||||
{
|
||||
// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue