mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Merge branch 'opensim-master' into dev-appearance
This commit is contained in:
@@ -292,6 +292,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
|
||||
public event ChatFromClientEvent OnChatFromClient;
|
||||
|
||||
/// <summary>
|
||||
/// ChatToClientsEvent is triggered via ChatModule (or
|
||||
/// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
|
||||
/// received chat message if they satisfy various conditions (within audible range, etc.)
|
||||
/// </summary>
|
||||
public delegate void ChatToClientsEvent(
|
||||
UUID senderID, HashSet<UUID> receiverIDs,
|
||||
string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
|
||||
ChatSourceType src, ChatAudibleLevel level);
|
||||
public event ChatToClientsEvent OnChatToClients;
|
||||
|
||||
/// <summary>
|
||||
/// ChatBroadcastEvent is called via Scene when a broadcast chat message
|
||||
/// from world comes in
|
||||
@@ -1603,6 +1614,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnChatToClients(
|
||||
UUID senderID, HashSet<UUID> receiverIDs,
|
||||
string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
|
||||
ChatSourceType src, ChatAudibleLevel level)
|
||||
{
|
||||
ChatToClientsEvent handler = OnChatToClients;
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (ChatToClientsEvent d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
|
||||
{
|
||||
|
||||
@@ -593,8 +593,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||
|
||||
StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity);
|
||||
|
||||
// Old
|
||||
/*
|
||||
m_simulatorVersion = simulatorVersion
|
||||
@@ -2390,7 +2388,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[SCENE]: Problem casting object: {0}", e.Message);
|
||||
m_log.WarnFormat("[SCENE]: Problem casting object: " + e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3273,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Do the work necessary to initiate a new user connection for a particular scene.
|
||||
/// At the moment, this consists of setting up the caps infrastructure
|
||||
@@ -3285,6 +3282,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns>True if the region accepts this agent. False if it does not. False will
|
||||
/// also return a reason.</returns>
|
||||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
|
||||
{
|
||||
return NewUserConnection(agent, teleportFlags, out reason, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do the work necessary to initiate a new user connection for a particular scene.
|
||||
/// At the moment, this consists of setting up the caps infrastructure
|
||||
/// The return bool should allow for connections to be refused, but as not all calling paths
|
||||
/// take proper notice of it let, we allowed banned users in still.
|
||||
/// </summary>
|
||||
/// <param name="agent">CircuitData of the agent who is connecting</param>
|
||||
/// <param name="reason">Outputs the reason for the false response on this string</param>
|
||||
/// <param name="requirePresenceLookup">True for normal presence. False for NPC
|
||||
/// or other applications where a full grid/Hypergrid presence may not be required.</param>
|
||||
/// <returns>True if the region accepts this agent. False if it does not. False will
|
||||
/// also return a reason.</returns>
|
||||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
|
||||
{
|
||||
bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
|
||||
(teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
|
||||
@@ -3334,16 +3348,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (sp == null) // We don't have an [child] agent here already
|
||||
{
|
||||
|
||||
try
|
||||
if (requirePresenceLookup)
|
||||
{
|
||||
if (!VerifyUserPresence(agent, out reason))
|
||||
try
|
||||
{
|
||||
if (!VerifyUserPresence(agent, out reason))
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
@@ -3353,7 +3369,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message);
|
||||
m_log.ErrorFormat("[CONNECTION BEGIN]: Exception authorizing user " + e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
|
||||
{
|
||||
EntityBase entity;
|
||||
if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
|
||||
if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
|
||||
return false;
|
||||
|
||||
SceneObjectGroup grp = (SceneObjectGroup)entity;
|
||||
|
||||
if (entity == null)
|
||||
return false;
|
||||
|
||||
if (!resultOfObjectLinked)
|
||||
{
|
||||
m_numPrim -= grp.PrimCount;
|
||||
|
||||
@@ -804,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||
{
|
||||
byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
|
||||
shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
|
||||
shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
|
||||
}
|
||||
|
||||
private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||
@@ -1426,7 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
reader.ReadStartElement(name);
|
||||
vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
|
||||
vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y
|
||||
vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
|
||||
vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
|
||||
reader.ReadEndElement();
|
||||
|
||||
@@ -1501,15 +1501,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
reader.ReadStartElement(name, String.Empty); // Shape
|
||||
|
||||
string nodeName = string.Empty;
|
||||
while (reader.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
nodeName = reader.Name;
|
||||
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
|
||||
ShapeXmlProcessor p = null;
|
||||
if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p))
|
||||
p(shape, reader);
|
||||
{
|
||||
try
|
||||
{
|
||||
p(shape, reader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing Shape {0}: {1}", nodeName, e);
|
||||
if (reader.NodeType == XmlNodeType.EndElement)
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
|
||||
// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name);
|
||||
reader.ReadOuterXml();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private int m_activeScripts = 0;
|
||||
private int m_scriptLinesPerSecond = 0;
|
||||
|
||||
private int objectCapacity = 45000;
|
||||
private int m_objectCapacity = 45000;
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
@@ -124,6 +124,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_scene = scene;
|
||||
ReportingRegion = scene.RegionInfo;
|
||||
|
||||
m_objectCapacity = scene.RegionInfo.ObjectCapacity;
|
||||
m_report.AutoReset = true;
|
||||
m_report.Interval = statsUpdatesEveryMS;
|
||||
m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
|
||||
@@ -271,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
SimStats simStats
|
||||
= new SimStats(
|
||||
ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID);
|
||||
ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID);
|
||||
|
||||
handlerSendStatResult = OnSendStatsResult;
|
||||
if (handlerSendStatResult != null)
|
||||
@@ -435,11 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_activeScripts = count;
|
||||
}
|
||||
|
||||
public void SetObjectCapacity(int objects)
|
||||
{
|
||||
objectCapacity = objects;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is for llGetRegionFPS
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user