Merge branch 'master' into bulletsim

bulletsim
Mic Bowman 2011-08-26 15:23:46 -07:00
commit 23f10f1d22
37 changed files with 1020 additions and 583 deletions

View File

@ -113,6 +113,7 @@ what it is today.
* mpallari * mpallari
* MrMonkE * MrMonkE
* Nebadon Izumi (Michael Cerquoni - http://OSgrid.org) * Nebadon Izumi (Michael Cerquoni - http://OSgrid.org)
* Neil Canham
* nornalbion * nornalbion
* Omar Vera Ustariz (IBM) * Omar Vera Ustariz (IBM)
* openlifegrid.com * openlifegrid.com

View File

@ -56,7 +56,6 @@ namespace OpenSim.Framework.Servers.HttpServer
private volatile int NotSocketErrors = 0; private volatile int NotSocketErrors = 0;
public volatile bool HTTPDRunning = false; public volatile bool HTTPDRunning = false;
protected Thread m_workerThread;
// protected HttpListener m_httpListener; // protected HttpListener m_httpListener;
protected CoolHTTPListener m_httpListener2; protected CoolHTTPListener m_httpListener2;
protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
@ -66,7 +65,6 @@ namespace OpenSim.Framework.Servers.HttpServer
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
new Dictionary<string, PollServiceEventArgs>(); new Dictionary<string, PollServiceEventArgs>();
@ -155,7 +153,8 @@ namespace OpenSim.Framework.Servers.HttpServer
public List<string> GetStreamHandlerKeys() public List<string> GetStreamHandlerKeys()
{ {
return new List<string>(m_streamHandlers.Keys); lock (m_streamHandlers)
return new List<string>(m_streamHandlers.Keys);
} }
private static string GetHandlerKey(string httpMethod, string path) private static string GetHandlerKey(string httpMethod, string path)
@ -196,7 +195,8 @@ namespace OpenSim.Framework.Servers.HttpServer
public List<string> GetXmlRpcHandlerKeys() public List<string> GetXmlRpcHandlerKeys()
{ {
return new List<string>(m_rpcHandlers.Keys); lock (m_rpcHandlers)
return new List<string>(m_rpcHandlers.Keys);
} }
public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
@ -218,10 +218,10 @@ namespace OpenSim.Framework.Servers.HttpServer
public List<string> GetHTTPHandlerKeys() public List<string> GetHTTPHandlerKeys()
{ {
return new List<string>(m_HTTPHandlers.Keys); lock (m_HTTPHandlers)
return new List<string>(m_HTTPHandlers.Keys);
} }
public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args)
{ {
bool pollHandlerResult = false; bool pollHandlerResult = false;
@ -242,10 +242,10 @@ namespace OpenSim.Framework.Servers.HttpServer
public List<string> GetPollServiceHandlerKeys() public List<string> GetPollServiceHandlerKeys()
{ {
return new List<string>(m_pollHandlers.Keys); lock (m_pollHandlers)
return new List<string>(m_pollHandlers.Keys);
} }
// Note that the agent string is provided simply to differentiate // Note that the agent string is provided simply to differentiate
// the handlers - it is NOT required to be an actual agent header // the handlers - it is NOT required to be an actual agent header
// value. // value.
@ -266,7 +266,8 @@ namespace OpenSim.Framework.Servers.HttpServer
public List<string> GetAgentHandlerKeys() public List<string> GetAgentHandlerKeys()
{ {
return new List<string>(m_agentHandlers.Keys); lock (m_agentHandlers)
return new List<string>(m_agentHandlers.Keys);
} }
public bool AddLLSDHandler(string path, LLSDMethod handler) public bool AddLLSDHandler(string path, LLSDMethod handler)
@ -284,7 +285,8 @@ namespace OpenSim.Framework.Servers.HttpServer
public List<string> GetLLSDHandlerKeys() public List<string> GetLLSDHandlerKeys()
{ {
return new List<string>(m_llsdHandlers.Keys); lock (m_llsdHandlers)
return new List<string>(m_llsdHandlers.Keys);
} }
public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler)
@ -404,14 +406,14 @@ namespace OpenSim.Framework.Servers.HttpServer
string requestMethod = request.HttpMethod; string requestMethod = request.HttpMethod;
string uriString = request.RawUrl; string uriString = request.RawUrl;
string reqnum = "unknown"; // string reqnum = "unknown";
int tickstart = Environment.TickCount; int tickstart = Environment.TickCount;
try try
{ {
// OpenSim.Framework.WebUtil.OSHeaderRequestID // OpenSim.Framework.WebUtil.OSHeaderRequestID
if (request.Headers["opensim-request-id"] != null) // if (request.Headers["opensim-request-id"] != null)
reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]); // reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]);
//m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl); //m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl);
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
@ -746,7 +748,8 @@ namespace OpenSim.Framework.Servers.HttpServer
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
{ {
agentHandler = null; agentHandler = null;
try
lock (m_agentHandlers)
{ {
foreach (IHttpAgentHandler handler in m_agentHandlers.Values) foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
{ {
@ -757,9 +760,6 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
} }
} }
catch(KeyNotFoundException)
{
}
return false; return false;
} }
@ -803,9 +803,12 @@ namespace OpenSim.Framework.Servers.HttpServer
XmlRpcMethod method; XmlRpcMethod method;
bool methodWasFound; bool methodWasFound;
bool keepAlive = false;
lock (m_rpcHandlers) lock (m_rpcHandlers)
{ {
methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
if (methodWasFound)
keepAlive = m_rpcHandlersKeepAlive[methodName];
} }
if (methodWasFound) if (methodWasFound)
@ -824,7 +827,6 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3]
try try
{ {
xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint);
@ -846,7 +848,7 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
// if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here
response.KeepAlive = m_rpcHandlersKeepAlive[methodName]; response.KeepAlive = keepAlive;
} }
else else
{ {
@ -1106,7 +1108,6 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <returns>true if we have one, false if not</returns> /// <returns>true if we have one, false if not</returns>
private bool DoWeHaveALLSDHandler(string path) private bool DoWeHaveALLSDHandler(string path)
{ {
string[] pathbase = path.Split('/'); string[] pathbase = path.Split('/');
string searchquery = "/"; string searchquery = "/";
@ -1122,14 +1123,12 @@ namespace OpenSim.Framework.Servers.HttpServer
string bestMatch = null; string bestMatch = null;
foreach (string pattern in m_llsdHandlers.Keys) lock (m_llsdHandlers)
{ {
foreach (string pattern in m_llsdHandlers.Keys)
if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
{ {
if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
bestMatch = pattern; bestMatch = pattern;
} }
} }
@ -1142,12 +1141,10 @@ namespace OpenSim.Framework.Servers.HttpServer
if (String.IsNullOrEmpty(bestMatch)) if (String.IsNullOrEmpty(bestMatch))
{ {
return false; return false;
} }
else else
{ {
return true; return true;
} }
} }
@ -1232,29 +1229,32 @@ namespace OpenSim.Framework.Servers.HttpServer
string bestMatch = null; string bestMatch = null;
foreach (string pattern in m_llsdHandlers.Keys) lock (m_llsdHandlers)
{ {
if (searchquery.ToLower().StartsWith(pattern.ToLower())) foreach (string pattern in m_llsdHandlers.Keys)
{ {
if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) if (searchquery.ToLower().StartsWith(pattern.ToLower()))
{ {
// You have to specifically register for '/' and to get it, you must specificaly request it if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length)
// {
if (pattern == "/" && searchquery == "/" || pattern != "/") // You have to specifically register for '/' and to get it, you must specificaly request it
bestMatch = pattern; //
if (pattern == "/" && searchquery == "/" || pattern != "/")
bestMatch = pattern;
}
} }
} }
}
if (String.IsNullOrEmpty(bestMatch))
if (String.IsNullOrEmpty(bestMatch)) {
{ llsdHandler = null;
llsdHandler = null; return false;
return false; }
} else
else {
{ llsdHandler = m_llsdHandlers[bestMatch];
llsdHandler = m_llsdHandlers[bestMatch]; return true;
return true; }
} }
} }
@ -1793,7 +1793,8 @@ namespace OpenSim.Framework.Servers.HttpServer
//m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey); lock (m_streamHandlers)
m_streamHandlers.Remove(handlerKey);
} }
public void RemoveHTTPHandler(string httpMethod, string path) public void RemoveHTTPHandler(string httpMethod, string path)
@ -1825,17 +1826,16 @@ namespace OpenSim.Framework.Servers.HttpServer
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
{ {
try lock (m_agentHandlers)
{ {
if (handler == m_agentHandlers[agent]) IHttpAgentHandler foundHandler;
if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
{ {
m_agentHandlers.Remove(agent); m_agentHandlers.Remove(agent);
return true; return true;
} }
} }
catch(KeyNotFoundException)
{
}
return false; return false;
} }
@ -1853,18 +1853,16 @@ namespace OpenSim.Framework.Servers.HttpServer
public bool RemoveLLSDHandler(string path, LLSDMethod handler) public bool RemoveLLSDHandler(string path, LLSDMethod handler)
{ {
try lock (m_llsdHandlers)
{ {
if (handler == m_llsdHandlers[path]) LLSDMethod foundHandler;
if (m_llsdHandlers.TryGetValue(path, out foundHandler) && foundHandler == handler)
{ {
m_llsdHandlers.Remove(path); m_llsdHandlers.Remove(path);
return true; return true;
} }
} }
catch (KeyNotFoundException)
{
// This is an exception to prevent crashing because of invalid code
}
return false; return false;
} }

View File

@ -43,21 +43,29 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Region.ClientStack.Linden namespace OpenSim.Region.ClientStack.Linden
{ {
/// <summary> /// <summary>
/// SimulatorFeatures capability. This is required for uploading Mesh. /// SimulatorFeatures capability.
/// </summary>
/// <remarks>
/// This is required for uploading Mesh.
/// Since is accepts an open-ended response, we also send more information /// Since is accepts an open-ended response, we also send more information
/// for viewers that care to interpret it. /// for viewers that care to interpret it.
/// ///
/// NOTE: Part of this code was adapted from the Aurora project, specifically /// NOTE: Part of this code was adapted from the Aurora project, specifically
/// the normal part of the response in the capability handler. /// the normal part of the response in the capability handler.
/// </summary> /// </remarks>
///
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimulatorFeaturesModule : ISharedRegionModule public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule
{ {
private static readonly ILog m_log = // private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
/// <summary>
/// Simulator features
/// </summary>
private OSDMap m_features = new OSDMap();
private string m_MapImageServerURL = string.Empty; private string m_MapImageServerURL = string.Empty;
private string m_SearchURL = string.Empty; private string m_SearchURL = string.Empty;
@ -66,18 +74,20 @@ namespace OpenSim.Region.ClientStack.Linden
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig config = source.Configs["SimulatorFeatures"]; IConfig config = source.Configs["SimulatorFeatures"];
if (config == null) if (config != null)
return;
m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
if (m_MapImageServerURL != string.Empty)
{ {
m_MapImageServerURL = m_MapImageServerURL.Trim(); m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
if (!m_MapImageServerURL.EndsWith("/")) if (m_MapImageServerURL != string.Empty)
m_MapImageServerURL = m_MapImageServerURL + "/"; {
m_MapImageServerURL = m_MapImageServerURL.Trim();
if (!m_MapImageServerURL.EndsWith("/"))
m_MapImageServerURL = m_MapImageServerURL + "/";
}
m_SearchURL = config.GetString("SearchServerURI", string.Empty);
} }
m_SearchURL = config.GetString("SearchServerURI", string.Empty); AddDefaultFeatures();
} }
public void AddRegion(Scene s) public void AddRegion(Scene s)
@ -110,43 +120,83 @@ namespace OpenSim.Region.ClientStack.Linden
#endregion #endregion
/// <summary>
/// Add default features
/// </summary>
/// <remarks>
/// TODO: These should be added from other modules rather than hardcoded.
/// </remarks>
private void AddDefaultFeatures()
{
lock (m_features)
{
m_features["MeshRezEnabled"] = true;
m_features["MeshUploadEnabled"] = true;
m_features["MeshXferEnabled"] = true;
m_features["PhysicsMaterialsEnabled"] = true;
OSDMap typesMap = new OSDMap();
typesMap["convex"] = true;
typesMap["none"] = true;
typesMap["prim"] = true;
m_features["PhysicsShapeTypes"] = typesMap;
// Extra information for viewers that want to use it
OSDMap gridServicesMap = new OSDMap();
if (m_MapImageServerURL != string.Empty)
gridServicesMap["map-server-url"] = m_MapImageServerURL;
if (m_SearchURL != string.Empty)
gridServicesMap["search"] = m_SearchURL;
m_features["GridServices"] = gridServicesMap;
}
}
public void RegisterCaps(UUID agentID, Caps caps) public void RegisterCaps(UUID agentID, Caps caps)
{ {
IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures); IRequestHandler reqHandler
= new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), HandleSimulatorFeaturesRequest);
caps.RegisterHandler("SimulatorFeatures", reqHandler); caps.RegisterHandler("SimulatorFeatures", reqHandler);
} }
private Hashtable SimulatorFeatures(Hashtable mDhttpMethod) public void AddFeature(string name, OSD value)
{ {
m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); lock (m_features)
OSDMap data = new OSDMap(); m_features[name] = value;
data["MeshRezEnabled"] = true; }
data["MeshUploadEnabled"] = true;
data["MeshXferEnabled"] = true;
data["PhysicsMaterialsEnabled"] = true;
OSDMap typesMap = new OSDMap(); public bool RemoveFeature(string name)
typesMap["convex"] = true; {
typesMap["none"] = true; lock (m_features)
typesMap["prim"] = true; return m_features.Remove(name);
data["PhysicsShapeTypes"] = typesMap; }
// Extra information for viewers that want to use it public bool TryGetFeature(string name, out OSD value)
OSDMap gridServicesMap = new OSDMap(); {
if (m_MapImageServerURL != string.Empty) lock (m_features)
gridServicesMap["map-server-url"] = m_MapImageServerURL; return m_features.TryGetValue(name, out value);
if (m_SearchURL != string.Empty) }
gridServicesMap["search"] = m_SearchURL;
data["GridServices"] = gridServicesMap; public OSDMap GetFeatures()
{
lock (m_features)
return new OSDMap(m_features);
}
private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod)
{
// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
//Send back data //Send back data
Hashtable responsedata = new Hashtable(); Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200; responsedata["int_response_code"] = 200;
responsedata["content_type"] = "text/plain"; responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false; responsedata["keepalive"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
lock (m_features)
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
return responsedata; return responsedata;
} }
} }
} }

View File

@ -46,7 +46,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
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 = null; private Scene m_scene = null;
private IDialogModule m_dialogModule;
public string Name { get { return "Attachments Module"; } } public string Name { get { return "Attachments Module"; } }
public Type ReplaceableInterface { get { return null; } } public Type ReplaceableInterface { get { return null; } }
@ -56,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
m_scene.RegisterModuleInterface<IAttachmentsModule>(this); m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
m_scene.EventManager.OnNewClient += SubscribeToClientEvents; m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
// TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
@ -80,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
client.OnObjectAttach += AttachObject; client.OnObjectAttach += AttachObject;
client.OnObjectDetach += DetachObject; client.OnObjectDetach += DetachObject;
client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
} }
public void UnsubscribeFromClientEvents(IClientAPI client) public void UnsubscribeFromClientEvents(IClientAPI client)
@ -89,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
client.OnObjectAttach -= AttachObject; client.OnObjectAttach -= AttachObject;
client.OnObjectDetach -= DetachObject; client.OnObjectDetach -= DetachObject;
client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv;
} }
/// <summary> /// <summary>
@ -101,10 +103,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// <param name="silent"></param> /// <param name="silent"></param>
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
{ {
// m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
// objectLocalID, remoteClient.Name, AttachmentPt, silent);
try try
{ {
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp == null)
{
m_log.ErrorFormat(
"[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId);
return;
}
// If we can't take it, we can't attach it! // If we can't take it, we can't attach it!
SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID); SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
if (part == null) if (part == null)
@ -123,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
AttachmentPt &= 0x7f; AttachmentPt &= 0x7f;
// Calls attach with a Zero position // Calls attach with a Zero position
if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false)) if (AttachObject(sp, part.ParentGroup, AttachmentPt, false))
{ {
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
@ -136,12 +149,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}", e); m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace);
} }
} }
public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
{ {
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp == null)
{
m_log.ErrorFormat(
"[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId);
return false;
}
return AttachObject(sp, group, AttachmentPt, silent);
}
private bool AttachObject(ScenePresence sp, SceneObjectGroup group, uint AttachmentPt, bool silent)
{
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
// group.Name, group.LocalId, sp.Name, AttachmentPt, silent);
if (sp.GetAttachments(AttachmentPt).Contains(group))
{
// m_log.WarnFormat(
// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
// group.Name, group.LocalId, sp.Name, AttachmentPt);
return false;
}
Vector3 attachPos = group.AbsolutePosition; Vector3 attachPos = group.AbsolutePosition;
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
@ -175,32 +215,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
group.AbsolutePosition = attachPos; group.AbsolutePosition = attachPos;
// Remove any previous attachments // Remove any previous attachments
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
UUID itemID = UUID.Zero; UUID itemID = UUID.Zero;
if (sp != null) foreach (SceneObjectGroup grp in sp.Attachments)
{ {
foreach (SceneObjectGroup grp in sp.Attachments) if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
{ {
if (grp.GetAttachmentPoint() == (byte)AttachmentPt) itemID = grp.GetFromItemID();
{ break;
itemID = grp.GetFromItemID();
break;
}
} }
if (itemID != UUID.Zero)
DetachSingleAttachmentToInv(itemID, remoteClient);
} }
if (group.GetFromItemID() == UUID.Zero) if (itemID != UUID.Zero)
{ DetachSingleAttachmentToInv(itemID, sp);
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
}
else
{
itemID = group.GetFromItemID();
}
ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group); itemID = group.GetFromItemID();
if (itemID == UUID.Zero)
itemID = AddSceneObjectAsAttachment(sp.ControllingClient, group).ID;
ShowAttachInUserInventory(sp, AttachmentPt, itemID, group);
AttachToAgent(sp, group, AttachmentPt, attachPos, silent); AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
@ -229,19 +261,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", // "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}",
// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); // (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name);
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
if (sp == null)
{
m_log.ErrorFormat(
"[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()",
remoteClient.Name, remoteClient.AgentId);
return UUID.Zero;
}
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
// be removed when that functionality is implemented in opensim // be removed when that functionality is implemented in opensim
AttachmentPt &= 0x7f; AttachmentPt &= 0x7f;
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, AttachmentPt);
if (updateInventoryStatus) if (updateInventoryStatus)
{ {
if (att == null) if (att == null)
ShowDetachInUserInventory(itemID, remoteClient); DetachSingleAttachmentToInv(itemID, sp.ControllingClient);
else else
ShowAttachInUserInventory(att, remoteClient, itemID, AttachmentPt); ShowAttachInUserInventory(att, sp, itemID, AttachmentPt);
} }
if (null == att) if (null == att)
@ -250,15 +292,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return att.UUID; return att.UUID;
} }
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt) ScenePresence sp, UUID itemID, uint AttachmentPt)
{ {
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null) if (invAccess != null)
{ {
SceneObjectGroup objatt = invAccess.RezObject(remoteClient, SceneObjectGroup objatt = invAccess.RezObject(sp.ControllingClient,
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, remoteClient.AgentId, true); false, false, sp.UUID, true);
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
@ -277,11 +319,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// This will throw if the attachment fails // This will throw if the attachment fails
try try
{ {
AttachObject(remoteClient, objatt, AttachmentPt, false); AttachObject(sp, objatt, AttachmentPt, false);
} }
catch catch (Exception e)
{ {
m_log.ErrorFormat(
"[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}",
objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace);
// Make sure the object doesn't stick around and bail // Make sure the object doesn't stick around and bail
sp.RemoveAttachment(objatt);
m_scene.DeleteSceneObject(objatt, false); m_scene.DeleteSceneObject(objatt, false);
return null; return null;
} }
@ -295,13 +342,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
objatt.ResumeScripts(); objatt.ResumeScripts();
// Do this last so that event listeners have access to all the effects of the attachment // Do this last so that event listeners have access to all the effects of the attachment
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID);
} }
else else
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
itemID, remoteClient.Name, AttachmentPt); itemID, sp.Name, AttachmentPt);
} }
return objatt; return objatt;
@ -314,12 +361,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// Update the user inventory to the attachment of an item /// Update the user inventory to the attachment of an item
/// </summary> /// </summary>
/// <param name="att"></param> /// <param name="att"></param>
/// <param name="remoteClient"></param> /// <param name="sp"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
/// <param name="AttachmentPt"></param> /// <param name="AttachmentPt"></param>
/// <returns></returns> /// <returns></returns>
protected UUID ShowAttachInUserInventory( private UUID ShowAttachInUserInventory(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) SceneObjectGroup att, ScenePresence sp, UUID itemID, uint AttachmentPt)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", // "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
@ -328,16 +375,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!att.IsDeleted) if (!att.IsDeleted)
AttachmentPt = att.RootPart.AttachmentPoint; AttachmentPt = att.RootPart.AttachmentPoint;
ScenePresence presence; InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) item = m_scene.InventoryService.GetItem(item);
{
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
if (changed && m_scene.AvatarFactory != null) if (changed && m_scene.AvatarFactory != null)
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
}
return att.UUID; return att.UUID;
} }
@ -345,12 +388,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// <summary> /// <summary>
/// Update the user inventory to reflect an attachment /// Update the user inventory to reflect an attachment
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="sp"></param>
/// <param name="AttachmentPt"></param> /// <param name="AttachmentPt"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
/// <param name="att"></param> /// <param name="att"></param>
protected void ShowAttachInUserInventory( private void ShowAttachInUserInventory(
IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) ScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
@ -374,16 +417,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return; return;
} }
ScenePresence presence; InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID);
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) item = m_scene.InventoryService.GetItem(item);
{ bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
// XXYY!! if (changed && m_scene.AvatarFactory != null)
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
item = m_scene.InventoryService.GetItem(item);
bool changed = presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
if (changed && m_scene.AvatarFactory != null)
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
}
} }
public void DetachObject(uint objectLocalID, IClientAPI remoteClient) public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
@ -391,12 +429,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
if (group != null) if (group != null)
{ {
//group.DetachToGround(); DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient);
ShowDetachInUserInventory(group.GetFromItemID(), remoteClient);
} }
} }
public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
{ {
ScenePresence presence; ScenePresence presence;
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
@ -407,34 +444,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
bool changed = presence.Appearance.DetachAttachment(itemID); bool changed = presence.Appearance.DetachAttachment(itemID);
if (changed && m_scene.AvatarFactory != null) if (changed && m_scene.AvatarFactory != null)
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
}
DetachSingleAttachmentToInv(itemID, remoteClient); DetachSingleAttachmentToInv(itemID, presence);
}
} }
public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient)
{ {
SceneObjectPart part = m_scene.GetSceneObjectPart(itemID); SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID);
if (part == null || part.ParentGroup == null)
if (so == null)
return; return;
if (part.ParentGroup.RootPart.AttachedAvatar != remoteClient.AgentId) if (so.AttachedAvatar != remoteClient.AgentId)
return; return;
UUID inventoryID = part.ParentGroup.GetFromItemID(); UUID inventoryID = so.GetFromItemID();
ScenePresence presence; ScenePresence presence;
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
{ {
if (!m_scene.Permissions.CanRezObject( if (!m_scene.Permissions.CanRezObject(
part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
return; return;
bool changed = presence.Appearance.DetachAttachment(itemID); bool changed = presence.Appearance.DetachAttachment(sceneObjectID);
if (changed && m_scene.AvatarFactory != null) if (changed && m_scene.AvatarFactory != null)
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
part.ParentGroup.DetachToGround(); presence.RemoveAttachment(so);
DetachSceneObjectToGround(so, presence);
List<UUID> uuids = new List<UUID>(); List<UUID> uuids = new List<UUID>();
uuids.Add(inventoryID); uuids.Add(inventoryID);
@ -442,12 +481,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
remoteClient.SendRemoveInventoryItem(inventoryID); remoteClient.SendRemoveInventoryItem(inventoryID);
} }
m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero); m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero);
}
/// <summary>
/// Detach the given scene objet to the ground.
/// </summary>
/// <remarks>
/// The caller has to take care of all the other work in updating avatar appearance, inventory, etc.
/// </remarks>
/// <param name="so">The scene object to detach.</param>
/// <param name="sp">The scene presence from which the scene object is being detached.</param>
private void DetachSceneObjectToGround(SceneObjectGroup so, ScenePresence sp)
{
SceneObjectPart rootPart = so.RootPart;
rootPart.FromItemID = UUID.Zero;
so.AbsolutePosition = sp.AbsolutePosition;
so.AttachedAvatar = UUID.Zero;
rootPart.SetParentLocalId(0);
so.ClearPartAttachmentData();
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
so.HasGroupChanged = true;
rootPart.Rezzed = DateTime.Now;
rootPart.RemFlag(PrimFlags.TemporaryOnRez);
so.AttachToBackup();
m_scene.EventManager.TriggerParcelPrimCountTainted();
rootPart.ScheduleFullUpdate();
rootPart.ClearUndoState();
} }
// What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
// To LocalId or UUID, *THAT* is the question. How now Brown UUID?? // To LocalId or UUID, *THAT* is the question. How now Brown UUID??
protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) private void DetachSingleAttachmentToInv(UUID itemID, ScenePresence sp)
{ {
if (itemID == UUID.Zero) // If this happened, someone made a mistake.... if (itemID == UUID.Zero) // If this happened, someone made a mistake....
return; return;
@ -465,17 +531,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (group.GetFromItemID() == itemID) if (group.GetFromItemID() == itemID)
{ {
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
group.DetachToInventoryPrep(); sp.RemoveAttachment(group);
// m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
// If an item contains scripts, it's always changed. // Prepare sog for storage
// This ensures script state is saved on detach group.AttachedAvatar = UUID.Zero;
foreach (SceneObjectPart p in group.Parts)
if (p.Inventory.ContainsScripts())
group.HasGroupChanged = true;
UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); group.ForEachPart(
delegate(SceneObjectPart part)
{
// If there are any scripts,
// then always trigger a new object and state persistence in UpdateKnownItem()
if (part.Inventory.ContainsScripts())
group.HasGroupChanged = true;
}
);
group.RootPart.SetParentLocalId(0);
group.RootPart.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos;
UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID);
m_scene.DeleteSceneObject(group, false); m_scene.DeleteSceneObject(group, false);
return; return;
} }
} }
@ -515,7 +592,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
if (!grp.HasGroupChanged) if (!grp.HasGroupChanged)
{ {
m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID); m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
grp.UUID, grp.GetAttachmentPoint());
return; return;
} }
@ -524,6 +604,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
grp.UUID, grp.GetAttachmentPoint()); grp.UUID, grp.GetAttachmentPoint());
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item); item = m_scene.InventoryService.GetItem(item);
@ -575,12 +656,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.DeleteFromStorage(so.UUID); m_scene.DeleteFromStorage(so.UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted(); m_scene.EventManager.TriggerParcelPrimCountTainted();
so.RootPart.AttachedAvatar = avatar.UUID; so.AttachedAvatar = avatar.UUID;
//Anakin Lohner bug #3839
SceneObjectPart[] parts = so.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = avatar.UUID;
if (so.RootPart.PhysActor != null) if (so.RootPart.PhysActor != null)
{ {
@ -616,5 +692,97 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// it get cleaned up // it get cleaned up
so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
} }
/// <summary>
/// Add a scene object that was previously free in the scene as an attachment to an avatar.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="grp"></param>
/// <returns>The user inventory item created that holds the attachment.</returns>
private InventoryItemBase AddSceneObjectAsAttachment(IClientAPI remoteClient, SceneObjectGroup grp)
{
// m_log.DebugFormat("[SCENE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2} {3} {4}", grp.Name, grp.LocalId, remoteClient.Name, remoteClient.AgentId, AgentId);
Vector3 inventoryStoredPosition = new Vector3
(((grp.AbsolutePosition.X > (int)Constants.RegionSize)
? Constants.RegionSize - 6
: grp.AbsolutePosition.X)
,
(grp.AbsolutePosition.Y > (int)Constants.RegionSize)
? Constants.RegionSize - 6
: grp.AbsolutePosition.Y,
grp.AbsolutePosition.Z);
Vector3 originalPosition = grp.AbsolutePosition;
grp.AbsolutePosition = inventoryStoredPosition;
// If we're being called from a script, then trying to serialize that same script's state will not complete
// in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if
// the client/server crashes rather than logging out normally, the attachment's scripts will resume
// without state on relog. Arguably, this is what we want anyway.
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false);
grp.AbsolutePosition = originalPosition;
AssetBase asset = m_scene.CreateAsset(
grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
m_scene.AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase();
item.CreatorId = grp.RootPart.CreatorID.ToString();
item.CreatorData = grp.RootPart.CreatorData;
item.Owner = remoteClient.AgentId;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
InventoryFolderBase folder = m_scene.InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object);
if (folder != null)
item.Folder = folder.ID;
else // oopsies
item.Folder = UUID.Zero;
if ((remoteClient.AgentId != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions())
{
item.BasePermissions = grp.RootPart.NextOwnerMask;
item.CurrentPermissions = grp.RootPart.NextOwnerMask;
item.NextPermissions = grp.RootPart.NextOwnerMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
}
else
{
item.BasePermissions = grp.RootPart.BaseMask;
item.CurrentPermissions = grp.RootPart.OwnerMask;
item.NextPermissions = grp.RootPart.NextOwnerMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask;
item.GroupPermissions = grp.RootPart.GroupMask;
}
item.CreationDate = Util.UnixTimeSinceEpoch();
// sets itemID so client can show item as 'attached' in inventory
grp.SetFromItemID(item.ID);
if (m_scene.AddInventoryItem(item))
{
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
else
{
if (m_dialogModule != null)
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
}
return item;
}
} }
} }

View File

@ -54,11 +54,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
[TestFixture] [TestFixture]
public class AttachmentsModuleTests public class AttachmentsModuleTests
{ {
public Scene scene; private Scene scene;
public UUID agent1; private AttachmentsModule m_attMod;
public static Random random; private ScenePresence m_presence;
public AgentCircuitData acd1;
public SceneObjectGroup sog1, sog2;
[SetUp] [SetUp]
public void Init() public void Init()
@ -71,12 +69,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
scene = SceneHelpers.SetupScene(); scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); m_attMod = new AttachmentsModule();
SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
agent1 = UUID.Random();
random = new Random();
sog1 = NewSOG(UUID.Random(), scene, agent1);
sog2 = NewSOG(UUID.Random(), scene, agent1);
} }
[TearDown] [TearDown]
@ -86,31 +80,139 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// threads. Possibly, later tests should be rewritten not to worry about such things. // threads. Possibly, later tests should be rewritten not to worry about such things.
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
} }
[Test] /// <summary>
public void TestAddAttachments() /// Add the standard presence for a test.
/// </summary>
private void AddPresence()
{ {
TestHelpers.InMethod(); UUID userId = TestHelpers.ParseTail(0x1);
UserAccountHelpers.CreateUserWithInventory(scene, userId);
ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); m_presence = SceneHelpers.AddScenePresence(scene, userId);
presence.AddAttachment(sog1);
presence.AddAttachment(sog2);
Assert.That(presence.HasAttachments(), Is.True);
Assert.That(presence.ValidateAttachments(), Is.True);
} }
[Test] [Test]
public void TestRemoveAttachments() public void TestAddAttachmentFromGround()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); AddPresence();
presence.AddAttachment(sog1); string attName = "att";
presence.AddAttachment(sog2);
presence.RemoveAttachment(sog1); SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup;
presence.RemoveAttachment(sog2);
Assert.That(presence.HasAttachments(), Is.False); m_attMod.AttachObject(m_presence.ControllingClient, so, (uint)AttachmentPoint.Chest, false);
// Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.True);
List<SceneObjectGroup> attachments = m_presence.Attachments;
Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0];
Assert.That(attSo.Name, Is.EqualTo(attName));
Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
Assert.That(attSo.IsTemporary, Is.False);
// Check item status
Assert.That(m_presence.Appearance.GetAttachpoint(
attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest));
}
[Test]
public void TestAddAttachmentFromInventory()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
AddPresence();
UUID attItemId = TestHelpers.ParseTail(0x2);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
InventoryItemBase attItem
= UserInventoryHelpers.CreateInventoryItem(
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
m_attMod.RezSingleAttachmentFromInventory(
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
// Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.True);
List<SceneObjectGroup> attachments = m_presence.Attachments;
Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0];
Assert.That(attSo.Name, Is.EqualTo(attName));
Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
Assert.That(attSo.IsTemporary, Is.False);
// Check item status
Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
}
[Test]
public void TestDetachAttachmentToScene()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
AddPresence();
UUID attItemId = TestHelpers.ParseTail(0x2);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
InventoryItemBase attItem
= UserInventoryHelpers.CreateInventoryItem(
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
UUID attSoId = m_attMod.RezSingleAttachmentFromInventory(
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient);
// Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.False);
List<SceneObjectGroup> attachments = m_presence.Attachments;
Assert.That(attachments.Count, Is.EqualTo(0));
// Check item status
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null);
// Check object in scene
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
}
[Test]
public void TestDetachAttachmentToInventory()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
AddPresence();
UUID attItemId = TestHelpers.ParseTail(0x2);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
InventoryItemBase attItem
= UserInventoryHelpers.CreateInventoryItem(
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
m_attMod.RezSingleAttachmentFromInventory(
m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
m_attMod.DetachSingleAttachmentToInv(attItemId, m_presence.ControllingClient);
// Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.False);
List<SceneObjectGroup> attachments = m_presence.Attachments;
Assert.That(attachments.Count, Is.EqualTo(0));
// Check item status
Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0));
} }
[Test] [Test]
@ -138,7 +240,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
List<SceneObjectGroup> attachments = presence.Attachments; List<SceneObjectGroup> attachments = presence.Attachments;
Assert.That(attachments.Count, Is.EqualTo(1)); Assert.That(attachments.Count, Is.EqualTo(1));
Assert.That(attachments[0].Name, Is.EqualTo(attName)); SceneObjectGroup attSo = attachments[0];
Assert.That(attSo.Name, Is.EqualTo(attName));
Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
Assert.That(attSo.IsTemporary, Is.False);
} }
// I'm commenting this test because scene setup NEEDS InventoryService to // I'm commenting this test because scene setup NEEDS InventoryService to
@ -162,39 +269,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); // //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); // Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
// } // }
private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
{
SceneObjectPart sop = new SceneObjectPart();
sop.Name = RandomName();
sop.Description = RandomName();
sop.Text = RandomName();
sop.SitName = RandomName();
sop.TouchName = RandomName();
sop.UUID = uuid;
sop.Shape = PrimitiveBaseShape.Default;
sop.Shape.State = 1;
sop.OwnerID = agent;
SceneObjectGroup sog = new SceneObjectGroup(sop);
sog.SetScene(scene);
return sog;
}
private static string RandomName()
{
StringBuilder name = new StringBuilder();
int size = random.Next(5,12);
char ch;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
name.Append(ch);
}
return name.ToString();
}
} }
} }

View File

@ -278,7 +278,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
else else
{ {
if (m_TransferModule != null) if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); m_TransferModule.SendInstantMessage(im, delegate(bool success) {
// Send BulkUpdateInventory
IInventoryService invService = scene.InventoryService;
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item /folder, back from it's trip
InventoryFolderBase folder = new InventoryFolderBase(inventoryEntityID, client.AgentId);
folder = invService.GetFolder(folder);
ScenePresence fromUser = scene.GetScenePresence(new UUID(im.fromAgentID));
fromUser.ControllingClient.SendBulkUpdateInventory(folder);
});
} }
} }
else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)

View File

@ -282,6 +282,90 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
} }
} }
/// <summary>
/// Delivers the message to.
/// </summary>
/// <param name='target'>
/// Target.
/// </param>
/// <param name='channel'>
/// Channel.
/// </param>
/// <param name='name'>
/// Name.
/// </param>
/// <param name='id'>
/// Identifier.
/// </param>
/// <param name='msg'>
/// Message.
/// </param>
public bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error)
{
error = null;
// Is id an avatar?
ScenePresence sp = m_scene.GetScenePresence(target);
if (sp != null)
{
// Send message to avatar
if (channel == 0)
{
m_scene.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0, pos, name, id, false);
}
List<SceneObjectGroup> attachments = sp.Attachments;
// Nothing left to do
if (attachments == null)
return true;
// Get uuid of attachments
List<UUID> targets = new List<UUID>();
foreach ( SceneObjectGroup sog in attachments )
{
targets.Add(sog.UUID);
}
// Need to check each attachment
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
{
if (li.GetHostID().Equals(id))
continue;
if (m_scene.GetSceneObjectPart(li.GetHostID()) == null)
continue;
if ( targets.Contains(li.GetHostID()))
QueueMessage(new ListenerInfo(li, name, id, msg));
}
return true;
}
// Need to toss an error here
if (channel == 0)
{
error = "Cannot use llRegionSayTo to message objects on channel 0";
return false;
}
foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg))
{
// Dont process if this message is from yourself!
if (li.GetHostID().Equals(id))
continue;
SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID());
if (sPart == null)
continue;
if ( li.GetHostID().Equals(target))
{
QueueMessage(new ListenerInfo(li, name, id, msg));
break;
}
}
return true;
}
protected void QueueMessage(ListenerInfo li) protected void QueueMessage(ListenerInfo li)
{ {
lock (m_pending.SyncRoot) lock (m_pending.SyncRoot)

View File

@ -48,7 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
private static bool m_Enabled = false; private static bool m_Enabled = false;
private IConfigSource m_Config; private IConfigSource m_Config;
bool m_Registered = false;
#region IRegionModule interface #region IRegionModule interface
@ -64,9 +63,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
m_log.Info("[MAP SERVICE IN CONNECTOR]: MapImage Service In Connector enabled"); m_log.Info("[MAP SERVICE IN CONNECTOR]: MapImage Service In Connector enabled");
new MapGetServiceConnector(m_Config, MainServer.Instance, "MapImageService"); new MapGetServiceConnector(m_Config, MainServer.Instance, "MapImageService");
} }
} }
} }
public void PostInitialise() public void PostInitialise()
@ -106,6 +103,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
} }
#endregion #endregion
} }
} }

View File

@ -125,7 +125,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
bool isAuthorized = true; bool isAuthorized = true;
message = String.Empty; message = String.Empty;
string mail = String.Empty;
// get the scene this call is being made for // get the scene this call is being made for
Scene scene = null; Scene scene = null;
@ -144,9 +143,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
{ {
UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID)); UserAccount account = scene.UserAccountService.GetUserAccount(UUID.Zero, new UUID(userID));
if (account != null)
mail = account.Email;
isAuthorized isAuthorized
= IsAuthorizedForRegion( = IsAuthorizedForRegion(
userID, firstName, lastName, account.Email, scene.RegionInfo.RegionName, regionID, out message); userID, firstName, lastName, account.Email, scene.RegionInfo.RegionName, regionID, out message);

View File

@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
// m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID);
UUID requestedItemId = item.ID; // UUID requestedItemId = item.ID;
item = m_InventoryService.GetItem(item); item = m_InventoryService.GetItem(item);

View File

@ -61,7 +61,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
private bool m_enabled = false; private bool m_enabled = false;
private IMapImageService m_MapService; private IMapImageService m_MapService;
private string m_serverUrl = String.Empty;
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
private int m_refreshtime = 0; private int m_refreshtime = 0;

View File

@ -39,7 +39,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
{ {
public class PresenceDetector public class PresenceDetector
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IPresenceService m_PresenceService; private IPresenceService m_PresenceService;
private Scene m_aScene; private Scene m_aScene;

View File

@ -743,7 +743,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// Corner case. If an autoreturn happens during sim startup // Corner case. If an autoreturn happens during sim startup
// we will come here with the list uninitialized // we will come here with the list uninitialized
// //
int landId = m_landIDList[x, y]; // int landId = m_landIDList[x, y];
// if (landId == 0) // if (landId == 0)
// m_log.DebugFormat( // m_log.DebugFormat(

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_Scene; private Scene m_Scene;
private Dictionary<UUID, PrimCounts> m_PrimCounts = private Dictionary<UUID, PrimCounts> m_PrimCounts =

View File

@ -435,7 +435,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
List<ILandObject> parcels = landChannel.AllParcels(); List<ILandObject> parcels = landChannel.AllParcels();
// Local Map Item Request // Local Map Item Request
int tc = Environment.TickCount;
List<mapItemReply> mapitems = new List<mapItemReply>(); List<mapItemReply> mapitems = new List<mapItemReply>();
mapItemReply mapitem = new mapItemReply(); mapItemReply mapitem = new mapItemReply();
if ((parcels != null) && (parcels.Count >= 1)) if ((parcels != null) && (parcels.Count >= 1))

View File

@ -47,13 +47,11 @@ namespace OpenSim.Region.Framework.Interfaces
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
/// <summary> /// <summary>
/// Attach an object to an avatar. /// Attach an object to an avatar
/// </summary> /// </summary>
/// <param name="controllingClient"></param> /// <param name="remoteClient"></param>
/// <param name="localID"></param> /// <param name="grp"></param>
/// <param name="attachPoint"></param> /// <param name="AttachmentPt"></param>
/// <param name="rot"></param>
/// <param name="attachPos"></param>
/// <param name="silent"></param> /// <param name="silent"></param>
/// <returns>true if the object was successfully attached, false otherwise</returns> /// <returns>true if the object was successfully attached, false otherwise</returns>
bool AttachObject( bool AttachObject(
@ -107,16 +105,16 @@ namespace OpenSim.Region.Framework.Interfaces
/// <summary> /// <summary>
/// Detach the given item to the ground. /// Detach the given item to the ground.
/// </summary> /// </summary>
/// <param name="itemID"></param> /// <param name="sceneObjectID"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient); void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient);
/// <summary> /// <summary>
/// Update the user inventory to show a detach. /// Detach the given item so that it remains in the user's inventory.
/// </summary> /// </summary>
/// <param name="itemID">/param> /// <param name="itemID">/param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient);
/// <summary> /// <summary>
/// Update the position of an attachment. /// Update the position of an attachment.
@ -128,18 +126,10 @@ namespace OpenSim.Region.Framework.Interfaces
/// <summary> /// <summary>
/// Update the user inventory with a changed attachment /// Update the user inventory with a changed attachment
/// </summary> /// </summary>
/// <param name="remoteClient"> /// <param name="remoteClient"></param>
/// A <see cref="IClientAPI"/> /// <param name="grp"></param>
/// </param> /// <param name="itemID"></param>
/// <param name="grp"> /// <param name="agentID"></param>
/// A <see cref="SceneObjectGroup"/>
/// </param>
/// <param name="itemID">
/// A <see cref="UUID"/>
/// </param>
/// <param name="agentID">
/// A <see cref="UUID"/>
/// </param>
void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID); void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID);
} }
} }

View File

@ -0,0 +1,43 @@
/*
* 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 OpenMetaverse.StructuredData;
namespace OpenSim.Region.Framework.Interfaces
{
/// <summary>
/// Add remove or retrieve Simulator Features that will be given to a viewer via the SimulatorFeatures capability.
/// </summary>
public interface ISimulatorFeaturesModule
{
void AddFeature(string name, OSD value);
bool RemoveFeature(string name);
bool TryGetFeature(string name, out OSD value);
OSDMap GetFeatures();
}
}

View File

@ -80,6 +80,26 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="msg">msg to sent</param> /// <param name="msg">msg to sent</param>
void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg);
/// <summary>
/// Delivers the message to a specified object in the region.
/// </summary>
/// <param name='target'>
/// Target.
/// </param>
/// <param name='channel'>
/// Channel.
/// </param>
/// <param name='name'>
/// Name.
/// </param>
/// <param name='id'>
/// Identifier.
/// </param>
/// <param name='msg'>
/// Message.
/// </param>
bool DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg, out string error);
/// <summary> /// <summary>
/// Are there any listen events ready to be dispatched? /// Are there any listen events ready to be dispatched?
/// </summary> /// </summary>

View File

@ -66,12 +66,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Signals whether this entity was in a scene but has since been removed from it. /// Signals whether this entity was in a scene but has since been removed from it.
/// </summary> /// </summary>
public bool IsDeleted public bool IsDeleted { get; protected internal set; }
{
get { return m_isDeleted; }
set { m_isDeleted = value; }
}
protected bool m_isDeleted;
protected Vector3 m_pos; protected Vector3 m_pos;

View File

@ -116,14 +116,13 @@ namespace OpenSim.Region.Framework.Scenes
return priority; return priority;
} }
private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
{ {
// And anything attached to this avatar gets top priority as well // And anything attached to this avatar gets top priority as well
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
{ {
SceneObjectPart sop = (SceneObjectPart)entity; SceneObjectPart sop = (SceneObjectPart)entity;
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
return 1; return 1;
} }
@ -136,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
{ {
SceneObjectPart sop = (SceneObjectPart)entity; SceneObjectPart sop = (SceneObjectPart)entity;
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
return 1; return 1;
} }
@ -149,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
{ {
SceneObjectPart sop = (SceneObjectPart)entity; SceneObjectPart sop = (SceneObjectPart)entity;
if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.AttachedAvatar)
return 1; return 1;
} }

View File

@ -1871,86 +1871,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
{
itemID = UUID.Zero;
if (grp != null)
{
Vector3 inventoryStoredPosition = new Vector3
(((grp.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: grp.AbsolutePosition.X)
,
(grp.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: grp.AbsolutePosition.X,
grp.AbsolutePosition.Z);
Vector3 originalPosition = grp.AbsolutePosition;
grp.AbsolutePosition = inventoryStoredPosition;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
grp.AbsolutePosition = originalPosition;
AssetBase asset = CreateAsset(
grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
AssetService.Store(asset);
InventoryItemBase item = new InventoryItemBase();
item.CreatorId = grp.RootPart.CreatorID.ToString();
item.CreatorData = grp.RootPart.CreatorData;
item.Owner = remoteClient.AgentId;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object);
if (folder != null)
item.Folder = folder.ID;
else // oopsies
item.Folder = UUID.Zero;
if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions())
{
item.BasePermissions = grp.RootPart.NextOwnerMask;
item.CurrentPermissions = grp.RootPart.NextOwnerMask;
item.NextPermissions = grp.RootPart.NextOwnerMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask;
item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask;
}
else
{
item.BasePermissions = grp.RootPart.BaseMask;
item.CurrentPermissions = grp.RootPart.OwnerMask;
item.NextPermissions = grp.RootPart.NextOwnerMask;
item.EveryOnePermissions = grp.RootPart.EveryoneMask;
item.GroupPermissions = grp.RootPart.GroupMask;
}
item.CreationDate = Util.UnixTimeSinceEpoch();
// sets itemID so client can show item as 'attached' in inventory
grp.SetFromItemID(item.ID);
if (AddInventoryItem(item))
remoteClient.SendInventoryItemCreateUpdate(item, 0);
else
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
itemID = item.ID;
return item.AssetID;
}
return UUID.Zero;
}
/// <summary> /// <summary>
/// Event Handler Rez an object into a scene /// Event Handler Rez an object into a scene
/// Calls the non-void event handler /// Calls the non-void event handler

View File

@ -147,15 +147,16 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
/// <value> /// <summary>
/// Is this scene object acting as an attachment? /// Is this scene object acting as an attachment?
/// /// </summary>
/// <remarks>
/// We return false if the group has already been deleted. /// We return false if the group has already been deleted.
/// ///
/// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I /// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I
/// presume either all or no parts in a linkset can be part of an attachment (in which /// presume either all or no parts in a linkset can be part of an attachment (in which
/// case the value would get proprogated down into all the descendent parts). /// case the value would get proprogated down into all the descendent parts).
/// </value> /// </remarks>
public bool IsAttachment public bool IsAttachment
{ {
get get
@ -167,6 +168,52 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// The avatar to which this scene object is attached.
/// </summary>
/// <remarks>
/// If we're not attached to an avatar then this is UUID.Zero
/// </remarks>
public UUID AttachedAvatar { get; set; }
/// <summary>
/// Is this scene object phantom?
/// </summary>
/// <remarks>
/// Updating must currently take place through UpdatePrimFlags()
/// </remarks>
public bool IsPhantom
{
get { return (RootPart.Flags & PrimFlags.Phantom) != 0; }
}
/// <summary>
/// Does this scene object use physics?
/// </summary>
/// <remarks>
/// Updating must currently take place through UpdatePrimFlags()
/// </remarks>
public bool UsesPhysics
{
get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; }
}
/// <summary>
/// Is this scene object temporary?
/// </summary>
/// <remarks>
/// Updating must currently take place through UpdatePrimFlags()
/// </remarks>
public bool IsTemporary
{
get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; }
}
public bool IsVolumeDetect
{
get { return RootPart.VolumeDetectActive; }
}
public float scriptScore; public float scriptScore;
private Vector3 lastPhysGroupPos; private Vector3 lastPhysGroupPos;
@ -940,70 +987,18 @@ namespace OpenSim.Region.Framework.Scenes
return m_rootPart.Shape.State; return m_rootPart.Shape.State;
} }
public void SetAttachmentPoint(byte point)
{
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].SetAttachmentPoint(point);
}
public void ClearPartAttachmentData() public void ClearPartAttachmentData()
{ {
SetAttachmentPoint((Byte)0); SetAttachmentPoint((Byte)0);
} }
public void DetachToGround()
{
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
if (avatar == null)
return;
avatar.RemoveAttachment(this);
Vector3 detachedpos = new Vector3(127f,127f,127f);
if (avatar == null)
return;
detachedpos = avatar.AbsolutePosition;
RootPart.FromItemID = UUID.Zero;
AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(0);
SetAttachmentPoint((byte)0);
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
HasGroupChanged = true;
RootPart.Rezzed = DateTime.Now;
RootPart.RemFlag(PrimFlags.TemporaryOnRez);
AttachToBackup();
m_scene.EventManager.TriggerParcelPrimCountTainted();
m_rootPart.ScheduleFullUpdate();
m_rootPart.ClearUndoState();
}
public void DetachToInventoryPrep()
{
ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar);
//Vector3 detachedpos = new Vector3(127f, 127f, 127f);
if (avatar != null)
{
//detachedpos = avatar.AbsolutePosition;
avatar.RemoveAttachment(this);
}
m_rootPart.AttachedAvatar = UUID.Zero;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(0);
//m_rootPart.SetAttachmentPoint((byte)0);
m_rootPart.IsAttachment = false;
AbsolutePosition = m_rootPart.AttachedPos;
//m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
//AttachToBackup();
//m_rootPart.ScheduleFullUpdate();
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -1510,36 +1505,24 @@ namespace OpenSim.Region.Framework.Scenes
SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed));
} }
public void ScriptSetPhysicsStatus(bool UsePhysics) public void ScriptSetPhysicsStatus(bool usePhysics)
{ {
bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0); UpdatePrimFlags(RootPart.LocalId, usePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
bool IsVolumeDetect = RootPart.VolumeDetectActive;
UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
} }
public void ScriptSetTemporaryStatus(bool TemporaryStatus) public void ScriptSetTemporaryStatus(bool makeTemporary)
{ {
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); UpdatePrimFlags(RootPart.LocalId, UsesPhysics, makeTemporary, IsPhantom, IsVolumeDetect);
bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
bool IsVolumeDetect = RootPart.VolumeDetectActive;
UpdatePrimFlags(RootPart.LocalId, UsePhysics, TemporaryStatus, IsPhantom, IsVolumeDetect);
} }
public void ScriptSetPhantomStatus(bool PhantomStatus) public void ScriptSetPhantomStatus(bool makePhantom)
{ {
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, makePhantom, IsVolumeDetect);
bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
bool IsVolumeDetect = RootPart.VolumeDetectActive;
UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, PhantomStatus, IsVolumeDetect);
} }
public void ScriptSetVolumeDetect(bool VDStatus) public void ScriptSetVolumeDetect(bool makeVolumeDetect)
{ {
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); UpdatePrimFlags(RootPart.LocalId, UsesPhysics, IsTemporary, IsPhantom, makeVolumeDetect);
bool IsTemporary = ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0);
bool IsPhantom = ((RootPart.Flags & PrimFlags.Phantom) != 0);
UpdatePrimFlags(RootPart.LocalId, UsePhysics, IsTemporary, IsPhantom, VDStatus);
/* /*
ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore ScriptSetPhantomStatus(false); // What ever it was before, now it's not phantom anymore
@ -1565,7 +1548,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (IsAttachment) if (IsAttachment)
{ {
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null) if (avatar != null)
{ {
avatar.PushForce(impulse); avatar.PushForce(impulse);
@ -1647,7 +1630,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (IsAttachment) if (IsAttachment)
{ {
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null) if (avatar != null)
{ {
avatar.MoveToTarget(target, false); avatar.MoveToTarget(target, false);
@ -1806,7 +1789,7 @@ namespace OpenSim.Region.Framework.Scenes
// an object has been deleted from a scene before update was processed. // an object has been deleted from a scene before update was processed.
// A more fundamental overhaul of the update mechanism is required to eliminate all // A more fundamental overhaul of the update mechanism is required to eliminate all
// the race conditions. // the race conditions.
if (m_isDeleted) if (IsDeleted)
return; return;
// Even temporary objects take part in physics (e.g. temp-on-rez bullets) // Even temporary objects take part in physics (e.g. temp-on-rez bullets)
@ -2116,7 +2099,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_scene.UnlinkSceneObject(objectGroup, true); m_scene.UnlinkSceneObject(objectGroup, true);
objectGroup.m_isDeleted = true; objectGroup.IsDeleted = true;
objectGroup.m_parts.Clear(); objectGroup.m_parts.Clear();
@ -3347,19 +3330,12 @@ namespace OpenSim.Region.Framework.Scenes
return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);
} }
public void SetAttachmentPoint(byte point)
{
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].SetAttachmentPoint(point);
}
#region ISceneObject #region ISceneObject
public virtual ISceneObject CloneForNewScene() public virtual ISceneObject CloneForNewScene()
{ {
SceneObjectGroup sog = Copy(false); SceneObjectGroup sog = Copy(false);
sog.m_isDeleted = false; sog.IsDeleted = false;
return sog; return sog;
} }

View File

@ -221,9 +221,6 @@ namespace OpenSim.Region.Framework.Scenes
public scriptEvents AggregateScriptEvents; public scriptEvents AggregateScriptEvents;
public UUID AttachedAvatar;
public Vector3 AttachedPos; public Vector3 AttachedPos;
@ -728,7 +725,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsAttachment) if (IsAttachment)
{ {
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); ScenePresence sp = m_parentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
if (sp != null) if (sp != null)
return sp.AbsolutePosition; return sp.AbsolutePosition;
} }

View File

@ -3509,12 +3509,7 @@ namespace OpenSim.Region.Framework.Scenes
public void RemoveAttachment(SceneObjectGroup gobj) public void RemoveAttachment(SceneObjectGroup gobj)
{ {
lock (m_attachments) lock (m_attachments)
{ m_attachments.Remove(gobj);
if (m_attachments.Contains(gobj))
{
m_attachments.Remove(gobj);
}
}
} }
public bool ValidateAttachments() public bool ValidateAttachments()
@ -3525,12 +3520,22 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectGroup gobj in m_attachments) foreach (SceneObjectGroup gobj in m_attachments)
{ {
if (gobj == null) if (gobj == null)
{
m_log.WarnFormat(
"[SCENE PRESENCE]: Failed to validate an attachment for {0} since it was null", Name);
return false; return false;
}
if (gobj.IsDeleted) if (gobj.IsDeleted)
{
m_log.WarnFormat(
"[SCENE PRESENCE]: Failed to validate attachment {0} {1} for {2} since it had been deleted",
gobj.Name, gobj.UUID, Name);
return false; return false;
}
} }
} }
return true; return true;
} }
@ -3804,9 +3809,6 @@ namespace OpenSim.Region.Framework.Scenes
List<AvatarAttachment> attachments = m_appearance.GetAttachments(); List<AvatarAttachment> attachments = m_appearance.GetAttachments();
foreach (AvatarAttachment attach in attachments) foreach (AvatarAttachment attach in attachments)
{ {
if (m_isDeleted)
return;
int p = attach.AttachPoint; int p = attach.AttachPoint;
UUID itemID = attach.ItemID; UUID itemID = attach.ItemID;

View File

@ -126,27 +126,37 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <returns></returns> /// <returns></returns>
public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject)
{
return ToOriginalXmlFormat(sceneObject, true);
}
/// <summary>
/// Serialize a scene object to the original xml format
/// </summary>
/// <param name="sceneObject"></param>
/// <param name="doScriptStates">Control whether script states are also serialized.</para>
/// <returns></returns>
public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, bool doScriptStates)
{ {
using (StringWriter sw = new StringWriter()) using (StringWriter sw = new StringWriter())
{ {
using (XmlTextWriter writer = new XmlTextWriter(sw)) using (XmlTextWriter writer = new XmlTextWriter(sw))
{ {
ToOriginalXmlFormat(sceneObject, writer); ToOriginalXmlFormat(sceneObject, writer, doScriptStates);
} }
return sw.ToString(); return sw.ToString();
} }
} }
/// <summary> /// <summary>
/// Serialize a scene object to the original xml format /// Serialize a scene object to the original xml format
/// </summary> /// </summary>
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <returns></returns> /// <returns></returns>
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates)
{ {
ToOriginalXmlFormat(sceneObject, writer, false); ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
} }
/// <summary> /// <summary>
@ -156,10 +166,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
/// <param name="writer"></param> /// <param name="writer"></param>
/// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param> /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
/// <returns></returns> /// <returns></returns>
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement) public static void ToOriginalXmlFormat(
SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates, bool noRootElement)
{ {
//m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); // m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", sceneObject.Name);
//int time = System.Environment.TickCount; // int time = System.Environment.TickCount;
if (!noRootElement) if (!noRootElement)
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
@ -182,12 +193,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
writer.WriteEndElement(); // OtherParts writer.WriteEndElement(); // OtherParts
sceneObject.SaveScriptedState(writer);
if (doScriptStates)
sceneObject.SaveScriptedState(writer);
if (!noRootElement) if (!noRootElement)
writer.WriteEndElement(); // SceneObjectGroup writer.WriteEndElement(); // SceneObjectGroup
//m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); // m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time);
} }
protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)

View File

@ -58,7 +58,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// </summary> /// </summary>
public interface IScriptInstance public interface IScriptInstance
{ {
/// <summary>
/// Is this script currently running?
/// </summary>
bool Running { get; set; } bool Running { get; set; }
bool ShuttingDown { get; set; } bool ShuttingDown { get; set; }
string State { get; set; } string State { get; set; }
IScriptEngine Engine { get; } IScriptEngine Engine { get; }
@ -78,7 +82,14 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void Init(); void Init();
void Start(); void Start();
/// <summary>
/// Stop the script.
/// </summary>
/// <param name="timeout"></param>
/// <returns>true if the script was successfully stopped, false otherwise</returns>
bool Stop(int timeout); bool Stop(int timeout);
void SetState(string state); void SetState(string state);
void PostEvent(EventParams data); void PostEvent(EventParams data);

View File

@ -843,6 +843,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
} }
public void llRegionSayTo(string target, int channel, string msg)
{
string error = String.Empty;
if (msg.Length > 1023)
msg = msg.Substring(0, 1023);
m_host.AddScriptLPS(1);
UUID TargetID;
UUID.TryParse(target, out TargetID);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
if (wComm != null)
if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error))
LSLError(error);
}
public LSL_Integer llListen(int channelID, string name, string ID, string msg) public LSL_Integer llListen(int channelID, string name, string ID, string msg)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -1601,9 +1619,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tex.FaceTextures[i].RGBA = texcolor; tex.FaceTextures[i].RGBA = texcolor;
} }
} }
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); // In some cases, the default texture can be null, eg when every face
tex.DefaultTexture.RGBA = texcolor; // has a unique texture
if (tex.DefaultTexture != null)
{
texcolor = tex.DefaultTexture.RGBA;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.DefaultTexture.RGBA = texcolor;
}
part.UpdateTexture(tex); part.UpdateTexture(tex);
return; return;
} }
@ -2074,7 +2099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
if (part.ParentGroup.RootPart.AttachmentPoint != 0) if (part.ParentGroup.RootPart.AttachmentPoint != 0)
{ {
ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar);
if (avatar != null) if (avatar != null)
{ {
if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
@ -2218,7 +2243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.IsAttachment) if (m_host.IsAttachment)
{ {
ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.AttachedAvatar); ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
vel = avatar.Velocity; vel = avatar.Velocity;
} }
else else
@ -2939,8 +2964,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
return; // return;
TaskInventoryItem item; TaskInventoryItem item;
@ -3006,7 +3031,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
if (attachmentsModule != null) if (attachmentsModule != null)
attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); attachmentsModule.DetachSingleAttachmentToInv(itemID, presence.ControllingClient);
} }
public void llTakeCamera(string avatar) public void llTakeCamera(string avatar)
@ -3363,7 +3388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.RootPart.AttachedAvatar) if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar)
{ {
// When attached, certain permissions are implicit if requested from owner // When attached, certain permissions are implicit if requested from owner
int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS |
@ -3909,7 +3934,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
GridInstantMessage msg = new GridInstantMessage(World, GridInstantMessage msg = new GridInstantMessage(World,
m_host.UUID, m_host.Name+", an object owned by "+ m_host.UUID, m_host.Name+", an object owned by "+
resolveName(m_host.OwnerID)+",", destId, resolveName(m_host.OwnerID)+",", destId,
(byte)InstantMessageDialog.InventoryOffered, (byte)InstantMessageDialog.TaskInventoryOffered,
false, objName+"\n"+m_host.Name+" is located at "+ false, objName+"\n"+m_host.Name+" is located at "+
World.RegionInfo.RegionName+" "+ World.RegionInfo.RegionName+" "+
m_host.AbsolutePosition.ToString(), m_host.AbsolutePosition.ToString(),
@ -6583,7 +6608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return Util.SHA1Hash(src).ToLower(); return Util.SHA1Hash(src).ToLower();
} }
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
@ -6594,7 +6619,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT; holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT;
} }
shapeBlock.ProfileCurve = (byte)holeshape; shapeBlock.PathCurve = pathcurve;
shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape.
shapeBlock.ProfileCurve += profileshape; // Add in the profile shape.
if (cut.x < 0f) if (cut.x < 0f)
{ {
cut.x = 0f; cut.x = 0f;
@ -6626,9 +6653,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
hollow = 0f; hollow = 0f;
} }
if (hollow > 0.95) // If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a
// Box or Tube) and the hole shape is a square, hollow is limited to
// a max of 70%. The viewer performs its own check on this value but
// we need to do it here also so llGetPrimitiveParams can have access
// to the correct value.
if (profileshape != (byte)ProfileCurve.Square &&
holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE)
{ {
hollow = 0.95f; if (hollow > 0.70f)
{
hollow = 0.70f;
}
}
// Otherwise, hollow is limited to 95%.
else
{
if (hollow > 0.95f)
{
hollow = 0.95f;
}
} }
shapeBlock.ProfileHollow = (ushort)(50000 * hollow); shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
if (twist.x < -1.0f) if (twist.x < -1.0f)
@ -6652,20 +6696,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
shapeBlock.ObjectLocalID = part.LocalId; shapeBlock.ObjectLocalID = part.LocalId;
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SculptEntry = false; part.Shape.SculptEntry = false;
return shapeBlock; return shapeBlock;
} }
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge) // Prim type box, cylinder and prism.
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock; ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
shapeBlock.ProfileCurve += fudge;
if (taper_b.x < 0f) if (taper_b.x < 0f)
{ {
@ -6708,18 +6748,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
} }
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge) // Prim type sphere.
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock; ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
// profile/path swapped for a sphere // profile/path swapped for a sphere
shapeBlock.PathBegin = shapeBlock.ProfileBegin; shapeBlock.PathBegin = shapeBlock.ProfileBegin;
shapeBlock.PathEnd = shapeBlock.ProfileEnd; shapeBlock.PathEnd = shapeBlock.ProfileEnd;
shapeBlock.ProfileCurve += fudge;
shapeBlock.PathScaleX = 100; shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 100; shapeBlock.PathScaleY = 100;
@ -6750,13 +6789,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
} }
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte fudge) // Prim type torus, tube and ring.
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock; ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist); shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
shapeBlock.ProfileCurve += fudge;
// profile/path swapped for a torrus, tube, ring // profile/path swapped for a torrus, tube, ring
shapeBlock.PathBegin = shapeBlock.ProfileBegin; shapeBlock.PathBegin = shapeBlock.ProfileBegin;
@ -6876,7 +6914,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
} }
protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type) // Prim type sculpt.
protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve)
{ {
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock(); ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
UUID sculptId; UUID sculptId;
@ -6889,6 +6928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (sculptId == UUID.Zero) if (sculptId == UUID.Zero)
return; return;
shapeBlock.PathCurve = pathcurve;
shapeBlock.ObjectLocalID = part.LocalId; shapeBlock.ObjectLocalID = part.LocalId;
shapeBlock.PathScaleX = 100; shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150; shapeBlock.PathScaleY = 150;
@ -6902,9 +6942,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
} }
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SetSculptProperties((byte)type, sculptId); part.Shape.SetSculptProperties((byte)type, sculptId);
part.Shape.SculptEntry = true; part.Shape.SculptEntry = true;
part.UpdateShape(shapeBlock); part.UpdateShape(shapeBlock);
@ -7028,8 +7065,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
taper_b = rules.GetVector3Item(idx++); taper_b = rules.GetVector3Item(idx++);
topshear = rules.GetVector3Item(idx++); topshear = rules.GetVector3Item(idx++);
part.Shape.PathCurve = (byte)Extrusion.Straight; SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 1); (byte)ProfileShape.Square, (byte)Extrusion.Straight);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
@ -7042,9 +7079,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
twist = rules.GetVector3Item(idx++); twist = rules.GetVector3Item(idx++);
taper_b = rules.GetVector3Item(idx++); taper_b = rules.GetVector3Item(idx++);
topshear = rules.GetVector3Item(idx++); topshear = rules.GetVector3Item(idx++);
part.Shape.ProfileShape = ProfileShape.Circle; SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
part.Shape.PathCurve = (byte)Extrusion.Straight; (byte)ProfileShape.Circle, (byte)Extrusion.Straight);
SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 0);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_PRISM: case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
@ -7057,8 +7093,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
twist = rules.GetVector3Item(idx++); twist = rules.GetVector3Item(idx++);
taper_b = rules.GetVector3Item(idx++); taper_b = rules.GetVector3Item(idx++);
topshear = rules.GetVector3Item(idx++); topshear = rules.GetVector3Item(idx++);
part.Shape.PathCurve = (byte)Extrusion.Straight; SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 3); (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
@ -7070,8 +7106,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
hollow = (float)rules.GetLSLFloatItem(idx++); hollow = (float)rules.GetLSLFloatItem(idx++);
twist = rules.GetVector3Item(idx++); twist = rules.GetVector3Item(idx++);
taper_b = rules.GetVector3Item(idx++); // dimple taper_b = rules.GetVector3Item(idx++); // dimple
part.Shape.PathCurve = (byte)Extrusion.Curve1; SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b,
SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 5); (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_TORUS: case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
@ -7089,9 +7125,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
revolutions = (float)rules.GetLSLFloatItem(idx++); revolutions = (float)rules.GetLSLFloatItem(idx++);
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 0); revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_TUBE: case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@ -7109,9 +7144,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
revolutions = (float)rules.GetLSLFloatItem(idx++); revolutions = (float)rules.GetLSLFloatItem(idx++);
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 1); revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_RING: case (int)ScriptBaseClass.PRIM_TYPE_RING:
@ -7129,9 +7163,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
revolutions = (float)rules.GetLSLFloatItem(idx++); revolutions = (float)rules.GetLSLFloatItem(idx++);
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 3); revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@ -7140,8 +7173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string map = rules.Data[idx++].ToString(); string map = rules.Data[idx++].ToString();
face = (int)rules.GetLSLIntegerItem(idx++); // type face = (int)rules.GetLSLIntegerItem(idx++); // type
part.Shape.PathCurve = (byte)Extrusion.Curve1; SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1);
SetPrimitiveShapeParams(part, map, face);
break; break;
} }
@ -7428,7 +7460,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Quaternion q; Quaternion q;
if (m_host.ParentGroup.RootPart.AttachmentPoint != 0) if (m_host.ParentGroup.RootPart.AttachmentPoint != 0)
{ {
ScenePresence avatar = World.GetScenePresence(m_host.AttachedAvatar); ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
if (avatar != null) if (avatar != null)
if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
q = avatar.CameraRotation; // Mouselook q = avatar.CameraRotation; // Mouselook
@ -10486,12 +10518,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NotImplemented("llGetUsedMemory"); NotImplemented("llGetUsedMemory");
} }
public void llRegionSayTo(LSL_Key target, LSL_Integer channel, LSL_String msg)
{
m_host.AddScriptLPS(1);
NotImplemented("llRegionSayTo");
}
public void llScriptProfiler(LSL_Integer flags) public void llScriptProfiler(LSL_Integer flags)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);

View File

@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// In attachments, the sensor cone always orients with the // In attachments, the sensor cone always orients with the
// avatar rotation. This may include a nonzero elevation if // avatar rotation. This may include a nonzero elevation if
// in mouselook. // in mouselook.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar); ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
q = avatar.Rotation; q = avatar.Rotation;
} }
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
@ -428,7 +428,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// In attachments, the sensor cone always orients with the // In attachments, the sensor cone always orients with the
// avatar rotation. This may include a nonzero elevation if // avatar rotation. This may include a nonzero elevation if
// in mouselook. // in mouselook.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar); ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
q = avatar.Rotation; q = avatar.Rotation;
} }

View File

@ -271,6 +271,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local); void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local);
void llRefreshPrimURL(); void llRefreshPrimURL();
void llRegionSay(int channelID, string text); void llRegionSay(int channelID, string text);
void llRegionSayTo(string target, int channelID, string text);
void llReleaseCamera(string avatar); void llReleaseCamera(string avatar);
void llReleaseControls(); void llReleaseControls();
void llReleaseURL(string url); void llReleaseURL(string url);

View File

@ -1199,6 +1199,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llRegionSay(channelID, text); m_LSL_Functions.llRegionSay(channelID, text);
} }
public void llRegionSayTo(string key, int channelID, string text)
{
m_LSL_Functions.llRegionSayTo(key, channelID, text);
}
public void llReleaseCamera(string avatar) public void llReleaseCamera(string avatar)
{ {
m_LSL_Functions.llReleaseCamera(avatar); m_LSL_Functions.llReleaseCamera(avatar);

View File

@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_MaxScriptQueue = maxScriptQueue; m_MaxScriptQueue = maxScriptQueue;
m_stateSource = stateSource; m_stateSource = stateSource;
m_postOnRez = postOnRez; m_postOnRez = postOnRez;
m_AttachedAvatar = part.AttachedAvatar; m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
if (part != null) if (part != null)

View File

@ -182,6 +182,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Vector3.Zero) { Name = obj1Name, UUID = objUuid }; Vector3.Zero) { Name = obj1Name, UUID = objUuid };
Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
// Note that prim hollow check is passed with the other prim params in order to allow the
// specification of a different check value from the prim param. A cylinder, prism, sphere,
// torus or ring, with a hole shape of square, is limited to a hollow of 70%. Test 5 below
// specifies a value of 95% and checks to see if 70% was properly returned.
// Test a sphere. // Test a sphere.
CheckllSetPrimitiveParams( CheckllSetPrimitiveParams(
"test 1", // Prim test identification string "test 1", // Prim test identification string
@ -191,7 +196,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut
0.80d, // Prim hollow 0.80d, // Prim hollow
new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple new LSL_Types.Vector3(0.32d, 0.76d, 0.0d), // Prim dimple
0.80d); // Prim hollow check
// Test a prism. // Test a prism.
CheckllSetPrimitiveParams( CheckllSetPrimitiveParams(
@ -203,7 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
0.90d, // Prim hollow 0.90d, // Prim hollow
new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper
new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
0.90d); // Prim hollow check
// Test a box. // Test a box.
CheckllSetPrimitiveParams( CheckllSetPrimitiveParams(
@ -212,10 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
ScriptBaseClass.PRIM_TYPE_BOX, // Prim type ScriptBaseClass.PRIM_TYPE_BOX, // Prim type
ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type
new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
0.90d, // Prim hollow 0.95d, // Prim hollow
new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist
new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper
new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
0.95d); // Prim hollow check
// Test a tube. // Test a tube.
CheckllSetPrimitiveParams( CheckllSetPrimitiveParams(
@ -232,13 +240,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper
1.0d, // Prim revolutions 1.0d, // Prim revolutions
1.0d, // Prim radius 1.0d, // Prim radius
0.0d); // Prim skew 0.0d, // Prim skew
0.00d); // Prim hollow check
// Test a prism.
CheckllSetPrimitiveParams(
"test 5", // Prim test identification string
new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size
ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type
ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type
new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
0.95d, // Prim hollow
new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist
new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper
new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
0.70d); // Prim hollow check
// Test a sculpted prim.
CheckllSetPrimitiveParams(
"test 6", // Prim test identification string
new LSL_Types.Vector3(2.0d, 2.0d, 2.0d), // Prim size
ScriptBaseClass.PRIM_TYPE_SCULPT, // Prim type
"be293869-d0d9-0a69-5989-ad27f1946fd4", // Prim map
ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE); // Prim sculpt type
} }
// Set prim params for a box, cylinder or prism and check results. // Set prim params for a box, cylinder or prism and check results.
public void CheckllSetPrimitiveParams(string primTest, public void CheckllSetPrimitiveParams(string primTest,
LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear,
double primHollowCheck)
{ {
// Set the prim params. // Set the prim params.
m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@ -256,7 +287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
"TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
"TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper");
@ -266,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Set prim params for a sphere and check results. // Set prim params for a sphere and check results.
public void CheckllSetPrimitiveParams(string primTest, public void CheckllSetPrimitiveParams(string primTest,
LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck)
{ {
// Set the prim params. // Set the prim params.
m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@ -284,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
"TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
"TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple");
@ -295,7 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut,
double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize,
LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper,
double primRev, double primRadius, double primSkew) double primRev, double primRadius, double primSkew, double primHollowCheck)
{ {
// Set the prim params. // Set the prim params.
m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
@ -314,7 +345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2),
"TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); "TestllSetPrimitiveParams " + primTest + " prim hole default check fail");
CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut");
Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY,
"TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); "TestllSetPrimitiveParams " + primTest + " prim hollow check fail");
CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist");
CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size");
@ -329,6 +360,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
"TestllSetPrimitiveParams " + primTest + " prim skew fail"); "TestllSetPrimitiveParams " + primTest + " prim skew fail");
} }
// Set prim params for a sculpted prim and check results.
public void CheckllSetPrimitiveParams(string primTest,
LSL_Types.Vector3 primSize, int primType, string primMap, int primSculptType)
{
// Set the prim params.
m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize,
ScriptBaseClass.PRIM_TYPE, primType, primMap, primSculptType));
// Get params for prim to validate settings.
LSL_Types.list primParams =
m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE));
// Validate settings.
CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size");
Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1),
"TestllSetPrimitiveParams " + primTest + " prim type check fail");
Assert.AreEqual(primMap, (string)m_lslApi.llList2String(primParams, 2),
"TestllSetPrimitiveParams " + primTest + " prim map check fail");
Assert.AreEqual(primSculptType, m_lslApi.llList2Integer(primParams, 3),
"TestllSetPrimitiveParams " + primTest + " prim type scuplt check fail");
}
public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg)
{ {
// Check each vector component against expected result. // Check each vector component against expected result.

View File

@ -1294,9 +1294,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public string GetXMLState(UUID itemID) public string GetXMLState(UUID itemID)
{ {
// m_log.DebugFormat("[XEngine]: Getting XML state for {0}", itemID);
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);
if (instance == null) if (instance == null)
{
// m_log.DebugFormat("[XEngine]: Found no script for {0}, returning empty string", itemID);
return ""; return "";
}
string xml = instance.GetXMLState(); string xml = instance.GetXMLState();
XmlDocument sdoc = new XmlDocument(); XmlDocument sdoc = new XmlDocument();
@ -1437,6 +1443,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
mapData.InnerText = map; mapData.InnerText = map;
stateData.AppendChild(mapData); stateData.AppendChild(mapData);
// m_log.DebugFormat("[XEngine]: Got XML state for {0}", itemID);
return doc.InnerXml; return doc.InnerXml;
} }

View File

@ -42,15 +42,13 @@ namespace OpenSim.Services.AuthenticationService
public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_config;
private Dictionary<string, IAuthenticationService> m_svcChecks private Dictionary<string, IAuthenticationService> m_svcChecks
= new Dictionary<string, IAuthenticationService>(); = new Dictionary<string, IAuthenticationService>();
public WebkeyOrPasswordAuthenticationService(IConfigSource config) public WebkeyOrPasswordAuthenticationService(IConfigSource config)
: base(config) : base(config)
{ {
this.m_config = config;
m_svcChecks["web_login_key"] = new WebkeyAuthenticationService(config); m_svcChecks["web_login_key"] = new WebkeyAuthenticationService(config);
m_svcChecks["password"] = new PasswordAuthenticationService(config); m_svcChecks["password"] = new PasswordAuthenticationService(config);
} }

View File

@ -203,6 +203,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService"
;; Ask co-operative viewers to use a different currency name
;Currency = "" ;Currency = ""
WelcomeMessage = "Welcome, Avatar!" WelcomeMessage = "Welcome, Avatar!"

View File

@ -188,6 +188,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService" LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService"
FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService"
;; Ask co-operative viewers to use a different currency name
;Currency = "" ;Currency = ""
WelcomeMessage = "Welcome, Avatar!" WelcomeMessage = "Welcome, Avatar!"

View File

@ -97,25 +97,26 @@
SRV_FriendsServerURI = "http://127.0.0.1:9000" SRV_FriendsServerURI = "http://127.0.0.1:9000"
SRV_IMServerURI = "http://127.0.0.1:9000" SRV_IMServerURI = "http://127.0.0.1:9000"
;; For Viewer 2 ;; For Viewer 2
MapTileURL = "http://127.0.0.1:9000/" MapTileURL = "http://127.0.0.1:9000/"
;; Ask co-operative viewers to use a different currency name
;Currency = "" ;Currency = ""
;; Regular expressions for controlling which client versions are accepted/denied. ;; Regular expressions for controlling which client versions are accepted/denied.
;; An empty string means nothing is checked. ;; An empty string means nothing is checked.
;; ;;
;; Example 1: allow only these 3 types of clients (any version of them) ;; Example 1: allow only these 3 types of clients (any version of them)
;; AllowedClients = "Imprudence|Hippo|Second Life" ;; AllowedClients = "Imprudence|Hippo|Second Life"
;; ;;
;; Example 2: allow all clients except these ;; Example 2: allow all clients except these
;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald"
;; ;;
;; Note that these are regular expressions, so every character counts. ;; Note that these are regular expressions, so every character counts.
;; Also note that this is very weak security and should not be trusted as a reliable means ;; Also note that this is very weak security and should not be trusted as a reliable means
;; for keeping bad clients out; modified clients can fake their identifiers. ;; for keeping bad clients out; modified clients can fake their identifiers.
;; ;;
;; ;;
;AllowedClients = "" ;AllowedClients = ""
;DeniedClients = "" ;DeniedClients = ""