diff options
Diffstat (limited to 'OpenSim/Region/Communications/Hypergrid/HGUserServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | 337 |
1 files changed, 0 insertions, 337 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs deleted file mode 100644 index 09d8285..0000000 --- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs +++ /dev/null | |||
@@ -1,337 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Framework.Communications.Clients; | ||
36 | using OpenSim.Region.Communications.OGS1; | ||
37 | using OpenSim.Region.Communications.Local; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | |||
40 | namespace OpenSim.Region.Communications.Hypergrid | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// For the time being, this class is just an identity wrapper around OGS1UserServices, | ||
44 | /// so it always fails for foreign users. | ||
45 | /// Later it needs to talk with the foreign users' user servers. | ||
46 | /// </summary> | ||
47 | public class HGUserServices : OGS1UserServices | ||
48 | { | ||
49 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | //private OGS1UserServices m_remoteUserServices; | ||
52 | private LocalUserServices m_localUserServices; | ||
53 | |||
54 | // Constructor called when running in grid mode | ||
55 | public HGUserServices(CommunicationsManager commsManager) | ||
56 | : base(commsManager) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | // Constructor called when running in standalone | ||
61 | public HGUserServices(CommunicationsManager commsManager, LocalUserServices local) | ||
62 | : base(commsManager) | ||
63 | { | ||
64 | m_localUserServices = local; | ||
65 | } | ||
66 | |||
67 | public override void SetInventoryService(IInventoryService invService) | ||
68 | { | ||
69 | base.SetInventoryService(invService); | ||
70 | if (m_localUserServices != null) | ||
71 | m_localUserServices.SetInventoryService(invService); | ||
72 | } | ||
73 | |||
74 | public override UUID AddUser( | ||
75 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid) | ||
76 | { | ||
77 | // Only valid to create users locally | ||
78 | if (m_localUserServices != null) | ||
79 | return m_localUserServices.AddUser(firstName, lastName, password, email, regX, regY, uuid); | ||
80 | |||
81 | return UUID.Zero; | ||
82 | } | ||
83 | |||
84 | public override bool AddUserAgent(UserAgentData agentdata) | ||
85 | { | ||
86 | if (m_localUserServices != null) | ||
87 | return m_localUserServices.AddUserAgent(agentdata); | ||
88 | |||
89 | return base.AddUserAgent(agentdata); | ||
90 | } | ||
91 | |||
92 | public override UserAgentData GetAgentByUUID(UUID userId) | ||
93 | { | ||
94 | string url = string.Empty; | ||
95 | if ((m_localUserServices != null) && !IsForeignUser(userId, out url)) | ||
96 | return m_localUserServices.GetAgentByUUID(userId); | ||
97 | |||
98 | return base.GetAgentByUUID(userId); | ||
99 | } | ||
100 | |||
101 | public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | ||
102 | { | ||
103 | string url = string.Empty; | ||
104 | if ((m_localUserServices != null) && !IsForeignUser(userid, out url)) | ||
105 | m_localUserServices.LogOffUser(userid, regionid, regionhandle, position, lookat); | ||
106 | else | ||
107 | base.LogOffUser(userid, regionid, regionhandle, position, lookat); | ||
108 | } | ||
109 | |||
110 | public override UserProfileData GetUserProfile(string firstName, string lastName) | ||
111 | { | ||
112 | if (m_localUserServices != null) | ||
113 | return m_localUserServices.GetUserProfile(firstName, lastName); | ||
114 | |||
115 | return base.GetUserProfile(firstName, lastName); | ||
116 | } | ||
117 | |||
118 | public override List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) | ||
119 | { | ||
120 | if (m_localUserServices != null) | ||
121 | return m_localUserServices.GenerateAgentPickerRequestResponse(queryID, query); | ||
122 | |||
123 | return base.GenerateAgentPickerRequestResponse(queryID, query); | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Get a user profile from the user server | ||
128 | /// </summary> | ||
129 | /// <param name="avatarID"></param> | ||
130 | /// <returns>null if the request fails</returns> | ||
131 | public override UserProfileData GetUserProfile(UUID avatarID) | ||
132 | { | ||
133 | //string url = string.Empty; | ||
134 | // Unfortunately we can't query for foreigners here, | ||
135 | // because we'll end up in an infinite loop... | ||
136 | //if ((m_localUserServices != null) && (!IsForeignUser(avatarID, out url))) | ||
137 | if (m_localUserServices != null) | ||
138 | return m_localUserServices.GetUserProfile(avatarID); | ||
139 | |||
140 | return base.GetUserProfile(avatarID); | ||
141 | } | ||
142 | |||
143 | public override void ClearUserAgent(UUID avatarID) | ||
144 | { | ||
145 | if (m_localUserServices != null) | ||
146 | m_localUserServices.ClearUserAgent(avatarID); | ||
147 | else | ||
148 | base.ClearUserAgent(avatarID); | ||
149 | } | ||
150 | |||
151 | /// <summary> | ||
152 | /// Retrieve the user information for the given master uuid. | ||
153 | /// </summary> | ||
154 | /// <param name="uuid"></param> | ||
155 | /// <returns></returns> | ||
156 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | ||
157 | { | ||
158 | if (m_localUserServices != null) | ||
159 | return m_localUserServices.SetupMasterUser(firstName, lastName); | ||
160 | |||
161 | return base.SetupMasterUser(firstName, lastName); | ||
162 | } | ||
163 | |||
164 | /// <summary> | ||
165 | /// Retrieve the user information for the given master uuid. | ||
166 | /// </summary> | ||
167 | /// <param name="uuid"></param> | ||
168 | /// <returns></returns> | ||
169 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
170 | { | ||
171 | if (m_localUserServices != null) | ||
172 | return m_localUserServices.SetupMasterUser(firstName, lastName, password); | ||
173 | |||
174 | return base.SetupMasterUser(firstName, lastName, password); | ||
175 | } | ||
176 | |||
177 | /// <summary> | ||
178 | /// Retrieve the user information for the given master uuid. | ||
179 | /// </summary> | ||
180 | /// <param name="uuid"></param> | ||
181 | /// <returns></returns> | ||
182 | public override UserProfileData SetupMasterUser(UUID uuid) | ||
183 | { | ||
184 | if (m_localUserServices != null) | ||
185 | return m_localUserServices.SetupMasterUser(uuid); | ||
186 | |||
187 | return base.SetupMasterUser(uuid); | ||
188 | } | ||
189 | |||
190 | public override bool ResetUserPassword(string firstName, string lastName, string newPassword) | ||
191 | { | ||
192 | if (m_localUserServices != null) | ||
193 | return m_localUserServices.ResetUserPassword(firstName, lastName, newPassword); | ||
194 | else | ||
195 | return base.ResetUserPassword(firstName, lastName, newPassword); | ||
196 | } | ||
197 | |||
198 | public override bool UpdateUserProfile(UserProfileData userProfile) | ||
199 | { | ||
200 | string url = string.Empty; | ||
201 | if ((m_localUserServices != null) && (!IsForeignUser(userProfile.ID, out url))) | ||
202 | return m_localUserServices.UpdateUserProfile(userProfile); | ||
203 | |||
204 | return base.UpdateUserProfile(userProfile); | ||
205 | } | ||
206 | |||
207 | public override bool AuthenticateUserByPassword(UUID userID, string password) | ||
208 | { | ||
209 | if (m_localUserServices != null) | ||
210 | return m_localUserServices.AuthenticateUserByPassword(userID, password); | ||
211 | else | ||
212 | return base.AuthenticateUserByPassword(userID, password); | ||
213 | } | ||
214 | |||
215 | #region IUserServices Friend Methods | ||
216 | |||
217 | // NOTE: We're still not dealing with foreign user friends | ||
218 | |||
219 | /// <summary> | ||
220 | /// Adds a new friend to the database for XUser | ||
221 | /// </summary> | ||
222 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> | ||
223 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> | ||
224 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
225 | public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
226 | { | ||
227 | if (m_localUserServices != null) | ||
228 | m_localUserServices.AddNewUserFriend(friendlistowner, friend, perms); | ||
229 | else | ||
230 | base.AddNewUserFriend(friendlistowner, friend, perms); | ||
231 | } | ||
232 | |||
233 | /// <summary> | ||
234 | /// Delete friend on friendlistowner's friendlist. | ||
235 | /// </summary> | ||
236 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
237 | /// <param name="friend">The Ex-friend agent</param> | ||
238 | public override void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
239 | { | ||
240 | if (m_localUserServices != null) | ||
241 | m_localUserServices.RemoveUserFriend(friendlistowner, friend); | ||
242 | else | ||
243 | base.RemoveUserFriend(friend, friend); | ||
244 | } | ||
245 | |||
246 | /// <summary> | ||
247 | /// Update permissions for friend on friendlistowner's friendlist. | ||
248 | /// </summary> | ||
249 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
250 | /// <param name="friend">The agent that is getting or loosing permissions</param> | ||
251 | /// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param> | ||
252 | public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
253 | { | ||
254 | if (m_localUserServices != null) | ||
255 | m_localUserServices.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
256 | else | ||
257 | base.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
258 | } | ||
259 | /// <summary> | ||
260 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner | ||
261 | /// </summary> | ||
262 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | ||
263 | public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
264 | { | ||
265 | if (m_localUserServices != null) | ||
266 | return m_localUserServices.GetUserFriendList(friendlistowner); | ||
267 | |||
268 | return base.GetUserFriendList(friendlistowner); | ||
269 | } | ||
270 | |||
271 | #endregion | ||
272 | |||
273 | /// Appearance | ||
274 | public override AvatarAppearance GetUserAppearance(UUID user) | ||
275 | { | ||
276 | string url = string.Empty; | ||
277 | if ((m_localUserServices != null) && (!IsForeignUser(user, out url))) | ||
278 | return m_localUserServices.GetUserAppearance(user); | ||
279 | else | ||
280 | return base.GetUserAppearance(user); | ||
281 | } | ||
282 | |||
283 | public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance) | ||
284 | { | ||
285 | string url = string.Empty; | ||
286 | if ((m_localUserServices != null) && (!IsForeignUser(user, out url))) | ||
287 | m_localUserServices.UpdateUserAppearance(user, appearance); | ||
288 | else | ||
289 | base.UpdateUserAppearance(user, appearance); | ||
290 | } | ||
291 | |||
292 | #region IMessagingService | ||
293 | |||
294 | public override Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | ||
295 | { | ||
296 | if (m_localUserServices != null) | ||
297 | return m_localUserServices.GetFriendRegionInfos(uuids); | ||
298 | |||
299 | return base.GetFriendRegionInfos(uuids); | ||
300 | } | ||
301 | #endregion | ||
302 | |||
303 | public override bool VerifySession(UUID userID, UUID sessionID) | ||
304 | { | ||
305 | string url = string.Empty; | ||
306 | if ((m_localUserServices != null) && (!IsForeignUser(userID, out url))) | ||
307 | return m_localUserServices.VerifySession(userID, sessionID); | ||
308 | else | ||
309 | return base.VerifySession(userID, sessionID); | ||
310 | } | ||
311 | |||
312 | |||
313 | protected override string GetUserServerURL(UUID userID) | ||
314 | { | ||
315 | string serverURL = string.Empty; | ||
316 | if (IsForeignUser(userID, out serverURL)) | ||
317 | return serverURL; | ||
318 | |||
319 | return m_commsManager.NetworkServersInfo.UserURL; | ||
320 | } | ||
321 | |||
322 | public bool IsForeignUser(UUID userID, out string userServerURL) | ||
323 | { | ||
324 | userServerURL = m_commsManager.NetworkServersInfo.UserURL; | ||
325 | CachedUserInfo uinfo = m_commsManager.UserProfileCacheService.GetUserDetails(userID); | ||
326 | if (uinfo != null) | ||
327 | { | ||
328 | if (!HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile)) | ||
329 | { | ||
330 | userServerURL = ((ForeignUserProfileData)(uinfo.UserProfile)).UserServerURI; | ||
331 | return true; | ||
332 | } | ||
333 | } | ||
334 | return false; | ||
335 | } | ||
336 | } | ||
337 | } | ||