diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 72ac3039d1..854307c1e8 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -116,7 +116,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController int port = m_config.GetInt("port", 0); m_application = openSim; - m_httpServer = MainServer.GetHttpServer((uint)port); + string bind_ip_address = m_config.GetString("bind_ip_address", "0.0.0.0"); + IPAddress ipaddr = IPAddress.Parse( bind_ip_address ); + m_httpServer = MainServer.GetHttpServer((uint)port,ipaddr); Dictionary availableMethods = new Dictionary(); availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 1da52b41e4..80ec65e246 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -705,6 +705,9 @@ VALUES //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index e2b69538e5..ae78814f06 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -817,6 +817,7 @@ namespace OpenSim.Data.MySQL nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); + nWP.valid = true; } } } @@ -964,6 +965,21 @@ namespace OpenSim.Data.MySQL } } + public void RemoveRegionWindlightSettings(UUID regionID) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; + cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); + ExecuteNonQuery(cmd); + } + } + } + public void StoreRegionSettings(RegionSettings rs) { lock (m_dbLock) diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 34d3a4e38a..eb4e313f84 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -56,6 +56,9 @@ namespace OpenSim.Data.Null //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 9d49fb681f..bade0a1e9c 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -323,6 +323,9 @@ namespace OpenSim.Data.SQLite //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index ce18a428bb..4952cdf569 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -286,6 +286,9 @@ namespace OpenSim.Data.SQLiteLegacy //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index d0a22b23b9..69e1ae6c7b 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -231,7 +231,7 @@ namespace OpenSim.Framework protected virtual void SetDefaultParams() { - m_visualparams = new byte[] { 56,23,66,0,0,25,0,124,107,0,0,91,137,36,180,79,78,20,32,255,0,63,137,137,63,122,0,71,127,94,63,0,150,150,150,17,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,78,0,0,0,0,0,0,0,0,0,145,216,133,0,0,0,219,107,150,150,165,135,0,150,150,150,63,112,155,150,150,150,150,150,150,150,150,150,150,150,0,0,0,0,188,255,91,219,124,0,150,127,165,127,127,127,127,59,63,107,71,68,89,33,79,114,178,127,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,0,85,131,117,127,147,163,104,0,140,18,0,107,130,0,150,150,198,0,0,40,38,91,165,209,198,127,127,153,204,51,51,150,150,255,204,0,150,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,22,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; + m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; // for (int i = 0; i < VISUALPARAM_COUNT; i++) // { // m_visualparams[i] = 150; diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index efec50b71f..0809ab691c 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -221,9 +221,6 @@ namespace OpenSim.Framework { get { - if (defaultWearables != null) - return defaultWearables; - defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these for (int i = 0; i < MAX_WEARABLES; i++) { diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 7eb289ba72..07de27a2fc 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -32,6 +32,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using System.Threading; using OpenMetaverse; using Nini.Config; @@ -62,6 +63,7 @@ namespace OpenSim.Framework.Console new Dictionary(); private string m_UserName = String.Empty; private string m_Password = String.Empty; + private string m_AllowedOrigin = String.Empty; public RemoteConsole(string defaultPrompt) : base(defaultPrompt) { @@ -77,6 +79,7 @@ namespace OpenSim.Framework.Console m_UserName = netConfig.GetString("ConsoleUser", String.Empty); m_Password = netConfig.GetString("ConsolePass", String.Empty); + m_AllowedOrigin = netConfig.GetString("ConsoleAllowedOrigin", String.Empty); } public void SetServer(IHttpServer server) @@ -150,6 +153,29 @@ namespace OpenSim.Framework.Console return cmdinput; } + private Hashtable CheckOrigin(Hashtable result) + { + if (!string.IsNullOrEmpty(m_AllowedOrigin)) + result["access_control_allow_origin"] = m_AllowedOrigin; + return result; + } + /* TODO: Figure out how PollServiceHTTPHandler can access the request headers + * in order to use m_AllowedOrigin as a regular expression + private Hashtable CheckOrigin(Hashtable headers, Hashtable result) + { + if (!string.IsNullOrEmpty(m_AllowedOrigin)) + { + if (headers.ContainsKey("origin")) + { + string origin = headers["origin"].ToString(); + if (Regex.IsMatch(origin, m_AllowedOrigin)) + result["access_control_allow_origin"] = origin; + } + } + return result; + } + */ + private void DoExpire() { List expired = new List(); @@ -235,6 +261,7 @@ namespace OpenSim.Framework.Console reply["str_response_string"] = xmldoc.InnerXml; reply["int_response_code"] = 200; reply["content_type"] = "text/xml"; + reply = CheckOrigin(reply); return reply; } @@ -289,6 +316,7 @@ namespace OpenSim.Framework.Console reply["str_response_string"] = xmldoc.InnerXml; reply["int_response_code"] = 200; reply["content_type"] = "text/xml"; + reply = CheckOrigin(reply); return reply; } @@ -344,6 +372,7 @@ namespace OpenSim.Framework.Console reply["str_response_string"] = xmldoc.InnerXml; reply["int_response_code"] = 200; reply["content_type"] = "text/xml"; + reply = CheckOrigin(reply); return reply; } @@ -457,6 +486,7 @@ namespace OpenSim.Framework.Console result["content_type"] = "application/xml"; result["keepalive"] = false; result["reusecontext"] = false; + result = CheckOrigin(result); return result; } @@ -480,6 +510,7 @@ namespace OpenSim.Framework.Console result["content_type"] = "text/xml"; result["keepalive"] = false; result["reusecontext"] = false; + result = CheckOrigin(result); return result; } diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs index 1f5f2088fc..8ccabece50 100644 --- a/OpenSim/Framework/MainServer.cs +++ b/OpenSim/Framework/MainServer.cs @@ -27,6 +27,7 @@ using System.Collections.Generic; using System.Reflection; +using System.Net; using log4net; using OpenSim.Framework.Servers.HttpServer; @@ -47,6 +48,11 @@ namespace OpenSim.Framework } public static IHttpServer GetHttpServer(uint port) + { + return GetHttpServer(port,null); + } + + public static IHttpServer GetHttpServer(uint port, IPAddress ipaddr) { if (port == 0) return Instance; @@ -58,6 +64,9 @@ namespace OpenSim.Framework m_Servers[port] = new BaseHttpServer(port); + if (ipaddr != null ) + m_Servers[port].ListenIPAddress = ipaddr; + m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port); m_Servers[port].Start(); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 73b8bd0120..680e702a11 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -42,6 +42,7 @@ namespace OpenSim.Framework { public class RegionLightShareData : ICloneable { + public bool valid = false; public UUID regionID = UUID.Zero; public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); public float waterFogDensityExponent = 4.0f; diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 0c1e5e013b..3c58a7d4d8 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1450,6 +1450,10 @@ namespace OpenSim.Framework.Servers.HttpServer if (responsedata.ContainsKey("reusecontext")) response.ReuseContext = (bool) responsedata["reusecontext"]; + // Cross-Origin Resource Sharing with simple requests + if (responsedata.ContainsKey("access_control_allow_origin")) + response.AddHeader("Access-Control-Allow-Origin", (string)responsedata["access_control_allow_origin"]); + //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //and should check for NullReferenceExceptions diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 7a0142f2cd..f80cb342af 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -264,9 +264,10 @@ namespace OpenSim LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar []", + "save oar [-v|version=N] []", "Save a region's data to an OAR archive.", - "The OAR path must be a filesystem path." + "-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine + + "The OAR path must be a filesystem path." + " If this is not given then the oar is saved to region.oar in the current directory.", SaveOar); diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 412dbb69c3..88f392dcdb 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -194,7 +194,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare } private void EventManager_OnSaveNewWindlightProfile() { - m_scene.ForEachScenePresence(SendProfileToClient); + if (m_scene.RegionInfo.WindlightSettings.valid) + m_scene.ForEachScenePresence(SendProfileToClient); } public void PostInitialise() diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index c23cea539a..ed3e516631 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -176,44 +176,44 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL stream = response.GetResponseStream(); if (stream != null) { - Bitmap image = new Bitmap(stream); - Size newsize; - - // TODO: make this a bit less hard coded - if ((image.Height < 64) && (image.Width < 64)) - { - newsize = new Size(32, 32); - } - else if ((image.Height < 128) && (image.Width < 128)) - { - newsize = new Size(64, 64); - } - else if ((image.Height < 256) && (image.Width < 256)) - { - newsize = new Size(128, 128); - } - else if ((image.Height < 512 && image.Width < 512)) - { - newsize = new Size(256, 256); - } - else if ((image.Height < 1024 && image.Width < 1024)) - { - newsize = new Size(512, 512); - } - else - { - newsize = new Size(1024, 1024); - } - - Bitmap resize = new Bitmap(image, newsize); - try { + Bitmap image = new Bitmap(stream); + Size newsize; + + // TODO: make this a bit less hard coded + if ((image.Height < 64) && (image.Width < 64)) + { + newsize = new Size(32, 32); + } + else if ((image.Height < 128) && (image.Width < 128)) + { + newsize = new Size(64, 64); + } + else if ((image.Height < 256) && (image.Width < 256)) + { + newsize = new Size(128, 128); + } + else if ((image.Height < 512 && image.Width < 512)) + { + newsize = new Size(256, 256); + } + else if ((image.Height < 1024 && image.Width < 1024)) + { + newsize = new Size(512, 512); + } + else + { + newsize = new Size(1024, 1024); + } + + Bitmap resize = new Bitmap(image, newsize); + imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); } catch (Exception) { - m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); + m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!"); } } else diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index c062833370..f8a599a232 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); - Dictionary serializationOptions = new Dictionary(); -// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0") -// serializationOptions["old-guids"] = true; - + // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); - string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions); + string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 31820794b8..0567a82825 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -187,20 +187,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public static string Create0p2ControlFile(Dictionary options) { - int majorVersion = 0, minorVersion = 4; - - /* - if (options.ContainsKey("version") && (string)options["version"] == "0") + int majorVersion = 0, minorVersion = 5; + + if (options.ContainsKey("version")) { - majorVersion = 0; - minorVersion = 3; - } - else - { - majorVersion = 1; minorVersion = 0; + string[] parts = options["version"].ToString().Split('.'); + if (parts.Length >= 1) + majorVersion = Int32.Parse(parts[0]); + if (parts.Length >= 2) + minorVersion = Int32.Parse(parts[1]); } - */ m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); // if (majorVersion == 1) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index a52fea46fc..8df645dd32 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -31,12 +31,14 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using System.Reflection; +using log4net; namespace OpenSim.Region.CoreModules.World.Sound { public class SoundModule : IRegionModule, ISoundModule { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; @@ -62,6 +64,12 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void PlayAttachedSound( UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if (part == null) + return; + + SceneObjectGroup grp = part.ParentGroup; + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.IsChildAgent) @@ -71,12 +79,25 @@ namespace OpenSim.Region.CoreModules.World.Sound if (dis > 100.0) // Max audio distance return; + if (grp.IsAttachment) + { + if (grp.GetAttachmentPoint() > 30) // HUD + { + if (sp.ControllingClient.AgentId != grp.OwnerID) + return; + } + + if (sp.ControllingClient.AgentId == grp.OwnerID) + dis = 0; + } + // Scale by distance if (radius == 0) gain = (float)((double)gain * ((100.0 - dis) / 100.0)); else gain = (float)((double)gain * ((radius - dis) / radius)); + m_log.DebugFormat("Play sound, gain {0}", gain); sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); }); } @@ -84,6 +105,18 @@ namespace OpenSim.Region.CoreModules.World.Sound public virtual void TriggerSound( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) { + SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); + if (part == null) + return; + + SceneObjectGroup grp = part.ParentGroup; + + if (grp.IsAttachment && grp.GetAttachmentPoint() > 30) + { + objectID = ownerID; + parentID = ownerID; + } + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.IsChildAgent) diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs index edaa07c80f..5295a72976 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs @@ -94,5 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); } } diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index 0a4d531b91..615f3770d1 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); void Shutdown(); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7a6449decf..f1642015af 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3100,6 +3100,7 @@ namespace OpenSim.Region.Framework.Scenes UUID ownerID = _ownerID; UUID objectID = ParentGroup.RootPart.UUID; UUID parentID = GetRootPartUUID(); + UUID soundID = UUID.Zero; Vector3 position = AbsolutePosition; // region local ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 039041442f..fe9dc5616e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -171,9 +171,6 @@ namespace OpenSim.Region.Framework.Scenes private float m_health = 100f; - // Default AV Height - private float m_avHeight = 127.0f; - protected RegionInfo m_regionInfo; protected ulong crossingFromRegion; @@ -841,9 +838,10 @@ namespace OpenSim.Region.Framework.Scenes } float localAVHeight = 1.56f; - if (m_avHeight != 127.0f) + if (m_appearance != null) { - localAVHeight = m_avHeight; + if (m_appearance.AvatarHeight > 0) + localAVHeight = m_appearance.AvatarHeight; } float posZLimit = 0; @@ -872,6 +870,12 @@ namespace OpenSim.Region.Framework.Scenes AddToPhysicalScene(isFlying); + if (m_appearance != null) + { + if (m_appearance.AvatarHeight > 0) + SetHeight(m_appearance.AvatarHeight); + } + if (m_forceFly) { m_physicsActor.Flying = true; @@ -1060,10 +1064,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetHeight(float height) { - m_avHeight = height; if (PhysicsActor != null && !IsChildAgent) { - Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight); + Vector3 SetSize = new Vector3(0.45f, 0.6f, height); PhysicsActor.Size = SetSize; } } @@ -1687,9 +1690,10 @@ namespace OpenSim.Region.Framework.Scenes m_parentID = 0; SendFullUpdateToAllClients(); m_requestedSitTargetID = 0; - if ((m_physicsActor != null) && (m_avHeight > 0)) + if (m_physicsActor != null && m_appearance != null) { - SetHeight(m_avHeight); + if (m_appearance.AvatarHeight > 0) + SetHeight(m_appearance.AvatarHeight); } } @@ -2391,11 +2395,14 @@ namespace OpenSim.Region.Framework.Scenes if (m_appearance.Texture == null) return; - if (LocalId == remoteAvatar.LocalId) - { - m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); - return; - } +// MT: This is needed for sit. It's legal to send it to oneself, and the name +// of the method is a misnomer +// +// if (LocalId == remoteAvatar.LocalId) +// { +// m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); +// return; +// } if (IsChildAgent) { @@ -2576,7 +2583,7 @@ namespace OpenSim.Region.Framework.Scenes cadu.ActiveGroupID = UUID.Zero.Guid; cadu.AgentID = UUID.Guid; cadu.alwaysrun = m_setAlwaysRun; - cadu.AVHeight = m_avHeight; + cadu.AVHeight = m_appearance.AvatarHeight; Vector3 tempCameraCenter = m_CameraCenter; cadu.cameraPosition = tempCameraCenter; cadu.drawdistance = m_DrawDistance; @@ -2912,7 +2919,6 @@ namespace OpenSim.Region.Framework.Scenes m_CameraCenter = cAgentData.Center + offset; - m_avHeight = cAgentData.Size.Z; //SetHeight(cAgentData.AVHeight); if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) @@ -2937,8 +2943,6 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Position = AbsolutePosition; cAgent.Velocity = m_velocity; cAgent.Center = m_CameraCenter; - // Don't copy the size; it is inferred from apearance parameters - //cAgent.Size = new Vector3(0, 0, m_avHeight); cAgent.AtAxis = m_CameraAtAxis; cAgent.LeftAxis = m_CameraLeftAxis; cAgent.UpAxis = m_CameraUpAxis; @@ -3056,7 +3060,6 @@ namespace OpenSim.Region.Framework.Scenes m_pos = cAgent.Position; m_velocity = cAgent.Velocity; m_CameraCenter = cAgent.Center; - //m_avHeight = cAgent.Size.Z; m_CameraAtAxis = cAgent.AtAxis; m_CameraLeftAxis = cAgent.LeftAxis; m_CameraUpAxis = cAgent.UpAxis; @@ -3075,6 +3078,12 @@ namespace OpenSim.Region.Framework.Scenes m_setAlwaysRun = cAgent.AlwaysRun; m_appearance = new AvatarAppearance(cAgent.Appearance); + if (m_physicsActor != null) + { + bool isFlying = m_physicsActor.Flying; + RemoveFromPhysicalScene(); + AddToPhysicalScene(isFlying); + } /* uint i = 0; @@ -3184,21 +3193,17 @@ namespace OpenSim.Region.Framework.Scenes /// public void AddToPhysicalScene(bool isFlying) { + if (m_appearance.AvatarHeight == 0) + m_appearance.SetHeight(); + PhysicsScene scene = m_scene.PhysicsScene; Vector3 pVec = AbsolutePosition; // Old bug where the height was in centimeters instead of meters - if (m_avHeight == 127.0f) - { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f), - isFlying); - } - else - { - m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, - new Vector3(0f, 0f, m_avHeight), isFlying); - } + m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, + new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); + scene.AddPhysicsActorTaint(m_physicsActor); //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index e661ca9da1..7f37878cda 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); - writer.WriteElementString("Flags", sop.Flags.ToString()); + WriteFlags(writer, "Flags", sop.Flags.ToString(), options); WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); if (sop.MediaUrl != null) @@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } + static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary options) + { + // Older versions of serialization can't cope with commas + if (options.ContainsKey("version")) + { + float version = 0.5F; + float.TryParse(options["version"].ToString(), out version); + if (version < 0.5) + flagsStr = flagsStr.Replace(",", ""); + } + + writer.WriteElementString(name, flagsStr); + } + static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options) { if (tinv.Count > 0) // otherwise skip this @@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); writer.WriteElementString("State", shp.State.ToString()); - writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString()); - writer.WriteElementString("HollowShape", shp.HollowShape.ToString()); + WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); + WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options); WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); writer.WriteElementString("SculptType", shp.SculptType.ToString()); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 665b39f6fc..645566eaf0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -455,6 +455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (LightShareModule.EnableWindlight) { RegionLightShareData wl = getWindlightProfileFromRules(rules); + wl.valid = true; m_host.ParentGroup.Scene.StoreWindlightProfile(wl); success = 1; } @@ -465,6 +466,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return success; } + public void lsClearWindlightScene() + { + if (!m_LSFunctionsEnabled) + { + LSShoutError("LightShare functions are not enabled."); + return; + } + if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + { + LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); + return; + } + + m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false; + if (m_host.ParentGroup.Scene.SimulationDataService != null) + m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID); + } /// /// Set the current Windlight scene to a target avatar /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs index 9aa437b37e..f2df094abf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs @@ -44,5 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List lsGetWindlightScene(LSL_List rules); int lsSetWindlightScene(LSL_List rules); int lsSetWindlightSceneTargeted(LSL_List rules, key target); + void lsClearWindlightScene(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs index f8dbe03ccc..143b497cd8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs @@ -72,5 +72,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target); } + public void lsClearWindlightScene() + { + m_LS_Functions.lsClearWindlightScene(); + } } } diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index c8ecb18bbc..0df9380547 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs @@ -144,5 +144,9 @@ namespace OpenSim.Services.Connectors { m_database.StoreRegionWindlightSettings(wl); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + m_database.RemoveRegionWindlightSettings(regionID); + } } } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 6d3bff7683..a34f0bebf6 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -97,7 +97,7 @@ namespace OpenSim.Services.Interfaces int GetRegionFlags(UUID scopeID, UUID regionID); } - public class GridRegion + public class GridRegion : Object { /// @@ -238,6 +238,33 @@ namespace OpenSim.Services.Interfaces EstateOwner = ConvertFrom.EstateOwner; } + # region Definition of equality + + /// + /// Define equality as two regions having the same, non-zero UUID. + /// + public bool Equals(GridRegion region) + { + if ((object)region == null) + return false; + // Return true if the non-zero UUIDs are equal: + return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID); + } + + public override bool Equals(Object obj) + { + if (obj == null) + return false; + return Equals(obj as GridRegion); + } + + public override int GetHashCode() + { + return RegionID.GetHashCode() ^ TerrainImage.GetHashCode(); + } + + #endregion + /// /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. /// diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 09c31c321b..c8ac38e63a 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs @@ -45,10 +45,20 @@ namespace OpenSim.Services.PresenceService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected bool m_allowDuplicatePresences = false; + public PresenceService(IConfigSource config) : base(config) { m_log.Debug("[PRESENCE SERVICE]: Starting presence service"); + + IConfig presenceConfig = config.Configs["PresenceService"]; + if (presenceConfig != null) + { + m_allowDuplicatePresences = + presenceConfig.GetBoolean("AllowDuplicatePresences", + m_allowDuplicatePresences); + } } public bool LoginAgent(string userID, UUID sessionID, @@ -57,6 +67,9 @@ namespace OpenSim.Services.PresenceService //PresenceData[] d = m_Database.Get("UserID", userID); //m_Database.Get("UserID", userID); + if (!m_allowDuplicatePresences) + m_Database.Delete("UserID", userID.ToString()); + PresenceData data = new PresenceData(); data.UserID = userID; diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 2e5020b043..2ea36da228 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -104,6 +104,10 @@ namespace OpenSim.Data.Null return m_store.LoadRegionWindlightSettings(regionUUID); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { m_store.StoreRegionWindlightSettings(wl); @@ -146,6 +150,10 @@ namespace OpenSim.Data.Null return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet @@ -274,4 +282,4 @@ namespace OpenSim.Data.Null { } } -} \ No newline at end of file +} diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index de7c44ccf4..f98689b613 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -624,6 +624,9 @@ ; Set this to a nonzero value to have remote admin use a different port port = 0 + ; Set this to the ip address that you want the admin server to bind to + bind_ip_address = "0.0.0.0" + ; This password is required to make any XMLRPC call (should be set as the "password" parameter) access_password = unknown diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 10edccd9c9..bc87ac286d 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -107,6 +107,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [PresenceService] ; for the server connector LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" + ; Set this to true to allow the use of advanced web services and multiple + ; bots using one account + AllowDuplicatePresences = false; [AvatarService] ; for the server connector