fix merge

This commit is contained in:
UbitUmarov
2017-04-25 17:59:53 +01:00
111 changed files with 17583 additions and 2491 deletions

View File

@@ -1097,7 +1097,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public void SendAvatarDataImmediate(ISceneEntity avatar)
public void SendEntityFullUpdateImmediate(ISceneEntity ent)
{
}
public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
{
}

View File

@@ -134,11 +134,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
{
SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
if (hostPart == null)
return 0;
if (hostPart.ParentGroup.IsAttachment)
SceneObjectGroup hostgroup = hostPart.ParentGroup;
if (hostgroup== null || hostgroup.IsAttachment)
return 0;
IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>();
@@ -156,32 +157,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
return 0;
if (target.UUID != hostPart.ParentGroup.OwnerID)
if (target.UUID != hostgroup.OwnerID)
{
uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions();
uint effectivePerms = hostgroup.EffectiveOwnerPerms;
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
return 0;
hostPart.ParentGroup.SetOwnerId(target.UUID);
hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId);
hostgroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId);
if (m_scene.Permissions.PropagatePermissions())
{
foreach (SceneObjectPart child in hostPart.ParentGroup.Parts)
foreach (SceneObjectPart child in hostgroup.Parts)
{
child.Inventory.ChangeInventoryOwner(target.UUID);
child.TriggerScriptChangedEvent(Changed.OWNER);
child.ApplyNextOwnerPermissions();
}
hostgroup.AggregatePerms();
}
hostPart.ParentGroup.RootPart.ObjectSaleType = 0;
hostPart.ParentGroup.RootPart.SalePrice = 10;
hostgroup.RootPart.ObjectSaleType = 0;
hostgroup.RootPart.SalePrice = 10;
hostPart.ParentGroup.HasGroupChanged = true;
hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient);
hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
hostgroup.HasGroupChanged = true;
hostgroup.RootPart.SendPropertiesToClient(target.ControllingClient);
hostgroup.RootPart.ScheduleFullUpdate();
}
return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0;

View File

@@ -0,0 +1,195 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using netcd;
using netcd.Serialization;
using netcd.Advanced;
using netcd.Advanced.Requests;
namespace OpenSim.Region.OptionalModules.Framework.Monitoring
{
/// <summary>
/// Allows to store monitoring data in etcd, a high availability
/// name-value store.
/// </summary>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EtcdMonitoringModule")]
public class EtcdMonitoringModule : INonSharedRegionModule, IEtcdModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene;
protected IEtcdClient m_client;
protected bool m_enabled = false;
protected string m_etcdBasePath = String.Empty;
protected bool m_appendRegionID = true;
public string Name
{
get { return "EtcdMonitoringModule"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
public void Initialise(IConfigSource source)
{
if (source.Configs["Etcd"] == null)
return;
IConfig etcdConfig = source.Configs["Etcd"];
string etcdUrls = etcdConfig.GetString("EtcdUrls", String.Empty);
if (etcdUrls == String.Empty)
return;
m_etcdBasePath = etcdConfig.GetString("BasePath", m_etcdBasePath);
m_appendRegionID = etcdConfig.GetBoolean("AppendRegionID", m_appendRegionID);
if (!m_etcdBasePath.EndsWith("/"))
m_etcdBasePath += "/";
try
{
string[] endpoints = etcdUrls.Split(new char[] {','});
List<Uri> uris = new List<Uri>();
foreach (string endpoint in endpoints)
uris.Add(new Uri(endpoint.Trim()));
m_client = new EtcdClient(uris.ToArray(), new DefaultSerializer(), new DefaultSerializer());
}
catch (Exception e)
{
m_log.DebugFormat("[ETCD]: Error initializing connection: " + e.ToString());
return;
}
m_log.DebugFormat("[ETCD]: Etcd module configured");
m_enabled = true;
}
public void Close()
{
//m_client = null;
m_scene = null;
}
public void AddRegion(Scene scene)
{
m_scene = scene;
if (m_enabled)
{
if (m_appendRegionID)
m_etcdBasePath += m_scene.RegionInfo.RegionID.ToString() + "/";
m_log.DebugFormat("[ETCD]: Using base path {0} for all keys", m_etcdBasePath);
try
{
m_client.Advanced.CreateDirectory(new CreateDirectoryRequest() {Key = m_etcdBasePath});
}
catch (Exception e)
{
m_log.ErrorFormat("Exception trying to create base path {0}: " + e.ToString(), m_etcdBasePath);
}
scene.RegisterModuleInterface<IEtcdModule>(this);
}
}
public void RemoveRegion(Scene scene)
{
}
public void RegionLoaded(Scene scene)
{
}
public bool Store(string k, string v)
{
return Store(k, v, 0);
}
public bool Store(string k, string v, int ttl)
{
Response resp = m_client.Advanced.SetKey(new SetKeyRequest() { Key = m_etcdBasePath + k, Value = v, TimeToLive = ttl });
if (resp == null)
return false;
if (resp.ErrorCode.HasValue)
{
m_log.DebugFormat("[ETCD]: Error {0} ({1}) storing {2} => {3}", resp.Cause, (int)resp.ErrorCode, m_etcdBasePath + k, v);
return false;
}
return true;
}
public string Get(string k)
{
Response resp = m_client.Advanced.GetKey(new GetKeyRequest() { Key = m_etcdBasePath + k });
if (resp == null)
return String.Empty;
if (resp.ErrorCode.HasValue)
{
m_log.DebugFormat("[ETCD]: Error {0} ({1}) getting {2}", resp.Cause, (int)resp.ErrorCode, m_etcdBasePath + k);
return String.Empty;
}
return resp.Node.Value;
}
public void Delete(string k)
{
m_client.Advanced.DeleteKey(new DeleteKeyRequest() { Key = m_etcdBasePath + k });
}
public void Watch(string k, Action<string> callback)
{
m_client.Advanced.WatchKey(new WatchKeyRequest() { Key = m_etcdBasePath + k, Callback = (x) => { callback(x.Node.Value); } });
}
}
}

View File

@@ -329,7 +329,7 @@ namespace OpenSim.Region.OptionalModules.Materials
AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 )
{
m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
//m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
return;
}

View File

@@ -52,6 +52,7 @@ namespace OpenSim.Region.OptionalModules
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_enabled;
private Scene m_scene;
public string Name { get { return "PrimLimitsModule"; } }
public Type ReplaceableInterface { get { return null; } }
@@ -77,11 +78,12 @@ namespace OpenSim.Region.OptionalModules
public void AddRegion(Scene scene)
{
if (!m_enabled)
{
return;
}
m_scene = scene;
scene.Permissions.OnRezObject += CanRezObject;
scene.Permissions.OnObjectEntry += CanObjectEnter;
scene.Permissions.OnObjectEnterWithScripts += CanObjectEnterWithScripts;
scene.Permissions.OnDuplicateObject += CanDuplicateObject;
m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName);
@@ -89,14 +91,13 @@ namespace OpenSim.Region.OptionalModules
public void RemoveRegion(Scene scene)
{
if (m_enabled)
{
if (!m_enabled)
return;
}
scene.Permissions.OnRezObject -= CanRezObject;
scene.Permissions.OnObjectEntry -= CanObjectEnter;
scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
m_scene.Permissions.OnRezObject -= CanRezObject;
m_scene.Permissions.OnObjectEntry -= CanObjectEnter;
scene.Permissions.OnObjectEnterWithScripts -= CanObjectEnterWithScripts;
m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
}
public void RegionLoaded(Scene scene)
@@ -104,11 +105,12 @@ namespace OpenSim.Region.OptionalModules
m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
}
private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition)
{
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
string response = DoCommonChecks(objectCount, ownerID, lo, scene);
string response = DoCommonChecks(objectCount, ownerID, lo);
if (response != null)
{
@@ -119,88 +121,99 @@ namespace OpenSim.Region.OptionalModules
}
//OnDuplicateObject
private bool CanDuplicateObject(int objectCount, UUID objectID, UUID ownerID, Scene scene, Vector3 objectPosition)
private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp)
{
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
Vector3 objectPosition = sog.AbsolutePosition;
ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
string response = DoCommonChecks(objectCount, ownerID, lo, scene);
string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo);
if (response != null)
{
m_dialogModule.SendAlertToUser(ownerID, response);
m_dialogModule.SendAlertToUser(sp.UUID, response);
return false;
}
return true;
}
private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene)
private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
{
if (newPoint.X < -1f || newPoint.X > (scene.RegionInfo.RegionSizeX + 1) ||
newPoint.Y < -1f || newPoint.Y > (scene.RegionInfo.RegionSizeY) )
float newX = newPoint.X;
float newY = newPoint.Y;
if (newX < -1.0f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) ||
newY < -1.0f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
SceneObjectPart obj = scene.GetSceneObjectPart(objectID);
if (obj == null)
if (sog == null)
return false;
// Prim counts are determined by the location of the root prim. if we're
// moving a child prim, just let it pass
if (!obj.IsRoot)
{
return true;
}
ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
ILandObject newParcel = m_scene.LandChannel.GetLandObject(newX, newY);
if (newParcel == null)
return true;
Vector3 oldPoint = obj.GroupPosition;
ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
// The prim hasn't crossed a region boundry so we don't need to worry
// about prim counts here
if(oldParcel != null && oldParcel.Equals(newParcel))
if(!enteringRegion)
{
return true;
Vector3 oldPoint = sog.AbsolutePosition;
ILandObject oldParcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
if(oldParcel != null && oldParcel.Equals(newParcel))
return true;
}
int objectCount = obj.ParentGroup.PrimCount;
int usedPrims = newParcel.PrimCounts.Total;
int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
int objectCount = sog.PrimCount;
// TODO: Add Special Case here for temporary prims
string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene);
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
if (response != null)
{
m_dialogModule.SendAlertToUser(obj.OwnerID, response);
if(m_dialogModule != null)
m_dialogModule.SendAlertToUser(sog.OwnerID, response);
return false;
}
return true;
}
private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene)
private bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject newParcel)
{
if (sog == null)
return false;
if (newParcel == null)
return true;
int objectCount = sog.PrimCount;
// TODO: Add Special Case here for temporary prims
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
if (response != null)
return false;
return true;
}
private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo)
{
string response = null;
int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
{
response = "Unable to rez object because the parcel is too full";
response = "Unable to rez object because the parcel is full";
}
else
{
int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser;
int maxPrimsPerUser = m_scene.RegionInfo.MaxPrimsPerUser;
if (maxPrimsPerUser >= 0)
{
// per-user prim limit is set
if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
{
// caller is not the sole Parcel owner
EstateSettings estateSettings = scene.RegionInfo.EstateSettings;
EstateSettings estateSettings = m_scene.RegionInfo.EstateSettings;
if (ownerID != estateSettings.EstateOwner)
{
// caller is NOT the Estate owner

View File

@@ -665,7 +665,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
taskItem.AssetID = asset.FullID;
host.Inventory.AddInventoryItem(taskItem, false);
host.ParentGroup.AggregatePerms();
m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
}

View File

@@ -813,7 +813,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
}
public void SendAvatarDataImmediate(ISceneEntity avatar)
public void SendEntityFullUpdateImmediate(ISceneEntity avatar)
{
}
public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
{
}

View File

@@ -523,9 +523,9 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
rootPart.AddFlag(PrimFlags.Phantom);
m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.AggregatePerms();
return sceneObject;
}