From 55e7e7fc744f645945d458829b32ee718943112c Mon Sep 17 00:00:00 2001
From: Dahlia Trimble
Date: Sun, 22 Jun 2008 04:36:34 +0000
Subject: Added an experimental "kickuser" console command to log off a user by
 name.

---
 OpenSim/Region/Application/OpenSim.cs | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 4e69b9e..600566b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -254,6 +254,7 @@ namespace OpenSim
                     m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim");
                     m_console.Notice("export-map [filename] - save image of world map");
                     m_console.Notice("force-update - force an update of prims in the scene");
+                    m_console.Notice("kickuser [first] [last] - attempts to log off a user from any region we are serving");
                     m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)");
                     m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
                     m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
@@ -534,6 +535,36 @@ namespace OpenSim
                         }
                     }
                     break;
+
+                case "kickuser": // attempts to log off a user from any region we are serving
+                    if (cmdparams.Length < 2 )
+                        break;
+
+                    string firstName = cmdparams[0];
+                    string lastName = cmdparams[1];
+
+                    IList agents = m_sceneManager.GetCurrentSceneAvatars();
+
+                    foreach (ScenePresence presence in agents)
+                    {
+                        RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
+
+                        if ( presence.Firstname.ToLower().Equals(firstName) && presence.Lastname.ToLower().Equals(lastName))
+                        {
+                            m_console.Notice(
+                                String.Format(
+                                     "Found user: {0,-16}{1,-16}{2,-37} in region: {3,-16}",
+                                     presence.Firstname,
+                                     presence.Lastname,
+                                     presence.UUID,
+                                     regionInfo.RegionName));
+
+                            presence.Scene.CloseConnection(regionInfo.RegionHandle, presence.UUID);
+                        }
+                    }
+                    m_console.Notice("");
+                    break;
+
                 case "modules":
                     if (cmdparams.Length > 0)
                     {
-- 
cgit v1.1