diff options
Diffstat (limited to '')
3 files changed, 0 insertions, 306 deletions
diff --git a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs deleted file mode 100644 index b8d8847..0000000 --- a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Data; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenSim.Framework.Communications.Caches | ||
8 | { | ||
9 | public class CachedUserInfo | ||
10 | { | ||
11 | public UserProfileData UserProfile; | ||
12 | //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>(); | ||
13 | public InventoryFolder RootFolder; | ||
14 | |||
15 | public CachedUserInfo() | ||
16 | { | ||
17 | |||
18 | } | ||
19 | |||
20 | /// <summary> | ||
21 | /// | ||
22 | /// </summary> | ||
23 | /// <param name="userID"></param> | ||
24 | /// <param name="folderInfo"></param> | ||
25 | public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) | ||
26 | { | ||
27 | if (userID == UserProfile.UUID) | ||
28 | { | ||
29 | if (this.RootFolder == null) | ||
30 | { | ||
31 | if (folderInfo.parentID == LLUUID.Zero) | ||
32 | { | ||
33 | this.RootFolder = folderInfo; | ||
34 | } | ||
35 | } | ||
36 | else | ||
37 | { | ||
38 | if (this.RootFolder.folderID == folderInfo.parentID) | ||
39 | { | ||
40 | this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); | ||
41 | } | ||
42 | else | ||
43 | { | ||
44 | InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID); | ||
45 | if (pFolder != null) | ||
46 | { | ||
47 | pFolder.SubFolders.Add(folderInfo.folderID, folderInfo); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | } | ||
53 | |||
54 | public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) | ||
55 | { | ||
56 | if (userID == UserProfile.UUID) | ||
57 | { | ||
58 | if (this.RootFolder != null) | ||
59 | { | ||
60 | if (itemInfo.parentFolderID == this.RootFolder.folderID) | ||
61 | { | ||
62 | this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); | ||
63 | } | ||
64 | else | ||
65 | { | ||
66 | InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); | ||
67 | if (pFolder != null) | ||
68 | { | ||
69 | pFolder.Items.Add(itemInfo.inventoryID, itemInfo); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | } | ||
75 | } | ||
76 | } | ||
77 | } | ||
diff --git a/OpenSim/Framework/Communications/caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs deleted file mode 100644 index 8978cee..0000000 --- a/OpenSim/Framework/Communications/caches/InventoryFolder.cs +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Data; | ||
6 | |||
7 | namespace OpenSim.Framework.Communications.Caches | ||
8 | { | ||
9 | public class InventoryFolder : InventoryFolderBase | ||
10 | { | ||
11 | public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>(); | ||
12 | public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); | ||
13 | |||
14 | public InventoryFolder() | ||
15 | { | ||
16 | } | ||
17 | |||
18 | public InventoryFolder HasSubFolder(LLUUID folderID) | ||
19 | { | ||
20 | InventoryFolder returnFolder = null; | ||
21 | if (this.SubFolders.ContainsKey(folderID)) | ||
22 | { | ||
23 | returnFolder = this.SubFolders[folderID]; | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | foreach (InventoryFolder folder in this.SubFolders.Values) | ||
28 | { | ||
29 | returnFolder = folder.HasSubFolder(folderID); | ||
30 | if (returnFolder != null) | ||
31 | { | ||
32 | break; | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | return returnFolder; | ||
37 | } | ||
38 | |||
39 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type ) | ||
40 | { | ||
41 | InventoryFolder subFold = new InventoryFolder(); | ||
42 | subFold.name = folderName; | ||
43 | subFold.folderID = folderID; | ||
44 | subFold.type = type; | ||
45 | subFold.parentID = this.folderID; | ||
46 | subFold.agentID = this.agentID; | ||
47 | this.SubFolders.Add(subFold.folderID, subFold); | ||
48 | return subFold; | ||
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 | } | ||
60 | } | ||
61 | } | ||
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 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Interfaces; | ||
6 | using OpenSim.Framework.Data; | ||
7 | using OpenSim.Framework.Communications; | ||
8 | |||
9 | namespace 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 | } | ||