diff options
author | Melanie | 2012-02-01 09:45:42 +0000 |
---|---|---|
committer | Melanie | 2012-02-01 09:45:42 +0000 |
commit | cc1476fc3614aaa1e63da2c62b0fa21bbd46183e (patch) | |
tree | 9f36463d4e674c089c6ddee9920130d394abe267 /OpenSim/Region/CoreModules | |
parent | Fix copy/paste errors (diff) | |
parent | HG: This hopefully fixes the HG teleports back home to OSGrid. Looks like Uri... (diff) | |
download | opensim-SC-cc1476fc3614aaa1e63da2c62b0fa21bbd46183e.zip opensim-SC-cc1476fc3614aaa1e63da2c62b0fa21bbd46183e.tar.gz opensim-SC-cc1476fc3614aaa1e63da2c62b0fa21bbd46183e.tar.bz2 opensim-SC-cc1476fc3614aaa1e63da2c62b0fa21bbd46183e.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 236 |
2 files changed, 221 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 8d41728..38a7805 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -348,7 +348,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
348 | 348 | ||
349 | region.ExternalHostName = uri.Host; | 349 | region.ExternalHostName = uri.Host; |
350 | region.HttpPort = (uint)uri.Port; | 350 | region.HttpPort = (uint)uri.Port; |
351 | region.ServerURI = uri.ToString(); | 351 | region.ServerURI = aCircuit.ServiceURLs["HomeURI"].ToString(); |
352 | region.RegionName = string.Empty; | 352 | region.RegionName = string.Empty; |
353 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); | 353 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); |
354 | return region; | 354 | return region; |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 57c109e..e3d04cd 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
50 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private Scene m_scene; | 52 | private Scene m_scene; |
53 | private ICommandConsole m_console; | ||
53 | 54 | ||
54 | public string Name { get { return "Object Commands Module"; } } | 55 | public string Name { get { return "Object Commands Module"; } } |
55 | 56 | ||
@@ -75,6 +76,51 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
75 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 76 | // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
76 | 77 | ||
77 | m_scene = scene; | 78 | m_scene = scene; |
79 | m_console = MainConsole.Instance; | ||
80 | |||
81 | m_console.Commands.AddCommand("region", false, "delete object owner", | ||
82 | "delete object owner <UUID>", | ||
83 | "Delete a scene object by owner", HandleDeleteObject); | ||
84 | m_console.Commands.AddCommand("region", false, "delete object creator", | ||
85 | "delete object creator <UUID>", | ||
86 | "Delete a scene object by creator", HandleDeleteObject); | ||
87 | m_console.Commands.AddCommand("region", false, "delete object uuid", | ||
88 | "delete object uuid <UUID>", | ||
89 | "Delete a scene object by uuid", HandleDeleteObject); | ||
90 | m_console.Commands.AddCommand("region", false, "delete object name", | ||
91 | "delete object name <name>", | ||
92 | "Delete a scene object by name", HandleDeleteObject); | ||
93 | m_console.Commands.AddCommand("region", false, "delete object outside", | ||
94 | "delete object outside", | ||
95 | "Delete all scene objects outside region boundaries", HandleDeleteObject); | ||
96 | |||
97 | m_console.Commands.AddCommand( | ||
98 | "region", | ||
99 | false, | ||
100 | "show object uuid", | ||
101 | "show object uuid <UUID>", | ||
102 | "Show details of a scene object with the given UUID", HandleShowObjectByUuid); | ||
103 | |||
104 | m_console.Commands.AddCommand( | ||
105 | "region", | ||
106 | false, | ||
107 | "show object name", | ||
108 | "show object name <name>", | ||
109 | "Show details of scene objects with the given name", HandleShowObjectByName); | ||
110 | |||
111 | m_console.Commands.AddCommand( | ||
112 | "region", | ||
113 | false, | ||
114 | "show part uuid", | ||
115 | "show part uuid <UUID>", | ||
116 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); | ||
117 | |||
118 | m_console.Commands.AddCommand( | ||
119 | "region", | ||
120 | false, | ||
121 | "show part name", | ||
122 | "show part name <name>", | ||
123 | "Show details of scene object parts with the given name", HandleShowPartByName); | ||
78 | } | 124 | } |
79 | 125 | ||
80 | public void RemoveRegion(Scene scene) | 126 | public void RemoveRegion(Scene scene) |
@@ -85,26 +131,167 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
85 | public void RegionLoaded(Scene scene) | 131 | public void RegionLoaded(Scene scene) |
86 | { | 132 | { |
87 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 133 | // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
134 | } | ||
88 | 135 | ||
89 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner", | 136 | private void HandleShowObjectByUuid(string module, string[] cmd) |
90 | "delete object owner <UUID>", | 137 | { |
91 | "Delete object by owner", HandleDeleteObject); | 138 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
92 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator", | 139 | return; |
93 | "delete object creator <UUID>", | 140 | |
94 | "Delete object by creator", HandleDeleteObject); | 141 | if (cmd.Length < 4) |
95 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid", | 142 | { |
96 | "delete object uuid <UUID>", | 143 | m_console.OutputFormat("Usage: show object uuid <uuid>"); |
97 | "Delete object by uuid", HandleDeleteObject); | 144 | return; |
98 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", | 145 | } |
99 | "delete object name <name>", | 146 | |
100 | "Delete object by name", HandleDeleteObject); | 147 | UUID objectUuid; |
101 | MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", | 148 | if (!UUID.TryParse(cmd[3], out objectUuid)) |
102 | "delete object outside", | 149 | { |
103 | "Delete all objects outside boundaries", HandleDeleteObject); | 150 | m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); |
151 | return; | ||
152 | } | ||
153 | |||
154 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); | ||
155 | |||
156 | if (so == null) | ||
157 | { | ||
158 | // m_console.OutputFormat("No part found with uuid {0}", objectUuid); | ||
159 | return; | ||
160 | } | ||
161 | |||
162 | StringBuilder sb = new StringBuilder(); | ||
163 | AddSceneObjectReport(sb, so); | ||
164 | |||
165 | m_console.OutputFormat(sb.ToString()); | ||
166 | } | ||
167 | |||
168 | private void HandleShowObjectByName(string module, string[] cmd) | ||
169 | { | ||
170 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
171 | return; | ||
172 | |||
173 | if (cmd.Length < 4) | ||
174 | { | ||
175 | m_console.OutputFormat("Usage: show object name <name>"); | ||
176 | return; | ||
177 | } | ||
178 | |||
179 | string name = cmd[3]; | ||
180 | |||
181 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | ||
182 | |||
183 | m_scene.ForEachSOG(so => { if (so.Name == name) { sceneObjects.Add(so); }}); | ||
184 | |||
185 | if (sceneObjects.Count == 0) | ||
186 | { | ||
187 | m_console.OutputFormat("No objects with name {0} found in {1}", name, m_scene.RegionInfo.RegionName); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | StringBuilder sb = new StringBuilder(); | ||
192 | |||
193 | foreach (SceneObjectGroup so in sceneObjects) | ||
194 | { | ||
195 | AddSceneObjectReport(sb, so); | ||
196 | sb.Append("\n"); | ||
197 | } | ||
198 | |||
199 | m_console.OutputFormat(sb.ToString()); | ||
200 | } | ||
201 | |||
202 | private void HandleShowPartByUuid(string module, string[] cmd) | ||
203 | { | ||
204 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
205 | return; | ||
206 | |||
207 | if (cmd.Length < 4) | ||
208 | { | ||
209 | m_console.OutputFormat("Usage: show part uuid <uuid>"); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | UUID objectUuid; | ||
214 | if (!UUID.TryParse(cmd[3], out objectUuid)) | ||
215 | { | ||
216 | m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); | ||
217 | return; | ||
218 | } | ||
219 | |||
220 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); | ||
221 | |||
222 | if (sop == null) | ||
223 | { | ||
224 | // m_console.OutputFormat("No part found with uuid {0}", objectUuid); | ||
225 | return; | ||
226 | } | ||
227 | |||
228 | StringBuilder sb = new StringBuilder(); | ||
229 | AddScenePartReport(sb, sop); | ||
230 | |||
231 | m_console.OutputFormat(sb.ToString()); | ||
232 | } | ||
233 | |||
234 | private void HandleShowPartByName(string module, string[] cmd) | ||
235 | { | ||
236 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
237 | return; | ||
238 | |||
239 | if (cmd.Length < 4) | ||
240 | { | ||
241 | m_console.OutputFormat("Usage: show part name <name>"); | ||
242 | return; | ||
243 | } | ||
244 | |||
245 | string name = cmd[3]; | ||
246 | |||
247 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | ||
248 | |||
249 | m_scene.ForEachSOG(so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } })); | ||
250 | |||
251 | if (parts.Count == 0) | ||
252 | { | ||
253 | m_console.OutputFormat("No parts with name {0} found in {1}", name, m_scene.RegionInfo.RegionName); | ||
254 | return; | ||
255 | } | ||
256 | |||
257 | StringBuilder sb = new StringBuilder(); | ||
258 | |||
259 | foreach (SceneObjectPart part in parts) | ||
260 | { | ||
261 | AddScenePartReport(sb, part); | ||
262 | sb.Append("\n"); | ||
263 | } | ||
264 | |||
265 | m_console.OutputFormat(sb.ToString()); | ||
266 | } | ||
267 | |||
268 | private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) | ||
269 | { | ||
270 | sb.AppendFormat("Name: {0}\n", so.Name); | ||
271 | sb.AppendFormat("Description: {0}\n", so.Description); | ||
272 | sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName); | ||
273 | sb.AppendFormat("Parts: {0}\n", so.PrimCount); | ||
274 | |||
275 | return sb; | ||
276 | } | ||
277 | |||
278 | private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop) | ||
279 | { | ||
280 | sb.AppendFormat("Name: {0}\n", sop.Name); | ||
281 | sb.AppendFormat("Description: {0}\n", sop.Description); | ||
282 | sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); | ||
283 | sb.AppendFormat("Parent: {0}", | ||
284 | sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); | ||
285 | sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; | ||
286 | |||
287 | return sb; | ||
104 | } | 288 | } |
105 | 289 | ||
106 | private void HandleDeleteObject(string module, string[] cmd) | 290 | private void HandleDeleteObject(string module, string[] cmd) |
107 | { | 291 | { |
292 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
293 | return; | ||
294 | |||
108 | if (cmd.Length < 3) | 295 | if (cmd.Length < 3) |
109 | return; | 296 | return; |
110 | 297 | ||
@@ -135,6 +322,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
135 | deletes.Add(g); | 322 | deletes.Add(g); |
136 | }); | 323 | }); |
137 | 324 | ||
325 | // if (deletes.Count == 0) | ||
326 | // m_console.OutputFormat("No objects were found with owner {0}", match); | ||
327 | |||
138 | break; | 328 | break; |
139 | 329 | ||
140 | case "creator": | 330 | case "creator": |
@@ -147,6 +337,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
147 | deletes.Add(g); | 337 | deletes.Add(g); |
148 | }); | 338 | }); |
149 | 339 | ||
340 | // if (deletes.Count == 0) | ||
341 | // m_console.OutputFormat("No objects were found with creator {0}", match); | ||
342 | |||
150 | break; | 343 | break; |
151 | 344 | ||
152 | case "uuid": | 345 | case "uuid": |
@@ -159,6 +352,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
159 | deletes.Add(g); | 352 | deletes.Add(g); |
160 | }); | 353 | }); |
161 | 354 | ||
355 | // if (deletes.Count == 0) | ||
356 | // m_console.OutputFormat("No objects were found with uuid {0}", match); | ||
357 | |||
162 | break; | 358 | break; |
163 | 359 | ||
164 | case "name": | 360 | case "name": |
@@ -168,6 +364,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
168 | deletes.Add(g); | 364 | deletes.Add(g); |
169 | }); | 365 | }); |
170 | 366 | ||
367 | // if (deletes.Count == 0) | ||
368 | // m_console.OutputFormat("No objects were found with name {0}", o); | ||
369 | |||
171 | break; | 370 | break; |
172 | 371 | ||
173 | case "outside": | 372 | case "outside": |
@@ -193,12 +392,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
193 | deletes.Add(g); | 392 | deletes.Add(g); |
194 | }); | 393 | }); |
195 | 394 | ||
395 | // if (deletes.Count == 0) | ||
396 | // m_console.OutputFormat("No objects were found outside region bounds"); | ||
397 | |||
196 | break; | 398 | break; |
197 | } | 399 | } |
198 | 400 | ||
401 | m_console.OutputFormat("Deleting {0} objects in {1}", deletes.Count, m_scene.RegionInfo.RegionName); | ||
402 | |||
199 | foreach (SceneObjectGroup g in deletes) | 403 | foreach (SceneObjectGroup g in deletes) |
200 | { | 404 | { |
201 | MainConsole.Instance.OutputFormat("Deleting object {0}", g.UUID); | 405 | m_console.OutputFormat("Deleting object {0} {1}", g.UUID, g.Name); |
202 | m_scene.DeleteSceneObject(g, false); | 406 | m_scene.DeleteSceneObject(g, false); |
203 | } | 407 | } |
204 | } | 408 | } |