diff options
author | Justin Clarke Casey | 2008-05-03 18:57:02 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-03 18:57:02 +0000 |
commit | 10875427058e68784ca6f5538a00a0cafd46a72b (patch) | |
tree | 51d7be53b9bc64eb86bf1720513661933ea0a5ba /OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |
parent | * Refactor: remove redundant userId parameter from UpdateItem() and DeleteItem() (diff) | |
download | opensim-SC_OLD-10875427058e68784ca6f5538a00a0cafd46a72b.zip opensim-SC_OLD-10875427058e68784ca6f5538a00a0cafd46a72b.tar.gz opensim-SC_OLD-10875427058e68784ca6f5538a00a0cafd46a72b.tar.bz2 opensim-SC_OLD-10875427058e68784ca6f5538a00a0cafd46a72b.tar.xz |
* Refactor: Move bulk of CreateFolder from UserProfileCacheService into CachedUserInfo
* Remove unused/superseded methods from GridInventoryService
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 76 |
1 files changed, 5 insertions, 71 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index befb6c7..f1929c8 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -34,8 +34,6 @@ using log4net; | |||
34 | 34 | ||
35 | namespace OpenSim.Framework.Communications.Cache | 35 | namespace OpenSim.Framework.Communications.Cache |
36 | { | 36 | { |
37 | internal delegate void CreateInventoryFolderDelegate( | ||
38 | IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); | ||
39 | internal delegate void MoveInventoryFolderDelegate(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID); | 37 | internal delegate void MoveInventoryFolderDelegate(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID); |
40 | internal delegate void PurgeInventoryDescendentsDelegate(IClientAPI remoteClient, LLUUID folderID); | 38 | internal delegate void PurgeInventoryDescendentsDelegate(IClientAPI remoteClient, LLUUID folderID); |
41 | internal delegate void UpdateInventoryFolderDelegate( | 39 | internal delegate void UpdateInventoryFolderDelegate( |
@@ -157,80 +155,16 @@ namespace OpenSim.Framework.Communications.Cache | |||
157 | /// <param name="parentID"></param> | 155 | /// <param name="parentID"></param> |
158 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, | 156 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, |
159 | string folderName, LLUUID parentID) | 157 | string folderName, LLUUID parentID) |
160 | { | 158 | { |
161 | // m_log.DebugFormat( | ||
162 | // "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId); | ||
163 | |||
164 | CachedUserInfo userProfile; | 159 | CachedUserInfo userProfile; |
165 | 160 | ||
166 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | 161 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) |
167 | { | 162 | { |
168 | if (userProfile.HasInventory) | 163 | if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID)) |
169 | { | 164 | { |
170 | if (userProfile.RootFolder.ID == parentID) | 165 | m_log.WarnFormat( |
171 | { | 166 | "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", |
172 | InventoryFolderImpl createdFolder = | 167 | remoteClient.Name, remoteClient.AgentId); |
173 | userProfile.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); | ||
174 | |||
175 | if (createdFolder != null) | ||
176 | { | ||
177 | InventoryFolderBase createdBaseFolder = new InventoryFolderBase(); | ||
178 | createdBaseFolder.Owner = createdFolder.Owner; | ||
179 | createdBaseFolder.ID = createdFolder.ID; | ||
180 | createdBaseFolder.Name = createdFolder.Name; | ||
181 | createdBaseFolder.ParentID = createdFolder.ParentID; | ||
182 | createdBaseFolder.Type = createdFolder.Type; | ||
183 | createdBaseFolder.Version = createdFolder.Version; | ||
184 | |||
185 | m_commsManager.InventoryService.AddFolder(createdBaseFolder); | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | m_log.WarnFormat( | ||
190 | "[INVENTORY CACHE]: Tried to create folder {0} {1} for user {2} {3} but the folder already exists", | ||
191 | folderName, folderID, remoteClient.Name, remoteClient.AgentId); | ||
192 | } | ||
193 | } | ||
194 | else | ||
195 | { | ||
196 | InventoryFolderImpl folder = userProfile.RootFolder.GetDescendentFolder(parentID); | ||
197 | if (folder != null) | ||
198 | { | ||
199 | InventoryFolderImpl createdFolder = folder.CreateNewSubFolder(folderID, folderName, folderType); | ||
200 | |||
201 | if (createdFolder != null) | ||
202 | { | ||
203 | InventoryFolderBase createdBaseFolder = new InventoryFolderBase(); | ||
204 | createdBaseFolder.Owner = createdFolder.Owner; | ||
205 | createdBaseFolder.ID = createdFolder.ID; | ||
206 | createdBaseFolder.Name = createdFolder.Name; | ||
207 | createdBaseFolder.ParentID = createdFolder.ParentID; | ||
208 | createdBaseFolder.Type = createdFolder.Type; | ||
209 | createdBaseFolder.Version = createdFolder.Version; | ||
210 | |||
211 | m_commsManager.InventoryService.AddFolder(createdBaseFolder); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | m_log.WarnFormat( | ||
216 | "[INVENTORY CACHE]: Tried to create folder {0} {1} for user {2} {3} but the folder already exists", | ||
217 | folderName, folderID, remoteClient.Name, remoteClient.AgentId); | ||
218 | } | ||
219 | } | ||
220 | else | ||
221 | { | ||
222 | m_log.WarnFormat( | ||
223 | "[INVENTORY CACHE]: Could not find parent folder with id {0} in order to create folder {1} {2} for user {3} {4}", | ||
224 | parentID, folderName, folderID, remoteClient.Name, remoteClient.AgentId); | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | userProfile.AddRequest( | ||
231 | new InventoryRequest( | ||
232 | Delegate.CreateDelegate(typeof(CreateInventoryFolderDelegate), this, "HandleCreateInventoryFolder"), | ||
233 | new object[] { remoteClient, folderID, folderType, folderName, parentID })); | ||
234 | } | 168 | } |
235 | } | 169 | } |
236 | } | 170 | } |