diff options
Diffstat (limited to 'OpenSim/Framework/Communications/caches/UserProfileCache.cs')
-rw-r--r-- | OpenSim/Framework/Communications/caches/UserProfileCache.cs | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs new file mode 100644 index 0000000..0ee63ba --- /dev/null +++ b/OpenSim/Framework/Communications/caches/UserProfileCache.cs | |||
@@ -0,0 +1,107 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using OpenSim.Framework.Data; | ||
6 | using OpenSim.Framework.Communications; | ||
7 | |||
8 | namespace OpenSim.Framework.Communications.Caches | ||
9 | { | ||
10 | public class UserProfileCache | ||
11 | { | ||
12 | public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>(); | ||
13 | |||
14 | private CommunicationsManager m_parent; | ||
15 | |||
16 | public UserProfileCache(CommunicationsManager parent) | ||
17 | { | ||
18 | m_parent = parent; | ||
19 | } | ||
20 | |||
21 | /// <summary> | ||
22 | /// A new user has moved into a region in this instance | ||
23 | /// so get info from servers | ||
24 | /// </summary> | ||
25 | /// <param name="userID"></param> | ||
26 | public void AddNewUser(LLUUID userID) | ||
27 | { | ||
28 | if (!this.UserProfiles.ContainsKey(userID)) | ||
29 | { | ||
30 | CachedUserInfo userInfo = new CachedUserInfo(); | ||
31 | userInfo.UserProfile = this.RequestUserProfileForUser(userID); | ||
32 | this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); | ||
33 | if (userInfo.UserProfile != null) | ||
34 | { | ||
35 | this.UserProfiles.Add(userID, userInfo); | ||
36 | } | ||
37 | else | ||
38 | { | ||
39 | //no profile for this user, what do we do now? | ||
40 | } | ||
41 | } | ||
42 | else | ||
43 | { | ||
44 | //already have a cached profile for this user | ||
45 | //we should make sure its upto date with the user server version | ||
46 | } | ||
47 | } | ||
48 | |||
49 | /// <summary> | ||
50 | /// A new user has moved into a region in this instance | ||
51 | /// so get info from servers | ||
52 | /// </summary> | ||
53 | /// <param name="firstName"></param> | ||
54 | /// <param name="lastName"></param> | ||
55 | public void AddNewUser(string firstName, string lastName) | ||
56 | { | ||
57 | |||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// A user has left this instance | ||
62 | /// so make sure servers have been updated | ||
63 | /// Then remove cached info | ||
64 | /// </summary> | ||
65 | /// <param name="userID"></param> | ||
66 | public void UserLogOut(LLUUID userID) | ||
67 | { | ||
68 | |||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// Request the user profile from User server | ||
73 | /// </summary> | ||
74 | /// <param name="userID"></param> | ||
75 | private UserProfileData RequestUserProfileForUser(LLUUID userID) | ||
76 | { | ||
77 | return this.m_parent.UserServer.GetUserProfile(userID); | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Request Iventory Info from Inventory server | ||
82 | /// </summary> | ||
83 | /// <param name="userID"></param> | ||
84 | private void RequestInventoryForUser(LLUUID userID) | ||
85 | { | ||
86 | |||
87 | } | ||
88 | |||
89 | /// <summary> | ||
90 | /// Make sure UserProfile is updated on user server | ||
91 | /// </summary> | ||
92 | /// <param name="userID"></param> | ||
93 | private void UpdateUserProfileToServer(LLUUID userID) | ||
94 | { | ||
95 | |||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Update Inventory data to Inventory server | ||
100 | /// </summary> | ||
101 | /// <param name="userID"></param> | ||
102 | private void UpdateInventoryToServer(LLUUID userID) | ||
103 | { | ||
104 | |||
105 | } | ||
106 | } | ||
107 | } | ||