From e078fb2e713fd20c811bd8a12a914042fdf062ee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 Nov 2009 19:23:51 +0000 Subject: Implement god mode user freezing and unfreezing See http://opensimulator.org/mantis/view.php?id=4356 Thanks Revolution I performed a subsequent probable bug fix in this patch --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- .../Region/CoreModules/Avatar/Gods/GodsModule.cs | 71 ++++++++++++++-------- 2 files changed, 45 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4221212..c2aa8e2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -13610,7 +13610,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (handlerGodKickUser != null) { handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, - gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason); + gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason,gkupack.UserInfo); } } else diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 273c128..7e1bed5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods /// The person doing the kicking /// The session of the person doing the kicking /// the person that is being kicked - /// This isn't used apparently + /// Tells what to do to the user /// The message to send to the user after it's been turned into a field public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) { @@ -110,39 +110,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods { if (m_scene.Permissions.IsGod(godID)) { - if (agentID == kickUserID) + if (kickflags == 0) { - string reasonStr = Utils.BytesToString(reason); + if (agentID == kickUserID) + { + string reasonStr = Utils.BytesToString(reason); - m_scene.ForEachClient( - delegate(IClientAPI controller) - { - if (controller.AgentId != godID) - controller.Kick(reasonStr); - } - ); + m_scene.ForEachClient( + delegate(IClientAPI controller) + { + if (controller.AgentId != godID) + controller.Kick(reasonStr); + } + ); - // This is a bit crude. It seems the client will be null before it actually stops the thread - // The thread will kill itself eventually :/ - // Is there another way to make sure *all* clients get this 'inter region' message? - m_scene.ForEachScenePresence( - delegate(ScenePresence p) - { - if (p.UUID != godID && !p.IsChildAgent) + // This is a bit crude. It seems the client will be null before it actually stops the thread + // The thread will kill itself eventually :/ + // Is there another way to make sure *all* clients get this 'inter region' message? + m_scene.ForEachScenePresence( + delegate(ScenePresence p) { - // Possibly this should really be p.Close() though that method doesn't send a close - // to the client - p.ControllingClient.Close(); + if (p.UUID != godID && !p.IsChildAgent) + { + // Possibly this should really be p.Close() though that method doesn't send a close + // to the client + p.ControllingClient.Close(); + } } - } - ); + ); + } + else + { + m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent); + + sp.ControllingClient.Kick(Utils.BytesToString(reason)); + sp.ControllingClient.Close(); + } } - else + + if (kickflags == 1) { - m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent); - - sp.ControllingClient.Kick(Utils.BytesToString(reason)); - sp.ControllingClient.Close(); + sp.AllowMovement = false; + m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); + m_dialogModule.SendAlertToUser(godID, "User Frozen"); + } + + if (kickflags == 2) + { + sp.AllowMovement = true; + m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); + m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); } } else -- cgit v1.1