aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Communications/Cache/UserProfileCache.cs
parent* Deleted .user file (diff)
downloadopensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/UserProfileCache.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCache.cs72
1 files changed, 35 insertions, 37 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
index 8105556..fe943b0 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
@@ -25,16 +25,8 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife; 29using libsecondlife;
34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework;
37
38 30
39namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Framework.Communications.Cache
40{ 32{
@@ -49,7 +41,7 @@ namespace OpenSim.Framework.Communications.Cache
49 // Methods 41 // Methods
50 public UserProfileCache(CommunicationsManager parent) 42 public UserProfileCache(CommunicationsManager parent)
51 { 43 {
52 this.m_parent = parent; 44 m_parent = parent;
53 } 45 }
54 46
55 /// <summary> 47 /// <summary>
@@ -62,14 +54,14 @@ namespace OpenSim.Framework.Communications.Cache
62 // Potential fix - Multithreading issue. 54 // Potential fix - Multithreading issue.
63 lock (UserProfiles) 55 lock (UserProfiles)
64 { 56 {
65 if (!this.UserProfiles.ContainsKey(userID)) 57 if (!UserProfiles.ContainsKey(userID))
66 { 58 {
67 CachedUserInfo userInfo = new CachedUserInfo(this.m_parent); 59 CachedUserInfo userInfo = new CachedUserInfo(m_parent);
68 userInfo.UserProfile = this.RequestUserProfileForUser(userID); 60 userInfo.UserProfile = RequestUserProfileForUser(userID);
69 if (userInfo.UserProfile != null) 61 if (userInfo.UserProfile != null)
70 { 62 {
71 this.RequestInventoryForUser(userID, userInfo); 63 RequestInventoryForUser(userID, userInfo);
72 this.UserProfiles.Add(userID, userInfo); 64 UserProfiles.Add(userID, userInfo);
73 } 65 }
74 else 66 else
75 { 67 {
@@ -91,26 +83,28 @@ namespace OpenSim.Framework.Communications.Cache
91 83
92 public CachedUserInfo GetUserDetails(LLUUID userID) 84 public CachedUserInfo GetUserDetails(LLUUID userID)
93 { 85 {
94 if (this.UserProfiles.ContainsKey(userID)) 86 if (UserProfiles.ContainsKey(userID))
95 { 87 {
96 return this.UserProfiles[userID]; 88 return UserProfiles[userID];
97 } 89 }
98 return null; 90 return null;
99 } 91 }
100 92
101 public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) 93 public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
94 string folderName, LLUUID parentID)
102 { 95 {
103 if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 96 if (UserProfiles.ContainsKey(remoteClient.AgentId))
104 { 97 {
105 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 98 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
106 { 99 {
107 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 100 CachedUserInfo info = UserProfiles[remoteClient.AgentId];
108 if (info.RootFolder.folderID == parentID) 101 if (info.RootFolder.folderID == parentID)
109 { 102 {
110 InventoryFolderImpl createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); 103 InventoryFolderImpl createdFolder =
104 info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
111 if (createdFolder != null) 105 if (createdFolder != null)
112 { 106 {
113 this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); 107 m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
114 } 108 }
115 } 109 }
116 else 110 else
@@ -125,27 +119,30 @@ namespace OpenSim.Framework.Communications.Cache
125 } 119 }
126 } 120 }
127 121
128 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) 122 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
123 bool fetchFolders, bool fetchItems, int sortOrder)
129 { 124 {
130 InventoryFolderImpl fold = null; 125 InventoryFolderImpl fold = null;
131 if (folderID == libraryRoot.folderID ) 126 if (folderID == libraryRoot.folderID)
132 { 127 {
133 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); 128 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID,
129 libraryRoot.RequestListOfItems());
134 } 130 }
135 else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) 131 else if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
136 { 132 {
137 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); 133 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems());
138 } 134 }
139 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 135 else if (UserProfiles.ContainsKey(remoteClient.AgentId))
140 { 136 {
141 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 137 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
142 { 138 {
143 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 139 CachedUserInfo info = UserProfiles[remoteClient.AgentId];
144 if (info.RootFolder.folderID == folderID) 140 if (info.RootFolder.folderID == folderID)
145 { 141 {
146 if (fetchItems) 142 if (fetchItems)
147 { 143 {
148 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, info.RootFolder.RequestListOfItems()); 144 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
145 info.RootFolder.RequestListOfItems());
149 } 146 }
150 } 147 }
151 else 148 else
@@ -153,7 +150,8 @@ namespace OpenSim.Framework.Communications.Cache
153 InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID); 150 InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID);
154 if ((folder != null) && fetchItems) 151 if ((folder != null) && fetchItems)
155 { 152 {
156 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems()); 153 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
154 folder.RequestListOfItems());
157 } 155 }
158 } 156 }
159 } 157 }
@@ -166,11 +164,11 @@ namespace OpenSim.Framework.Communications.Cache
166 { 164 {
167 //Console.WriteLine("request info for library item"); 165 //Console.WriteLine("request info for library item");
168 } 166 }
169 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 167 else if (UserProfiles.ContainsKey(remoteClient.AgentId))
170 { 168 {
171 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 169 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
172 { 170 {
173 InventoryItemBase item = this.UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID); 171 InventoryItemBase item = UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID);
174 if (item != null) 172 if (item != null)
175 { 173 {
176 remoteClient.SendInventoryItemDetails(ownerID, item); 174 remoteClient.SendInventoryItemDetails(ownerID, item);
@@ -185,7 +183,7 @@ namespace OpenSim.Framework.Communications.Cache
185 /// <param name="userID"></param> 183 /// <param name="userID"></param>
186 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) 184 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
187 { 185 {
188 this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 186 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
189 } 187 }
190 188
191 /// <summary> 189 /// <summary>
@@ -194,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache
194 /// <param name="userID"></param> 192 /// <param name="userID"></param>
195 private UserProfileData RequestUserProfileForUser(LLUUID userID) 193 private UserProfileData RequestUserProfileForUser(LLUUID userID)
196 { 194 {
197 return this.m_parent.UserService.GetUserProfile(userID); 195 return m_parent.UserService.GetUserProfile(userID);
198 } 196 }
199 197
200 /// <summary> 198 /// <summary>