diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/caches/InventoryFolder.cs | 12 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/caches/UserProfileCache.cs | 67 |
2 files changed, 75 insertions, 4 deletions
diff --git a/OpenSim/Framework/Communications/caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs index af38b12..8978cee 100644 --- a/OpenSim/Framework/Communications/caches/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/caches/InventoryFolder.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
36 | return returnFolder; | 36 | return returnFolder; |
37 | } | 37 | } |
38 | 38 | ||
39 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) | 39 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type ) |
40 | { | 40 | { |
41 | InventoryFolder subFold = new InventoryFolder(); | 41 | InventoryFolder subFold = new InventoryFolder(); |
42 | subFold.name = folderName; | 42 | subFold.name = folderName; |
@@ -47,5 +47,15 @@ namespace OpenSim.Framework.Communications.Caches | |||
47 | this.SubFolders.Add(subFold.folderID, subFold); | 47 | this.SubFolders.Add(subFold.folderID, subFold); |
48 | return subFold; | 48 | return subFold; |
49 | } | 49 | } |
50 | |||
51 | public List<InventoryItemBase> RequestListOfItems() | ||
52 | { | ||
53 | List<InventoryItemBase> itemList = new List<InventoryItemBase>(); | ||
54 | foreach (InventoryItemBase item in this.Items.Values) | ||
55 | { | ||
56 | itemList.Add(item); | ||
57 | } | ||
58 | return itemList; | ||
59 | } | ||
50 | } | 60 | } |
51 | } | 61 | } |
diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs index f651b8a..bfb6f07 100644 --- a/OpenSim/Framework/Communications/caches/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/caches/UserProfileCache.cs | |||
@@ -2,6 +2,7 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Interfaces; | ||
5 | using OpenSim.Framework.Data; | 6 | using OpenSim.Framework.Data; |
6 | using OpenSim.Framework.Communications; | 7 | using OpenSim.Framework.Communications; |
7 | 8 | ||
@@ -29,14 +30,17 @@ namespace OpenSim.Framework.Communications.Caches | |||
29 | { | 30 | { |
30 | CachedUserInfo userInfo = new CachedUserInfo(); | 31 | CachedUserInfo userInfo = new CachedUserInfo(); |
31 | userInfo.UserProfile = this.RequestUserProfileForUser(userID); | 32 | userInfo.UserProfile = this.RequestUserProfileForUser(userID); |
32 | this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | 33 | |
33 | if (userInfo.UserProfile != null) | 34 | if (userInfo.UserProfile != null) |
34 | { | 35 | { |
36 | this.RequestInventoryForUser(userID, userInfo); | ||
35 | this.UserProfiles.Add(userID, userInfo); | 37 | this.UserProfiles.Add(userID, userInfo); |
36 | } | 38 | } |
37 | else | 39 | else |
38 | { | 40 | { |
39 | //no profile for this user, what do we do now? | 41 | //no profile for this user, what do we do now? |
42 | Console.WriteLine("UserProfileCache.cs: user profile for user not found"); | ||
43 | |||
40 | } | 44 | } |
41 | } | 45 | } |
42 | else | 46 | else |
@@ -68,6 +72,52 @@ namespace OpenSim.Framework.Communications.Caches | |||
68 | 72 | ||
69 | } | 73 | } |
70 | 74 | ||
75 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) | ||
76 | { | ||
77 | if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | ||
78 | { | ||
79 | CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId]; | ||
80 | if (userInfo.RootFolder.folderID == parentID) | ||
81 | { | ||
82 | userInfo.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(parentID); | ||
87 | if (parentFolder != null) | ||
88 | { | ||
89 | parentFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | ||
96 | { | ||
97 | if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) | ||
98 | { | ||
99 | CachedUserInfo userInfo = this.UserProfiles[remoteClient.AgentId]; | ||
100 | if (userInfo.RootFolder.folderID == folderID) | ||
101 | { | ||
102 | if (fetchItems) | ||
103 | { | ||
104 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, userInfo.RootFolder.RequestListOfItems()); | ||
105 | } | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | InventoryFolder parentFolder = userInfo.RootFolder.HasSubFolder(folderID); | ||
110 | if(parentFolder != null) | ||
111 | { | ||
112 | if(fetchItems) | ||
113 | { | ||
114 | remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, parentFolder.RequestListOfItems()); | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | |||
71 | /// <summary> | 121 | /// <summary> |
72 | /// Request the user profile from User server | 122 | /// Request the user profile from User server |
73 | /// </summary> | 123 | /// </summary> |
@@ -81,9 +131,20 @@ namespace OpenSim.Framework.Communications.Caches | |||
81 | /// Request Iventory Info from Inventory server | 131 | /// Request Iventory Info from Inventory server |
82 | /// </summary> | 132 | /// </summary> |
83 | /// <param name="userID"></param> | 133 | /// <param name="userID"></param> |
84 | private void RequestInventoryForUser(LLUUID userID) | 134 | private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) |
85 | { | 135 | { |
86 | 136 | // this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | |
137 | |||
138 | //for now we manually create the root folder, | ||
139 | // but should be requesting all inventory from inventory server. | ||
140 | InventoryFolder rootFolder = new InventoryFolder(); | ||
141 | rootFolder.agentID = userID; | ||
142 | rootFolder.folderID = userInfo.UserProfile.rootInventoryFolderID; | ||
143 | rootFolder.name = "My Inventory"; | ||
144 | rootFolder.parentID = LLUUID.Zero; | ||
145 | rootFolder.type = 8; | ||
146 | rootFolder.version = 1; | ||
147 | userInfo.FolderReceive(userID, rootFolder); | ||
87 | } | 148 | } |
88 | 149 | ||
89 | /// <summary> | 150 | /// <summary> |