aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs32
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs39
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs173
4 files changed, 191 insertions, 57 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 765fafc..bf7bb7e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -189,7 +189,6 @@ namespace OpenSim.Region.Environment.Scenes
189 /// <param name="primLocalID"></param> 189 /// <param name="primLocalID"></param>
190 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) 190 public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
191 { 191 {
192
193 bool hasPrim = false; 192 bool hasPrim = false;
194 foreach (EntityBase ent in Entities.Values) 193 foreach (EntityBase ent in Entities.Values)
195 { 194 {
@@ -198,7 +197,11 @@ namespace OpenSim.Region.Environment.Scenes
198 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID); 197 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(primLocalID);
199 if (hasPrim != false) 198 if (hasPrim != false)
200 { 199 {
201 ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID); 200 bool fileChange = ((SceneObjectGroup)ent).GetPartInventoryFileName(remoteClient, primLocalID);
201 if (fileChange)
202 {
203 ((SceneObjectGroup)ent).RequestInventoryFile(primLocalID, xferManager);
204 }
202 break; 205 break;
203 } 206 }
204 } 207 }
@@ -216,6 +219,7 @@ namespace OpenSim.Region.Environment.Scenes
216 if (item != null) 219 if (item != null)
217 { 220 {
218 bool isTexture = false; 221 bool isTexture = false;
222 bool rezzed = false;
219 if (item.invType == 0) 223 if (item.invType == 0)
220 { 224 {
221 isTexture = true; 225 isTexture = true;
@@ -226,6 +230,7 @@ namespace OpenSim.Region.Environment.Scenes
226 string script = Util.FieldToString(rezAsset.Data); 230 string script = Util.FieldToString(rezAsset.Data);
227 //Console.WriteLine("rez script "+script); 231 //Console.WriteLine("rez script "+script);
228 this.EventManager.TriggerRezScript(localID, script); 232 this.EventManager.TriggerRezScript(localID, script);
233 rezzed = true;
229 } 234 }
230 else 235 else
231 { 236 {
@@ -236,8 +241,31 @@ namespace OpenSim.Region.Environment.Scenes
236 string script = Util.FieldToString(rezAsset.Data); 241 string script = Util.FieldToString(rezAsset.Data);
237 // Console.WriteLine("rez script " + script); 242 // Console.WriteLine("rez script " + script);
238 this.EventManager.TriggerRezScript(localID, script); 243 this.EventManager.TriggerRezScript(localID, script);
244 rezzed = true;
239 } 245 }
240 } 246 }
247
248 if (rezzed)
249 {
250 bool hasPrim = false;
251 foreach (EntityBase ent in Entities.Values)
252 {
253 if (ent is SceneObjectGroup)
254 {
255 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
256 if (hasPrim != false)
257 {
258 bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item);
259 if (added)
260 {
261 userInfo.DeleteItem(remoteClient.AgentId, item);
262 remoteClient.SendRemoveInventoryItem(itemID);
263 }
264 }
265 }
266 }
267
268 }
241 } 269 }
242 } 270 }
243 } 271 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d625dec..d3aafcc 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -77,6 +77,7 @@ namespace OpenSim.Region.Environment.Scenes
77 protected AgentCircuitManager authenticateHandler; 77 protected AgentCircuitManager authenticateHandler;
78 protected RegionCommsListener regionCommsHost; 78 protected RegionCommsListener regionCommsHost;
79 protected CommunicationsManager commsManager; 79 protected CommunicationsManager commsManager;
80 protected XferManagaer xferManager;
80 81
81 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); 82 protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>();
82 protected BaseHttpServer httpListener; 83 protected BaseHttpServer httpListener;
@@ -163,6 +164,7 @@ namespace OpenSim.Region.Environment.Scenes
163 m_scriptManager = new ScriptManager(this); 164 m_scriptManager = new ScriptManager(this);
164 m_eventManager = new EventManager(); 165 m_eventManager = new EventManager();
165 m_permissionManager = new PermissionManager(this); 166 m_permissionManager = new PermissionManager(this);
167 xferManager = new XferManagaer();
166 168
167 m_eventManager.OnParcelPrimCountAdd += 169 m_eventManager.OnParcelPrimCountAdd +=
168 m_LandManager.addPrimToLandPrimCounts; 170 m_LandManager.addPrimToLandPrimCounts;
@@ -711,6 +713,8 @@ namespace OpenSim.Region.Environment.Scenes
711 client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; 713 client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest;
712 client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; 714 client.OnXferReceive += commsManager.TransactionsManager.HandleXfer;
713 // client.OnRequestXfer += RequestXfer; 715 // client.OnRequestXfer += RequestXfer;
716 client.OnRequestXfer += xferManager.RequestXfer;
717 client.OnConfirmXfer += xferManager.AckPacket;
714 client.OnRezScript += RezScript; 718 client.OnRezScript += RezScript;
715 719
716 client.OnRequestAvatarProperties += RequestAvatarProperty; 720 client.OnRequestAvatarProperties += RequestAvatarProperty;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 2151ded..219de84 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -10,6 +10,7 @@ using libsecondlife.Packets;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
12using OpenSim.Physics.Manager; 12using OpenSim.Physics.Manager;
13using OpenSim.Framework.Data;
13 14
14namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
15{ 16{
@@ -518,7 +519,7 @@ namespace OpenSim.Region.Environment.Scenes
518 proper.ObjectData[0].FolderID = LLUUID.Zero; 519 proper.ObjectData[0].FolderID = LLUUID.Zero;
519 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 520 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
520 proper.ObjectData[0].GroupID = LLUUID.Zero; 521 proper.ObjectData[0].GroupID = LLUUID.Zero;
521 proper.ObjectData[0].InventorySerial = 0; 522 proper.ObjectData[0].InventorySerial = (short) this.m_rootPart.InventorySerial;
522 proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; 523 proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID;
523 proper.ObjectData[0].ObjectID = this.UUID; 524 proper.ObjectData[0].ObjectID = this.UUID;
524 proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; 525 proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID;
@@ -601,27 +602,45 @@ namespace OpenSim.Region.Environment.Scenes
601 /// </summary> 602 /// </summary>
602 /// <param name="remoteClient"></param> 603 /// <param name="remoteClient"></param>
603 /// <param name="localID"></param> 604 /// <param name="localID"></param>
604 public void GetPartInventoryFileName(IClientAPI remoteClient, uint localID) 605 public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID)
605 { 606 {
606 SceneObjectPart part = this.GetChildPrim(localID); 607 SceneObjectPart part = this.GetChildPrim(localID);
607 if (part != null) 608 if (part != null)
608 { 609 {
609 part.GetInventoryFileName(remoteClient, localID); 610 return part.GetInventoryFileName(remoteClient, localID);
610 } 611 }
612 return false;
611 } 613 }
612 614
613 /// <summary> 615 public string RequestInventoryFile(uint localID, XferManagaer xferManager)
614 /// 616 {
615 /// </summary> 617 SceneObjectPart part = this.GetChildPrim(localID);
616 /// <param name="remoteClient"></param> 618 if (part != null)
617 /// <param name="partID"></param> 619 {
618 public void RequestInventoryFile(IClientAPI remoteClient, uint localID, ulong xferID) 620 return part.RequestInventoryFile(xferManager);
621 }
622 return "";
623 }
624
625 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item)
619 { 626 {
620 SceneObjectPart part = this.GetChildPrim(localID); 627 SceneObjectPart part = this.GetChildPrim(localID);
621 if (part != null) 628 if (part != null)
622 { 629 {
623 part.RequestInventoryFile(remoteClient, xferID); 630 SceneObjectPart.TaskInventoryItem taskItem = new SceneObjectPart.TaskInventoryItem();
631 taskItem.item_id = item.inventoryID;
632 taskItem.asset_id = item.assetID;
633 taskItem.name = item.inventoryName;
634 taskItem.desc = item.inventoryDescription;
635 taskItem.owner_id = item.avatarID;
636 taskItem.creator_id = item.creatorsID;
637 taskItem.type = taskItem.AssetTypes[item.assetType];
638 taskItem.inv_type = taskItem.AssetTypes[item.invType];
639 part.AddInventoryItem(taskItem);
640 return true;
624 } 641 }
642 return false;
643
625 } 644 }
626 645
627 /// <summary> 646 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 904b158..5fa79fb 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -10,6 +10,7 @@ using libsecondlife.Packets;
10using OpenSim.Framework.Interfaces; 10using OpenSim.Framework.Interfaces;
11using OpenSim.Framework.Types; 11using OpenSim.Framework.Types;
12using OpenSim.Region.Environment.Scenes.Scripting; 12using OpenSim.Region.Environment.Scenes.Scripting;
13using OpenSim.Framework.Utilities;
13 14
14namespace OpenSim.Region.Environment.Scenes 15namespace OpenSim.Region.Environment.Scenes
15{ 16{
@@ -18,6 +19,10 @@ namespace OpenSim.Region.Environment.Scenes
18 { 19 {
19 private const uint FULL_MASK_PERMISSIONS = 2147483647; 20 private const uint FULL_MASK_PERMISSIONS = 2147483647;
20 21
22 private string m_inventoryFileName = "";
23 private LLUUID m_folderID = LLUUID.Zero;
24
25 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
21 26
22 public LLUUID CreatorID; 27 public LLUUID CreatorID;
23 public LLUUID OwnerID; 28 public LLUUID OwnerID;
@@ -43,6 +48,16 @@ namespace OpenSim.Region.Environment.Scenes
43 48
44 #region Properties 49 #region Properties
45 50
51 /// <summary>
52 /// Serial count for inventory file , used to tell if inventory has changed
53 /// no need for this to be part of Database backup
54 /// </summary>
55 protected uint m_inventorySerial = 0;
56 public uint InventorySerial
57 {
58 get { return m_inventorySerial; }
59 }
60
46 protected LLUUID m_uuid; 61 protected LLUUID m_uuid;
47 public LLUUID UUID 62 public LLUUID UUID
48 { 63 {
@@ -221,6 +236,8 @@ namespace OpenSim.Region.Environment.Scenes
221 this.AngularVelocity = new LLVector3(0, 0, 0); 236 this.AngularVelocity = new LLVector3(0, 0, 0);
222 this.Acceleration = new LLVector3(0, 0, 0); 237 this.Acceleration = new LLVector3(0, 0, 0);
223 238
239 m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString();
240 m_folderID = LLUUID.Random();
224 241
225 //temporary code just so the m_flags field doesn't give a compiler warning 242 //temporary code just so the m_flags field doesn't give a compiler warning
226 if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop) 243 if (m_flags == LLObject.ObjectFlags.AllowInventoryDrop)
@@ -396,9 +413,12 @@ namespace OpenSim.Region.Environment.Scenes
396 #endregion 413 #endregion
397 414
398 #region Inventory 415 #region Inventory
399 public void AddInventoryItem() 416 public void AddInventoryItem(TaskInventoryItem item)
400 { 417 {
401 418 item.parent_id = m_folderID;
419 item.creation_date = 1000;
420 this.TaskInventory.Add(item.item_id, item);
421 this.m_inventorySerial++;
402 } 422 }
403 423
404 public void RemoveInventoryItem() 424 public void RemoveInventoryItem()
@@ -410,54 +430,63 @@ namespace OpenSim.Region.Environment.Scenes
410 /// </summary> 430 /// </summary>
411 /// <param name="client"></param> 431 /// <param name="client"></param>
412 /// <param name="localID"></param> 432 /// <param name="localID"></param>
413 public void GetInventoryFileName(IClientAPI client, uint localID) 433 public bool GetInventoryFileName(IClientAPI client, uint localID)
414 { 434 {
415 if (localID == this.m_localID) 435 if (localID == this.m_localID)
416 { 436 {
437 if (this.m_inventorySerial > 0)
438 {
439 client.SendTaskInventory(this.m_uuid, (short)m_inventorySerial, Helpers.StringToField(m_inventoryFileName));
440 return true;
441 }
442 else
443 {
444 client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
445 return false;
446 }
417 //client.SendTaskInventory(this.m_uuid, 1, Helpers.StringToField("primInventory2")); 447 //client.SendTaskInventory(this.m_uuid, 1, Helpers.StringToField("primInventory2"));
418 client.SendTaskInventory(this.m_uuid, 0, new byte[0]); 448 //client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
419 } 449 }
450 return false;
420 } 451 }
421 452
422 /// <summary> 453 public string RequestInventoryFile(XferManagaer xferManager)
423 /// 454 {
424 /// </summary> 455 byte[] fileData = new byte[0];
425 /// <param name="client"></param> 456 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, this.UUID);
426 /// <param name="xferID"></param> 457 foreach (TaskInventoryItem item in this.TaskInventory.Values)
427 public void RequestInventoryFile(IClientAPI client, ulong xferID) 458 {
428 { 459 invString.AddItemStart();
429 // a test item 460 invString.AddNameValueLine("item_id", item.item_id.ToStringHyphenated());
430 InventoryStringBuilder invString = new InventoryStringBuilder(); 461 invString.AddNameValueLine("parent_id", item.parent_id.ToStringHyphenated());
431 invString.AddItemStart(); 462
432 invString.AddNameValueLine("item_id", LLUUID.Random().ToStringHyphenated()); 463 invString.AddPermissionsStart();
433 invString.AddNameValueLine("parent_id", LLUUID.Zero.ToStringHyphenated()); 464 invString.AddNameValueLine("base_mask", "0x7FFFFFFF");
434 465 invString.AddNameValueLine("owner_mask", "0x7FFFFFFF");
435 invString.AddPermissionsStart(); 466 invString.AddNameValueLine("group_mask", "0x7FFFFFFF");
436 invString.AddNameValueLine("base_mask", "0x7FFFFFFF"); 467 invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF");
437 invString.AddNameValueLine("owner_mask", "0x7FFFFFFF"); 468 invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF");
438 invString.AddNameValueLine("group_mask", "0x7FFFFFFF"); 469 invString.AddNameValueLine("creator_id", item.creator_id.ToStringHyphenated());
439 invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF"); 470 invString.AddNameValueLine("owner_id", item.owner_id.ToStringHyphenated());
440 invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF"); 471 invString.AddNameValueLine("last_owner_id", item.last_owner_id.ToStringHyphenated());
441 invString.AddNameValueLine("creator_id", client.AgentId.ToStringHyphenated()); 472 invString.AddNameValueLine("group_id", item.group_id.ToStringHyphenated());
442 invString.AddNameValueLine("owner_id", client.AgentId.ToStringHyphenated()); 473 invString.AddSectionEnd();
443 invString.AddNameValueLine("last_owner_id", LLUUID.Zero.ToStringHyphenated()); 474
444 invString.AddNameValueLine("group_id", LLUUID.Zero.ToStringHyphenated()); 475 invString.AddNameValueLine("asset_id", item.asset_id.ToStringHyphenated());
445 invString.AddSectionEnd(); 476 invString.AddNameValueLine("type", item.type);
446 477 invString.AddNameValueLine("inv_type", item.inv_type);
447 invString.AddNameValueLine("asset_id", "00000000-0000-2222-3333-000000000001"); 478 invString.AddNameValueLine("flags", "0x00");
448 invString.AddNameValueLine("type", "lsltext"); 479 invString.AddNameValueLine("name", item.name + "|");
449 invString.AddNameValueLine("inv_type", "lsltext"); 480 invString.AddNameValueLine("desc", item.desc + "|");
450 invString.AddNameValueLine("flags", "0x00"); 481 invString.AddNameValueLine("creation_date", item.creation_date.ToString());
451 invString.AddNameValueLine("name", "Test inventory" + "|"); 482 invString.AddSectionEnd();
452 invString.AddNameValueLine("desc", "test description" + "|"); 483 }
453 invString.AddNameValueLine("creation_date", "10000"); 484 fileData = Helpers.StringToField(invString.BuildString);
454 invString.AddSectionEnd(); 485 if (fileData.Length > 2)
455 486 {
456 byte[] fileInv = Helpers.StringToField(invString.BuildString); 487 xferManager.AddNewFile(m_inventoryFileName, fileData);
457 byte[] data = new byte[fileInv.Length + 4]; 488 }
458 Array.Copy(Helpers.IntToBytes(fileInv.Length), 0, data, 0, 4); 489 return "";
459 Array.Copy(fileInv, 0, data, 4, fileInv.Length);
460 client.SendXferPacket(xferID, 0 + 0x80000000, data);
461 } 490 }
462 #endregion 491 #endregion
463 492
@@ -643,9 +672,14 @@ namespace OpenSim.Region.Environment.Scenes
643 { 672 {
644 public string BuildString = ""; 673 public string BuildString = "";
645 674
646 public InventoryStringBuilder() 675 public InventoryStringBuilder(LLUUID folderID, LLUUID parentID)
647 { 676 {
648 677 BuildString += "\tinv_object\t0\n\t{\n";
678 this.AddNameValueLine("obj_id", folderID.ToStringHyphenated());
679 this.AddNameValueLine("parent_id", parentID.ToStringHyphenated());
680 this.AddNameValueLine("type", "category");
681 this.AddNameValueLine("name", "Contents");
682 this.AddSectionEnd();
649 } 683 }
650 684
651 public void AddItemStart() 685 public void AddItemStart()
@@ -676,6 +710,55 @@ namespace OpenSim.Region.Environment.Scenes
676 BuildString += name + "\t"; 710 BuildString += name + "\t";
677 BuildString += value + "\n"; 711 BuildString += value + "\n";
678 } 712 }
713
714 public void Close()
715 {
716 }
717 }
718
719 public class TaskInventoryItem
720 {
721 public string[] AssetTypes = new string[]
722 {
723 "texture",
724 "sound",
725 "",
726 "",
727 "",
728 "",
729 "",
730 "",
731 "",
732 "",
733 "lsltext",
734 ""
735 };
736 public LLUUID item_id = LLUUID.Zero;
737 public LLUUID parent_id = LLUUID.Zero;
738
739 public uint base_mask = FULL_MASK_PERMISSIONS;
740 public uint owner_mask = FULL_MASK_PERMISSIONS;
741 public uint group_mask = FULL_MASK_PERMISSIONS;
742 public uint everyone_mask = FULL_MASK_PERMISSIONS;
743 public uint next_owner_mask = FULL_MASK_PERMISSIONS;
744 public LLUUID creator_id = LLUUID.Zero;
745 public LLUUID owner_id = LLUUID.Zero;
746 public LLUUID last_owner_id = LLUUID.Zero;
747 public LLUUID group_id = LLUUID.Zero;
748
749 public LLUUID asset_id = LLUUID.Zero;
750 public string type = "";
751 public string inv_type = "";
752 public uint flags = 0;
753 public string name = "";
754 public string desc = "";
755 public uint creation_date = 0;
756 public string FileName = "";
757
758 public TaskInventoryItem()
759 {
760 FileName = "taskItem" + LLUUID.Random().ToString();
761 }
679 } 762 }
680 } 763 }
681} 764}