diff options
author | Justin Clarke Casey | 2008-11-25 15:19:00 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-25 15:19:00 +0000 |
commit | e187972377c19bdd85093677c4c54034e4f9196e (patch) | |
tree | cc1bb5f003628b018b823eafc9ee0a67f98df31c /OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | |
parent | * Adding some virtual hooks and making some privaets protected for great just... (diff) | |
download | opensim-SC-e187972377c19bdd85093677c4c54034e4f9196e.zip opensim-SC-e187972377c19bdd85093677c4c54034e4f9196e.tar.gz opensim-SC-e187972377c19bdd85093677c4c54034e4f9196e.tar.bz2 opensim-SC-e187972377c19bdd85093677c4c54034e4f9196e.tar.xz |
* Apply http://opensimulator.org/mantis/view.php?id=2640
* This is Diva's hypergrid patch, as perviously discussed on the opensim-dev mailing list
* Applied some minor prebuild.xml jiggling to resolve a dependency issue
* Thanks Diva!
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | 267 |
1 files changed, 267 insertions, 0 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs new file mode 100644 index 0000000..d9b44a1 --- /dev/null +++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | |||
@@ -0,0 +1,267 @@ | |||
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 OpenSim 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 System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text.RegularExpressions; | ||
34 | using OpenMetaverse; | ||
35 | using log4net; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Region.Communications.OGS1; | ||
40 | |||
41 | namespace OpenSim.Region.Communications.Hypergrid | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// For the time being, this class is just an identity wrapper around OGS1UserServices, | ||
45 | /// so it always fails for foreign users. | ||
46 | /// Later it needs to talk with the foreign users' user servers. | ||
47 | /// </summary> | ||
48 | public class HGUserServices : IUserService, IAvatarService, IMessagingService | ||
49 | { | ||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
52 | private HGCommunicationsGridMode m_parent; | ||
53 | private OGS1UserServices m_remoteUserServices; | ||
54 | |||
55 | public HGUserServices(HGCommunicationsGridMode parent) | ||
56 | { | ||
57 | m_parent = parent; | ||
58 | m_remoteUserServices = new OGS1UserServices(parent); | ||
59 | } | ||
60 | |||
61 | public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) | ||
62 | { | ||
63 | return m_remoteUserServices.ConvertXMLRPCDataToUserProfile(data); | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Get a user agent from the user server | ||
68 | /// </summary> | ||
69 | /// <param name="avatarID"></param> | ||
70 | /// <returns>null if the request fails</returns> | ||
71 | public UserAgentData GetAgentByUUID(UUID userId) | ||
72 | { | ||
73 | return m_remoteUserServices.GetAgentByUUID(userId); | ||
74 | } | ||
75 | |||
76 | public AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data) | ||
77 | { | ||
78 | return m_remoteUserServices.ConvertXMLRPCDataToAvatarAppearance(data); | ||
79 | } | ||
80 | |||
81 | public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data) | ||
82 | { | ||
83 | return m_remoteUserServices.ConvertXMLRPCDataToAvatarPickerList(queryID, data); | ||
84 | } | ||
85 | |||
86 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) | ||
87 | { | ||
88 | return m_remoteUserServices.ConvertXMLRPCDataToFriendListItemList(data); | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// Logs off a user on the user server | ||
93 | /// </summary> | ||
94 | /// <param name="UserID">UUID of the user</param> | ||
95 | /// <param name="regionID">UUID of the Region</param> | ||
96 | /// <param name="regionhandle">regionhandle</param> | ||
97 | /// <param name="position">final position</param> | ||
98 | /// <param name="lookat">final lookat</param> | ||
99 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | ||
100 | { | ||
101 | m_remoteUserServices.LogOffUser(userid, regionid, regionhandle, position, lookat); | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Logs off a user on the user server (deprecated as of 2008-08-27) | ||
106 | /// </summary> | ||
107 | /// <param name="UserID">UUID of the user</param> | ||
108 | /// <param name="regionID">UUID of the Region</param> | ||
109 | /// <param name="regionhandle">regionhandle</param> | ||
110 | /// <param name="posx">final position x</param> | ||
111 | /// <param name="posy">final position y</param> | ||
112 | /// <param name="posz">final position z</param> | ||
113 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | ||
114 | { | ||
115 | m_remoteUserServices.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); | ||
116 | } | ||
117 | |||
118 | public UserProfileData GetUserProfile(string firstName, string lastName) | ||
119 | { | ||
120 | return GetUserProfile(firstName + " " + lastName); | ||
121 | } | ||
122 | |||
123 | public void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle) | ||
124 | { | ||
125 | m_remoteUserServices.UpdateUserCurrentRegion(avatarid, regionuuid, regionhandle); | ||
126 | } | ||
127 | |||
128 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) | ||
129 | { | ||
130 | return m_remoteUserServices.GenerateAgentPickerRequestResponse(queryID, query); | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
134 | /// Get a user profile from the user server | ||
135 | /// </summary> | ||
136 | /// <param name="avatarID"></param> | ||
137 | /// <returns>null if the request fails</returns> | ||
138 | public UserProfileData GetUserProfile(string name) | ||
139 | { | ||
140 | return m_remoteUserServices.GetUserProfile(name); | ||
141 | } | ||
142 | |||
143 | /// <summary> | ||
144 | /// Get a user profile from the user server | ||
145 | /// </summary> | ||
146 | /// <param name="avatarID"></param> | ||
147 | /// <returns>null if the request fails</returns> | ||
148 | public UserProfileData GetUserProfile(UUID avatarID) | ||
149 | { | ||
150 | return m_remoteUserServices.GetUserProfile(avatarID); | ||
151 | } | ||
152 | |||
153 | |||
154 | public void ClearUserAgent(UUID avatarID) | ||
155 | { | ||
156 | m_remoteUserServices.ClearUserAgent(avatarID); | ||
157 | } | ||
158 | |||
159 | /// <summary> | ||
160 | /// Retrieve the user information for the given master uuid. | ||
161 | /// </summary> | ||
162 | /// <param name="uuid"></param> | ||
163 | /// <returns></returns> | ||
164 | public UserProfileData SetupMasterUser(string firstName, string lastName) | ||
165 | { | ||
166 | return m_remoteUserServices.SetupMasterUser(firstName, lastName); | ||
167 | } | ||
168 | |||
169 | /// <summary> | ||
170 | /// Retrieve the user information for the given master uuid. | ||
171 | /// </summary> | ||
172 | /// <param name="uuid"></param> | ||
173 | /// <returns></returns> | ||
174 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
175 | { | ||
176 | return m_remoteUserServices.SetupMasterUser(firstName, lastName, password); | ||
177 | } | ||
178 | |||
179 | /// <summary> | ||
180 | /// Retrieve the user information for the given master uuid. | ||
181 | /// </summary> | ||
182 | /// <param name="uuid"></param> | ||
183 | /// <returns></returns> | ||
184 | public UserProfileData SetupMasterUser(UUID uuid) | ||
185 | { | ||
186 | return m_remoteUserServices.SetupMasterUser(uuid); | ||
187 | } | ||
188 | |||
189 | public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) | ||
190 | { | ||
191 | return m_remoteUserServices.AddUserProfile(firstName, lastName, pass, regX, regY); | ||
192 | } | ||
193 | |||
194 | public bool ResetUserPassword(string firstName, string lastName, string newPassword) | ||
195 | { | ||
196 | return m_remoteUserServices.ResetUserPassword(firstName, lastName, newPassword); | ||
197 | } | ||
198 | |||
199 | public bool UpdateUserProfile(UserProfileData userProfile) | ||
200 | { | ||
201 | return m_remoteUserServices.UpdateUserProfile(userProfile); | ||
202 | } | ||
203 | |||
204 | #region IUserServices Friend Methods | ||
205 | /// <summary> | ||
206 | /// Adds a new friend to the database for XUser | ||
207 | /// </summary> | ||
208 | /// <param name="friendlistowner">The agent that who's friends list is being added to</param> | ||
209 | /// <param name="friend">The agent that being added to the friends list of the friends list owner</param> | ||
210 | /// <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> | ||
211 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
212 | { | ||
213 | m_remoteUserServices.AddNewUserFriend(friendlistowner, friend, perms); | ||
214 | } | ||
215 | |||
216 | /// <summary> | ||
217 | /// Delete friend on friendlistowner's friendlist. | ||
218 | /// </summary> | ||
219 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
220 | /// <param name="friend">The Ex-friend agent</param> | ||
221 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
222 | { | ||
223 | m_remoteUserServices.RemoveUserFriend(friend, friend); | ||
224 | } | ||
225 | |||
226 | /// <summary> | ||
227 | /// Update permissions for friend on friendlistowner's friendlist. | ||
228 | /// </summary> | ||
229 | /// <param name="friendlistowner">The agent that who's friends list is being updated</param> | ||
230 | /// <param name="friend">The agent that is getting or loosing permissions</param> | ||
231 | /// <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> | ||
232 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
233 | { | ||
234 | m_remoteUserServices.UpdateUserFriendPerms(friendlistowner, friend, perms); | ||
235 | } | ||
236 | /// <summary> | ||
237 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner | ||
238 | /// </summary> | ||
239 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | ||
240 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
241 | { | ||
242 | return m_remoteUserServices.GetUserFriendList(friendlistowner); | ||
243 | } | ||
244 | |||
245 | #endregion | ||
246 | |||
247 | /// Appearance | ||
248 | public AvatarAppearance GetUserAppearance(UUID user) | ||
249 | { | ||
250 | return m_remoteUserServices.GetUserAppearance(user); | ||
251 | } | ||
252 | |||
253 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) | ||
254 | { | ||
255 | m_remoteUserServices.UpdateUserAppearance(user, appearance); | ||
256 | } | ||
257 | |||
258 | #region IMessagingService | ||
259 | |||
260 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) | ||
261 | { | ||
262 | return m_remoteUserServices.GetFriendRegionInfos(uuids); | ||
263 | } | ||
264 | #endregion | ||
265 | |||
266 | } | ||
267 | } | ||