diff options
author | Dahlia Trimble | 2008-06-22 05:08:58 +0000 |
---|---|---|
committer | Dahlia Trimble | 2008-06-22 05:08:58 +0000 |
commit | eecaf327b962229a2467e4fbe42873436f0034d1 (patch) | |
tree | 240ec074a4d2e5ea37b358d3246375e77ba43136 /OpenSim/Region/Application/OpenSim.cs | |
parent | Added an experimental "kickuser" console command to log off a user by name. (diff) | |
download | opensim-SC-eecaf327b962229a2467e4fbe42873436f0034d1.zip opensim-SC-eecaf327b962229a2467e4fbe42873436f0034d1.tar.gz opensim-SC-eecaf327b962229a2467e4fbe42873436f0034d1.tar.bz2 opensim-SC-eecaf327b962229a2467e4fbe42873436f0034d1.tar.xz |
Changed the kickuser command to use the new console RegisterCmd feature.
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 600566b..12977a8 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -117,6 +117,8 @@ namespace OpenSim | |||
117 | 117 | ||
118 | PrintFileToConsole("startuplogo.txt"); | 118 | PrintFileToConsole("startuplogo.txt"); |
119 | RegisterCmd("echoTest", RunEchoTest, "this echos your command args to see how they are parsed"); | 119 | RegisterCmd("echoTest", RunEchoTest, "this echos your command args to see how they are parsed"); |
120 | RegisterCmd("kickuser", KickUserCommand, "kickuser [first] [last] - attempts to log off a user from any region we are serving"); | ||
121 | |||
120 | } | 122 | } |
121 | 123 | ||
122 | protected ConsoleBase CreateConsole() | 124 | protected ConsoleBase CreateConsole() |
@@ -142,6 +144,37 @@ namespace OpenSim | |||
142 | } | 144 | } |
143 | } | 145 | } |
144 | 146 | ||
147 | private void KickUserCommand(string[] cmdparams) | ||
148 | { | ||
149 | if (cmdparams.Length < 2) | ||
150 | return; | ||
151 | |||
152 | string firstName = cmdparams[0]; | ||
153 | string lastName = cmdparams[1]; | ||
154 | |||
155 | IList agents = m_sceneManager.GetCurrentSceneAvatars(); | ||
156 | |||
157 | foreach (ScenePresence presence in agents) | ||
158 | { | ||
159 | RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle); | ||
160 | |||
161 | if (presence.Firstname.ToLower().Equals(firstName) && presence.Lastname.ToLower().Equals(lastName)) | ||
162 | { | ||
163 | m_console.Notice( | ||
164 | String.Format( | ||
165 | "Found user: {0,-16}{1,-16}{2,-37} in region: {3,-16}", | ||
166 | presence.Firstname, | ||
167 | presence.Lastname, | ||
168 | presence.UUID, | ||
169 | regionInfo.RegionName)); | ||
170 | |||
171 | presence.Scene.CloseConnection(regionInfo.RegionHandle, presence.UUID); | ||
172 | } | ||
173 | } | ||
174 | m_console.Notice(""); | ||
175 | |||
176 | } | ||
177 | |||
145 | /// <summary> | 178 | /// <summary> |
146 | /// | 179 | /// |
147 | /// </summary> | 180 | /// </summary> |
@@ -254,7 +287,6 @@ namespace OpenSim | |||
254 | m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); | 287 | m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); |
255 | m_console.Notice("export-map [filename] - save image of world map"); | 288 | m_console.Notice("export-map [filename] - save image of world map"); |
256 | m_console.Notice("force-update - force an update of prims in the scene"); | 289 | m_console.Notice("force-update - force an update of prims in the scene"); |
257 | m_console.Notice("kickuser [first] [last] - attempts to log off a user from any region we are serving"); | ||
258 | m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)"); | 290 | m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)"); |
259 | m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); | 291 | m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); |
260 | m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); | 292 | m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); |
@@ -535,36 +567,6 @@ namespace OpenSim | |||
535 | } | 567 | } |
536 | } | 568 | } |
537 | break; | 569 | break; |
538 | |||
539 | case "kickuser": // attempts to log off a user from any region we are serving | ||
540 | if (cmdparams.Length < 2 ) | ||
541 | break; | ||
542 | |||
543 | string firstName = cmdparams[0]; | ||
544 | string lastName = cmdparams[1]; | ||
545 | |||
546 | IList agents = m_sceneManager.GetCurrentSceneAvatars(); | ||
547 | |||
548 | foreach (ScenePresence presence in agents) | ||
549 | { | ||
550 | RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle); | ||
551 | |||
552 | if ( presence.Firstname.ToLower().Equals(firstName) && presence.Lastname.ToLower().Equals(lastName)) | ||
553 | { | ||
554 | m_console.Notice( | ||
555 | String.Format( | ||
556 | "Found user: {0,-16}{1,-16}{2,-37} in region: {3,-16}", | ||
557 | presence.Firstname, | ||
558 | presence.Lastname, | ||
559 | presence.UUID, | ||
560 | regionInfo.RegionName)); | ||
561 | |||
562 | presence.Scene.CloseConnection(regionInfo.RegionHandle, presence.UUID); | ||
563 | } | ||
564 | } | ||
565 | m_console.Notice(""); | ||
566 | break; | ||
567 | |||
568 | case "modules": | 570 | case "modules": |
569 | if (cmdparams.Length > 0) | 571 | if (cmdparams.Length > 0) |
570 | { | 572 | { |