diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 826a1b0ab0..0608f66827 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -588,6 +588,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController /// estate_name /// the name of the estate to join (or to create if it doesn't /// already exist) + /// region_file + /// The name of the file to persist the region specifications to. + /// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional) /// /// /// XmlRpcCreateRegionMethod returns @@ -701,7 +704,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController bool persist = Convert.ToBoolean((string) requestData["persist"]); if (persist) { - // default place for region XML files is in the + // default place for region configuration files is in the // Regions directory of the config dir (aka /bin) string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); try @@ -714,19 +717,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController { // No INI setting recorded. } - string regionXmlPath = Path.Combine(regionConfigPath, + + string regionIniPath; + + if (requestData.Contains("region_file")) + { + // Make sure that the file to be created is in a subdirectory of the region storage directory. + string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]); + string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath)); + if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath))) + regionIniPath = requestedFilePath; + else + throw new Exception("Invalid location for region file."); + } + else + { + regionIniPath = Path.Combine(regionConfigPath, String.Format( m_config.GetString("region_file_template", - "{0}x{1}-{2}.xml"), + "{0}x{1}-{2}.ini"), region.RegionLocX.ToString(), region.RegionLocY.ToString(), regionID.ToString(), region.InternalEndPoint.Port.ToString(), region.RegionName.Replace(" ", "_").Replace(":", "_"). Replace("/", "_"))); + } + m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", - region.RegionID, regionXmlPath); - region.SaveRegionToFile("dynamic region", regionXmlPath); + region.RegionID, regionIniPath); + region.SaveRegionToFile("dynamic region", regionIniPath); } else { @@ -1700,8 +1720,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; - inventoryService.AddItem(destinationItem); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); // Wear item AvatarWearable newWearable = new AvatarWearable(); @@ -1711,7 +1731,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } else { - m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); + m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); } } } @@ -1753,16 +1773,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = destinationFolder.ID; - inventoryService.AddItem(destinationItem); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID); // Attach item avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); - m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); + m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID); } else { - m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID); + m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID); } } } @@ -1860,16 +1880,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.CreationDate = item.CreationDate; destinationItem.Folder = extraFolder.ID; - inventoryService.AddItem(destinationItem); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem); inventoryMap.Add(item.ID, destinationItem.ID); - m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); + m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID); // Attach item, if original is attached int attachpoint = avatarAppearance.GetAttachpoint(item.ID); if (attachpoint != 0) { avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID); - m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID); + m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID); } } } @@ -1888,7 +1908,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController private bool CreateDefaultAvatars() { // Only load once - if (m_defaultAvatarsLoaded) { return false; @@ -2146,7 +2165,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); inventoryItem.Folder = extraFolder.ID; // Parent folder - inventoryService.AddItem(inventoryItem); + m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem); m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID); } diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index faab3714e8..87b99e03c9 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -305,94 +305,94 @@ namespace OpenSim.Client.MXP.ClientStack #region MXP Outgoing Message Processing - private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) - { - String typeName = ToOmType(primShape.PCode); - m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); - - PerceptionEventMessage pe = new PerceptionEventMessage(); - pe.ObjectFragment.ObjectId = objectID.Guid; - - pe.ObjectFragment.ParentObjectId = Guid.Empty; - - // Resolving parent UUID. - OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; - if (scene.Entities.ContainsKey(parentID)) - { - pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; - } - - pe.ObjectFragment.ObjectIndex = localID; - pe.ObjectFragment.ObjectName = typeName + " Object"; - pe.ObjectFragment.OwnerId = ownerID.Guid; - pe.ObjectFragment.TypeId = Guid.Empty; - pe.ObjectFragment.TypeName = typeName; - pe.ObjectFragment.Acceleration = ToOmVector(acc); - pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); - pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); - pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); - - pe.ObjectFragment.Location = ToOmVector(pos); - - pe.ObjectFragment.Mass = 1.0f; - pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); - pe.ObjectFragment.Velocity =ToOmVector(vel); - - OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); - - if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) - { - - ext.PathBegin = primShape.PathBegin; - ext.PathEnd = primShape.PathEnd; - ext.PathScaleX = primShape.PathScaleX; - ext.PathScaleY = primShape.PathScaleY; - ext.PathShearX = primShape.PathShearX; - ext.PathShearY = primShape.PathShearY; - ext.PathSkew = primShape.PathSkew; - ext.ProfileBegin = primShape.ProfileBegin; - ext.ProfileEnd = primShape.ProfileEnd; - ext.PathCurve = primShape.PathCurve; - ext.ProfileCurve = primShape.ProfileCurve; - ext.ProfileHollow = primShape.ProfileHollow; - ext.PathRadiusOffset = primShape.PathRadiusOffset; - ext.PathRevolutions = primShape.PathRevolutions; - ext.PathTaperX = primShape.PathTaperX; - ext.PathTaperY = primShape.PathTaperY; - ext.PathTwist = primShape.PathTwist; - ext.PathTwistBegin = primShape.PathTwistBegin; - - - } - - ext.UpdateFlags = flags; - ext.ExtraParams = primShape.ExtraParams; - ext.State = primShape.State; - ext.TextureEntry = primShape.TextureEntry; - ext.TextureAnim = textureanim; - ext.Scale = ToOmVector(primShape.Scale); - ext.Text = text; - ext.TextColor = ToOmColor(textColor); - ext.PSBlock = particleSystem; - ext.ClickAction = clickAction; - ext.Material = material; - - pe.SetExtension(ext); - - Session.Send(pe); - - if (m_objectsSynchronized != -1) - { - m_objectsSynchronized++; - - if (m_objectsToSynchronize >= m_objectsSynchronized) - { - SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); - Session.Send(synchronizationEndEventMessage); - m_objectsSynchronized = -1; - } - } - } +// private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim) +// { +// String typeName = ToOmType(primShape.PCode); +// m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName); +// +// PerceptionEventMessage pe = new PerceptionEventMessage(); +// pe.ObjectFragment.ObjectId = objectID.Guid; +// +// pe.ObjectFragment.ParentObjectId = Guid.Empty; +// +// // Resolving parent UUID. +// OpenSim.Region.Framework.Scenes.Scene scene = (OpenSim.Region.Framework.Scenes.Scene)Scene; +// if (scene.Entities.ContainsKey(parentID)) +// { +// pe.ObjectFragment.ParentObjectId = scene.Entities[parentID].UUID.Guid; +// } +// +// pe.ObjectFragment.ObjectIndex = localID; +// pe.ObjectFragment.ObjectName = typeName + " Object"; +// pe.ObjectFragment.OwnerId = ownerID.Guid; +// pe.ObjectFragment.TypeId = Guid.Empty; +// pe.ObjectFragment.TypeName = typeName; +// pe.ObjectFragment.Acceleration = ToOmVector(acc); +// pe.ObjectFragment.AngularAcceleration=new MsdQuaternion4f(); +// pe.ObjectFragment.AngularVelocity = ToOmQuaternion(rvel); +// pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length(); +// +// pe.ObjectFragment.Location = ToOmVector(pos); +// +// pe.ObjectFragment.Mass = 1.0f; +// pe.ObjectFragment.Orientation = ToOmQuaternion(rotation); +// pe.ObjectFragment.Velocity =ToOmVector(vel); +// +// OmSlPrimitiveExt ext = new OmSlPrimitiveExt(); +// +// if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass))) +// { +// +// ext.PathBegin = primShape.PathBegin; +// ext.PathEnd = primShape.PathEnd; +// ext.PathScaleX = primShape.PathScaleX; +// ext.PathScaleY = primShape.PathScaleY; +// ext.PathShearX = primShape.PathShearX; +// ext.PathShearY = primShape.PathShearY; +// ext.PathSkew = primShape.PathSkew; +// ext.ProfileBegin = primShape.ProfileBegin; +// ext.ProfileEnd = primShape.ProfileEnd; +// ext.PathCurve = primShape.PathCurve; +// ext.ProfileCurve = primShape.ProfileCurve; +// ext.ProfileHollow = primShape.ProfileHollow; +// ext.PathRadiusOffset = primShape.PathRadiusOffset; +// ext.PathRevolutions = primShape.PathRevolutions; +// ext.PathTaperX = primShape.PathTaperX; +// ext.PathTaperY = primShape.PathTaperY; +// ext.PathTwist = primShape.PathTwist; +// ext.PathTwistBegin = primShape.PathTwistBegin; +// +// +// } +// +// ext.UpdateFlags = flags; +// ext.ExtraParams = primShape.ExtraParams; +// ext.State = primShape.State; +// ext.TextureEntry = primShape.TextureEntry; +// ext.TextureAnim = textureanim; +// ext.Scale = ToOmVector(primShape.Scale); +// ext.Text = text; +// ext.TextColor = ToOmColor(textColor); +// ext.PSBlock = particleSystem; +// ext.ClickAction = clickAction; +// ext.Material = material; +// +// pe.SetExtension(ext); +// +// Session.Send(pe); +// +// if (m_objectsSynchronized != -1) +// { +// m_objectsSynchronized++; +// +// if (m_objectsToSynchronize >= m_objectsSynchronized) +// { +// SynchronizationEndEventMessage synchronizationEndEventMessage = new SynchronizationEndEventMessage(); +// Session.Send(synchronizationEndEventMessage); +// m_objectsSynchronized = -1; +// } +// } +// } public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation) { diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 2098625f72..7056e0110b 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs @@ -63,7 +63,7 @@ namespace OpenSim.Client.MXP.PacketHandler private readonly IList m_sessionsToRemove = new List(); private readonly int m_port; - private readonly bool m_accountsAuthenticate; +// private readonly bool m_accountsAuthenticate; private readonly String m_programName; private readonly byte m_programMajorVersion; @@ -76,7 +76,7 @@ namespace OpenSim.Client.MXP.PacketHandler public MXPPacketServer(int port, Dictionary scenes, bool accountsAuthenticate) { m_port = port; - m_accountsAuthenticate = accountsAuthenticate; +// m_accountsAuthenticate = accountsAuthenticate; m_scenes = scenes; @@ -491,7 +491,6 @@ namespace OpenSim.Client.MXP.PacketHandler public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account) { - UUID userId = UUID.Zero; string firstName = ""; string lastName = ""; account = null; diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index 7ff87379b5..77b8a10f07 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs @@ -638,9 +638,9 @@ ELSE //Insert new values string sql = @"INSERT INTO [land] -([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime],[Dwell]) +([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime]) VALUES -(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime,@Dwell)"; +(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)"; using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlCommand cmd = new SqlCommand(sql, conn)) @@ -954,7 +954,6 @@ VALUES newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); try { @@ -1357,7 +1356,6 @@ VALUES parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); - parameters.Add(_Database.CreateParameter("Dwell", land.Dwell)); return parameters.ToArray(); } diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 04446ced4f..30253c3158 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -677,7 +677,7 @@ namespace OpenSim.Data.MySQL "MusicURL, PassHours, PassPrice, SnapshotUUID, " + "UserLocationX, UserLocationY, UserLocationZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " + - "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "?UUID, ?RegionUUID, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " + @@ -688,7 +688,7 @@ namespace OpenSim.Data.MySQL "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + - "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ + "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); @@ -1329,7 +1329,6 @@ namespace OpenSim.Data.MySQL UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); newData.AuthBuyerID = authedbuyer; newData.SnapshotID = snapshotID; @@ -1660,7 +1659,6 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); - cmd.Parameters.AddWithValue("Dwell", land.Dwell); cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); cmd.Parameters.AddWithValue("MediaType", land.MediaType); cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); diff --git a/OpenSim/Data/SQLite/Resources/019_RegionStore.sql b/OpenSim/Data/SQLite/Resources/019_RegionStore.sql deleted file mode 100644 index d62f8484b8..0000000000 --- a/OpenSim/Data/SQLite/Resources/019_RegionStore.sql +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN; - -ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; - -COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/SQLite/Resources/020_RegionStore.sql b/OpenSim/Data/SQLite/Resources/020_RegionStore.sql deleted file mode 100644 index 39cb752979..0000000000 --- a/OpenSim/Data/SQLite/Resources/020_RegionStore.sql +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN; - -ALTER TABLE prims ADD COLUMN MediaURL varchar(255); -ALTER TABLE primshapes ADD COLUMN Media TEXT; - -COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 0c421ec037..5e2045b1b9 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -448,11 +448,22 @@ update land COMMIT; :VERSION 19 -BEGIN ; -ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ; +BEGIN; +ALTER TABLE regionsettings ADD COLUMN map_tile_ID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000'; +COMMIT; + +:VERSION 20 +BEGIN; +ALTER TABLE prims ADD COLUMN MediaURL varchar(255); +ALTER TABLE primshapes ADD COLUMN Media TEXT; +COMMIT; + +:VERSION 21 +BEGIN; +ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none'; ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT ''; ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0'; ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE; -COMMIT ; \ No newline at end of file +COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 8432e74592..88699a767f 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -1111,7 +1111,6 @@ namespace OpenSim.Data.SQLite createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1449,7 +1448,6 @@ namespace OpenSim.Data.SQLite UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1761,7 +1759,6 @@ namespace OpenSim.Data.SQLite row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; row["MediaType"] = land.MediaType; row["MediaDescription"] = land.MediaDescription; row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs index 289fd948ce..b5ce4c0080 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs @@ -1069,7 +1069,6 @@ namespace OpenSim.Data.SQLiteLegacy createCol(land, "UserLookAtZ", typeof (Double)); createCol(land, "AuthbuyerID", typeof(String)); createCol(land, "OtherCleanTime", typeof(Int32)); - createCol(land, "Dwell", typeof(Int32)); land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; @@ -1400,7 +1399,6 @@ namespace OpenSim.Data.SQLiteLegacy UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - newData.Dwell = Convert.ToInt32(row["Dwell"]); return newData; } @@ -1711,7 +1709,6 @@ namespace OpenSim.Data.SQLiteLegacy row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["Dwell"] = land.Dwell; } /// diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 4440c94163..5bb0413929 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -88,7 +88,6 @@ namespace OpenSim.Framework private UUID _snapshotID = UUID.Zero; private Vector3 _userLocation = new Vector3(); private Vector3 _userLookAt = new Vector3(); - private int _dwell = 0; private int _otherCleanTime = 0; private string _mediaType = "none/none"; private string _mediaDescription = ""; @@ -619,18 +618,6 @@ namespace OpenSim.Framework } } - /// - /// Deprecated idea. Number of visitors ~= free money - /// - public int Dwell { - get { - return _dwell; - } - set { - _dwell = value; - } - } - /// /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own /// the parcel and isn't set to the same 'group' as the parcel. @@ -703,7 +690,6 @@ namespace OpenSim.Framework landData._userLocation = _userLocation; landData._userLookAt = _userLookAt; landData._otherCleanTime = _otherCleanTime; - landData._dwell = _dwell; landData._mediaType = _mediaType; landData._mediaDescription = _mediaDescription; landData._mediaWidth = _mediaWidth; diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index ec25118ebc..e36a72bf5b 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -806,7 +806,7 @@ namespace OpenSim.Framework IConfig config = source.Configs[RegionName]; if (config != null) - source.Configs.Remove(RegionName); + source.Configs.Remove(config); config = source.AddConfig(RegionName); @@ -865,10 +865,15 @@ namespace OpenSim.Framework return; } - configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, - ignoreIncomingConfiguration, false); - configMember.performConfigurationRetrieve(); - RegionFile = filename; + else if (filename.ToLower().EndsWith(".xml")) + { + configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, + ignoreIncomingConfiguration, false); + configMember.performConfigurationRetrieve(); + RegionFile = filename; + } + else + throw new Exception("Invalid file type for region persistence."); } public void loadConfigurationOptionsFromMe() diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index ff0afc86e8..fc0387b76c 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -118,7 +118,8 @@ namespace OpenSim.Framework.Serialization.External landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); - landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell")); + // No longer used here + xtr.ReadElementString("Dwell"); landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); xtr.ReadEndElement(); @@ -177,7 +178,7 @@ namespace OpenSim.Framework.Serialization.External xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); - xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); + xtw.WriteElementString("Dwell", "0"); xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); xtw.WriteEndElement(); diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 016ab738bc..d20f8c9b25 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.Specialized; using System.IO; using System.Net; using System.Net.Sockets; @@ -338,19 +339,25 @@ namespace OpenSim.Framework.Servers.HttpServer // HandleRequest(request,resp); // } + /// + /// This methods is the start of incoming HTTP request handling. + /// + /// + /// public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) { try { +// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); + // This is the REST agent interface. We require an agent to properly identify // itself. If the REST handler recognizes the prefix it will attempt to // satisfy the request. If it is not recognizable, and no damage has occurred // the request can be passed through to the other handlers. This is a low // probability event; if a request is matched it is normally expected to be // handled -// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); - IHttpAgentHandler agentHandler; if (TryGetAgentHandler(request, response, out agentHandler)) @@ -731,6 +738,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (methodWasFound) { xmlRprcRequest.Params.Add(request.Url); // Param[2] + xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] try { diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index f955df7731..41ece86047 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -57,80 +57,73 @@ namespace OpenSim.Framework.Servers.HttpServer { WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - - if ((verb == "POST") || (verb == "PUT")) - { - request.ContentType = "text/www-form-urlencoded"; - - MemoryStream buffer = new MemoryStream(); - int length = 0; - using (StreamWriter writer = new StreamWriter(buffer)) - { - writer.Write(obj); - writer.Flush(); - } - - length = (int)obj.Length; - request.ContentLength = length; - - Stream requestStream = null; - try - { - requestStream = request.GetRequestStream(); - requestStream.Write(buffer.ToArray(), 0, length); - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); - } - finally - { - // If this is closed, it will be disposed internally, - // but the above write is asynchronous and may hit after - // we're through here. So the thread handling that will - // throw and put us back into the catch above. Isn't - // .NET great? - //if (requestStream != null) - // requestStream.Close(); - // Let's not close this - //buffer.Close(); - - } - } - string respstring = String.Empty; - try + using (MemoryStream buffer = new MemoryStream()) { - using (WebResponse resp = request.GetResponse()) + if ((verb == "POST") || (verb == "PUT")) { - if (resp.ContentLength != 0) + request.ContentType = "text/www-form-urlencoded"; + + int length = 0; + using (StreamWriter writer = new StreamWriter(buffer)) { - Stream respStream = null; - try + writer.Write(obj); + writer.Flush(); + } + + length = (int)obj.Length; + request.ContentLength = length; + + Stream requestStream = null; + try + { + requestStream = request.GetRequestStream(); + requestStream.Write(buffer.ToArray(), 0, length); + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); + } + finally + { + if (requestStream != null) + requestStream.Close(); + } + } + + try + { + using (WebResponse resp = request.GetResponse()) + { + if (resp.ContentLength != 0) { - respStream = resp.GetResponseStream(); - using (StreamReader reader = new StreamReader(respStream)) + Stream respStream = null; + try { - respstring = reader.ReadToEnd(); + respStream = resp.GetResponseStream(); + using (StreamReader reader = new StreamReader(respStream)) + { + respstring = reader.ReadToEnd(); + } + } + catch (Exception e) + { + m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); + } + finally + { + if (respStream != null) + respStream.Close(); } - } - catch (Exception e) - { - m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); - } - finally - { - if (respStream != null) - respStream.Close(); } } } - } - catch (System.InvalidOperationException) - { - // This is what happens when there is invalid XML - m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + catch (System.InvalidOperationException) + { + // This is what happens when there is invalid XML + m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request"); + } } return respstring; } diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index af5a0ced9a..b66d82681a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1495,5 +1495,49 @@ namespace OpenSim.Framework } } + /// + /// Gets the client IP address + /// + /// + /// + public static IPEndPoint GetClientIPFromXFF(string xff) + { + if (xff == string.Empty) + return null; + + string[] parts = xff.Split(new char[] { ',' }); + if (parts.Length > 0) + { + try + { + return new IPEndPoint(IPAddress.Parse(parts[0]), 0); + } + catch (Exception e) + { + m_log.WarnFormat("[UTIL]: Exception parsing XFF header {0}: {1}", xff, e.Message); + } + } + + return null; + } + + public static string GetCallerIP(Hashtable req) + { + if (req.ContainsKey("headers")) + { + try + { + Hashtable headers = (Hashtable)req["headers"]; + if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) + return headers["remote_addr"].ToString(); + } + catch (Exception e) + { + m_log.WarnFormat("[UTIL]: exception in GetCallerIP: {0}", e.Message); + } + } + return string.Empty; + } + } } diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 072e4d3689..945da7de05 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -218,7 +218,13 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "debug packet", "debug packet ", - "Turn on packet debugging", Debug); + "Turn on packet debugging", + "If level > 255 then all incoming and outgoing packets are logged.\n" + + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" + + "If level <= 0 then no packets are logged.", + Debug); m_console.Commands.AddCommand("region", false, "debug scene", "debug scene ", diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 4ef0b1bdb2..ec3193cb7c 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -36,7 +36,6 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; - using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; @@ -403,7 +402,9 @@ namespace OpenSim } catch (Exception e) { - m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace); + m_log.ErrorFormat( + "[STARTUP]: Registration of region with grid failed, aborting startup due to {0} {1}", + e.Message, e.StackTrace); if (scene.SnmpService != null) { diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index aa7de056ce..3dea40cc05 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector { /// - /// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets). + /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. /// protected int m_debugPacketLevel = 0; @@ -2687,6 +2687,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y) { + float dwell = 0.0f; + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + if (dwellModule != null) + dwell = dwellModule.GetDwell(land.GlobalID); ParcelInfoReplyPacket reply = (ParcelInfoReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelInfoReply); reply.AgentData.AgentID = m_agentId; reply.Data.ParcelID = parcelID; @@ -2711,7 +2715,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.GlobalZ = pos.Z; reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SnapshotID = land.SnapshotID; - reply.Data.Dwell = land.Dwell; + reply.Data.Dwell = dwell; reply.Data.SalePrice = land.SalePrice; reply.Data.AuctionID = (int)land.AuctionID; @@ -11229,8 +11233,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// handles splitting manually protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting) { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); + if (m_debugPacketLevel > 0) + { + bool outputPacket = true; + + if (m_debugPacketLevel <= 255 + && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage)) + outputPacket = false; + + if (m_debugPacketLevel <= 200 + && + (packet.Type == PacketType.ImagePacket + || packet.Type == PacketType.ImageData + || packet.Type == PacketType.LayerData + || packet.Type == PacketType.CoarseLocationUpdate)) + outputPacket = false; + + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) + outputPacket = false; + + if (outputPacket) + m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); + } m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); } @@ -11316,26 +11340,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Entryway from the client to the simulator. All UDP packets from the client will end up here /// /// OpenMetaverse.packet - public void ProcessInPacket(Packet Pack) + public void ProcessInPacket(Packet packet) { - if (!m_IsPresenceReady) + if (m_debugPacketLevel > 0) { - if (m_pendingPackets == null) - { - m_pendingPackets = new List(); - } - m_pendingPackets.Add(Pack); + bool outputPacket = true; + + if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) + outputPacket = false; + + if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) + outputPacket = false; + + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) + outputPacket = false; + + if (outputPacket) + m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); } - else - { - if (m_debugPacketLevel >= 255) - m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type); - if (!ProcessPacketMethod(Pack)) - m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type); + if (!ProcessPacketMethod(packet)) + m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); - PacketPool.Instance.ReturnPacket(Pack); - } + PacketPool.Instance.ReturnPacket(packet); } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index c791cb4c8d..460973840b 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs @@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); - IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService; - InventoryItemBase item = new InventoryItemBase(); item.Owner = ourClient.AgentId; item.CreatorId = ourClient.AgentId.ToString(); @@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction item.Flags = (uint) wearableType; item.CreationDate = Util.UnixTimeSinceEpoch(); - if (invService.AddItem(item)) + if (m_userTransactions.Manager.MyScene.AddInventoryItem(item)) ourClient.SendInventoryItemCreateUpdate(item, callbackID); else ourClient.SendAlertMessage("Unable to create inventory item"); diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 38152ccbb5..100b55cf6d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -174,16 +174,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments UUID itemID = UUID.Zero; if (sp != null) { - foreach(SceneObjectGroup grp in sp.Attachments) + foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) { - if (grp.GetAttachmentPoint() == (byte)AttachmentPt) - { - itemID = grp.GetFromItemID(); - break; - } - } - if (itemID != UUID.Zero) - DetachSingleAttachmentToInv(itemID, remoteClient); + itemID = grp.GetFromItemID(); + if (itemID != UUID.Zero) + DetachSingleAttachmentToInv(itemID, remoteClient); + } } if (group.GetFromItemID() == UUID.Zero) @@ -197,12 +193,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments 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; + AttachToAgent(sp, group, AttachmentPt, attachPos, silent); } else { @@ -280,8 +271,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; - AttachObject(remoteClient, objatt, AttachmentPt, false); - //objatt.ScheduleGroupForFullUpdate(); + // This will throw if the attachment fails + try + { + AttachObject(remoteClient, objatt, AttachmentPt, false); + } + catch + { + // Make sure the object doesn't stick around and bail + m_scene.DeleteSceneObject(objatt, false); + return null; + } if (tainted) objatt.HasGroupChanged = true; @@ -551,6 +551,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments remoteClient.SendInventoryItemCreateUpdate(item, 0); } } - } + } + + /// + /// Attach this scene object to the given avatar. + /// + /// + /// This isn't publicly available since attachments should always perform the corresponding inventory + /// operation (to show the attach in user inventory and update the asset with positional information). + /// + /// + /// + /// + /// + /// + protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent) + { + // don't attach attachments to child agents + if (avatar.IsChildAgent) return; + +// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name); + + so.DetachFromBackup(); + + // Remove from database and parcel prim count + m_scene.DeleteFromStorage(so.UUID); + m_scene.EventManager.TriggerParcelPrimCountTainted(); + + so.RootPart.AttachedAvatar = avatar.UUID; + + //Anakin Lohner bug #3839 + lock (so.Children) + { + foreach (SceneObjectPart p in so.Children.Values) + { + p.AttachedAvatar = avatar.UUID; + } + } + + if (so.RootPart.PhysActor != null) + { + m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); + so.RootPart.PhysActor = null; + } + + so.AbsolutePosition = AttachOffset; + so.RootPart.AttachedPos = AttachOffset; + so.RootPart.IsAttachment = true; + + so.RootPart.SetParentLocalId(avatar.LocalId); + so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); + + avatar.AddAttachment(so); + + if (!silent) + { + // Killing it here will cause the client to deselect it + // It then reappears on the avatar, deselected + // through the full update below + // + if (so.IsSelected) + { + m_scene.SendKillObject(so.RootPart.LocalId); + } + + so.IsSelected = false; // fudge.... + so.ScheduleGroupForFullUpdate(); + } + + // In case it is later dropped again, don't let + // it get cleaned up + so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); + so.HasGroupChanged = false; + } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 22c84e947c..52342ec357 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver // Reset folder ID to the one in which we want to load it item.Folder = loadFolder.ID; - //m_userInfo.AddItem(item); - m_scene.InventoryService.AddItem(item); + m_scene.AddInventoryItem(item); return item; } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs index 8343091773..47e34dcdd6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// public static class InventoryArchiveUtils { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings public static readonly char ESCAPE_CHARACTER = '\\'; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 0218f86178..d66a1d0640 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; @@ -282,7 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; @@ -485,7 +485,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase objsFolder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; item1.Folder = objsFolder.ID; - scene.AddInventoryItem(userId, item1); + scene.AddInventoryItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index 6294935215..b62df18c10 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -54,12 +54,12 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue }; } - private static byte[] uintToByteArray(uint uIntValue) - { - byte[] result = new byte[4]; - Utils.UIntToBytesBig(uIntValue, result, 0); - return result; - } +// private static byte[] uintToByteArray(uint uIntValue) +// { +// byte[] result = new byte[4]; +// Utils.UIntToBytesBig(uIntValue, result, 0); +// return result; +// } public static OSD buildEvent(string eventName, OSD eventBody) { diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index c673b31bbc..125a397d0e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } // DO NOT OVERRIDE THE BASE METHOD - public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, + public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { UUID assetID = base.DeleteToInventory(action, folderID, new List() {objectGroup}, remoteClient); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 41596104f3..37f6ea0ba8 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -430,7 +430,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item.Name = asset.Name; item.AssetType = asset.Type; - m_Scene.InventoryService.AddItem(item); + m_Scene.AddInventoryItem(item); if (remoteClient != null && item.Owner == remoteClient.AgentId) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 97161fcbd1..5b4fecb802 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 915b59ec29..cbd9e05de7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -221,34 +221,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // m_log.DebugFormat( // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", // item.Name, item.Owner, item.Folder); - - if (UUID.Zero == item.Folder) - { - InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); - if (f != null) - { -// m_log.DebugFormat( -// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", -// f.Name, (AssetType)f.Type, item.Name); - - item.Folder = f.ID; - } - else - { - f = m_InventoryService.GetRootFolder(item.Owner); - if (f != null) - { - item.Folder = f.ID; - } - else - { -// m_log.WarnFormat( -// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", -// item.Owner, item.Name); - return false; - } - } - } return m_InventoryService.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 4211fa9b07..4ab69474a1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -227,31 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public bool AddItem(InventoryItemBase item) { if (item == null) - return false; - - if (UUID.Zero == item.Folder) - { - InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType); - if (f != null) - { - item.Folder = f.ID; - } - else - { - f = m_RemoteConnector.GetRootFolder(item.Owner); - if (f != null) - { - item.Folder = f.ID; - } - else - { - m_log.WarnFormat( - "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", - item.Owner, item.Name); - return false; - } - } - } + return false; return m_RemoteConnector.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 776fe302a5..f62ec1b275 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -171,7 +171,6 @@ namespace OpenSim.Region.CoreModules.World.Land client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; client.OnParcelReclaim += ClientOnParcelReclaim; client.OnParcelInfoRequest += ClientOnParcelInfoRequest; -// client.OnParcelDwellRequest += ClientOnParcelDwellRequest; client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; client.OnPreAgentUpdate += ClientOnPreAgentUpdate; @@ -1116,7 +1115,11 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.TryGetValue(localID, out land); } - if (land != null) land.UpdateLandProperties(args, remote_client); + if (land != null) + { + land.UpdateLandProperties(args, remote_client); + m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); + } } public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) @@ -1434,9 +1437,13 @@ namespace OpenSim.Region.CoreModules.World.Land m_landList.TryGetValue(parcelID, out land); } - if (land != null) { + if (land != null) + { land.UpdateLandProperties(land_update, client); - } else { + m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); + } + else + { m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); } return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); @@ -1512,18 +1519,6 @@ namespace OpenSim.Region.CoreModules.World.Land #endregion - private void ClientOnParcelDwellRequest(int localID, IClientAPI remoteClient) - { - ILandObject selectedParcel = null; - lock (m_landList) - { - if (!m_landList.TryGetValue(localID, out selectedParcel)) - return; - } - - remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell); - } - private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) { if (parcelID == UUID.Zero) diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 8ce6dafc95..12750c5e2c 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell item.CurrentPermissions |= 16; // Slam! item.CreationDate = Util.UnixTimeSinceEpoch(); - if (m_scene.InventoryService.AddItem(item)) + if (m_scene.AddInventoryItem(item)) { remoteClient.SendInventoryItemCreateUpdate(item, 0); } diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs index 64d29f2655..b8c90cd5a1 100644 --- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs @@ -123,6 +123,8 @@ namespace OpenSim.Region.DataSnapshot.Providers ILandChannel landChannel = m_scene.LandChannel; List parcels = landChannel.AllParcels(); + IDwellModule dwellModule = m_scene.RequestModuleInterface(); + XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); if (parcels != null) { @@ -208,7 +210,10 @@ namespace OpenSim.Region.DataSnapshot.Providers xmlparcel.AppendChild(infouuid); XmlNode dwell = nodeFactory.CreateNode(XmlNodeType.Element, "dwell", ""); - dwell.InnerText = parcel.Dwell.ToString(); + if (dwellModule != null) + dwell.InnerText = dwellModule.GetDwell(parcel.GlobalID).ToString(); + else + dwell.InnerText = "0"; xmlparcel.AppendChild(dwell); //TODO: figure how to figure out teleport system landData.landingType diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 52e6e92bb5..d4e2736522 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -113,6 +113,8 @@ namespace OpenSim.Region.Framework.Scenes public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; + public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; + /// /// Fired when an object is touched/grabbed. /// @@ -2128,5 +2130,27 @@ namespace OpenSim.Region.Framework.Scenes } } } + + public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, + int local_id, IClientAPI remote_client) + { + ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest; + if (handler != null) + { + foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList()) + { + try + { + d(args, local_id, remote_client); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 0d9682e117..5ee895556d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) { - IMoneyModule money=RequestModuleInterface(); + IMoneyModule money = RequestModuleInterface(); if (money != null) { money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); } - AddInventoryItem(agentID, item); + AddInventoryItem(item); } public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) { - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) return true; else { @@ -92,19 +92,23 @@ namespace OpenSim.Region.Framework.Scenes } } - public void AddInventoryItem(UUID AgentID, InventoryItemBase item) + /// + /// Add the given inventory item to a user's inventory. + /// + /// + public bool AddInventoryItem(InventoryItemBase item) { InventoryFolderBase folder; if (item.Folder == UUID.Zero) { - folder = InventoryService.GetFolderForType(AgentID, (AssetType)item.AssetType); + folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); if (folder == null) { - folder = InventoryService.GetRootFolder(AgentID); + folder = InventoryService.GetRootFolder(item.Owner); if (folder == null) - return; + return false; } item.Folder = folder.ID; @@ -113,20 +117,37 @@ namespace OpenSim.Region.Framework.Scenes if (InventoryService.AddItem(item)) { int userlevel = 0; - if (Permissions.IsGod(AgentID)) + if (Permissions.IsGod(item.Owner)) { userlevel = 1; } - EventManager.TriggerOnNewInventoryItemUploadComplete(AgentID, item.AssetID, item.Name, userlevel); + EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); + + return true; } else { m_log.WarnFormat( "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", - AgentID, item.Name, item.ID); + item.Owner, item.Name, item.ID); - return; - } + return false; + } + } + + /// + /// Add the given inventory item to a user's inventory. + /// + /// + /// A + /// + /// + /// A + /// + [Obsolete("Use AddInventoryItem(InventoryItemBase item) instead. This was deprecated in OpenSim 0.7.1")] + public void AddInventoryItem(UUID AgentID, InventoryItemBase item) + { + AddInventoryItem(item); } /// @@ -137,7 +158,7 @@ namespace OpenSim.Region.Framework.Scenes /// in which the item is to be placed. public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) { - AddInventoryItem(remoteClient.AgentId, item); + AddInventoryItem(item); remoteClient.SendInventoryItemCreateUpdate(item, 0); } @@ -529,7 +550,7 @@ namespace OpenSim.Region.Framework.Scenes itemCopy.SalePrice = item.SalePrice; itemCopy.SaleType = item.SaleType; - if (InventoryService.AddItem(itemCopy)) + if (AddInventoryItem(itemCopy)) { IInventoryAccessModule invAccess = RequestModuleInterface(); if (invAccess != null) @@ -775,8 +796,10 @@ namespace OpenSim.Region.Framework.Scenes item.BasePermissions = baseMask; item.CreationDate = creationDate; - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) + { remoteClient.SendInventoryItemCreateUpdate(item, callbackID); + } else { m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); @@ -1142,7 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes agentItem.Folder = folderId; - AddInventoryItem(avatarId, agentItem); + AddInventoryItem(agentItem); return agentItem; } @@ -1266,7 +1289,7 @@ namespace OpenSim.Region.Framework.Scenes { agentItem.Folder = newFolderID; - AddInventoryItem(destID, agentItem); + AddInventoryItem(agentItem); } } @@ -1908,7 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes // sets itemID so client can show item as 'attached' in inventory grp.SetFromItemID(item.ID); - if (InventoryService.AddItem(item)) + if (AddInventoryItem(item)) remoteClient.SendInventoryItemCreateUpdate(item, 0); else m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 400f4c0adb..94a9dab365 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2729,6 +2729,8 @@ namespace OpenSim.Region.Framework.Scenes try { ScenePresence sp = GetScenePresence(agentID); + PresenceService.LogoutAgent(sp.ControllingClient.SessionId); + if (sp != null) sp.ControllingClient.Close(); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 8823df1eff..86842b3ab0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1619,11 +1619,6 @@ namespace OpenSim.Region.Framework.Scenes if (child != null) { - // Make sure no child prim is set for sale - // So that, on delink, no prims are unwittingly - // left for sale and sold off - child.RootPart.ObjectSaleType = 0; - child.RootPart.SalePrice = 10; childGroups.Add(child); } } @@ -1907,9 +1902,6 @@ namespace OpenSim.Region.Framework.Scenes child.ApplyNextOwnerPermissions(); } } - - copy.RootPart.ObjectSaleType = 0; - copy.RootPart.SalePrice = 10; } Entities.Add(copy); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index c5994b2397..1959427cf3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes if (!m_part.ParentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) { - if (stateSource == 1 && // Prim crossing + if (stateSource == 2 && // Prim crossing m_part.ParentGroup.Scene.m_trustBinaries) { m_items.LockItemsForWrite(true); @@ -1263,4 +1263,4 @@ namespace OpenSim.Region.Framework.Scenes Items.LockItemsForRead(false); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index faf6354940..d88f2ccd29 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3913,6 +3913,27 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju m_attachments.Add(gobj); } } + + /// + /// Get the scene object attached to the given point. + /// + /// + /// Returns an empty list if there were no attachments at the point. + public List GetAttachments(uint attachmentPoint) + { + List attachments = new List(); + + lock (m_attachments) + { + foreach (SceneObjectGroup so in m_attachments) + { + if (attachmentPoint == so.RootPart.AttachmentPoint) + attachments.Add(so); + } + } + + return attachments; + } public bool HasAttachments() { diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 358ce220b5..dfc9aa3dea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -134,5 +134,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests #endregion + [Test] + // llRot2Euler test. + public void TestllRot2Euler() + { + // 180, 90 and zero degree rotations. + CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 0.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, 0.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 1.0f, 0.0f, 0.0f), new LSL_Types.Vector3(Math.PI, 0.0f, Math.PI)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 1.0f, 0.0f), new LSL_Types.Vector3(0.0f, 0.0f, Math.PI)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f), new LSL_Types.Vector3(0.0f, 0.0f, 0.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(-0.5f, -0.5f, 0.5f, 0.5f), new LSL_Types.Vector3(0, -Math.PI / 2.0f, Math.PI / 2.0f)); + CheckllRot2Euler(new LSL_Types.Quaternion(-0.707107f, 0.0f, 0.0f, -0.707107f), new LSL_Types.Vector3(Math.PI / 2.0f, 0.0f, 0.0f)); + // A couple of messy rotations. + CheckllRot2Euler(new LSL_Types.Quaternion(1.0f, 5.651f, -3.1f, 67.023f), new LSL_Types.Vector3(0.037818f, 0.166447f, -0.095595f)); + CheckllRot2Euler(new LSL_Types.Quaternion(0.719188f, -0.408934f, -0.363998f, -0.427841f), new LSL_Types.Vector3(-1.954769f, -0.174533f, 1.151917f)); + } + + private void CheckllRot2Euler(LSL_Types.Quaternion rot, LSL_Types.Vector3 eulerCheck) + { + // Call LSL function to convert quaternion rotaion to euler radians. + LSL_Types.Vector3 eulerCalc = m_lslApi.llRot2Euler(rot); + // Check upper and lower bounds of x, y and z. + // This type of check is performed as opposed to comparing for equal numbers, in order to allow slight + // differences in accuracy. + Assert.Greater(eulerCalc.x, eulerCheck.x - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X lower bounds check fail"); + Assert.Less(eulerCalc.x, eulerCheck.x + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler X upper bounds check fail"); + Assert.Greater(eulerCalc.y, eulerCheck.y - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y lower bounds check fail"); + Assert.Less(eulerCalc.y, eulerCheck.y + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Y upper bounds check fail"); + Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); + Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); + } } } diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index e50481a259..d10d6fc6fe 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -54,9 +54,12 @@ namespace OpenSim.Server.Handlers.Hypergrid private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IUserAgentService m_UserAgentService; - public HomeAgentHandler(IUserAgentService userAgentService) + private string m_LoginServerIP; + + public HomeAgentHandler(IUserAgentService userAgentService, string loginServerIP) { m_UserAgentService = userAgentService; + m_LoginServerIP = loginServerIP; } public Hashtable Handler(Hashtable request) @@ -120,6 +123,7 @@ namespace OpenSim.Server.Handlers.Hypergrid string regionname = string.Empty; string gatekeeper_host = string.Empty; int gatekeeper_port = 0; + IPEndPoint client_ipaddress = null; if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null) gatekeeper_host = args["gatekeeper_host"].AsString(); @@ -144,6 +148,24 @@ namespace OpenSim.Server.Handlers.Hypergrid if (args.ContainsKey("destination_name") && args["destination_name"] != null) regionname = args["destination_name"].ToString(); + if (args.ContainsKey("client_ip") && args["client_ip"] != null) + { + string ip_str = args["client_ip"].ToString(); + try + { + string callerIP = Util.GetCallerIP(request); + // Verify if this caller has authority to send the client IP + if (callerIP == m_LoginServerIP) + client_ipaddress = new IPEndPoint(IPAddress.Parse(ip_str), 0); + else + m_log.WarnFormat("[HOME AGENT HANDLER]: Unauthorized machine {0} tried to set client ip to {1}", callerIP, ip_str); + } + catch + { + m_log.DebugFormat("[HOME AGENT HANDLER]: Exception parsing client ip address from {0}", ip_str); + } + } + GridRegion destination = new GridRegion(); destination.RegionID = uuid; destination.RegionLocX = x; @@ -166,7 +188,7 @@ namespace OpenSim.Server.Handlers.Hypergrid OSDMap resp = new OSDMap(2); string reason = String.Empty; - bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason); + bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, client_ipaddress, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 6b1152b00e..70157d5705 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -66,13 +66,15 @@ namespace OpenSim.Server.Handlers.Hypergrid if (m_HomeUsersService == null) throw new Exception("UserAgent server connector cannot proceed because of missing service"); + string loginServerIP = gridConfig.GetString("LoginServerIP", "127.0.0.1"); + server.AddXmlRPCHandler("agent_is_coming_home", AgentIsComingHome, false); server.AddXmlRPCHandler("get_home_region", GetHomeRegion, false); server.AddXmlRPCHandler("verify_agent", VerifyAgent, false); server.AddXmlRPCHandler("verify_client", VerifyClient, false); server.AddXmlRPCHandler("logout_agent", LogoutAgent, false); - server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService).Handler); + server.AddHTTPHandler("/homeagent/", new HomeAgentHandler(m_HomeUsersService, loginServerIP).Handler); } public XmlRpcResponse GetHomeRegion(XmlRpcRequest request, IPEndPoint remoteClient) diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 5bb529c89e..30dc65e5e8 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -52,15 +52,24 @@ namespace OpenSim.Server.Handlers.Login private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private ILoginService m_LocalService; + private bool m_Proxy; - public LLLoginHandlers(ILoginService service) + public LLLoginHandlers(ILoginService service, bool hasProxy) { m_LocalService = service; + m_Proxy = hasProxy; } public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) { Hashtable requestData = (Hashtable)request.Params[0]; + if (m_Proxy && request.Params[3] != null) + { + IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); + if (ep != null) + // Bang! + remoteClient = ep; + } if (requestData != null) { @@ -189,6 +198,7 @@ namespace OpenSim.Server.Handlers.Login return map; } + } } diff --git a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs index 67e83924d0..16c93c8e2c 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginServiceInConnector.cs @@ -43,6 +43,7 @@ namespace OpenSim.Server.Handlers.Login private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private ILoginService m_LoginService; + private bool m_Proxy; public LLLoginServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : base(config, server, String.Empty) @@ -81,12 +82,14 @@ namespace OpenSim.Server.Handlers.Login if (loginService == string.Empty) throw new Exception(String.Format("No LocalServiceModule for LoginService in config file")); + m_Proxy = serverConfig.GetBoolean("HasProxy", false); + return loginService; } private void InitializeHandlers(IHttpServer server) { - LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService); + LLLoginHandlers loginHandlers = new LLLoginHandlers(m_LoginService, m_Proxy); server.AddXmlRPCHandler("login_to_simulator", loginHandlers.HandleXMLRPCLogin, false); server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false); server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin); diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 05b00e5428..42ea29690a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -184,7 +184,7 @@ namespace OpenSim.Server.Handlers.Simulation resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); // Let's also send out the IP address of the caller back to the caller (HG 1.5) - resp["your_ip"] = OSD.FromString(GetCallerIP(request)); + resp["your_ip"] = OSD.FromString(Util.GetCallerIP(request)); // TODO: add reason if not String.Empty? responsedata["int_response_code"] = HttpStatusCode.OK; @@ -378,23 +378,6 @@ namespace OpenSim.Server.Handlers.Simulation m_SimulationService.ReleaseAgent(regionID, id, ""); } - private string GetCallerIP(Hashtable req) - { - if (req.ContainsKey("headers")) - { - try - { - Hashtable headers = (Hashtable)req["headers"]; - if (headers.ContainsKey("remote_addr") && headers["remote_addr"] != null) - return headers["remote_addr"].ToString(); - } - catch (Exception e) - { - m_log.WarnFormat("[AGENT HANDLER]: exception in GetCallerIP: {0}", e.Message); - } - } - return string.Empty; - } } } diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 8d0f7be961..f5b59823e6 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -86,13 +86,8 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - IPEndPoint ext = info.ExternalEndPoint; - string uri = ""; - if (ext != null) - { - uri = "http://" + ext.Address + ":" + info.HttpPort + "/"; - } - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); + string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try { @@ -193,12 +188,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - IPEndPoint ext = gatekeeper.ExternalEndPoint; - string uri = ""; - if (ext != null) - { - uri = "http://" + ext.Address + ":" + gatekeeper.HttpPort + "/"; - } + string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 45019373cf..6d3c64a875 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -51,34 +51,49 @@ namespace OpenSim.Services.Connectors.Hypergrid MethodBase.GetCurrentMethod().DeclaringType); string m_ServerURL; - Uri m_Uri; public UserAgentServiceConnector(string url) { m_ServerURL = url; + // Doing this here, because XML-RPC or mono have some strong ideas about + // caching DNS translations. try { - m_Uri = new Uri(m_ServerURL); + Uri m_Uri = new Uri(m_ServerURL); IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); - m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port; + m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ; } catch (Exception e) { m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); } + m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); } public UserAgentServiceConnector(IConfigSource config) { + IConfig serviceConfig = config.Configs["UserAgentService"]; + if (serviceConfig == null) + { + m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini"); + throw new Exception("UserAgent connector init error"); + } + + string serviceURI = serviceConfig.GetString("UserAgentServerURI", + String.Empty); + + if (serviceURI == String.Empty) + { + m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); + throw new Exception("UserAgent connector init error"); + } + m_ServerURL = serviceURI; + + m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); } - public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) - { - // not available over remote calls - reason = "Method not available over remote calls"; - return false; - } - public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) + // The Login service calls this interface with a non-null [client] ipaddress + public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason) { reason = String.Empty; @@ -89,7 +104,7 @@ namespace OpenSim.Services.Connectors.Hypergrid return false; } - string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; + string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); @@ -101,7 +116,7 @@ namespace OpenSim.Services.Connectors.Hypergrid //AgentCreateRequest.Headers.Add("Authorization", authKey); // Fill it in - OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); + OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress); string strBuffer = ""; byte[] buffer = new byte[1]; @@ -198,7 +213,14 @@ namespace OpenSim.Services.Connectors.Hypergrid } - protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination) + + // The simulators call this interface + public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) + { + return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason); + } + + protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress) { OSDMap args = null; try @@ -216,6 +238,8 @@ namespace OpenSim.Services.Connectors.Hypergrid args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); + if (ipaddress != null) + args["client_ip"] = OSD.FromString(ipaddress.Address.ToString()); return args; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 616b5a7663..99e69838ab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private IImprovedAssetCache m_cache; + private bool m_Enabled = false; #region ISharedRegionModule @@ -73,8 +74,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAssetServiceConnector() { } public string Name { get { return "SimianAssetServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -85,26 +86,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AssetServices", this.Name)) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - IConfig gridConfig = source.Configs["AssetService"]; - if (gridConfig == null) + string name = moduleConfig.GetString("AssetServices", ""); + if (name == Name) { - m_log.Error("[SIMIAN ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); - throw new Exception("Asset connector init error"); + IConfig gridConfig = source.Configs["AssetService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AssetServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); + else + m_Enabled = true; } - - string serviceUrl = gridConfig.GetString("AssetServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) - { - m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI in section AssetService"); - throw new Exception("Asset connector init error"); - } - - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 7a96a05dea..68f73ee983 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -51,6 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid MethodBase.GetCurrentMethod().DeclaringType); private string m_serverUrl = String.Empty; + private bool m_Enabled = false; #region ISharedRegionModule @@ -61,8 +62,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAuthenticationServiceConnector() { } public string Name { get { return "SimianAuthenticationServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -73,23 +74,28 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AuthenticationServices", this.Name)) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - IConfig assetConfig = source.Configs["AuthenticationService"]; - if (assetConfig == null) + string name = moduleConfig.GetString("AuthenticationServices", ""); + if (name == Name) { - m_log.Error("[SIMIAN AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); - throw new Exception("Authentication connector init error"); - } + IConfig gridConfig = source.Configs["AuthenticationService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } - string serviceURI = assetConfig.GetString("AuthenticationServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN AUTH CONNECTOR]: No Server URI named in section AuthenticationService"); - throw new Exception("Authentication connector init error"); + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); } - - m_serverUrl = serviceURI; } } @@ -253,7 +259,8 @@ namespace OpenSim.Services.Connectors.SimianGrid if (password == simianGridCredential || "$1$" + password == simianGridCredential || "$1$" + Utils.MD5String(password) == simianGridCredential || - Utils.MD5String(password) == simianGridCredential) + Utils.MD5String(password) == simianGridCredential || + "$1$" + Utils.MD5String(password + ":") == simianGridCredential) { authorizeResult = Authorize(userID); return true; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 734bdd2e48..7e56bd19e2 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -56,6 +56,7 @@ namespace OpenSim.Services.Connectors.SimianGrid // private static string ZeroID = UUID.Zero.ToString(); private string m_serverUrl = String.Empty; + private bool m_Enabled = false; #region ISharedRegionModule @@ -66,8 +67,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAvatarServiceConnector() { } public string Name { get { return "SimianAvatarServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -78,26 +79,28 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "AvatarServices", this.Name)) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - IConfig gridConfig = source.Configs["AvatarService"]; - if (gridConfig == null) + string name = moduleConfig.GetString("AvatarServices", ""); + if (name == Name) { - m_log.Error("[SIMIAN AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); - throw new Exception("Avatar connector init error"); + IConfig gridConfig = source.Configs["AvatarService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AvatarServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); } - - string serviceUrl = gridConfig.GetString("AvatarServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) - { - m_log.Error("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService"); - throw new Exception("Avatar connector init error"); - } - - if (!serviceUrl.EndsWith("/")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 89f3594a94..5b18aeff3c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -46,8 +46,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// Stores and retrieves friend lists from the SimianGrid backend /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianFriendsServiceConnector : IFriendsService, ISharedRegionModule + public class SimianFriendsServiceConnector : IFriendsService { private static readonly ILog m_log = LogManager.GetLogger( @@ -55,20 +54,6 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; - #region ISharedRegionModule - - public Type ReplaceableInterface { get { return null; } } - public void RegionLoaded(Scene scene) { } - public void PostInitialise() { } - public void Close() { } - - public SimianFriendsServiceConnector() { } - public string Name { get { return "SimianFriendsServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } - - #endregion ISharedRegionModule - public SimianFriendsServiceConnector(IConfigSource source) { Initialise(source); @@ -76,38 +61,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - bool isSimianEnabled = false; - - if (source.Configs["Friends"] != null) + IConfig gridConfig = source.Configs["FriendsService"]; + if (gridConfig != null) { - string module = source.Configs["Friends"].GetString("Connector"); - isSimianEnabled = !String.IsNullOrEmpty(module) && module.EndsWith(this.Name); + string serviceUrl = gridConfig.GetString("FriendsServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + } } - if (isSimianEnabled) - { - IConfig assetConfig = source.Configs["FriendsService"]; - if (assetConfig == null) - { - m_log.Error("[SIMIAN FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); - throw new Exception("Friends connector init error"); - } - - string serviceURI = assetConfig.GetString("FriendsServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN FRIENDS CONNECTOR]: No Server URI named in section FriendsService"); - throw new Exception("Friends connector init error"); - } - - m_serverUrl = serviceURI; - } + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN FRIENDS CONNECTOR]: No FriendsServerURI specified, disabling connector"); } #region IFriendsService public FriendInfo[] GetFriends(UUID principalID) { + if (String.IsNullOrEmpty(m_serverUrl)) + return new FriendInfo[0]; + Dictionary friends = new Dictionary(); OSDArray friendsArray = GetFriended(principalID); @@ -156,6 +132,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool StoreFriend(UUID principalID, string friend, int flags) { + if (String.IsNullOrEmpty(m_serverUrl)) + return true; + NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "AddGeneric" }, @@ -176,6 +155,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool Delete(UUID principalID, string friend) { + if (String.IsNullOrEmpty(m_serverUrl)) + return true; + NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "RemoveGeneric" }, diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs index 7d97aaa3e8..847319c25a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs @@ -31,17 +31,3 @@ using Nini.Config; [assembly: Addin("SimianGrid", "1.0")] [assembly: AddinDependency("OpenSim", "0.5")] - -public static class Simian -{ - public static bool IsSimianEnabled(IConfigSource config, string moduleName, string connectorName) - { - if (config.Configs["Modules"] != null) - { - string module = config.Configs["Modules"].GetString(moduleName); - return !String.IsNullOrEmpty(module) && module.EndsWith(connectorName); - } - - return false; - } -} \ No newline at end of file diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 1ddcc75a0b..4fceef648f 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private Dictionary m_scenes = new Dictionary(); + private bool m_Enabled = false; #region ISharedRegionModule @@ -72,21 +73,25 @@ namespace OpenSim.Services.Connectors.SimianGrid public string Name { get { return "SimianGridServiceConnector"; } } public void AddRegion(Scene scene) { + if (!m_Enabled) + return; + // Every shared region module has to maintain an indepedent list of // currently running regions lock (m_scenes) m_scenes[scene.RegionInfo.RegionID] = scene; - if (!String.IsNullOrEmpty(m_serverUrl)) - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene scene) { + if (!m_Enabled) + return; + lock (m_scenes) m_scenes.Remove(scene.RegionInfo.RegionID); - if (!String.IsNullOrEmpty(m_serverUrl)) - scene.UnregisterModuleInterface(this); + scene.UnregisterModuleInterface(this); } #endregion ISharedRegionModule @@ -98,23 +103,28 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "GridServices", this.Name)) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - IConfig gridConfig = source.Configs["GridService"]; - if (gridConfig == null) + string name = moduleConfig.GetString("GridServices", ""); + if (name == Name) { - m_log.Error("[SIMIAN GRID CONNECTOR]: GridService missing from OpenSim.ini"); - throw new Exception("Grid connector init error"); - } + IConfig gridConfig = source.Configs["GridService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("GridServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } - string serviceUrl = gridConfig.GetString("GridServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) - { - m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService"); - throw new Exception("Grid connector init error"); + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } - - m_serverUrl = serviceUrl; } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 89c1a5a445..eb118ae557 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -70,6 +70,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private string m_userServerUrl = String.Empty; // private object m_gestureSyncRoot = new object(); + private bool m_Enabled = false; #region ISharedRegionModule @@ -80,8 +81,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianInventoryServiceConnector() { } public string Name { get { return "SimianInventoryServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -92,36 +93,39 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "InventoryServices", this.Name)) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - IConfig gridConfig = source.Configs["InventoryService"]; - if (gridConfig == null) + string name = moduleConfig.GetString("InventoryServices", ""); + if (name == Name) { - m_log.Error("[SIMIAN INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); - throw new Exception("Inventory connector init error"); - } + IConfig gridConfig = source.Configs["InventoryService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("InventoryServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; - string serviceUrl = gridConfig.GetString("InventoryServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) - { - m_log.Error("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section InventoryService"); - throw new Exception("Inventory connector init error"); - } + gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) + { + serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + m_userServerUrl = serviceUrl; + m_Enabled = true; + } + } + } + } - m_serverUrl = serviceUrl; - - gridConfig = source.Configs["UserAccountService"]; - if (gridConfig != null) - { - serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - m_userServerUrl = serviceUrl; - else - m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No Server URI named in section UserAccountService"); - } - else - { - m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini"); + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector"); + else if (String.IsNullOrEmpty(m_userServerUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index ca23e27347..074c80f719 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private SimianActivityDetector m_activityDetector; + private bool m_Enabled = false; #region ISharedRegionModule @@ -71,7 +72,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public string Name { get { return "SimianPresenceServiceConnector"; } } public void AddRegion(Scene scene) { - if (!String.IsNullOrEmpty(m_serverUrl)) + if (m_Enabled) { scene.RegisterModuleInterface(this); scene.RegisterModuleInterface(this); @@ -83,7 +84,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } public void RemoveRegion(Scene scene) { - if (!String.IsNullOrEmpty(m_serverUrl)) + if (m_Enabled) { scene.UnregisterModuleInterface(this); scene.UnregisterModuleInterface(this); @@ -103,23 +104,28 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "PresenceServices", this.Name)) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - IConfig gridConfig = source.Configs["PresenceService"]; - if (gridConfig == null) + string name = moduleConfig.GetString("PresenceServices", ""); + if (name == Name) { - m_log.Error("[SIMIAN PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); - throw new Exception("Presence connector init error"); - } + IConfig gridConfig = source.Configs["PresenceService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("PresenceServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } - string serviceUrl = gridConfig.GetString("PresenceServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) - { - m_log.Error("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService"); - throw new Exception("Presence connector init error"); + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } - - m_serverUrl = serviceUrl; } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index d30d8805de..0ef4974f79 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -67,6 +67,7 @@ namespace OpenSim.Services.Connectors.SimianGrid MethodBase.GetCurrentMethod().DeclaringType); private string m_serverUrl = String.Empty; + private bool m_Enabled = false; #region INonSharedRegionModule @@ -76,8 +77,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianProfiles() { } public string Name { get { return "SimianProfiles"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } + public void AddRegion(Scene scene) { if (m_Enabled) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } #endregion INonSharedRegionModule @@ -88,44 +89,27 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector")) + IConfig profileConfig = source.Configs["Profile"]; + if (profileConfig == null) + return; + + if (profileConfig.GetString("Module", String.Empty) != Name) + return; + + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) { - IConfig gridConfig = source.Configs["UserAccountService"]; - if (gridConfig == null) - { - m_log.Error("[SIMIAN PROFILES]: UserAccountService missing from OpenSim.ini"); - throw new Exception("Profiles init error"); - } - string serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (String.IsNullOrEmpty(serviceUrl)) + if (!String.IsNullOrEmpty(serviceUrl)) { - m_log.Error("[SIMIAN PROFILES]: No UserAccountServerURI in section UserAccountService"); - throw new Exception("Profiles init error"); - } - - if (!serviceUrl.EndsWith("/")) - serviceUrl = serviceUrl + '/'; - - m_serverUrl = serviceUrl; - IConfig profilesConfig = source.Configs["Profiles"]; - if (profilesConfig == null) - { - // Do not run this module by default. - return; - } - else - { - // if profiles aren't enabled, we're not needed. - // if we're not specified as the connector to use, then we're not wanted - if (profilesConfig.GetString("Module", String.Empty) != Name) - { - - return; - } - m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PROFILES]: No UserAccountServerURI specified, disabling connector"); } private void ClientConnectHandler(IClientCore clientCore) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 56c73ec7c9..deb86951b6 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -55,6 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; private ExpiringCache m_accountCache; + private bool m_Enabled = false; #region ISharedRegionModule @@ -65,8 +66,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianUserAccountServiceConnector() { } public string Name { get { return "SimianUserAccountServiceConnector"; } } - public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } - public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -77,24 +78,28 @@ namespace OpenSim.Services.Connectors.SimianGrid public void Initialise(IConfigSource source) { - if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name)) + IConfig moduleConfig = source.Configs["Modules"]; + if (moduleConfig != null) { - IConfig assetConfig = source.Configs["UserAccountService"]; - if (assetConfig == null) + string name = moduleConfig.GetString("UserAccountServices", ""); + if (name == Name) { - m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); - throw new Exception("User account connector init error"); - } + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; + } + } - string serviceURI = assetConfig.GetString("UserAccountServerURI"); - if (String.IsNullOrEmpty(serviceURI)) - { - m_log.Error("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector"); - throw new Exception("User account connector init error"); + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } - - m_accountCache = new ExpiringCache(); - m_serverUrl = serviceURI; } } diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 9e30044b31..a8ed66d100 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -104,17 +104,23 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - // Eventually, we want to use a caps url instead of the agentID string uri = string.Empty; - try + + // HACK -- Simian grid make it work!!! + if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) + uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + else { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); - reason = e.Message; - return false; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); + reason = e.Message; + return false; + } } //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 3d722eca96..b86fb6f01c 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -158,7 +158,7 @@ namespace OpenSim.Services.GridService string host = "127.0.0.1"; string portstr; string regionName = ""; - uint port = 9000; + uint port = 0; string[] parts = mapName.Split(new char[] { ':' }); if (parts.Length >= 1) { @@ -177,18 +177,16 @@ namespace OpenSim.Services.GridService regionName = parts[2]; } - // Sanity check. - //IPAddress ipaddr = null; - try - { - //ipaddr = Util.GetHostFromDNS(host); - Util.GetHostFromDNS(host); - } - catch - { - reason = "Malformed hostname"; - return null; - } + //// Sanity check. + //try + //{ + // Util.GetHostFromDNS(host); + //} + //catch + //{ + // reason = "Malformed hostname"; + // return null; + //} GridRegion regInfo; bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); @@ -217,6 +215,11 @@ namespace OpenSim.Services.GridService regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; + // Big HACK for Simian Grid !!! + // We need to clean up all URLs used in OpenSim !!! + if (externalHostName.Contains("/")) + regInfo.ServerURI = externalHostName; + try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs index 6e6b019f75..d62c0089a2 100644 --- a/OpenSim/Services/InventoryService/HGInventoryService.cs +++ b/OpenSim/Services/InventoryService/HGInventoryService.cs @@ -44,7 +44,7 @@ namespace OpenSim.Services.InventoryService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - protected IXInventoryData m_Database; + protected new IXInventoryData m_Database; public HGInventoryService(IConfigSource config) : base(config) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 84306e7296..fb395ec976 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -293,13 +293,35 @@ namespace OpenSim.Services.InventoryService public virtual bool AddFolder(InventoryFolderBase folder) { + InventoryFolderBase check = GetFolder(folder); + if (check != null) + return false; + XInventoryFolder xFolder = ConvertFromOpenSim(folder); return m_Database.StoreFolder(xFolder); } public virtual bool UpdateFolder(InventoryFolderBase folder) { - return AddFolder(folder); + XInventoryFolder xFolder = ConvertFromOpenSim(folder); + InventoryFolderBase check = GetFolder(folder); + if (check == null) + return AddFolder(folder); + + if (check.Type != -1 || xFolder.type != -1) + { + if (xFolder.version > check.Version) + return false; + check.Version = (ushort)xFolder.version; + xFolder = ConvertFromOpenSim(check); + return m_Database.StoreFolder(xFolder); + } + + if (xFolder.version < check.Version) + xFolder.version = check.Version; + xFolder.folderID = check.ID; + + return m_Database.StoreFolder(xFolder); } public virtual bool MoveFolder(InventoryFolderBase folder) diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 09be4a2e11..5ccb912185 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -104,7 +104,7 @@ namespace OpenSim.Services.LLLoginService m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); - + // These are required; the others aren't if (accountService == string.Empty || authService == string.Empty) throw new Exception("LoginService is missing service specifications"); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index f95c428eb7..9fd7e4632c 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -646,7 +646,7 @@ ; {2} - region UUID ; {3} - region port ; {4} - region name with " ", ":", "/" mapped to "_" - region_file_template = "{0}x{1}-{2}.xml" + region_file_template = "{0}x{1}-{2}.ini" ; we can limit the number of regions that XmlRpcCreateRegion will ; allow by setting this to a positive, non-0 number: as long as the @@ -1325,11 +1325,12 @@ Message = "The MOTD module is working!" [Architecture] ; Choose exactly one and only one of the architectures below. - Include-Standalone = "config-include/Standalone.ini" - ;Include-HGStandalone = "config-include/StandaloneHypergrid.ini" - ;Include-Grid = "config-include/Grid.ini" - ;Include-HGGrid = "config-include/GridHypergrid.ini" - ;Include-SimianGrid = "config-include/SimianGrid.ini" + Include-Standalone = "config-include/Standalone.ini" + ;Include-HGStandalone = "config-include/StandaloneHypergrid.ini" + ;Include-Grid = "config-include/Grid.ini" + ;Include-HGGrid = "config-include/GridHypergrid.ini" + ;Include-SimianGrid = "config-include/SimianGrid.ini" + ;Include-HyperSimianGrid = "config-include/HyperSimianGrid.ini" ; Then choose ; config-include/StandaloneCommon.ini.example (if you're in standlone) OR diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 554d00f86b..dae7a19e21 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -147,6 +147,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" + ; If you run this login server behind a proxy, set this to true + ; HasProxy = true + ; Defaults for the users, if none is specified in the useraccounts table entry (ServiceURLs) ; CHANGE THIS HomeURI = "http://127.0.0.1:8002" @@ -216,6 +219,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService" GridService = "OpenSim.Services.GridService.dll:GridService" GatekeeperService = "OpenSim.Services.HypergridService.dll:GatekeeperService" + + ;; If you separate the UserAgentService from the LoginService, set this to + ;; the IP address of the machine where your LoginService is + ;LoginServerIP = "127.0.0.1" ; * The interface that local users get when they are in other grids. ; * This restricts the inventory operations while in other grids. diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini new file mode 100644 index 0000000000..87ffe69f0e --- /dev/null +++ b/bin/config-include/HyperSimianGrid.ini @@ -0,0 +1,77 @@ +;; +;; Please don't change this file. +;; All optional settings are in GridCommon.ini.example, +;; which you can copy and change. +;; + +;; +;; In GridCommon.ini, these are the URLs you would use if SimianGrid is +;; installed at http://www.mygrid.com/Grid/ +;; +; AssetServerURI = "http://www.mygrid.com/Grid/?id=" +; InventoryServerURI = "http://www.mygrid.com/Grid/" +; AvatarServerURI = "http://www.mygrid.com/Grid/" +; PresenceServerURI = "http://www.mygrid.com/Grid/" +; UserAccountServerURI = "http://www.mygrid.com/Grid/" +; AuthenticationServerURI = "http://www.mygrid.com/Grid/" +; FriendsServerURI = "http://www.mygrid.com/Grid/" +; GroupsServerURI = "http://www.mygrid.com/Grid/" + +[Includes] + Include-Common = "config-include/GridCommon.ini" + +[Modules] + GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" + PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" + UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" + AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" + AssetServices = "HGAssetBroker" + InventoryServices = "HGInventoryBroker" + AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" + + NeighbourServices = "RemoteNeighbourServicesConnector" + SimulationServices = "RemoteSimulationConnectorModule" + EntityTransferModule = "HGEntityTransferModule" + InventoryAccessModule = "HGInventoryAccessModule" + + LandServiceInConnector = true + NeighbourServiceInConnector = true + SimulationServiceInConnector = true + LibraryModule = false + + AssetCaching = "FlotsamAssetCache" + +[Friends] + Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector" + +[GridService] + LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" + StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" + + AllowHypergridMapSearch = true + +[LibraryService] + LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" + LibraryName = "OpenSim Library" + DefaultLibrary = "./inventory/Libraries.xml" + +[AssetService] + DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" + LocalGridAssetService = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector" + HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector" + AssetLoaderArgs = "assets/AssetSets.xml" + +[InventoryService] + LocalGridInventoryService = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector" + +[Groups] + Enabled = true + Module = GroupsModule + DebugEnabled = false + NoticesEnabled = true + MessagingModule = GroupsMessagingModule + MessagingEnabled = true + ServicesConnectorModule = SimianGroupsServicesConnector + +[Profiles] + Module = SimianProfiles