aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2012-10-26 21:13:01 +0100
committerMelanie2012-10-26 21:13:01 +0100
commit26cc57b6cafda5168baab49cabe34d96f01dbd6d (patch)
tree94e078a75ab68825e64b15498f67d82988858dc9 /OpenSim/Region/CoreModules
parentMerge branch 'master' into careminster (diff)
parentminor: Make the error thrown logged when a simulator in grid mode is trying t... (diff)
downloadopensim-SC_OLD-26cc57b6cafda5168baab49cabe34d96f01dbd6d.zip
opensim-SC_OLD-26cc57b6cafda5168baab49cabe34d96f01dbd6d.tar.gz
opensim-SC_OLD-26cc57b6cafda5168baab49cabe34d96f01dbd6d.tar.bz2
opensim-SC_OLD-26cc57b6cafda5168baab49cabe34d96f01dbd6d.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs36
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs154
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs133
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs173
8 files changed, 350 insertions, 195 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index dbbb0ae..4407e40 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -197,6 +197,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
197 string fromName = c.From; 197 string fromName = c.From;
198 string fromNamePrefix = ""; 198 string fromNamePrefix = "";
199 UUID fromID = UUID.Zero; 199 UUID fromID = UUID.Zero;
200 UUID ownerID = UUID.Zero;
200 string message = c.Message; 201 string message = c.Message;
201 IScene scene = c.Scene; 202 IScene scene = c.Scene;
202 UUID destination = c.Destination; 203 UUID destination = c.Destination;
@@ -224,11 +225,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
224 fromNamePrefix = m_adminPrefix; 225 fromNamePrefix = m_adminPrefix;
225 } 226 }
226 destination = UUID.Zero; // Avatars cant "SayTo" 227 destination = UUID.Zero; // Avatars cant "SayTo"
228 ownerID = c.Sender.AgentId;
229
227 break; 230 break;
228 231
229 case ChatSourceType.Object: 232 case ChatSourceType.Object:
230 fromID = c.SenderUUID; 233 fromID = c.SenderUUID;
231 234
235 if (c.SenderObject != null && c.SenderObject is SceneObjectPart)
236 ownerID = ((SceneObjectPart)c.SenderObject).OwnerID;
237
232 break; 238 break;
233 } 239 }
234 240
@@ -262,8 +268,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
262 // objects on a parcel with access restrictions 268 // objects on a parcel with access restrictions
263 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) 269 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
264 { 270 {
265 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) 271 if (destination != UUID.Zero)
266 receiverIDs.Add(presence.UUID); 272 {
273 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, ownerID, fromNamePrefix + fromName, c.Type, message, sourceType, true))
274 receiverIDs.Add(presence.UUID);
275 }
276 else
277 {
278 if (TrySendChatMessage(presence, fromPos, regionPos, fromID, ownerID, fromNamePrefix + fromName, c.Type, message, sourceType, false))
279 receiverIDs.Add(presence.UUID);
280 }
267 } 281 }
268 } 282 }
269 } 283 }
@@ -324,7 +338,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
324 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) 338 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
325 return; 339 return;
326 340
327 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, 341 client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, fromID,
328 (byte)sourceType, (byte)ChatAudibleLevel.Fully); 342 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
329 receiverIDs.Add(client.AgentId); 343 receiverIDs.Add(client.AgentId);
330 } 344 }
@@ -341,15 +355,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
341 /// <param name="fromPos"></param> 355 /// <param name="fromPos"></param>
342 /// <param name="regionPos">/param> 356 /// <param name="regionPos">/param>
343 /// <param name="fromAgentID"></param> 357 /// <param name="fromAgentID"></param>
358 /// <param name='ownerID'>
359 /// Owner of the message. For at least some messages from objects, this has to be correctly filled with the owner's UUID.
360 /// This is the case for script error messages in viewer 3 since LLViewer change EXT-7762
361 /// </param>
344 /// <param name="fromName"></param> 362 /// <param name="fromName"></param>
345 /// <param name="type"></param> 363 /// <param name="type"></param>
346 /// <param name="message"></param> 364 /// <param name="message"></param>
347 /// <param name="src"></param> 365 /// <param name="src"></param>
348 /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a 366 /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a
349 /// precondition</returns> 367 /// precondition</returns>
350 protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, 368 protected virtual bool TrySendChatMessage(
351 UUID fromAgentID, string fromName, ChatTypeEnum type, 369 ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
352 string message, ChatSourceType src) 370 UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type,
371 string message, ChatSourceType src, bool ignoreDistance)
353 { 372 {
354 // don't send chat to child agents 373 // don't send chat to child agents
355 if (presence.IsChildAgent) return false; 374 if (presence.IsChildAgent) return false;
@@ -369,8 +388,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
369 } 388 }
370 389
371 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView 390 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
372 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 391 presence.ControllingClient.SendChatMessage(
373 fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); 392 message, (byte) type, fromPos, fromName,
393 fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully);
374 394
375 return true; 395 return true;
376 } 396 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 7d1fe68..a32afd5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -35,6 +35,7 @@ using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Console;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
@@ -209,6 +210,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
209 Guid id, string firstName, string lastName, string invPath, string pass, string savePath, 210 Guid id, string firstName, string lastName, string invPath, string pass, string savePath,
210 Dictionary<string, object> options) 211 Dictionary<string, object> options)
211 { 212 {
213 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath))
214 return false;
215
212 if (m_scenes.Count > 0) 216 if (m_scenes.Count > 0)
213 { 217 {
214 UserAccount userInfo = GetUserInfo(firstName, lastName, pass); 218 UserAccount userInfo = GetUserInfo(firstName, lastName, pass);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 21dff4b..ecaab44 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -38,15 +38,15 @@ using OpenSim.Services.Interfaces;
38 38
39namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer 39namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
40{ 40{
41 public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule 41 public class InventoryTransferModule : ISharedRegionModule
42 { 42 {
43 private static readonly ILog m_log 43 private static readonly ILog m_log
44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 /// <summary> 46 /// <summary>
47 private List<Scene> m_Scenelist = new List<Scene>(); 47 private List<Scene> m_Scenelist = new List<Scene>();
48 private Dictionary<UUID, Scene> m_AgentRegions = 48// private Dictionary<UUID, Scene> m_AgentRegions =
49 new Dictionary<UUID, Scene>(); 49// new Dictionary<UUID, Scene>();
50 50
51 private IMessageTransferModule m_TransferModule = null; 51 private IMessageTransferModule m_TransferModule = null;
52 private bool m_Enabled = true; 52 private bool m_Enabled = true;
@@ -76,12 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
76 76
77 m_Scenelist.Add(scene); 77 m_Scenelist.Add(scene);
78 78
79 scene.RegisterModuleInterface<IInventoryTransferModule>(this); 79// scene.RegisterModuleInterface<IInventoryTransferModule>(this);
80 80
81 scene.EventManager.OnNewClient += OnNewClient; 81 scene.EventManager.OnNewClient += OnNewClient;
82 scene.EventManager.OnClientClosed += ClientLoggedOut; 82// scene.EventManager.OnClientClosed += ClientLoggedOut;
83 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 83 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
84 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; 84// scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
85 } 85 }
86 86
87 public void RegionLoaded(Scene scene) 87 public void RegionLoaded(Scene scene)
@@ -96,9 +96,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
96 96
97 m_Scenelist.Clear(); 97 m_Scenelist.Clear();
98 scene.EventManager.OnNewClient -= OnNewClient; 98 scene.EventManager.OnNewClient -= OnNewClient;
99 scene.EventManager.OnClientClosed -= ClientLoggedOut; 99// scene.EventManager.OnClientClosed -= ClientLoggedOut;
100 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 100 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
101 scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; 101// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
102 } 102 }
103 } 103 }
104 } 104 }
@@ -106,9 +106,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
106 public void RemoveRegion(Scene scene) 106 public void RemoveRegion(Scene scene)
107 { 107 {
108 scene.EventManager.OnNewClient -= OnNewClient; 108 scene.EventManager.OnNewClient -= OnNewClient;
109 scene.EventManager.OnClientClosed -= ClientLoggedOut; 109// scene.EventManager.OnClientClosed -= ClientLoggedOut;
110 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; 110 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
111 scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; 111// scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
112 m_Scenelist.Remove(scene); 112 m_Scenelist.Remove(scene);
113 } 113 }
114 114
@@ -138,10 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
138 client.OnInstantMessage += OnInstantMessage; 138 client.OnInstantMessage += OnInstantMessage;
139 } 139 }
140 140
141 protected void OnSetRootAgentScene(UUID id, Scene scene) 141// protected void OnSetRootAgentScene(UUID id, Scene scene)
142 { 142// {
143 m_AgentRegions[id] = scene; 143// m_AgentRegions[id] = scene;
144 } 144// }
145 145
146 private Scene FindClientScene(UUID agentId) 146 private Scene FindClientScene(UUID agentId)
147 { 147 {
@@ -465,69 +465,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
465 } 465 }
466 } 466 }
467 467
468 public bool NeedSceneCacheClear(UUID agentID, Scene scene) 468// public bool NeedSceneCacheClear(UUID agentID, Scene scene)
469 { 469// {
470 if (!m_AgentRegions.ContainsKey(agentID)) 470// if (!m_AgentRegions.ContainsKey(agentID))
471 { 471// {
472 // Since we can get here two ways, we need to scan 472// // Since we can get here two ways, we need to scan
473 // the scenes here. This is somewhat more expensive 473// // the scenes here. This is somewhat more expensive
474 // but helps avoid a nasty bug 474// // but helps avoid a nasty bug
475 // 475// //
476 476//
477 foreach (Scene s in m_Scenelist) 477// foreach (Scene s in m_Scenelist)
478 { 478// {
479 ScenePresence presence; 479// ScenePresence presence;
480 480//
481 if (s.TryGetScenePresence(agentID, out presence)) 481// if (s.TryGetScenePresence(agentID, out presence))
482 { 482// {
483 // If the agent is in this scene, then we 483// // If the agent is in this scene, then we
484 // are being called twice in a single 484// // are being called twice in a single
485 // teleport. This is wasteful of cycles 485// // teleport. This is wasteful of cycles
486 // but harmless due to this 2nd level check 486// // but harmless due to this 2nd level check
487 // 487// //
488 // If the agent is found in another scene 488// // If the agent is found in another scene
489 // then the list wasn't current 489// // then the list wasn't current
490 // 490// //
491 // If the agent is totally unknown, then what 491// // If the agent is totally unknown, then what
492 // are we even doing here?? 492// // are we even doing here??
493 // 493// //
494 if (s == scene) 494// if (s == scene)
495 { 495// {
496 //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); 496// //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName);
497 return true; 497// return true;
498 } 498// }
499 else 499// else
500 { 500// {
501 //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); 501// //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName);
502 return false; 502// return false;
503 } 503// }
504 } 504// }
505 } 505// }
506 //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); 506// //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName);
507 return true; 507// return true;
508 } 508// }
509 509//
510 // The agent is left in current Scene, so we must be 510// // The agent is left in current Scene, so we must be
511 // going to another instance 511// // going to another instance
512 // 512// //
513 if (m_AgentRegions[agentID] == scene) 513// if (m_AgentRegions[agentID] == scene)
514 { 514// {
515 //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); 515// //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName);
516 m_AgentRegions.Remove(agentID); 516// m_AgentRegions.Remove(agentID);
517 return true; 517// return true;
518 } 518// }
519 519//
520 // Another region has claimed the agent 520// // Another region has claimed the agent
521 // 521// //
522 //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); 522// //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName);
523 return false; 523// return false;
524 } 524// }
525 525//
526 public void ClientLoggedOut(UUID agentID, Scene scene) 526// public void ClientLoggedOut(UUID agentID, Scene scene)
527 { 527// {
528 if (m_AgentRegions.ContainsKey(agentID)) 528// if (m_AgentRegions.ContainsKey(agentID))
529 m_AgentRegions.Remove(agentID); 529// m_AgentRegions.Remove(agentID);
530 } 530// }
531 531
532 /// <summary> 532 /// <summary>
533 /// 533 ///
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ffc362f..31e6ce9 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -677,13 +677,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
677 sp.Reset(); 677 sp.Reset();
678 } 678 }
679 679
680 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 680 // Commented pending deletion since this method no longer appears to do anything at all
681 if (sp.Scene.NeedSceneCacheClear(sp.UUID)) 681// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
682 { 682// if (sp.Scene.NeedSceneCacheClear(sp.UUID))
683 m_log.DebugFormat( 683// {
684 "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", 684// m_log.DebugFormat(
685 sp.UUID); 685// "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
686 } 686// sp.UUID);
687// }
687 688
688 m_entityTransferStateMachine.ResetFromTransit(sp.UUID); 689 m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
689 } 690 }
@@ -1222,11 +1223,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1222 // the user may change their profile information in other region, 1223 // the user may change their profile information in other region,
1223 // so the userinfo in UserProfileCache is not reliable any more, delete it 1224 // so the userinfo in UserProfileCache is not reliable any more, delete it
1224 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 1225 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1225 if (agent.Scene.NeedSceneCacheClear(agent.UUID)) 1226// if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1226 { 1227// {
1227 m_log.DebugFormat( 1228// m_log.DebugFormat(
1228 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); 1229// "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1229 } 1230// }
1230 1231
1231 //m_log.Debug("AFTER CROSS"); 1232 //m_log.Debug("AFTER CROSS");
1232 //Scene.DumpChildrenSeeds(UUID); 1233 //Scene.DumpChildrenSeeds(UUID);
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 07bb291..e167e31 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text.RegularExpressions;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -172,12 +173,42 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
172 /// <param name="hostID">UUID of the SceneObjectPart</param> 173 /// <param name="hostID">UUID of the SceneObjectPart</param>
173 /// <param name="channel">channel to listen on</param> 174 /// <param name="channel">channel to listen on</param>
174 /// <param name="name">name to filter on</param> 175 /// <param name="name">name to filter on</param>
175 /// <param name="id">key to filter on (user given, could be totally faked)</param> 176 /// <param name="id">
177 /// key to filter on (user given, could be totally faked)
178 /// </param>
179 /// <param name="msg">msg to filter on</param>
180 /// <returns>number of the scripts handle</returns>
181 public int Listen(uint localID, UUID itemID, UUID hostID, int channel,
182 string name, UUID id, string msg)
183 {
184 return m_listenerManager.AddListener(localID, itemID, hostID,
185 channel, name, id, msg);
186 }
187
188 /// <summary>
189 /// Create a listen event callback with the specified filters.
190 /// The parameters localID,itemID are needed to uniquely identify
191 /// the script during 'peek' time. Parameter hostID is needed to
192 /// determine the position of the script.
193 /// </summary>
194 /// <param name="localID">localID of the script engine</param>
195 /// <param name="itemID">UUID of the script engine</param>
196 /// <param name="hostID">UUID of the SceneObjectPart</param>
197 /// <param name="channel">channel to listen on</param>
198 /// <param name="name">name to filter on</param>
199 /// <param name="id">
200 /// key to filter on (user given, could be totally faked)
201 /// </param>
176 /// <param name="msg">msg to filter on</param> 202 /// <param name="msg">msg to filter on</param>
203 /// <param name="regexBitfield">
204 /// Bitfield indicating which strings should be processed as regex.
205 /// </param>
177 /// <returns>number of the scripts handle</returns> 206 /// <returns>number of the scripts handle</returns>
178 public int Listen(uint localID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg) 207 public int Listen(uint localID, UUID itemID, UUID hostID, int channel,
208 string name, UUID id, string msg, int regexBitfield)
179 { 209 {
180 return m_listenerManager.AddListener(localID, itemID, hostID, channel, name, id, msg); 210 return m_listenerManager.AddListener(localID, itemID, hostID,
211 channel, name, id, msg, regexBitfield);
181 } 212 }
182 213
183 /// <summary> 214 /// <summary>
@@ -326,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
326 if (channel == 0) 357 if (channel == 0)
327 { 358 {
328 // Channel 0 goes to viewer ONLY 359 // Channel 0 goes to viewer ONLY
329 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, false, false, target); 360 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, target, false, false);
330 return true; 361 return true;
331 } 362 }
332 363
@@ -470,15 +501,25 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
470 m_curlisteners = 0; 501 m_curlisteners = 0;
471 } 502 }
472 503
473 public int AddListener(uint localID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg) 504 public int AddListener(uint localID, UUID itemID, UUID hostID,
505 int channel, string name, UUID id, string msg)
506 {
507 return AddListener(localID, itemID, hostID, channel, name, id,
508 msg, 0);
509 }
510
511 public int AddListener(uint localID, UUID itemID, UUID hostID,
512 int channel, string name, UUID id, string msg,
513 int regexBitfield)
474 { 514 {
475 // do we already have a match on this particular filter event? 515 // do we already have a match on this particular filter event?
476 List<ListenerInfo> coll = GetListeners(itemID, channel, name, id, msg); 516 List<ListenerInfo> coll = GetListeners(itemID, channel, name, id,
517 msg);
477 518
478 if (coll.Count > 0) 519 if (coll.Count > 0)
479 { 520 {
480 // special case, called with same filter settings, return same handle 521 // special case, called with same filter settings, return same
481 // (2008-05-02, tested on 1.21.1 server, still holds) 522 // handle (2008-05-02, tested on 1.21.1 server, still holds)
482 return coll[0].GetHandle(); 523 return coll[0].GetHandle();
483 } 524 }
484 525
@@ -490,7 +531,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
490 531
491 if (newHandle > 0) 532 if (newHandle > 0)
492 { 533 {
493 ListenerInfo li = new ListenerInfo(newHandle, localID, itemID, hostID, channel, name, id, msg); 534 ListenerInfo li = new ListenerInfo(newHandle, localID,
535 itemID, hostID, channel, name, id, msg,
536 regexBitfield);
494 537
495 List<ListenerInfo> listeners; 538 List<ListenerInfo> listeners;
496 if (!m_listeners.TryGetValue(channel,out listeners)) 539 if (!m_listeners.TryGetValue(channel,out listeners))
@@ -631,6 +674,22 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
631 return -1; 674 return -1;
632 } 675 }
633 676
677 /// These are duplicated from ScriptBaseClass
678 /// http://opensimulator.org/mantis/view.php?id=6106#c21945
679 #region Constants for the bitfield parameter of osListenRegex
680
681 /// <summary>
682 /// process name parameter as regex
683 /// </summary>
684 public const int OS_LISTEN_REGEX_NAME = 0x1;
685
686 /// <summary>
687 /// process message parameter as regex
688 /// </summary>
689 public const int OS_LISTEN_REGEX_MESSAGE = 0x2;
690
691 #endregion
692
634 // Theres probably a more clever and efficient way to 693 // Theres probably a more clever and efficient way to
635 // do this, maybe with regex. 694 // do this, maybe with regex.
636 // PM2008: Ha, one could even be smart and define a specialized Enumerator. 695 // PM2008: Ha, one could even be smart and define a specialized Enumerator.
@@ -656,7 +715,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
656 { 715 {
657 continue; 716 continue;
658 } 717 }
659 if (li.GetName().Length > 0 && !li.GetName().Equals(name)) 718 if (li.GetName().Length > 0 && (
719 ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && !li.GetName().Equals(name)) ||
720 ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && !Regex.IsMatch(name, li.GetName()))
721 ))
660 { 722 {
661 continue; 723 continue;
662 } 724 }
@@ -664,7 +726,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
664 { 726 {
665 continue; 727 continue;
666 } 728 }
667 if (li.GetMessage().Length > 0 && !li.GetMessage().Equals(msg)) 729 if (li.GetMessage().Length > 0 && (
730 ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && !li.GetMessage().Equals(msg)) ||
731 ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && !Regex.IsMatch(msg, li.GetMessage()))
732 ))
668 { 733 {
669 continue; 734 continue;
670 } 735 }
@@ -697,10 +762,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
697 { 762 {
698 int idx = 0; 763 int idx = 0;
699 Object[] item = new Object[6]; 764 Object[] item = new Object[6];
765 int dataItemLength = 6;
700 766
701 while (idx < data.Length) 767 while (idx < data.Length)
702 { 768 {
703 Array.Copy(data, idx, item, 0, 6); 769 dataItemLength = (idx + 7 == data.Length || (idx + 7 < data.Length && data[idx + 7] is bool)) ? 7 : 6;
770 item = new Object[dataItemLength];
771 Array.Copy(data, idx, item, 0, dataItemLength);
704 772
705 ListenerInfo info = 773 ListenerInfo info =
706 ListenerInfo.FromData(localID, itemID, hostID, item); 774 ListenerInfo.FromData(localID, itemID, hostID, item);
@@ -712,12 +780,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
712 m_listeners[(int)item[2]].Add(info); 780 m_listeners[(int)item[2]].Add(info);
713 } 781 }
714 782
715 idx+=6; 783 idx+=dataItemLength;
716 } 784 }
717 } 785 }
718 } 786 }
719 787
720 public class ListenerInfo: IWorldCommListenerInfo 788 public class ListenerInfo : IWorldCommListenerInfo
721 { 789 {
722 private bool m_active; // Listener is active or not 790 private bool m_active; // Listener is active or not
723 private int m_handle; // Assigned handle of this listener 791 private int m_handle; // Assigned handle of this listener
@@ -731,16 +799,29 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
731 799
732 public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message) 800 public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message)
733 { 801 {
734 Initialise(handle, localID, ItemID, hostID, channel, name, id, message); 802 Initialise(handle, localID, ItemID, hostID, channel, name, id,
803 message, 0);
804 }
805
806 public ListenerInfo(int handle, uint localID, UUID ItemID,
807 UUID hostID, int channel, string name, UUID id,
808 string message, int regexBitfield)
809 {
810 Initialise(handle, localID, ItemID, hostID, channel, name, id,
811 message, regexBitfield);
735 } 812 }
736 813
737 public ListenerInfo(ListenerInfo li, string name, UUID id, string message) 814 public ListenerInfo(ListenerInfo li, string name, UUID id, string message)
738 { 815 {
739 Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message); 816 Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, 0);
817 }
818
819 public ListenerInfo(ListenerInfo li, string name, UUID id, string message, int regexBitfield)
820 {
821 Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message, regexBitfield);
740 } 822 }
741 823
742 private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, 824 private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message, int regexBitfield)
743 UUID id, string message)
744 { 825 {
745 m_active = true; 826 m_active = true;
746 m_handle = handle; 827 m_handle = handle;
@@ -751,11 +832,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
751 m_name = name; 832 m_name = name;
752 m_id = id; 833 m_id = id;
753 m_message = message; 834 m_message = message;
835 RegexBitfield = regexBitfield;
754 } 836 }
755 837
756 public Object[] GetSerializationData() 838 public Object[] GetSerializationData()
757 { 839 {
758 Object[] data = new Object[6]; 840 Object[] data = new Object[7];
759 841
760 data[0] = m_active; 842 data[0] = m_active;
761 data[1] = m_handle; 843 data[1] = m_handle;
@@ -763,16 +845,19 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
763 data[3] = m_name; 845 data[3] = m_name;
764 data[4] = m_id; 846 data[4] = m_id;
765 data[5] = m_message; 847 data[5] = m_message;
848 data[6] = RegexBitfield;
766 849
767 return data; 850 return data;
768 } 851 }
769 852
770 public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data) 853 public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data)
771 { 854 {
772 ListenerInfo linfo = new ListenerInfo((int)data[1], localID, 855 ListenerInfo linfo = new ListenerInfo((int)data[1], localID, ItemID, hostID, (int)data[2], (string)data[3], (UUID)data[4], (string)data[5]);
773 ItemID, hostID, (int)data[2], (string)data[3], 856 linfo.m_active = (bool)data[0];
774 (UUID)data[4], (string)data[5]); 857 if (data.Length >= 7)
775 linfo.m_active=(bool)data[0]; 858 {
859 linfo.RegexBitfield = (int)data[6];
860 }
776 861
777 return linfo; 862 return linfo;
778 } 863 }
@@ -831,5 +916,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
831 { 916 {
832 return m_id; 917 return m_id;
833 } 918 }
919
920 public int RegexBitfield { get; private set; }
834 } 921 }
835} 922}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
index a66ed88..d8dace2 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
110 lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX; 110 lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX;
111 } 111 }
112 112
113 Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastY - firstY + 1), (int)(lastX - firstX + 1)); 113 Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastX - firstX + 1), (int)(lastY - firstY + 1));
114 114
115 115
116 // Calculate the subdirectory in which each region will be stored in the archive 116 // Calculate the subdirectory in which each region will be stored in the archive
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 2a87dc2..970487a 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -32,6 +32,8 @@ using System.Reflection;
32using log4net; 32using log4net;
33using NDesk.Options; 33using NDesk.Options;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework;
36using OpenSim.Framework.Console;
35using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
37 39
@@ -117,7 +119,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
117// 119//
118// foreach (string param in mainParams) 120// foreach (string param in mainParams)
119// m_log.DebugFormat("GOT PARAM [{0}]", param); 121// m_log.DebugFormat("GOT PARAM [{0}]", param);
120 122
121 if (mainParams.Count > 2) 123 if (mainParams.Count > 2)
122 { 124 {
123 DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); 125 DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty);
@@ -150,14 +152,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
150 152
151 List<string> mainParams = ops.Parse(cmdparams); 153 List<string> mainParams = ops.Parse(cmdparams);
152 154
155 string path;
153 if (mainParams.Count > 2) 156 if (mainParams.Count > 2)
154 { 157 path = mainParams[2];
155 ArchiveRegion(mainParams[2], options);
156 }
157 else 158 else
158 { 159 path = DEFAULT_OAR_BACKUP_FILENAME;
159 ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, options); 160
160 } 161 if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, path))
162 return;
163
164 ArchiveRegion(path, options);
161 } 165 }
162 166
163 public void ArchiveRegion(string savePath, Dictionary<string, object> options) 167 public void ArchiveRegion(string savePath, Dictionary<string, object> options)
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 87241e1..b2c9bce 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -27,10 +27,12 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Linq; 31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
35using System.Xml;
34using log4net; 36using log4net;
35using Mono.Addins; 37using Mono.Addins;
36using NDesk.Options; 38using NDesk.Options;
@@ -41,6 +43,7 @@ using OpenSim.Framework.Console;
41using OpenSim.Framework.Monitoring; 43using OpenSim.Framework.Monitoring;
42using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.Framework.Scenes.Serialization;
44 47
45namespace OpenSim.Region.CoreModules.World.Objects.Commands 48namespace OpenSim.Region.CoreModules.World.Objects.Commands
46{ 49{
@@ -96,9 +99,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
96 HandleDeleteObject); 99 HandleDeleteObject);
97 100
98 m_console.Commands.AddCommand( 101 m_console.Commands.AddCommand(
99 "Objects", false, "delete object uuid", 102 "Objects", false, "delete object id",
100 "delete object uuid <UUID>", 103 "delete object id <UUID-or-localID>",
101 "Delete a scene object by uuid", 104 "Delete a scene object by uuid or localID",
102 HandleDeleteObject); 105 HandleDeleteObject);
103 106
104 m_console.Commands.AddCommand( 107 m_console.Commands.AddCommand(
@@ -122,28 +125,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
122 "delete object pos", 125 "delete object pos",
123 "delete object pos <start-coord> to <end-coord>", 126 "delete object pos <start-coord> to <end-coord>",
124 "Delete scene objects within the given area.", 127 "Delete scene objects within the given area.",
125 "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 128 ConsoleUtil.CoordHelp,
126 + "If you don't care about the z component you can simply omit it.\n"
127 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
128 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
129 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
130 + "e.g.\n"
131 + "delete object pos 20,20,20 to 40,40,40\n"
132 + "delete object pos 20,20 to 40,40\n"
133 + "delete object pos ,20,20 to ,40,40\n"
134 + "delete object pos ,,30 to ,,~\n"
135 + "delete object pos ,,-~ to ,,30",
136 HandleDeleteObject); 129 HandleDeleteObject);
137 130
138 m_console.Commands.AddCommand( 131 m_console.Commands.AddCommand(
139 "Objects", 132 "Objects",
140 false, 133 false,
141 "show object uuid", 134 "show object id",
142 "show object uuid [--full] <UUID>", 135 "show object id [--full] <UUID-or-localID>",
143 "Show details of a scene object with the given UUID", 136 "Show details of a scene object with the given UUID or localID",
144 "The --full option will print out information on all the parts of the object.\n" 137 "The --full option will print out information on all the parts of the object.\n"
145 + "For yet more detailed part information, use the \"show part\" commands.", 138 + "For yet more detailed part information, use the \"show part\" commands.",
146 HandleShowObjectByUuid); 139 HandleShowObjectById);
147 140
148 m_console.Commands.AddCommand( 141 m_console.Commands.AddCommand(
149 "Objects", 142 "Objects",
@@ -164,25 +157,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
164 "Show details of scene objects within the given area.", 157 "Show details of scene objects within the given area.",
165 "The --full option will print out information on all the parts of the object.\n" 158 "The --full option will print out information on all the parts of the object.\n"
166 + "For yet more detailed part information, use the \"show part\" commands.\n" 159 + "For yet more detailed part information, use the \"show part\" commands.\n"
167 + "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 160 + ConsoleUtil.CoordHelp,
168 + "If you don't care about the z component you can simply omit it.\n"
169 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
170 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
171 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
172 + "e.g.\n"
173 + "show object pos 20,20,20 to 40,40,40\n"
174 + "show object pos 20,20 to 40,40\n"
175 + "show object pos ,20,20 to ,40,40\n"
176 + "show object pos ,,30 to ,,~\n"
177 + "show object pos ,,-~ to ,,30",
178 HandleShowObjectByPos); 161 HandleShowObjectByPos);
179 162
180 m_console.Commands.AddCommand( 163 m_console.Commands.AddCommand(
181 "Objects", 164 "Objects",
182 false, 165 false,
183 "show part uuid", 166 "show part id",
184 "show part uuid <UUID>", 167 "show part id <UUID-or-localID>",
185 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); 168 "Show details of a scene object part with the given UUID or localID", HandleShowPartById);
186 169
187 m_console.Commands.AddCommand( 170 m_console.Commands.AddCommand(
188 "Objects", 171 "Objects",
@@ -190,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
190 "show part name", 173 "show part name",
191 "show part name [--regex] <name>", 174 "show part name [--regex] <name>",
192 "Show details of scene object parts with the given name.", 175 "Show details of scene object parts with the given name.",
193 "If --regex is specified then the name is treatead as a regular expression", 176 "If --regex is specified then the name is treated as a regular expression",
194 HandleShowPartByName); 177 HandleShowPartByName);
195 178
196 m_console.Commands.AddCommand( 179 m_console.Commands.AddCommand(
@@ -199,18 +182,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
199 "show part pos", 182 "show part pos",
200 "show part pos <start-coord> to <end-coord>", 183 "show part pos <start-coord> to <end-coord>",
201 "Show details of scene object parts within the given area.", 184 "Show details of scene object parts within the given area.",
202 "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 185 ConsoleUtil.CoordHelp,
203 + "If you don't care about the z component you can simply omit it.\n"
204 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
205 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
206 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
207 + "e.g.\n"
208 + "show object pos 20,20,20 to 40,40,40\n"
209 + "show object pos 20,20 to 40,40\n"
210 + "show object pos ,20,20 to ,40,40\n"
211 + "show object pos ,,30 to ,,~\n"
212 + "show object pos ,,-~ to ,,30",
213 HandleShowPartByPos); 186 HandleShowPartByPos);
187
188 m_console.Commands.AddCommand(
189 "Objects",
190 false,
191 "dump object id",
192 "dump object id <UUID-or-localID>",
193 "Dump the formatted serialization of the given object to the file <UUID>.xml",
194 "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n"
195 + "To locate the UUID or localID in the first place, you need to use the other show object commands.\n"
196 + "If a local ID is given then the filename used is still that for the UUID",
197 HandleDumpObjectById);
214 } 198 }
215 199
216 public void RemoveRegion(Scene scene) 200 public void RemoveRegion(Scene scene)
@@ -265,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
265 m_console.OutputFormat(sb.ToString()); 249 m_console.OutputFormat(sb.ToString());
266 } 250 }
267 251
268 private void HandleShowObjectByUuid(string module, string[] cmdparams) 252 private void HandleShowObjectById(string module, string[] cmdparams)
269 { 253 {
270 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 254 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
271 return; 255 return;
@@ -281,14 +265,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
281 return; 265 return;
282 } 266 }
283 267
284 UUID objectUuid; 268 UUID uuid;
285 if (!UUID.TryParse(mainParams[3], out objectUuid)) 269 uint localId;
286 { 270 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out uuid, out localId))
287 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
288 return; 271 return;
289 }
290 272
291 SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); 273 SceneObjectGroup so;
274
275 if (localId != ConsoleUtil.LocalIdNotFound)
276 so = m_scene.GetSceneObjectGroup(localId);
277 else
278 so = m_scene.GetSceneObjectGroup(uuid);
292 279
293 if (so == null) 280 if (so == null)
294 { 281 {
@@ -365,7 +352,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
365 OutputSogsToConsole(searchPredicate, showFull); 352 OutputSogsToConsole(searchPredicate, showFull);
366 } 353 }
367 354
368 private void HandleShowPartByUuid(string module, string[] cmdparams) 355 private void HandleShowPartById(string module, string[] cmdparams)
369 { 356 {
370 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 357 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
371 return; 358 return;
@@ -378,18 +365,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
378 365
379 if (mainParams.Count < 4) 366 if (mainParams.Count < 4)
380 { 367 {
381 m_console.OutputFormat("Usage: show part uuid [--full] <uuid>"); 368 m_console.OutputFormat("Usage: show part id [--full] <UUID-or-localID>");
382 return; 369 return;
383 } 370 }
384 371
385 UUID objectUuid; 372 UUID objectUuid;
386 if (!UUID.TryParse(mainParams[3], out objectUuid)) 373 uint localId;
387 { 374 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out objectUuid, out localId))
388 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
389 return; 375 return;
390 }
391 376
392 SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); 377 SceneObjectPart sop;
378 if (localId == ConsoleUtil.LocalIdNotFound)
379 sop = m_scene.GetSceneObjectPart(objectUuid);
380 else
381 sop = m_scene.GetSceneObjectPart(localId);
393 382
394 if (sop == null) 383 if (sop == null)
395 { 384 {
@@ -477,6 +466,51 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
477 OutputSopsToConsole(searchPredicate, true); 466 OutputSopsToConsole(searchPredicate, true);
478 } 467 }
479 468
469 private void HandleDumpObjectById(string module, string[] cmdparams)
470 {
471 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
472 return;
473
474 if (cmdparams.Length < 4)
475 {
476 m_console.OutputFormat("Usage: dump object id <UUID-or-localID>");
477 return;
478 }
479
480 UUID objectUuid;
481 uint localId;
482 if (!ConsoleUtil.TryParseConsoleId(m_console, cmdparams[3], out objectUuid, out localId))
483 return;
484
485 SceneObjectGroup so;
486 if (localId == ConsoleUtil.LocalIdNotFound)
487 so = m_scene.GetSceneObjectGroup(objectUuid);
488 else
489 so = m_scene.GetSceneObjectGroup(localId);
490
491 if (so == null)
492 {
493// m_console.OutputFormat("No part found with uuid {0}", objectUuid);
494 return;
495 }
496
497 // In case we found it via local ID.
498 objectUuid = so.UUID;
499
500 string fileName = string.Format("{0}.xml", objectUuid);
501
502 if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName))
503 return;
504
505 using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8))
506 {
507 xtw.Formatting = Formatting.Indented;
508 SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true);
509 }
510
511 m_console.OutputFormat("Object dumped to file {0}", fileName);
512 }
513
480 /// <summary> 514 /// <summary>
481 /// Append a scene object report to an input StringBuilder 515 /// Append a scene object report to an input StringBuilder
482 /// </summary> 516 /// </summary>
@@ -641,19 +675,24 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
641 675
642 break; 676 break;
643 677
644 case "uuid": 678 case "id":
645 if (!UUID.TryParse(o, out match)) 679 UUID uuid;
680 uint localId;
681 if (!ConsoleUtil.TryParseConsoleId(m_console, o, out uuid, out localId))
646 return; 682 return;
647 683
648 requireConfirmation = false; 684 requireConfirmation = false;
649 deletes = new List<SceneObjectGroup>(); 685 deletes = new List<SceneObjectGroup>();
650 686
651 m_scene.ForEachSOG(delegate (SceneObjectGroup g) 687 SceneObjectGroup so;
652 { 688 if (localId == ConsoleUtil.LocalIdNotFound)
653 if (g.UUID == match && !g.IsAttachment) 689 so = m_scene.GetSceneObjectGroup(uuid);
654 deletes.Add(g); 690 else
655 }); 691 so = m_scene.GetSceneObjectGroup(localId);
656 692
693 if (!so.IsAttachment)
694 deletes.Add(so);
695
657 // if (deletes.Count == 0) 696 // if (deletes.Count == 0)
658 // m_console.OutputFormat("No objects were found with uuid {0}", match); 697 // m_console.OutputFormat("No objects were found with uuid {0}", match);
659 698