Changed the kickuser command to use the new console RegisterCmd feature.

0.6.0-stable
Dahlia Trimble 2008-06-22 05:08:58 +00:00
parent 55e7e7fc74
commit eecaf327b9
2 changed files with 34 additions and 32 deletions

View File

@ -27,6 +27,7 @@ OpenSim Developers
* adjohn (Genkii)
* Alondria
* Dr Scofield (IBM)
* dahlia
Patches
@ -55,7 +56,6 @@ Patches
* John R Sohn(XenReborn)
* Xantor
* YZh
* Dahlia
* Grumly57

View File

@ -117,6 +117,8 @@ namespace OpenSim
PrintFileToConsole("startuplogo.txt");
RegisterCmd("echoTest", RunEchoTest, "this echos your command args to see how they are parsed");
RegisterCmd("kickuser", KickUserCommand, "kickuser [first] [last] - attempts to log off a user from any region we are serving");
}
protected ConsoleBase CreateConsole()
@ -142,6 +144,37 @@ namespace OpenSim
}
}
private void KickUserCommand(string[] cmdparams)
{
if (cmdparams.Length < 2)
return;
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("");
}
/// <summary>
///
/// </summary>
@ -254,7 +287,6 @@ 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.");
@ -535,36 +567,6 @@ 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)
{