aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/caches/UserProfileCache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/caches/UserProfileCache.cs')
-rw-r--r--OpenSim/Framework/Communications/caches/UserProfileCache.cs168
1 files changed, 0 insertions, 168 deletions
diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs
deleted file mode 100644
index bfb6f07..0000000
--- a/OpenSim/Framework/Communications/caches/UserProfileCache.cs
+++ /dev/null
@@ -1,168 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Interfaces;
6using OpenSim.Framework.Data;
7using OpenSim.Framework.Communications;
8
9namespace OpenSim.Framework.Communications.Caches
10{
11 public class UserProfileCache
12 {
13 public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>();
14
15 private CommunicationsManager m_parent;
16
17 public UserProfileCache(CommunicationsManager parent)
18 {
19 m_parent = parent;
20 }
21
22 /// <summary>
23 /// A new user has moved into a region in this instance
24 /// so get info from servers
25 /// </summary>
26 /// <param name="userID"></param>
27 public void AddNewUser(LLUUID userID)
28 {
29 if (!this.UserProfiles.ContainsKey(userID))
30 {
31 CachedUserInfo userInfo = new CachedUserInfo();
32 userInfo.UserProfile = this.RequestUserProfileForUser(userID);
33
34 if (userInfo.UserProfile != null)
35 {
36 this.RequestInventoryForUser(userID, userInfo);
37 this.UserProfiles.Add(userID, userInfo);
38 }
39 else
40 {
41 //no profile for this user, what do we do now?
42 Console.WriteLine("UserProfileCache.cs: user profile for user not found");
43
44 }
45 }
46 else
47 {
48 //already have a cached profile for this user
49 //we should make sure its upto date with the user server version
50 }
51 }
52
53 /// <summary>
54 /// A new user has moved into a region in this instance
55 /// so get info from servers
56 /// </summary>
57 /// <param name="firstName"></param>
58 /// <param name="lastName"></param>
59 public void AddNewUser(string firstName, string lastName)
60 {
61
62 }
63
64 /// <summary>
65 /// A user has left this instance
66 /// so make sure servers have been updated
67 /// Then remove cached info
68 /// </summary>
69 /// <param name="userID"></param>
70 public void UserLogOut(LLUUID userID)
71 {
72
73 }
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
121 /// <summary>
122 /// Request the user profile from User server
123 /// </summary>
124 /// <param name="userID"></param>
125 private UserProfileData RequestUserProfileForUser(LLUUID userID)
126 {
127 return this.m_parent.UserServer.GetUserProfile(userID);
128 }
129
130 /// <summary>
131 /// Request Iventory Info from Inventory server
132 /// </summary>
133 /// <param name="userID"></param>
134 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
135 {
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);
148 }
149
150 /// <summary>
151 /// Make sure UserProfile is updated on user server
152 /// </summary>
153 /// <param name="userID"></param>
154 private void UpdateUserProfileToServer(LLUUID userID)
155 {
156
157 }
158
159 /// <summary>
160 /// Update Inventory data to Inventory server
161 /// </summary>
162 /// <param name="userID"></param>
163 private void UpdateInventoryToServer(LLUUID userID)
164 {
165
166 }
167 }
168}