diff options
Diffstat (limited to 'OpenSim.RegionServer/SimClient.cs')
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index e013b63..6eb48fb 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -75,10 +75,20 @@ namespace OpenSim | |||
75 | private Dictionary<uint, SimClient> m_clientThreads; | 75 | private Dictionary<uint, SimClient> m_clientThreads; |
76 | private AssetCache m_assetCache; | 76 | private AssetCache m_assetCache; |
77 | private IGridServer m_gridServer; | 77 | private IGridServer m_gridServer; |
78 | private IUserServer m_userServer = null; | ||
78 | private OpenSimNetworkHandler m_application; | 79 | private OpenSimNetworkHandler m_application; |
79 | private InventoryCache m_inventoryCache; | 80 | private InventoryCache m_inventoryCache; |
80 | private bool m_sandboxMode; | 81 | private bool m_sandboxMode; |
81 | 82 | ||
83 | |||
84 | public IUserServer UserServer | ||
85 | { | ||
86 | set | ||
87 | { | ||
88 | this.m_userServer = value; | ||
89 | } | ||
90 | } | ||
91 | |||
82 | private void ack_pack(Packet Pack) | 92 | private void ack_pack(Packet Pack) |
83 | { | 93 | { |
84 | //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); | 94 | //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); |
@@ -241,6 +251,15 @@ namespace OpenSim | |||
241 | { | 251 | { |
242 | client.OutPacket(kill); | 252 | client.OutPacket(kill); |
243 | } | 253 | } |
254 | if (this.m_userServer != null) | ||
255 | { | ||
256 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | ||
261 | } | ||
262 | |||
244 | m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); | 263 | m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); |
245 | lock (m_world.Entities) | 264 | lock (m_world.Entities) |
246 | { | 265 | { |
@@ -657,12 +676,16 @@ namespace OpenSim | |||
657 | // Create Inventory, currently only works for sandbox mode | 676 | // Create Inventory, currently only works for sandbox mode |
658 | if (m_sandboxMode) | 677 | if (m_sandboxMode) |
659 | { | 678 | { |
679 | AgentInventory inventory = null; | ||
660 | if (sessionInfo.LoginInfo.InventoryFolder != null) | 680 | if (sessionInfo.LoginInfo.InventoryFolder != null) |
661 | { | 681 | { |
662 | this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); | 682 | inventory = this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); |
663 | if (sessionInfo.LoginInfo.BaseFolder != null) | 683 | if (sessionInfo.LoginInfo.BaseFolder != null) |
664 | { | 684 | { |
665 | m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); | 685 | if (!inventory.HasFolder(sessionInfo.LoginInfo.BaseFolder)) |
686 | { | ||
687 | m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); | ||
688 | } | ||
666 | this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; | 689 | this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; |
667 | AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID); | 690 | AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID); |
668 | if (inventorySet != null) | 691 | if (inventorySet != null) |
@@ -683,12 +706,23 @@ namespace OpenSim | |||
683 | } | 706 | } |
684 | } | 707 | } |
685 | 708 | ||
686 | private void CreateInventory(LLUUID baseFolder) | 709 | private AgentInventory CreateInventory(LLUUID baseFolder) |
687 | { | 710 | { |
688 | AgentInventory inventory = new AgentInventory(); | 711 | AgentInventory inventory = null; |
689 | inventory.AgentID = this.AgentID; | 712 | if (this.m_userServer != null) |
690 | m_inventoryCache.AddNewAgentsInventory(inventory); | 713 | { |
691 | m_inventoryCache.CreateNewInventoryFolder(this, baseFolder); | 714 | // a user server is set so request the inventory from it |
715 | inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer); | ||
716 | } | ||
717 | else | ||
718 | { | ||
719 | inventory = new AgentInventory(); | ||
720 | inventory.AgentID = this.AgentID; | ||
721 | inventory.CreateRootFolder(this.AgentID, false); | ||
722 | m_inventoryCache.AddNewAgentsInventory(inventory); | ||
723 | m_inventoryCache.CreateNewInventoryFolder(this, baseFolder); | ||
724 | } | ||
725 | return inventory; | ||
692 | } | 726 | } |
693 | } | 727 | } |
694 | } | 728 | } |