diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs index c0ca1e1896..c305797c59 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs @@ -97,7 +97,7 @@ namespace OpenSim.Capabilities.Handlers llsdItem.asset_id = invItem.AssetID; llsdItem.created_at = invItem.CreationDate; llsdItem.desc = invItem.Description; - llsdItem.flags = (int)invItem.Flags; + llsdItem.flags = ((int)invItem.Flags) & 0xff; llsdItem.item_id = invItem.ID; llsdItem.name = invItem.Name; llsdItem.parent_id = invItem.Folder; diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index 11a269882b..16e2f2d970 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs @@ -411,7 +411,7 @@ namespace OpenSim.Capabilities.Handlers llsdItem.asset_id = invItem.AssetID; llsdItem.created_at = invItem.CreationDate; llsdItem.desc = invItem.Description; - llsdItem.flags = (int)invItem.Flags; + llsdItem.flags = ((int)invItem.Flags) & 0xff; llsdItem.item_id = invItem.ID; llsdItem.name = invItem.Name; llsdItem.parent_id = invItem.Folder; diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 07bd48aaeb..7628e23c4d 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -345,7 +345,7 @@ namespace OpenSim.Framework.Servers.HttpServer if (responsedata == null) continue; - if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) + if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) // This is the event queue { try { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 37285e3a2a..eb40eb1900 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -376,7 +376,7 @@ namespace OpenSim.Region.ClientStack.Linden // TODO: Add EventQueueGet name/description for diagnostics MainServer.Instance.AddPollServiceHTTPHandler( eventQueueGetPath, - new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID, 1000)); + new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID, 40000)); // m_log.DebugFormat( // "[EVENT QUEUE GET MODULE]: Registered EQG handler {0} for {1} in {2}", diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index d4dbfb97fc..a42c96c981 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden public PollServiceTextureEventArgs thepoll; public UUID reqID; public Hashtable request; + public bool send503; } public class aPollResponse @@ -244,7 +245,19 @@ namespace OpenSim.Region.ClientStack.Linden reqinfo.thepoll = this; reqinfo.reqID = x; reqinfo.request = y; + reqinfo.send503 = false; + lock (responses) + { + if (responses.Count > 0) + { + if (m_queue.Count >= 4) + { + // Never allow more than 4 fetches to wait + reqinfo.send503 = true; + } + } + } m_queue.Enqueue(reqinfo); }; @@ -276,6 +289,22 @@ namespace OpenSim.Region.ClientStack.Linden UUID requestID = requestinfo.reqID; + if (requestinfo.send503) + { + response = new Hashtable(); + + response["int_response_code"] = 503; + response["str_response_string"] = "Throttled"; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["reusecontext"] = false; + + lock (responses) + responses[requestID] = new aPollResponse() {bytes = 0, response = response}; + + return; + } + // If the avatar is gone, don't bother to get the texture if (m_scene.GetScenePresence(Id) == null) { @@ -385,6 +414,9 @@ namespace OpenSim.Region.ClientStack.Linden GetTextureModule.aPollResponse response; if (responses.TryGetValue(key, out response)) { + // This is any error response + if (response.bytes == 0) + return true; // Normal if (BytesSent + response.bytes <= ThrottleBytes) @@ -411,12 +443,12 @@ namespace OpenSim.Region.ClientStack.Linden return haskey; } + public void ProcessTime() { PassTime(); } - private void PassTime() { currenttime = Util.EnvironmentTickCount(); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ef1d803edb..c78d552eda 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1741,7 +1741,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.CreationDate = item.CreationDate; newBlock.SalePrice = item.SalePrice; newBlock.SaleType = item.SaleType; - newBlock.Flags = item.Flags; + newBlock.Flags = item.Flags & 0xff; newBlock.CRC = Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, @@ -1995,7 +1995,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.GroupID = item.GroupID; itemBlock.GroupOwned = item.GroupOwned; itemBlock.GroupMask = item.GroupPermissions; - itemBlock.Flags = item.Flags; + itemBlock.Flags = item.Flags & 0xff; itemBlock.SalePrice = item.SalePrice; itemBlock.SaleType = item.SaleType; itemBlock.CreationDate = item.CreationDate; @@ -2062,7 +2062,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[0].GroupID = item.GroupID; bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; - bulkUpdate.ItemData[0].Flags = item.Flags; + bulkUpdate.ItemData[0].Flags = item.Flags & 0xff; bulkUpdate.ItemData[0].SalePrice = item.SalePrice; bulkUpdate.ItemData[0].SaleType = item.SaleType; @@ -2116,7 +2116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP InventoryReply.InventoryData[0].GroupID = Item.GroupID; InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; - InventoryReply.InventoryData[0].Flags = Item.Flags; + InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff; InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; InventoryReply.InventoryData[0].SaleType = Item.SaleType; InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; @@ -5137,6 +5137,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP data.CollisionPlane.ToBytes(objectData, 0); offsetPosition.ToBytes(objectData, 16); + Vector3 velocity = new Vector3(0, 0, 0); + Vector3 acceleration = new Vector3(0, 0, 0); + velocity.ToBytes(objectData, 28); + acceleration.ToBytes(objectData, 40); // data.Velocity.ToBytes(objectData, 28); // data.Acceleration.ToBytes(objectData, 40); rotation.ToBytes(objectData, 52); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index fab66ce9ac..d008702008 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1135,7 +1135,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!udpClient.IsConnected) { -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); return; } diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index d22f3f4aa1..5b12ecbbed 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -65,9 +65,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods protected Scene m_scene; protected IDialogModule m_dialogModule; - protected Dictionary m_capsDict = - new Dictionary(); - protected IDialogModule DialogModule { get @@ -89,7 +86,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods m_scene.RegisterModuleInterface(this); m_scene.EventManager.OnNewClient += SubscribeToClientEvents; m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; - m_scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnIncomingInstantMessage += OnIncomingInstantMessage; } @@ -125,15 +121,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods client.OnRequestGodlikePowers -= RequestGodlikePowers; } - private void OnClientClosed(UUID agentID, Scene scene) - { - m_capsDict.Remove(agentID); - } - private void OnRegisterCaps(UUID agentID, Caps caps) { string uri = "/CAPS/" + UUID.Random(); - m_capsDict[agentID] = uri; caps.RegisterHandler("UntrustedSimulatorMessage", new RestStreamHandler("POST", uri, diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6b90097cd3..b9c88d4360 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1113,14 +1113,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer ((Scene)(client.Scene)).RequestTeleportLocation( client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); + return true; } else { // can't find the Home region: Tell viewer and abort client.SendTeleportFailed("Your home region could not be found."); - return false; } - return true; + return false; } #endregion diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index f5b509f3ae..d5c26619e8 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -387,7 +387,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess inventoryStoredPosition = objectGroup.RootPart.AttachOffset; inventoryStoredRotation = objectGroup.RootPart.AttachRotation; } - objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; + + // Trees could be attached and it's been done, but it makes + // no sense. State must be preserved because it's the tree type + if (objectGroup.RootPart.Shape.PCode != (byte)PCode.Tree && + objectGroup.RootPart.Shape.PCode != (byte)PCode.NewTree) + objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; objectGroup.AbsolutePosition = inventoryStoredPosition; objectGroup.RootPart.RotationOffset = inventoryStoredRotation; @@ -797,7 +802,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess g.RootPart.AttachPoint = g.RootPart.Shape.State; g.RootPart.AttachOffset = g.AbsolutePosition; g.RootPart.AttachRotation = g.GroupRotation; - g.RootPart.Shape.State = 0; + if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && + g.RootPart.Shape.PCode != (byte)PCode.Tree) + g.RootPart.Shape.State = 0; } objlist.Add(g); @@ -831,7 +838,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess g.RootPart.AttachPoint = g.RootPart.Shape.State; g.RootPart.AttachOffset = g.AbsolutePosition; g.RootPart.AttachRotation = g.GroupRotation; - g.RootPart.Shape.State = 0; + if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && + g.RootPart.Shape.PCode != (byte)PCode.Tree) + g.RootPart.Shape.State = 0; objlist.Add(g); XmlElement el = (XmlElement)n; diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index f2922d6792..2a4d4404e6 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public UUID urlcode; public Dictionary requests; public bool isSsl; + public Scene scene; } public class RequestData @@ -66,6 +67,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public int startTime; public bool responseSent; public string uri; + public bool allowResponseType = false; + public UUID hostID; + public Scene scene; } /// @@ -171,6 +175,17 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public void RemoveRegion(Scene scene) { + // Drop references to that scene + foreach (KeyValuePair kvp in m_UrlMap) + { + if (kvp.Value.scene == scene) + kvp.Value.scene = null; + } + foreach (KeyValuePair kvp in m_RequestMap) + { + if (kvp.Value.scene == scene) + kvp.Value.scene = null; + } } public void Close() @@ -198,6 +213,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp urlData.urlcode = urlcode; urlData.isSsl = false; urlData.requests = new Dictionary(); + urlData.scene = host.ParentGroup.Scene; m_UrlMap[url] = urlData; @@ -316,6 +332,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp if (!urlData.requests[request].responseSent) { string responseBody = body; + + // If we have no OpenID from built-in browser, disable this + if (!urlData.requests[request].allowResponseType) + urlData.requests[request].responseType = "text/plain"; + if (urlData.requests[request].responseType.Equals("text/plain")) { string value; @@ -532,7 +553,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp //put response response["int_response_code"] = requestData.responseCode; response["str_response_string"] = requestData.responseBody; - response["content_type"] = "text/plain"; + response["content_type"] = requestData.responseType; response["keepalive"] = false; response["reusecontext"] = false; @@ -600,6 +621,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp requestData.requestDone = false; requestData.startTime = System.Environment.TickCount; requestData.uri = uri; + requestData.hostID = url.hostID; + requestData.scene = url.scene; if (requestData.headers == null) requestData.headers = new Dictionary(); @@ -608,6 +631,32 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp string key = (string)header.Key; string value = (string)header.Value; requestData.headers.Add(key, value); + if (key == "cookie") + { + string[] parts = value.Split(new char[] {'='}); + if (parts[0] == "agni_sl_session_id" && parts.Length > 1) + { + string cookie = Uri.UnescapeDataString(parts[1]); + string[] crumbs = cookie.Split(new char[] {':'}); + UUID owner; + if (crumbs.Length == 2 && UUID.TryParse(crumbs[0], out owner)) + { + if (crumbs[1].Length == 32) + { + Scene scene = requestData.scene; + if (scene != null) + { + SceneObjectPart host = scene.GetSceneObjectPart(requestData.hostID); + if (host != null) + { + if (host.OwnerID == owner) + requestData.allowResponseType = true; + } + } + } + } + } + } } foreach (DictionaryEntry de in request) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 317dfd812f..dbc92961f2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -940,6 +940,8 @@ namespace OpenSim.Region.CoreModules.World.Land newLand.LandData.Name = newLand.LandData.Name; newLand.LandData.GlobalID = UUID.Random(); newLand.LandData.Dwell = 0; + // Clear "Show in search" on the cut out parcel to prevent double-charging + newLand.LandData.Flags &= ~(uint)ParcelFlags.ShowDirectory; newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y)); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 4c96a50d77..14deeb603d 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -211,8 +211,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { if (regionInfos.Count == 0) remoteClient.SendAgentAlertMessage("No regions found with that name.", true); - else if (regionInfos.Count == 1) - remoteClient.SendAgentAlertMessage("Region found!", false); +// else if (regionInfos.Count == 1) +// remoteClient.SendAgentAlertMessage("Region found!", false); } }); } diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicFloaterModule.cs b/OpenSim/Region/Framework/Interfaces/IDynamicFloaterModule.cs new file mode 100644 index 0000000000..7684ce30ad --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IDynamicFloaterModule.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.Framework.Interfaces +{ + public delegate bool HandlerDelegate(IClientAPI client, FloaterData data, string[] msg); + + public abstract class FloaterData + { + public abstract int Channel { get; } + public abstract string FloaterName { get; set; } + public virtual string XmlName { get; set; } + public virtual string XmlText { get; set; } + public virtual HandlerDelegate Handler { get; set; } + } + + + public interface IDynamicFloaterModule + { + void DoUserFloater(UUID agentID, FloaterData dialogData, string configuration); + void FloaterControl(ScenePresence sp, FloaterData d, string msg); + } +} diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs b/OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs index 08b71e44b1..4d000b63b5 100644 --- a/OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IDynamicMenuModule.cs @@ -43,6 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces public enum UserMode : int { Normal = 0, + RegionManager = 2, God = 3 } diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index b102e48861..d773ee7f28 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -645,7 +645,7 @@ namespace OpenSim.Region.Framework.Scenes m_nextPosition = m_group.AbsolutePosition + motionThisFrame; m_group.AbsolutePosition = m_nextPosition; - m_group.RootPart.Velocity = v; + //m_group.RootPart.Velocity = v; update = true; } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6ef83fbf4c..436a544858 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2454,6 +2454,14 @@ namespace OpenSim.Region.Framework.Scenes else group.StopScriptInstances(); + List avatars = group.GetSittingAvatars(); + foreach (UUID av in avatars) + { + ScenePresence p = GetScenePresence(av); + if (p != null) + p.StandUp(); + } + SceneObjectPart[] partList = group.Parts; foreach (SceneObjectPart part in partList) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 155e450e91..02a8935660 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -272,6 +272,11 @@ namespace OpenSim.Region.Framework.Scenes { AttachmentPoint = 0; + // Don't zap trees + if (RootPart.Shape.PCode == (byte)PCode.Tree || + RootPart.Shape.PCode == (byte)PCode.NewTree) + return; + // Even though we don't use child part state parameters for attachments any more, we still need to set // these to zero since having them non-zero in rezzed scene objects will crash some clients. Even if // we store them correctly, scene objects that we receive from elsewhere might not. diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index c0ca48ef39..b6e0a97fce 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs @@ -131,7 +131,15 @@ namespace OpenSim.Region.Framework.Scenes public double this[int x, int y] { - get { return map[x, y]; } + get + { + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x >= (int)Constants.RegionSize) x = (int)Constants.RegionSize - 1; + if (y >= (int)Constants.RegionSize) y = (int)Constants.RegionSize - 1; + + return map[x, y]; + } set { // Will "fix" terrain hole problems. Although not fantastically. diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs new file mode 100644 index 0000000000..e76e8f28fb --- /dev/null +++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs @@ -0,0 +1,238 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.IO; +using System.Reflection; +using System.Text; +using System.Collections.Generic; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim; +using OpenSim.Region; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Framework; +using OpenSim.Framework.Servers; +using OpenSim.Framework.Servers.HttpServer; +using Nini.Config; +using log4net; +using Mono.Addins; +using Caps = OpenSim.Framework.Capabilities.Caps; +using OSDMap = OpenMetaverse.StructuredData.OSDMap; + +namespace OpenSim.Region.OptionalModules.ViewerSupport +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DynamicFloater")] + public class DynamicFloaterModule : INonSharedRegionModule, IDynamicFloaterModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private Scene m_scene; + + private Dictionary> m_floaters = new Dictionary>(); + + public string Name + { + get { return "DynamicFloaterModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource config) + { + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + m_scene = scene; + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnClientClosed += OnClientClosed; + m_scene.RegisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + private void OnNewClient(IClientAPI client) + { + client.OnChatFromClient += OnChatFromClient; + } + + private void OnClientClosed(UUID agentID, Scene scene) + { + m_floaters.Remove(agentID); + } + + private void SendToClient(ScenePresence sp, string msg) + { + sp.ControllingClient.SendChatMessage(msg, + (byte)ChatTypeEnum.Owner, + sp.AbsolutePosition, + "Server", + UUID.Zero, + UUID.Zero, + (byte)ChatSourceType.Object, + (byte)ChatAudibleLevel.Fully); + } + + public void DoUserFloater(UUID agentID, FloaterData dialogData, string configuration) + { + ScenePresence sp = m_scene.GetScenePresence(agentID); + if (sp == null || sp.IsChildAgent) + return; + + if (!m_floaters.ContainsKey(agentID)) + m_floaters[agentID] = new Dictionary(); + + if (m_floaters[agentID].ContainsKey(dialogData.Channel)) + return; + + m_floaters[agentID].Add(dialogData.Channel, dialogData); + + string xml; + if (dialogData.XmlText != null && dialogData.XmlText != String.Empty) + { + xml = dialogData.XmlText; + } + else + { + using (FileStream fs = File.Open(dialogData.XmlName + ".xml", FileMode.Open)) + { + using (StreamReader sr = new StreamReader(fs)) + xml = sr.ReadToEnd().Replace("\n", ""); + } + } + + List xparts = new List(); + + while (xml.Length > 0) + { + string x = xml; + if (x.Length > 600) + { + x = x.Substring(0, 600); + xml = xml.Substring(600); + } + else + { + xml = String.Empty; + } + + xparts.Add(x); + } + + for (int i = 0 ; i < xparts.Count ; i++) + SendToClient(sp, String.Format("># floater {2} create {0}/{1} " + xparts[i], i + 1, xparts.Count, dialogData.FloaterName)); + + SendToClient(sp, String.Format("># floater {0} {{notify:1}} {{channel: {1}}} {{node:cancel {{notify:1}}}} {{node:ok {{notify:1}}}} {2}", dialogData.FloaterName, (uint)dialogData.Channel, configuration)); + } + + private void OnChatFromClient(object sender, OSChatMessage msg) + { + if (msg.Sender == null) + return; + + //m_log.DebugFormat("chan {0} msg {1}", msg.Channel, msg.Message); + + IClientAPI client = msg.Sender; + + if (!m_floaters.ContainsKey(client.AgentId)) + return; + + string[] parts = msg.Message.Split(new char[] {':'}); + if (parts.Length == 0) + return; + + ScenePresence sp = m_scene.GetScenePresence(client.AgentId); + if (sp == null || sp.IsChildAgent) + return; + + Dictionary d = m_floaters[client.AgentId]; + + // Work around a viewer bug - VALUE from any + // dialog can appear on this channel and needs to + // be dispatched to ALL open dialogs for the user + if (msg.Channel == 427169570) + { + if (parts[0] == "VALUE") + { + foreach (FloaterData dd in d.Values) + { + if(dd.Handler(client, dd, parts)) + { + m_floaters[client.AgentId].Remove(dd.Channel); + SendToClient(sp, String.Format("># floater {0} destroy", dd.FloaterName)); + break; + } + } + } + return; + } + + if (!d.ContainsKey(msg.Channel)) + return; + + FloaterData data = d[msg.Channel]; + + if (parts[0] == "NOTIFY") + { + if (parts[1] == "cancel" || parts[1] == data.FloaterName) + { + m_floaters[client.AgentId].Remove(data.Channel); + SendToClient(sp, String.Format("># floater {0} destroy", data.FloaterName)); + } + } + + if (data.Handler != null && data.Handler(client, data, parts)) + { + m_floaters[client.AgentId].Remove(data.Channel); + SendToClient(sp, String.Format("># floater {0} destroy", data.FloaterName)); + } + } + + public void FloaterControl(ScenePresence sp, FloaterData d, string msg) + { + string sendData = String.Format("># floater {0} {1}", d.FloaterName, msg); + SendToClient(sp, sendData); + + } + } +} diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs index 917911f9ca..c68fe9976b 100644 --- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs +++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs @@ -110,8 +110,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport { foreach (MenuItemData d in m_menuItems[UUID.Zero]) { - if (d.Mode == UserMode.God && (!m_scene.Permissions.IsGod(agentID))) - continue; + if (!m_scene.Permissions.IsGod(agentID)) + { + if (d.Mode == UserMode.RegionManager && (!m_scene.Permissions.IsAdministrator(agentID))) + continue; + } OSDMap loc = null; switch (d.Location) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index bea34d42b5..e91299728a 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -1045,12 +1045,37 @@ namespace OpenSim.Region.Physics.OdePlugin if (me == midbox) { if (Math.Abs(contact.normal.Z) > 0.95f) + { offset.Z = contact.pos.Z - _position.Z; + offset.X = (float)Math.Abs(offset.X) * 0.5f + contact.depth; + offset.Y = (float)Math.Abs(offset.Y) * 0.5f + contact.depth; + offset.Z = (float)Math.Abs(offset.Z) * 0.5f + contact.depth; + + if (reverse) + { + offset.X *= -contact.normal.X; + offset.Y *= -contact.normal.Y; + offset.Z *= -contact.normal.Z; + } + else + { + offset.X *= contact.normal.X; + offset.Y *= contact.normal.Y; + offset.Z *= contact.normal.Z; + } + + offset.X += contact.pos.X; + offset.Y += contact.pos.Y; + offset.Z += contact.pos.Z; + _position = offset; + return true; + } else offset.Z = contact.normal.Z; offset.Normalize(); + /* if (reverse) { contact.normal.X = offset.X; @@ -1063,7 +1088,8 @@ namespace OpenSim.Region.Physics.OdePlugin contact.normal.Y = -offset.Y; contact.normal.Z = -offset.Z; } - + */ + //_position.Z = offset.Z; return true; } @@ -1071,8 +1097,20 @@ namespace OpenSim.Region.Physics.OdePlugin { float h = contact.pos.Z - _position.Z; + // Only do this if the normal is sufficiently pointing in the 'up' direction if (Math.Abs(contact.normal.Z) > 0.95f) { + // We Only want to do this if we're sunk into the object a bit and we're stuck and we're trying to move and feetcollision is false + if ((contact.depth > 0.0010f && _velocity.X == 0f && _velocity.Y == 0 && _velocity.Z == 0) + && (_target_velocity.X > 0 || _target_velocity.Y > 0 || _target_velocity.Z > 0) + && (!feetcollision) ) + { + m_collisionException = true; // Stop looping, do this only once not X times Contacts + _position.Z += contact.depth + 0.01f; // Move us Up the amount that we sank in, and add 0.01 meters to gently lift avatar up. + + return true; + } + if (contact.normal.Z > 0) contact.normal.Z = 1.0f; else diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0199461cc7..7c375e6d3f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4643,20 +4643,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentId); if (presence != null && presence.PresenceType != PresenceType.Npc) { - // agent must not be a god - if (presence.GodLevel >= 200) return; - if (destination == String.Empty) destination = World.RegionInfo.RegionName; - // agent must be over the owners land - if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) + if (m_item.PermsGranter == agentId) + { + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) + { + DoLLTeleport(presence, destination, targetPos, targetLookAt); + } + } + + // agent must be wearing the object + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) { DoLLTeleport(presence, destination, targetPos, targetLookAt); } - else // or must be wearing the prim + else { - if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) + // agent must not be a god + if (presence.GodLevel >= 200) return; + + // agent must be over the owners land + ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition); + ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition); + if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.LandData.OwnerID) { DoLLTeleport(presence, destination, targetPos, targetLookAt); } @@ -4670,24 +4681,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); UUID agentId = new UUID(); - ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); + ulong regionHandle = Utils.UIntsToLong((uint)(global_coords.x / 256) * 256, (uint)(global_coords.y / 256) * 256); if (UUID.TryParse(agent, out agentId)) { + // This function is owner only! + if (m_host.OwnerID != agentId) + return; + ScenePresence presence = World.GetScenePresence(agentId); + + // Can't TP sitting avatars + if (presence.ParentID != 0) // Sitting + return; + if (presence != null && presence.PresenceType != PresenceType.Npc) { - // agent must not be a god - if (presence.GodLevel >= 200) return; + if (m_item.PermsGranter == agentId) + { + // If attached using llAttachToAvatarTemp, cowardly refuse + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID == UUID.Zero) + return; - // agent must be over the owners land - if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) - { - World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); - } - else // or must be wearing the prim - { - if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) { World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); } @@ -7853,6 +7869,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_List llGetPhysicsMaterial() + { + LSL_List result = new LSL_List(); + + result.Add(new LSL_Float(m_host.GravityModifier)); + result.Add(new LSL_Float(m_host.Restitution)); + result.Add(new LSL_Float(m_host.Friction)); + result.Add(new LSL_Float(m_host.Density)); + + return result; + } + private void SetPhysicsMaterial(SceneObjectPart part, int material_bits, float material_density, float material_friction, float material_restitution, float material_gravity_modifier) @@ -13379,6 +13407,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return null; } + + public void llSetContentType(LSL_Key id, LSL_Integer content_type) + { + if (m_UrlModule != null) + { + string type = "text.plain"; + if (content_type == (int)ScriptBaseClass.CONTENT_TYPE_HTML) + type = "text/html"; + + m_UrlModule.HttpContentType(new UUID(id),type); + } + } } public class NotecardCache diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 884f07ccb0..a47e452101 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -398,7 +398,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins objtype = 0; part = ((SceneObjectGroup)ent).RootPart; - if (part.ParentGroup.AttachmentPoint != 0) // Attached so ignore + if (part.ParentGroup.RootPart.Shape.PCode != (byte)PCode.Tree && + part.ParentGroup.RootPart.Shape.PCode != (byte)PCode.NewTree && + part.ParentGroup.AttachmentPoint != 0) // Attached so ignore continue; if (part.Inventory.ContainsScripts()) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 9bf6f9b62c..daf89e575d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -433,5 +433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc); void llSetKeyframedMotion(LSL_List frames, LSL_List options); LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); + LSL_List llGetPhysicsMaterial(); + void llSetContentType(LSL_Key id, LSL_Integer content_type); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 2f8154da56..6efa73f5e1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -80,6 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PERMISSION_CHANGE_PERMISSIONS = 512; public const int PERMISSION_TRACK_CAMERA = 1024; public const int PERMISSION_CONTROL_CAMERA = 2048; + public const int PERMISSION_TELEPORT = 4096; public const int AGENT_FLYING = 1; public const int AGENT_ATTACHMENTS = 2; @@ -771,5 +772,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase /// process message parameter as regex /// public const int OS_LISTEN_REGEX_MESSAGE = 0x2; + + public const int CONTENT_TYPE_TEXT = 0; + public const int CONTENT_TYPE_HTML = 1; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 8ecc4f86aa..6f3677c4be 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -2009,5 +2009,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density); } + + public LSL_List llGetPhysicsMaterial() + { + return m_LSL_Functions.llGetPhysicsMaterial(); + } + + public void llSetContentType(LSL_Key id, LSL_Integer content_type) + { + m_LSL_Functions.llSetContentType(id, content_type); + } } } diff --git a/bin/enter_uuid.xml b/bin/enter_uuid.xml new file mode 100644 index 0000000000..84475ad7ca --- /dev/null +++ b/bin/enter_uuid.xml @@ -0,0 +1,7 @@ + + + Enter UUID + +