* 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.
afrisby
Teravus Ovares 2008-01-04 02:24:05 +00:00
parent 42e129cb33
commit 960b7e93b1
7 changed files with 138 additions and 33 deletions

View File

@ -618,6 +618,9 @@ namespace OpenSim.Framework
event ViewerEffectEventHandler OnViewerEffect;
event Action<IClientAPI> OnLogout;
event Action<IClientAPI> OnConnectionClosed;
void SendBlueBoxMessage(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message);
void SendLogoutPacket();
}
}

View File

@ -55,6 +55,8 @@ namespace OpenSim.Framework
RegionInfo RegionInfo { get; }
uint NextLocalId { get; }
bool PresenceChildStatus(LLUUID avatarID);
RegionStatus Region_Status { get; set; }
ClientManager ClientManager { get; }

View File

@ -133,6 +133,14 @@ namespace OpenSim.Region.ClientStack
get { return m_agentId; }
}
/// <summary>
/// This is a utility method used by single states to not duplicate kicks and blue card of death messages.
/// </summary>
public bool ChildAgentStatus()
{
return m_scene.PresenceChildStatus(AgentId);
}
/// <summary>
/// First name of the agent/avatar represented by the client
/// </summary>
@ -256,6 +264,8 @@ namespace OpenSim.Region.ClientStack
}
public void Kick(string message)
{
if (!ChildAgentStatus())
{
KickUserPacket kupack = (KickUserPacket)PacketPool.Instance.GetPacket(PacketType.KickUser);
kupack.UserInfo.AgentID = AgentId;
@ -265,6 +275,7 @@ namespace OpenSim.Region.ClientStack
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);

View File

@ -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)
{

View File

@ -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
}
/// <summary>
///
/// Sends a Big Blue Box message on the upper right of the screen to the client
/// for all agents in the region
/// </summary>
/// <param name="godID"></param>
/// <param name="sessionID"></param>
/// <param name="agentID"></param>
/// <param name="kickflags"></param>
/// <param name="reason"></param>
/// <param name="FromAvatarID">The person sending the message</param>
/// <param name="fromSessionID">The session of the person sending the message</param>
/// <param name="FromAvatarName">The name of the person doing the sending</param>
/// <param name="Message">The Message being sent to the user</param>
public void SendRegionMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
{
List<ScenePresence> presenceList = GetScenePresences();
foreach (ScenePresence presence in presenceList)
{
if (!presence.IsChildAgent)
presence.ControllingClient.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message);
}
}
/// <summary>
/// Sends a Big Blue Box message on the upper right of the screen to the client
/// for all agents in the estate
/// </summary>
/// <param name="FromAvatarID">The person sending the message</param>
/// <param name="fromSessionID">The session of the person sending the message</param>
/// <param name="FromAvatarName">The name of the person doing the sending</param>
/// <param name="Message">The Message being sent to the user</param>
public void SendEstateMessageFromEstateTools(LLUUID FromAvatarID, LLUUID fromSessionID, String FromAvatarName, String Message)
{
ClientManager.ForEachClient(delegate(IClientAPI controller)
{
controller.SendBlueBoxMessage(FromAvatarID, fromSessionID, FromAvatarName, Message);
}
);
}
/// <summary>
/// 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
/// </summary>
/// <param name="godID">The person doing the kicking</param>
/// <param name="sessionID">The session of the person doing the kicking</param>
/// <param name="agentID">the person that is being kicked</param>
/// <param name="kickflags">This isn't used apparently</param>
/// <param name="reason">The message to send to the user after it's been turned into a field</param>
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
@ -2199,6 +2233,17 @@ namespace OpenSim.Region.Environment.Scenes
return m_innerScene.GetScenePresence(avatarID);
}
/// <summary>
/// Request an Avatar's Child Status - used by ClientView when a 'kick everyone' or 'estate message' occurs
/// </summary>
/// <param name="avatarID">AvatarID to lookup</param>
/// <returns></returns>
public bool PresenceChildStatus(LLUUID avatarID)
{
ScenePresence cp = GetScenePresence(avatarID);
return cp.IsChildAgent;
}
/// <summary>
///
/// </summary>

View File

@ -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

View File

@ -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()
{
}