From 960b7e93b1fd48f240a11343716dc0be7e7b782d Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Fri, 4 Jan 2008 02:24:05 +0000
Subject: * Added the ability for estate managers to use the magic secondlife
blue card of death to send out region and estate messages. * Switched over
Region Restart notices to the magic secondlife blue card of death method.
---
OpenSim/Region/ClientStack/ClientView.cs | 35 +++++++--
OpenSim/Region/Environment/EstateManager.cs | 32 +++++++-
OpenSim/Region/Environment/Scenes/Scene.cs | 91 ++++++++++++++++------
OpenSim/Region/Environment/Scenes/SceneBase.cs | 5 +-
.../Region/Examples/SimpleApp/MyNpcCharacter.cs | 3 +
5 files changed, 133 insertions(+), 33 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 7bdbb67..c2c514e 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -134,6 +134,14 @@ namespace OpenSim.Region.ClientStack
}
///
+ /// This is a utility method used by single states to not duplicate kicks and blue card of death messages.
+ ///
+ public bool ChildAgentStatus()
+ {
+ return m_scene.PresenceChildStatus(AgentId);
+ }
+
+ ///
/// First name of the agent/avatar represented by the client
///
public string FirstName
@@ -257,13 +265,16 @@ namespace OpenSim.Region.ClientStack
public void Kick(string message)
{
- KickUserPacket kupack = (KickUserPacket) PacketPool.Instance.GetPacket(PacketType.KickUser);
- kupack.UserInfo.AgentID = AgentId;
- kupack.UserInfo.SessionID = SessionId;
- kupack.TargetBlock.TargetIP = (uint) 0;
- kupack.TargetBlock.TargetPort = (ushort) 0;
- kupack.UserInfo.Reason = Helpers.StringToField(message);
- OutPacket(kupack, ThrottleOutPacketType.Task);
+ if (!ChildAgentStatus())
+ {
+ KickUserPacket kupack = (KickUserPacket)PacketPool.Instance.GetPacket(PacketType.KickUser);
+ kupack.UserInfo.AgentID = AgentId;
+ kupack.UserInfo.SessionID = SessionId;
+ kupack.TargetBlock.TargetIP = (uint)0;
+ kupack.TargetBlock.TargetPort = (ushort)0;
+ kupack.UserInfo.Reason = Helpers.StringToField(message);
+ OutPacket(kupack, ThrottleOutPacketType.Task);
+ }
}
public void Stop()
@@ -2786,7 +2797,7 @@ namespace OpenSim.Region.ClientStack
{
ObjectAddPacket addPacket = (ObjectAddPacket) Pack;
PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
- MainLog.Instance.Verbose("REZData", addPacket.ToString());
+ // MainLog.Instance.Verbose("REZData", addPacket.ToString());
//BypassRaycast: 1
//RayStart: <69.79469, 158.2652, 98.40343>
//RayEnd: <61.97724, 141.995, 92.58341>
@@ -3585,6 +3596,14 @@ namespace OpenSim.Region.ClientStack
return shape;
}
+ public void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
+ {
+ if (!ChildAgentStatus())
+ SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)1, (uint)Util.UnixTimeSinceEpoch());
+
+ //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch());
+ }
+
public void SendLogoutPacket()
{
LogoutReplyPacket logReply = (LogoutReplyPacket) PacketPool.Instance.GetPacket(PacketType.LogoutReply);
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 1367cb3..64b9d78 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -198,18 +198,48 @@ namespace OpenSim.Region.Environment
EstateChangeCovenant(packet);
}
break;
- case "estateaccessdelta":
+ case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
{
estateAccessDelta(remote_client, packet);
}
break;
+ case "simulatormessage":
+ if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
+ {
+ SendSimulatorBlueBoxMessage(remote_client, packet);
+ }
+ break;
+ case "instantmessage":
+ if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
+ {
+ SendEstateBlueBoxMessage(remote_client, packet);
+ }
+ break;
default:
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
break;
}
}
+ private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, EstateOwnerMessagePacket packet)
+ {
+ LLUUID invoice = packet.MethodData.Invoice;
+ LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
+ string SenderName = Helpers.FieldToUTF8String(packet.ParamList[3].Parameter);
+ string Message = Helpers.FieldToUTF8String(packet.ParamList[4].Parameter);
+ m_scene.SendRegionMessageFromEstateTools(SenderID, packet.AgentData.SessionID, SenderName, Message);
+
+ }
+ private void SendEstateBlueBoxMessage(IClientAPI remote_client, EstateOwnerMessagePacket packet)
+ {
+ LLUUID invoice = packet.MethodData.Invoice;
+ LLUUID SenderID = packet.AgentData.AgentID;
+ string SenderName = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter);
+ string Message = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter);
+ m_scene.SendEstateMessageFromEstateTools(SenderID, packet.AgentData.SessionID, SenderName, Message);
+
+ }
private void sendDetailedEstateData(IClientAPI remote_client, EstateOwnerMessagePacket packet)
{
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 8032502..0a8df98 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -389,7 +389,8 @@ namespace OpenSim.Region.Environment.Scenes
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds/60) + " minutes");
m_restartTimer.Start();
- SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes");
+ SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), "", RegionInfo.RegionName + ": Restarting in 2 Minutes");
+ //SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes");
}
}
@@ -403,8 +404,11 @@ namespace OpenSim.Region.Environment.Scenes
if (m_RestartTimerCounter <= m_incrementsof15seconds)
{
if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
- SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) +
- " seconds");
+ SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), "", RegionInfo.RegionName + ": Restarting in " +
+ ((8 - m_RestartTimerCounter) * 15) + " seconds");
+
+ // SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) +
+ //" seconds");
}
else
{
@@ -1813,13 +1817,54 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- ///
+ /// Sends a Big Blue Box message on the upper right of the screen to the client
+ /// for all agents in the region
///
- ///
- ///
- ///
- ///
- ///
+ /// The person sending the message
+ /// The session of the person sending the message
+ /// The name of the person doing the sending
+ /// The Message being sent to the user
+ public void SendRegionMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
+ {
+
+ List presenceList = GetScenePresences();
+
+ foreach (ScenePresence presence in presenceList)
+ {
+ if (!presence.IsChildAgent)
+ presence.ControllingClient.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message);
+ }
+ }
+
+ ///
+ /// Sends a Big Blue Box message on the upper right of the screen to the client
+ /// for all agents in the estate
+ ///
+ /// The person sending the message
+ /// The session of the person sending the message
+ /// The name of the person doing the sending
+ /// The Message being sent to the user
+ public void SendEstateMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
+ {
+
+ ClientManager.ForEachClient(delegate(IClientAPI controller)
+ {
+ controller.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message);
+ }
+ );
+ }
+
+ ///
+ /// Kicks User specified from the simulator. This logs them off of the grid
+ /// If the client gets the UUID: 44e87126e7944ded05b37c42da3d5cdb it assumes
+ /// that you're kicking it even if the avatar's UUID isn't the UUID that the
+ /// agent is assigned
+ ///
+ /// The person doing the kicking
+ /// The session of the person doing the kicking
+ /// the person that is being kicked
+ /// This isn't used apparently
+ /// The message to send to the user after it's been turned into a field
public void handleGodlikeKickUser(LLUUID godID, LLUUID sessionID, LLUUID agentID, uint kickflags, byte[] reason)
{
// For some reason the client sends this seemingly hard coded UUID for kicking everyone. Dun-know.
@@ -1832,22 +1877,11 @@ namespace OpenSim.Region.Environment.Scenes
{
ClientManager.ForEachClient(delegate(IClientAPI controller)
{
- ScenePresence p = GetScenePresence(controller.AgentId);
- bool childagent = !p.Equals(null) && p.IsChildAgent;
- if (controller.AgentId != godID && !childagent)
- // Do we really want to kick the initiator of this madness?
- {
+ if (controller.AgentId != godID)
controller.Kick(Helpers.FieldToUTF8String(reason));
- if (childagent)
- {
- m_innerScene.removeUserCount(false);
- }
- else
- {
- m_innerScene.removeUserCount(true);
- }
- }
+
+
}
);
// This is a bit crude. It seems the client will be null before it actually stops the thread
@@ -2200,6 +2234,17 @@ namespace OpenSim.Region.Environment.Scenes
}
///
+ /// Request an Avatar's Child Status - used by ClientView when a 'kick everyone' or 'estate message' occurs
+ ///
+ /// AvatarID to lookup
+ ///
+ public bool PresenceChildStatus(LLUUID avatarID)
+ {
+ ScenePresence cp = GetScenePresence(avatarID);
+ return cp.IsChildAgent;
+ }
+
+ ///
///
///
///
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index fe8f8da..bf8bedc 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -157,7 +157,10 @@ namespace OpenSim.Region.Environment.Scenes
OnRestart(RegionInfo);
}
-
+ public virtual bool PresenceChildStatus(LLUUID avatarID)
+ {
+ return false;
+ }
public abstract bool OtherRegionUp(RegionInfo thisRegion);
#endregion
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index b6db4cc..809a13b 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -493,7 +493,10 @@ namespace SimpleApp
get { return m_circuitCode; }
set { m_circuitCode = value; }
}
+ public void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
+ {
+ }
public void SendLogoutPacket()
{
}
--
cgit v1.1