aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 18:04:42 +0000
committerAdam Frisby2008-05-01 18:04:42 +0000
commit20a9bf08f51351e1e0a9de94f184ff56cd572665 (patch)
tree52da64dab26353b903c8e4befed0178fa72a188b /OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
parentMore config cleanup in LaunchSLClient. (diff)
downloadopensim-SC_OLD-20a9bf08f51351e1e0a9de94f184ff56cd572665.zip
opensim-SC_OLD-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.gz
opensim-SC_OLD-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.bz2
opensim-SC_OLD-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.xz
* Rolled back a few changes.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs150
1 files changed, 74 insertions, 76 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index c8a8f95..0215cec 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -41,12 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
41 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 private readonly string m_inventoryFileName = String.Empty; 44 private string m_inventoryFileName = String.Empty;
45
46 /// <summary>
47 /// Tracks whether inventory has changed since the last persistent backup
48 /// </summary>
49 private bool HasInventoryChanged;
50 45
51 /// <summary> 46 /// <summary>
52 /// The inventory folder for this prim 47 /// The inventory folder for this prim
@@ -54,17 +49,6 @@ namespace OpenSim.Region.Environment.Scenes
54 private LLUUID m_folderID = LLUUID.Zero; 49 private LLUUID m_folderID = LLUUID.Zero;
55 50
56 /// <summary> 51 /// <summary>
57 /// Serial count for inventory file , used to tell if inventory has changed
58 /// no need for this to be part of Database backup
59 /// </summary>
60 protected uint m_inventorySerial;
61
62 /// <summary>
63 /// Holds in memory prim inventory
64 /// </summary>
65 protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary();
66
67 /// <summary>
68 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see 52 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
69 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim. 53 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
70 /// </summary> 54 /// </summary>
@@ -74,12 +58,23 @@ namespace OpenSim.Region.Environment.Scenes
74 set { m_folderID = value; } 58 set { m_folderID = value; }
75 } 59 }
76 60
61 /// <summary>
62 /// Serial count for inventory file , used to tell if inventory has changed
63 /// no need for this to be part of Database backup
64 /// </summary>
65 protected uint m_inventorySerial = 0;
66
77 public uint InventorySerial 67 public uint InventorySerial
78 { 68 {
79 get { return m_inventorySerial; } 69 get { return m_inventorySerial; }
80 set { m_inventorySerial = value; } 70 set { m_inventorySerial = value; }
81 } 71 }
82 72
73 /// <summary>
74 /// Holds in memory prim inventory
75 /// </summary>
76 protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary();
77
83 public TaskInventoryDictionary TaskInventory 78 public TaskInventoryDictionary TaskInventory
84 { 79 {
85 get { return m_taskInventory; } 80 get { return m_taskInventory; }
@@ -87,6 +82,11 @@ namespace OpenSim.Region.Environment.Scenes
87 } 82 }
88 83
89 /// <summary> 84 /// <summary>
85 /// Tracks whether inventory has changed since the last persistent backup
86 /// </summary>
87 private bool HasInventoryChanged;
88
89 /// <summary>
90 /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating 90 /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating
91 /// new ones or setting existing UUIDs to the correct parent UUIDs. 91 /// new ones or setting existing UUIDs to the correct parent UUIDs.
92 /// 92 ///
@@ -96,14 +96,14 @@ namespace OpenSim.Region.Environment.Scenes
96 public void ResetInventoryIDs() 96 public void ResetInventoryIDs()
97 { 97 {
98 lock (TaskInventory) 98 lock (TaskInventory)
99 { 99 {
100 if (0 == TaskInventory.Count) 100 if (0 == TaskInventory.Count)
101 { 101 {
102 return; 102 return;
103 } 103 }
104 104
105 HasInventoryChanged = true; 105 HasInventoryChanged = true;
106 106
107 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values); 107 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values);
108 TaskInventory.Clear(); 108 TaskInventory.Clear();
109 109
@@ -132,9 +132,9 @@ namespace OpenSim.Region.Environment.Scenes
132 if (ownerId != item.OwnerID) 132 if (ownerId != item.OwnerID)
133 { 133 {
134 item.LastOwnerID = item.OwnerID; 134 item.LastOwnerID = item.OwnerID;
135 item.OwnerID = ownerId; 135 item.OwnerID = ownerId;
136 item.BaseMask = item.NextOwnerMask & (uint) PermissionMask.All; 136 item.BaseMask = item.NextOwnerMask & (uint)PermissionMask.All;
137 item.OwnerMask = item.NextOwnerMask & (uint) PermissionMask.All; 137 item.OwnerMask = item.NextOwnerMask & (uint)PermissionMask.All;
138 } 138 }
139 } 139 }
140 } 140 }
@@ -194,22 +194,22 @@ namespace OpenSim.Region.Environment.Scenes
194 AssetCache cache = m_parentGroup.Scene.AssetCache; 194 AssetCache cache = m_parentGroup.Scene.AssetCache;
195 195
196 cache.GetAsset(item.AssetID, delegate(LLUUID assetID, AssetBase asset) 196 cache.GetAsset(item.AssetID, delegate(LLUUID assetID, AssetBase asset)
197 { 197 {
198 if (null == asset) 198 if (null == asset)
199 { 199 {
200 m_log.ErrorFormat( 200 m_log.ErrorFormat(
201 "[PRIMINVENTORY]: " + 201 "[PRIMINVENTORY]: " +
202 "Couldn't start script {0}, {1} since asset ID {2} could not be found", 202 "Couldn't start script {0}, {1} since asset ID {2} could not be found",
203 item.Name, item.ItemID, item.AssetID); 203 item.Name, item.ItemID, item.AssetID);
204 } 204 }
205 else 205 else
206 { 206 {
207 string script = Helpers.FieldToUTF8String(asset.Data); 207 string script = Helpers.FieldToUTF8String(asset.Data);
208 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId, item.ItemID, script); 208 m_parentGroup.Scene.EventManager.TriggerRezScript(LocalId,item.ItemID,script);
209 m_parentGroup.AddActiveScriptCount(1); 209 m_parentGroup.AddActiveScriptCount(1);
210 ScheduleFullUpdate(); 210 ScheduleFullUpdate();
211 } 211 }
212 }, false); 212 }, false);
213 } 213 }
214 } 214 }
215 215
@@ -226,6 +226,7 @@ namespace OpenSim.Region.Environment.Scenes
226 if (m_taskInventory.ContainsKey(itemId)) 226 if (m_taskInventory.ContainsKey(itemId))
227 { 227 {
228 StartScript(m_taskInventory[itemId]); 228 StartScript(m_taskInventory[itemId]);
229
229 } 230 }
230 else 231 else
231 { 232 {
@@ -262,7 +263,7 @@ namespace OpenSim.Region.Environment.Scenes
262 { 263 {
263 foreach (TaskInventoryItem item in m_taskInventory.Values) 264 foreach (TaskInventoryItem item in m_taskInventory.Values)
264 { 265 {
265 if (item.Name == name) 266 if(item.Name == name)
266 return true; 267 return true;
267 } 268 }
268 return false; 269 return false;
@@ -270,14 +271,14 @@ namespace OpenSim.Region.Environment.Scenes
270 271
271 private string FindAvailableInventoryName(string name) 272 private string FindAvailableInventoryName(string name)
272 { 273 {
273 if (!InventoryContainsName(name)) 274 if(!InventoryContainsName(name))
274 return name; 275 return name;
275 276
276 int suffix = 1; 277 int suffix=1;
277 while (suffix < 256) 278 while(suffix < 256)
278 { 279 {
279 string tryName = String.Format("{0} {1}", name, suffix); 280 string tryName=String.Format("{0} {1}", name, suffix);
280 if (!InventoryContainsName(tryName)) 281 if(!InventoryContainsName(tryName))
281 return tryName; 282 return tryName;
282 suffix++; 283 suffix++;
283 } 284 }
@@ -294,11 +295,11 @@ namespace OpenSim.Region.Environment.Scenes
294 item.CreationDate = 1000; 295 item.CreationDate = 1000;
295 item.ParentPartID = UUID; 296 item.ParentPartID = UUID;
296 297
297 string name = FindAvailableInventoryName(item.Name); 298 string name=FindAvailableInventoryName(item.Name);
298 if (name == String.Empty) 299 if(name == String.Empty)
299 return; 300 return;
300 301
301 item.Name = name; 302 item.Name=name;
302 303
303 lock (m_taskInventory) 304 lock (m_taskInventory)
304 { 305 {
@@ -346,7 +347,7 @@ namespace OpenSim.Region.Environment.Scenes
346// m_log.DebugFormat( 347// m_log.DebugFormat(
347// "[PRIM INVENTORY]: Retrieved task inventory item {0}, {1} from prim {2}, {3}", 348// "[PRIM INVENTORY]: Retrieved task inventory item {0}, {1} from prim {2}, {3}",
348// m_taskInventory[itemID].Name, itemID, Name, UUID); 349// m_taskInventory[itemID].Name, itemID, Name, UUID);
349 350
350 return m_taskInventory[itemID]; 351 return m_taskInventory[itemID];
351 } 352 }
352 else 353 else
@@ -427,6 +428,7 @@ namespace OpenSim.Region.Environment.Scenes
427 scriptcount++; 428 scriptcount++;
428 } 429 }
429 } 430 }
431
430 } 432 }
431 if (scriptcount <= 0) 433 if (scriptcount <= 0)
432 { 434 {
@@ -455,14 +457,14 @@ namespace OpenSim.Region.Environment.Scenes
455 /// <param name="client"></param> 457 /// <param name="client"></param>
456 /// <param name="localID"></param> 458 /// <param name="localID"></param>
457 public bool GetInventoryFileName(IClientAPI client, uint localID) 459 public bool GetInventoryFileName(IClientAPI client, uint localID)
458 { 460 {
459// m_log.DebugFormat( 461// m_log.DebugFormat(
460// "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", 462// "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}",
461// client.AgentId, Name, UUID); 463// client.AgentId, Name, UUID);
462 464
463 if (m_inventorySerial > 0) 465 if (m_inventorySerial > 0)
464 { 466 {
465 client.SendTaskInventory(m_uuid, (short) m_inventorySerial, 467 client.SendTaskInventory(m_uuid, (short)m_inventorySerial,
466 Helpers.StringToField(m_inventoryFileName)); 468 Helpers.StringToField(m_inventoryFileName));
467 return true; 469 return true;
468 } 470 }
@@ -478,9 +480,9 @@ namespace OpenSim.Region.Environment.Scenes
478 /// </summary> 480 /// </summary>
479 /// <param name="xferManager"></param> 481 /// <param name="xferManager"></param>
480 public void RequestInventoryFile(IXfer xferManager) 482 public void RequestInventoryFile(IXfer xferManager)
481 { 483 {
482 byte[] fileData = new byte[0]; 484 byte[] fileData = new byte[0];
483 485
484 // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches 486 // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches
485 // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality 487 // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality
486 // isn't available (such as drag from prim inventory to agent inventory) 488 // isn't available (such as drag from prim inventory to agent inventory)
@@ -491,53 +493,53 @@ namespace OpenSim.Region.Environment.Scenes
491 foreach (TaskInventoryItem item in m_taskInventory.Values) 493 foreach (TaskInventoryItem item in m_taskInventory.Values)
492 { 494 {
493 invString.AddItemStart(); 495 invString.AddItemStart();
494 invString.AddNameValueLine("item_id", item.ItemID.ToString()); 496 invString.AddNameValueLine("item_id", item.ItemID.ToString());
495 invString.AddNameValueLine("parent_id", m_folderID.ToString()); 497 invString.AddNameValueLine("parent_id", m_folderID.ToString());
496 498
497 invString.AddPermissionsStart(); 499 invString.AddPermissionsStart();
498 500
499 // FIXME: Temporary until permissions are properly sorted. 501 // FIXME: Temporary until permissions are properly sorted.
500 invString.AddNameValueLine("base_mask", "7fffffff"); 502 invString.AddNameValueLine("base_mask", "7fffffff");
501 invString.AddNameValueLine("owner_mask", "7fffffff"); 503 invString.AddNameValueLine("owner_mask", "7fffffff");
502 invString.AddNameValueLine("group_mask", "7fffffff"); 504 invString.AddNameValueLine("group_mask", "7fffffff");
503 invString.AddNameValueLine("everyone_mask", "7fffffff"); 505 invString.AddNameValueLine("everyone_mask", "7fffffff");
504 invString.AddNameValueLine("next_owner_mask", "7fffffff"); 506 invString.AddNameValueLine("next_owner_mask", "7fffffff");
505 507
506// invString.AddNameValueLine("group_mask", "00000000"); 508// invString.AddNameValueLine("group_mask", "00000000");
507// invString.AddNameValueLine("everyone_mask", "00000000"); 509// invString.AddNameValueLine("everyone_mask", "00000000");
508// invString.AddNameValueLine("next_owner_mask", "00086000"); 510// invString.AddNameValueLine("next_owner_mask", "00086000");
509 511
510// invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask)); 512// invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask));
511// invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask)); 513// invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask));
512// invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(item.GroupMask)); 514// invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(item.GroupMask));
513// invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(item.EveryoneMask)); 515// invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(item.EveryoneMask));
514// invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask)); 516// invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask));
515 517
516 invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); 518 invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
517 invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); 519 invString.AddNameValueLine("owner_id", item.OwnerID.ToString());
518 520
519 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); 521 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
520// invString.AddNameValueLine("last_owner_id", item.OwnerID.ToString()); 522// invString.AddNameValueLine("last_owner_id", item.OwnerID.ToString());
521 523
522 invString.AddNameValueLine("group_id", item.GroupID.ToString()); 524 invString.AddNameValueLine("group_id", item.GroupID.ToString());
523 invString.AddSectionEnd(); 525 invString.AddSectionEnd();
524 526
525 invString.AddNameValueLine("asset_id", item.AssetID.ToString()); 527 invString.AddNameValueLine("asset_id", item.AssetID.ToString());
526 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); 528 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
527 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); 529 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
528 invString.AddNameValueLine("flags", "00000000"); 530 invString.AddNameValueLine("flags", "00000000");
529 531
530 invString.AddSaleStart(); 532 invString.AddSaleStart();
531 invString.AddNameValueLine("sale_type", "not"); 533 invString.AddNameValueLine("sale_type", "not");
532 invString.AddNameValueLine("sale_price", "0"); 534 invString.AddNameValueLine("sale_price", "0");
533 invString.AddSectionEnd(); 535 invString.AddSectionEnd();
534 536
535 invString.AddNameValueLine("name", item.Name + "|"); 537 invString.AddNameValueLine("name", item.Name + "|");
536 invString.AddNameValueLine("desc", item.Description + "|"); 538 invString.AddNameValueLine("desc", item.Description + "|");
537 539
538 invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); 540 invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
539// invString.AddNameValueLine("creation_date", "1209151453"); 541// invString.AddNameValueLine("creation_date", "1209151453");
540 542
541 invString.AddSectionEnd(); 543 invString.AddSectionEnd();
542 } 544 }
543 } 545 }
@@ -569,8 +571,6 @@ namespace OpenSim.Region.Environment.Scenes
569 } 571 }
570 } 572 }
571 573
572 #region Nested type: InventoryStringBuilder
573
574 public class InventoryStringBuilder 574 public class InventoryStringBuilder
575 { 575 {
576 public string BuildString = String.Empty; 576 public string BuildString = String.Empty;
@@ -596,13 +596,13 @@ namespace OpenSim.Region.Environment.Scenes
596 BuildString += "\tpermissions 0\n"; 596 BuildString += "\tpermissions 0\n";
597 AddSectionStart(); 597 AddSectionStart();
598 } 598 }
599 599
600 public void AddSaleStart() 600 public void AddSaleStart()
601 { 601 {
602 BuildString += "\tsale_info\t0\n"; 602 BuildString += "\tsale_info\t0\n";
603 AddSectionStart(); 603 AddSectionStart();
604 } 604 }
605 605
606 protected void AddSectionStart() 606 protected void AddSectionStart()
607 { 607 {
608 BuildString += "\t{\n"; 608 BuildString += "\t{\n";
@@ -629,7 +629,5 @@ namespace OpenSim.Region.Environment.Scenes
629 { 629 {
630 } 630 }
631 } 631 }
632
633 #endregion
634 } 632 }
635} \ No newline at end of file 633}