diff options
Diffstat (limited to 'OpenSim/Services')
-rw-r--r-- | OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs | 6 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | 16 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs | 421 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/User/UserServiceConnector.cs | 114 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs | 287 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IPresenceService.cs | 68 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IUserService.cs | 80 | ||||
-rw-r--r-- | OpenSim/Services/PresenceService/PresenceService.cs | 146 | ||||
-rw-r--r-- | OpenSim/Services/PresenceService/PresenceServiceBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Services/UserAccountService/UserAccountService.cs (renamed from OpenSim/Services/UserService/UserService.cs) | 30 | ||||
-rw-r--r-- | OpenSim/Services/UserAccountService/UserAccountServiceBase.cs (renamed from OpenSim/Services/UserService/UserServiceBase.cs) | 19 |
11 files changed, 997 insertions, 192 deletions
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs index 50e817e..19bb3e2 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs | |||
@@ -84,7 +84,7 @@ namespace OpenSim.Services.Connectors | |||
84 | 84 | ||
85 | public string Authenticate(UUID principalID, string password, int lifetime) | 85 | public string Authenticate(UUID principalID, string password, int lifetime) |
86 | { | 86 | { |
87 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 87 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
88 | sendData["LIFETIME"] = lifetime.ToString(); | 88 | sendData["LIFETIME"] = lifetime.ToString(); |
89 | sendData["PRINCIPAL"] = principalID.ToString(); | 89 | sendData["PRINCIPAL"] = principalID.ToString(); |
90 | sendData["PASSWORD"] = password; | 90 | sendData["PASSWORD"] = password; |
@@ -106,7 +106,7 @@ namespace OpenSim.Services.Connectors | |||
106 | 106 | ||
107 | public bool Verify(UUID principalID, string token, int lifetime) | 107 | public bool Verify(UUID principalID, string token, int lifetime) |
108 | { | 108 | { |
109 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 109 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
110 | sendData["LIFETIME"] = lifetime.ToString(); | 110 | sendData["LIFETIME"] = lifetime.ToString(); |
111 | sendData["PRINCIPAL"] = principalID.ToString(); | 111 | sendData["PRINCIPAL"] = principalID.ToString(); |
112 | sendData["TOKEN"] = token; | 112 | sendData["TOKEN"] = token; |
@@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors | |||
128 | 128 | ||
129 | public bool Release(UUID principalID, string token) | 129 | public bool Release(UUID principalID, string token) |
130 | { | 130 | { |
131 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 131 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
132 | sendData["PRINCIPAL"] = principalID.ToString(); | 132 | sendData["PRINCIPAL"] = principalID.ToString(); |
133 | sendData["TOKEN"] = token; | 133 | sendData["TOKEN"] = token; |
134 | 134 | ||
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 02f2b79..99aa3fb 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -89,7 +89,7 @@ namespace OpenSim.Services.Connectors | |||
89 | public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) | 89 | public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo) |
90 | { | 90 | { |
91 | Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs(); | 91 | Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs(); |
92 | Dictionary<string, string> sendData = new Dictionary<string,string>(); | 92 | Dictionary<string, object> sendData = new Dictionary<string,object>(); |
93 | foreach (KeyValuePair<string, object> kvp in rinfo) | 93 | foreach (KeyValuePair<string, object> kvp in rinfo) |
94 | sendData[kvp.Key] = (string)kvp.Value; | 94 | sendData[kvp.Key] = (string)kvp.Value; |
95 | 95 | ||
@@ -130,7 +130,7 @@ namespace OpenSim.Services.Connectors | |||
130 | 130 | ||
131 | public virtual bool DeregisterRegion(UUID regionID) | 131 | public virtual bool DeregisterRegion(UUID regionID) |
132 | { | 132 | { |
133 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 133 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
134 | 134 | ||
135 | sendData["REGIONID"] = regionID.ToString(); | 135 | sendData["REGIONID"] = regionID.ToString(); |
136 | 136 | ||
@@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors | |||
162 | 162 | ||
163 | public virtual List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) | 163 | public virtual List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) |
164 | { | 164 | { |
165 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 165 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
166 | 166 | ||
167 | sendData["SCOPEID"] = scopeID.ToString(); | 167 | sendData["SCOPEID"] = scopeID.ToString(); |
168 | sendData["REGIONID"] = regionID.ToString(); | 168 | sendData["REGIONID"] = regionID.ToString(); |
@@ -212,7 +212,7 @@ namespace OpenSim.Services.Connectors | |||
212 | 212 | ||
213 | public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) | 213 | public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) |
214 | { | 214 | { |
215 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 215 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
216 | 216 | ||
217 | sendData["SCOPEID"] = scopeID.ToString(); | 217 | sendData["SCOPEID"] = scopeID.ToString(); |
218 | sendData["REGIONID"] = regionID.ToString(); | 218 | sendData["REGIONID"] = regionID.ToString(); |
@@ -258,7 +258,7 @@ namespace OpenSim.Services.Connectors | |||
258 | 258 | ||
259 | public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 259 | public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
260 | { | 260 | { |
261 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 261 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
262 | 262 | ||
263 | sendData["SCOPEID"] = scopeID.ToString(); | 263 | sendData["SCOPEID"] = scopeID.ToString(); |
264 | sendData["X"] = x.ToString(); | 264 | sendData["X"] = x.ToString(); |
@@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors | |||
303 | 303 | ||
304 | public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) | 304 | public virtual GridRegion GetRegionByName(UUID scopeID, string regionName) |
305 | { | 305 | { |
306 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 306 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
307 | 307 | ||
308 | sendData["SCOPEID"] = scopeID.ToString(); | 308 | sendData["SCOPEID"] = scopeID.ToString(); |
309 | sendData["NAME"] = regionName; | 309 | sendData["NAME"] = regionName; |
@@ -344,7 +344,7 @@ namespace OpenSim.Services.Connectors | |||
344 | 344 | ||
345 | public virtual List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) | 345 | public virtual List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) |
346 | { | 346 | { |
347 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 347 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
348 | 348 | ||
349 | sendData["SCOPEID"] = scopeID.ToString(); | 349 | sendData["SCOPEID"] = scopeID.ToString(); |
350 | sendData["NAME"] = name; | 350 | sendData["NAME"] = name; |
@@ -396,7 +396,7 @@ namespace OpenSim.Services.Connectors | |||
396 | 396 | ||
397 | public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) | 397 | public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) |
398 | { | 398 | { |
399 | Dictionary<string, string> sendData = new Dictionary<string, string>(); | 399 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
400 | 400 | ||
401 | sendData["SCOPEID"] = scopeID.ToString(); | 401 | sendData["SCOPEID"] = scopeID.ToString(); |
402 | sendData["XMIN"] = xmin.ToString(); | 402 | sendData["XMIN"] = xmin.ToString(); |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs new file mode 100644 index 0000000..29cfd6e --- /dev/null +++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs | |||
@@ -0,0 +1,421 @@ | |||
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 log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Services.Connectors | ||
43 | { | ||
44 | public class PresenceServicesConnector : IPresenceService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private string m_ServerURI = String.Empty; | ||
51 | |||
52 | public PresenceServicesConnector() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public PresenceServicesConnector(string serverURI) | ||
57 | { | ||
58 | m_ServerURI = serverURI.TrimEnd('/'); | ||
59 | } | ||
60 | |||
61 | public PresenceServicesConnector(IConfigSource source) | ||
62 | { | ||
63 | Initialise(source); | ||
64 | } | ||
65 | |||
66 | public virtual void Initialise(IConfigSource source) | ||
67 | { | ||
68 | IConfig gridConfig = source.Configs["PresenceService"]; | ||
69 | if (gridConfig == null) | ||
70 | { | ||
71 | m_log.Error("[PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); | ||
72 | throw new Exception("Presence connector init error"); | ||
73 | } | ||
74 | |||
75 | string serviceURI = gridConfig.GetString("PresenceServerURI", | ||
76 | String.Empty); | ||
77 | |||
78 | if (serviceURI == String.Empty) | ||
79 | { | ||
80 | m_log.Error("[PRESENCE CONNECTOR]: No Server URI named in section PresenceService"); | ||
81 | throw new Exception("Presence connector init error"); | ||
82 | } | ||
83 | m_ServerURI = serviceURI; | ||
84 | } | ||
85 | |||
86 | |||
87 | #region IPresenceService | ||
88 | |||
89 | public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) | ||
90 | { | ||
91 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
92 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
93 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
94 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
95 | sendData["METHOD"] = "login"; | ||
96 | |||
97 | sendData["UserID"] = userID; | ||
98 | sendData["SessionID"] = sessionID.ToString(); | ||
99 | sendData["SecureSessionID"] = secureSessionID.ToString(); | ||
100 | |||
101 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
102 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
103 | try | ||
104 | { | ||
105 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
106 | m_ServerURI + "/presence", | ||
107 | reqString); | ||
108 | if (reply != string.Empty) | ||
109 | { | ||
110 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
111 | |||
112 | if (replyData.ContainsKey("result")) | ||
113 | { | ||
114 | if (replyData["result"].ToString().ToLower() == "success") | ||
115 | return true; | ||
116 | else | ||
117 | return false; | ||
118 | } | ||
119 | else | ||
120 | m_log.DebugFormat("[PRESENCE CONNECTOR]: LoginAgent reply data does not contain result field"); | ||
121 | |||
122 | } | ||
123 | else | ||
124 | m_log.DebugFormat("[PRESENCE CONNECTOR]: LoginAgent received empty reply"); | ||
125 | } | ||
126 | catch (Exception e) | ||
127 | { | ||
128 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message); | ||
129 | } | ||
130 | |||
131 | return false; | ||
132 | |||
133 | } | ||
134 | |||
135 | public bool LogoutAgent(UUID sessionID) | ||
136 | { | ||
137 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
138 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
139 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
140 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
141 | sendData["METHOD"] = "logout"; | ||
142 | |||
143 | sendData["SessionID"] = sessionID.ToString(); | ||
144 | |||
145 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
146 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
147 | try | ||
148 | { | ||
149 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
150 | m_ServerURI + "/presence", | ||
151 | reqString); | ||
152 | if (reply != string.Empty) | ||
153 | { | ||
154 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
155 | |||
156 | if (replyData.ContainsKey("result")) | ||
157 | { | ||
158 | if (replyData["result"].ToString().ToLower() == "success") | ||
159 | return true; | ||
160 | else | ||
161 | return false; | ||
162 | } | ||
163 | else | ||
164 | m_log.DebugFormat("[PRESENCE CONNECTOR]: LogoutAgent reply data does not contain result field"); | ||
165 | |||
166 | } | ||
167 | else | ||
168 | m_log.DebugFormat("[PRESENCE CONNECTOR]: LogoutAgent received empty reply"); | ||
169 | } | ||
170 | catch (Exception e) | ||
171 | { | ||
172 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message); | ||
173 | } | ||
174 | |||
175 | return false; | ||
176 | } | ||
177 | |||
178 | public bool LogoutRegionAgents(UUID regionID) | ||
179 | { | ||
180 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
181 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
182 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
183 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
184 | sendData["METHOD"] = "logoutregion"; | ||
185 | |||
186 | sendData["RegionID"] = regionID.ToString(); | ||
187 | |||
188 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
189 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
190 | try | ||
191 | { | ||
192 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
193 | m_ServerURI + "/presence", | ||
194 | reqString); | ||
195 | if (reply != string.Empty) | ||
196 | { | ||
197 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
198 | |||
199 | if (replyData.ContainsKey("result")) | ||
200 | { | ||
201 | if (replyData["result"].ToString().ToLower() == "success") | ||
202 | return true; | ||
203 | else | ||
204 | return false; | ||
205 | } | ||
206 | else | ||
207 | m_log.DebugFormat("[PRESENCE CONNECTOR]: LogoutRegionAgents reply data does not contain result field"); | ||
208 | |||
209 | } | ||
210 | else | ||
211 | m_log.DebugFormat("[PRESENCE CONNECTOR]: LogoutRegionAgents received empty reply"); | ||
212 | } | ||
213 | catch (Exception e) | ||
214 | { | ||
215 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message); | ||
216 | } | ||
217 | |||
218 | return false; | ||
219 | } | ||
220 | |||
221 | public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
222 | { | ||
223 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
224 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
225 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
226 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
227 | sendData["METHOD"] = "report"; | ||
228 | |||
229 | sendData["SessionID"] = sessionID.ToString(); | ||
230 | sendData["RegionID"] = regionID.ToString(); | ||
231 | sendData["position"] = position.ToString(); | ||
232 | sendData["lookAt"] = lookAt.ToString(); | ||
233 | |||
234 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
235 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
236 | try | ||
237 | { | ||
238 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
239 | m_ServerURI + "/presence", | ||
240 | reqString); | ||
241 | if (reply != string.Empty) | ||
242 | { | ||
243 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
244 | |||
245 | if (replyData.ContainsKey("result")) | ||
246 | { | ||
247 | if (replyData["result"].ToString().ToLower() == "success") | ||
248 | return true; | ||
249 | else | ||
250 | return false; | ||
251 | } | ||
252 | else | ||
253 | m_log.DebugFormat("[PRESENCE CONNECTOR]: ReportAgent reply data does not contain result field"); | ||
254 | |||
255 | } | ||
256 | else | ||
257 | m_log.DebugFormat("[PRESENCE CONNECTOR]: ReportAgent received empty reply"); | ||
258 | } | ||
259 | catch (Exception e) | ||
260 | { | ||
261 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message); | ||
262 | } | ||
263 | |||
264 | return false; | ||
265 | } | ||
266 | |||
267 | public PresenceInfo GetAgent(UUID sessionID) | ||
268 | { | ||
269 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
270 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
271 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
272 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
273 | sendData["METHOD"] = "getagent"; | ||
274 | |||
275 | sendData["SessionID"] = sessionID.ToString(); | ||
276 | |||
277 | string reply = string.Empty; | ||
278 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
279 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
280 | try | ||
281 | { | ||
282 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
283 | m_ServerURI + "/presence", | ||
284 | reqString); | ||
285 | if (reply == null || (reply != null && reply == string.Empty)) | ||
286 | { | ||
287 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); | ||
288 | return null; | ||
289 | } | ||
290 | } | ||
291 | catch (Exception e) | ||
292 | { | ||
293 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message); | ||
294 | } | ||
295 | |||
296 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
297 | PresenceInfo pinfo = null; | ||
298 | |||
299 | if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) | ||
300 | { | ||
301 | if (replyData["result"] is Dictionary<string, object>) | ||
302 | { | ||
303 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | return pinfo; | ||
308 | } | ||
309 | |||
310 | public PresenceInfo[] GetAgents(string[] userIDs) | ||
311 | { | ||
312 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
313 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
314 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
315 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
316 | sendData["METHOD"] = "getagents"; | ||
317 | |||
318 | sendData["uuids"] = new List<string>(userIDs); | ||
319 | |||
320 | string reply = string.Empty; | ||
321 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
322 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
323 | try | ||
324 | { | ||
325 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
326 | m_ServerURI + "/presence", | ||
327 | reqString); | ||
328 | if (reply == null || (reply != null && reply == string.Empty)) | ||
329 | { | ||
330 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); | ||
331 | return null; | ||
332 | } | ||
333 | } | ||
334 | catch (Exception e) | ||
335 | { | ||
336 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message); | ||
337 | } | ||
338 | |||
339 | List<PresenceInfo> rinfos = new List<PresenceInfo>(); | ||
340 | |||
341 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
342 | |||
343 | if (replyData != null) | ||
344 | { | ||
345 | if (replyData.ContainsKey("result") && | ||
346 | (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) | ||
347 | { | ||
348 | return new PresenceInfo[0]; | ||
349 | } | ||
350 | |||
351 | Dictionary<string, object>.ValueCollection pinfosList = replyData.Values; | ||
352 | //m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count); | ||
353 | foreach (object presence in pinfosList) | ||
354 | { | ||
355 | if (presence is Dictionary<string, object>) | ||
356 | { | ||
357 | PresenceInfo pinfo = new PresenceInfo((Dictionary<string, object>)presence); | ||
358 | rinfos.Add(pinfo); | ||
359 | } | ||
360 | else | ||
361 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received invalid response type {0}", | ||
362 | presence.GetType()); | ||
363 | } | ||
364 | } | ||
365 | else | ||
366 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null response"); | ||
367 | |||
368 | return rinfos.ToArray(); | ||
369 | } | ||
370 | |||
371 | |||
372 | public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
373 | { | ||
374 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
375 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
376 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
377 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
378 | sendData["METHOD"] = "sethome"; | ||
379 | |||
380 | sendData["UserID"] = userID; | ||
381 | sendData["RegionID"] = regionID.ToString(); | ||
382 | sendData["position"] = position.ToString(); | ||
383 | sendData["lookAt"] = lookAt.ToString(); | ||
384 | |||
385 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
386 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
387 | try | ||
388 | { | ||
389 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
390 | m_ServerURI + "/presence", | ||
391 | reqString); | ||
392 | if (reply != string.Empty) | ||
393 | { | ||
394 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
395 | |||
396 | if (replyData.ContainsKey("result")) | ||
397 | { | ||
398 | if (replyData["result"].ToString().ToLower() == "success") | ||
399 | return true; | ||
400 | else | ||
401 | return false; | ||
402 | } | ||
403 | else | ||
404 | m_log.DebugFormat("[PRESENCE CONNECTOR]: SetHomeLocation reply data does not contain result field"); | ||
405 | |||
406 | } | ||
407 | else | ||
408 | m_log.DebugFormat("[PRESENCE CONNECTOR]: SetHomeLocation received empty reply"); | ||
409 | } | ||
410 | catch (Exception e) | ||
411 | { | ||
412 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server: {0}", e.Message); | ||
413 | } | ||
414 | |||
415 | return false; | ||
416 | } | ||
417 | |||
418 | #endregion | ||
419 | |||
420 | } | ||
421 | } | ||
diff --git a/OpenSim/Services/Connectors/User/UserServiceConnector.cs b/OpenSim/Services/Connectors/User/UserServiceConnector.cs deleted file mode 100644 index 683990f..0000000 --- a/OpenSim/Services/Connectors/User/UserServiceConnector.cs +++ /dev/null | |||
@@ -1,114 +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 log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenMetaverse; | ||
39 | |||
40 | namespace OpenSim.Services.Connectors | ||
41 | { | ||
42 | public class UserServicesConnector : IUserAccountService | ||
43 | { | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | // private string m_ServerURI = String.Empty; | ||
49 | |||
50 | public UserServicesConnector() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public UserServicesConnector(string serverURI) | ||
55 | { | ||
56 | // m_ServerURI = serverURI.TrimEnd('/'); | ||
57 | } | ||
58 | |||
59 | public UserServicesConnector(IConfigSource source) | ||
60 | { | ||
61 | Initialise(source); | ||
62 | } | ||
63 | |||
64 | public virtual void Initialise(IConfigSource source) | ||
65 | { | ||
66 | IConfig assetConfig = source.Configs["UserService"]; | ||
67 | if (assetConfig == null) | ||
68 | { | ||
69 | m_log.Error("[USER CONNECTOR]: UserService missing from OpanSim.ini"); | ||
70 | throw new Exception("User connector init error"); | ||
71 | } | ||
72 | |||
73 | string serviceURI = assetConfig.GetString("UserServerURI", | ||
74 | String.Empty); | ||
75 | |||
76 | if (serviceURI == String.Empty) | ||
77 | { | ||
78 | m_log.Error("[USER CONNECTOR]: No Server URI named in section UserService"); | ||
79 | throw new Exception("User connector init error"); | ||
80 | } | ||
81 | //m_ServerURI = serviceURI; | ||
82 | } | ||
83 | |||
84 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | ||
85 | { | ||
86 | return null; | ||
87 | } | ||
88 | |||
89 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | ||
90 | { | ||
91 | return null; | ||
92 | } | ||
93 | |||
94 | public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret) | ||
95 | { | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | public bool SetUserAccount(UserAccount data, UUID principalID, string token) | ||
100 | { | ||
101 | return false; | ||
102 | } | ||
103 | |||
104 | public bool CreateUserAccount(UserAccount data, UUID principalID, string token) | ||
105 | { | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | public List<UserAccount> GetUserAccount(UUID scopeID, string query) | ||
110 | { | ||
111 | return null; | ||
112 | } | ||
113 | } | ||
114 | } | ||
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs new file mode 100644 index 0000000..d4b906a --- /dev/null +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs | |||
@@ -0,0 +1,287 @@ | |||
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 log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Server.Base; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenMetaverse; | ||
40 | |||
41 | namespace OpenSim.Services.Connectors | ||
42 | { | ||
43 | public class UserAccountServicesConnector : IUserAccountService | ||
44 | { | ||
45 | private static readonly ILog m_log = | ||
46 | LogManager.GetLogger( | ||
47 | MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private string m_ServerURI = String.Empty; | ||
50 | |||
51 | public UserAccountServicesConnector() | ||
52 | { | ||
53 | } | ||
54 | |||
55 | public UserAccountServicesConnector(string serverURI) | ||
56 | { | ||
57 | m_ServerURI = serverURI.TrimEnd('/'); | ||
58 | } | ||
59 | |||
60 | public UserAccountServicesConnector(IConfigSource source) | ||
61 | { | ||
62 | Initialise(source); | ||
63 | } | ||
64 | |||
65 | public virtual void Initialise(IConfigSource source) | ||
66 | { | ||
67 | IConfig assetConfig = source.Configs["UserAccountService"]; | ||
68 | if (assetConfig == null) | ||
69 | { | ||
70 | m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); | ||
71 | throw new Exception("User account connector init error"); | ||
72 | } | ||
73 | |||
74 | string serviceURI = assetConfig.GetString("UserAccountServerURI", | ||
75 | String.Empty); | ||
76 | |||
77 | if (serviceURI == String.Empty) | ||
78 | { | ||
79 | m_log.Error("[ACCOUNT CONNECTOR]: No Server URI named in section UserAccountService"); | ||
80 | throw new Exception("User account connector init error"); | ||
81 | } | ||
82 | m_ServerURI = serviceURI; | ||
83 | } | ||
84 | |||
85 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | ||
86 | { | ||
87 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
88 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
89 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
90 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
91 | sendData["METHOD"] = "getaccount"; | ||
92 | |||
93 | sendData["ScopeID"] = scopeID; | ||
94 | sendData["FirstName"] = firstName.ToString(); | ||
95 | sendData["LastName"] = lastName.ToString(); | ||
96 | |||
97 | return SendAndGetReply(sendData); | ||
98 | } | ||
99 | |||
100 | public UserAccount GetUserAccount(UUID scopeID, string email) | ||
101 | { | ||
102 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
103 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
104 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
105 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
106 | sendData["METHOD"] = "getaccount"; | ||
107 | |||
108 | sendData["ScopeID"] = scopeID; | ||
109 | sendData["Email"] = email; | ||
110 | |||
111 | return SendAndGetReply(sendData); | ||
112 | } | ||
113 | |||
114 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | ||
115 | { | ||
116 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
117 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
118 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
119 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
120 | sendData["METHOD"] = "getaccount"; | ||
121 | |||
122 | sendData["ScopeID"] = scopeID; | ||
123 | sendData["UserID"] = userID.ToString(); | ||
124 | |||
125 | return SendAndGetReply(sendData); | ||
126 | } | ||
127 | |||
128 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | ||
129 | { | ||
130 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
131 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
132 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
133 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
134 | sendData["METHOD"] = "getagents"; | ||
135 | |||
136 | sendData["ScopeID"] = scopeID.ToString(); | ||
137 | sendData["query"] = query; | ||
138 | |||
139 | string reply = string.Empty; | ||
140 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
141 | // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); | ||
142 | try | ||
143 | { | ||
144 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
145 | m_ServerURI + "/accounts", | ||
146 | reqString); | ||
147 | if (reply == null || (reply != null && reply == string.Empty)) | ||
148 | { | ||
149 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); | ||
150 | return null; | ||
151 | } | ||
152 | } | ||
153 | catch (Exception e) | ||
154 | { | ||
155 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting accounts server: {0}", e.Message); | ||
156 | } | ||
157 | |||
158 | List<UserAccount> accounts = new List<UserAccount>(); | ||
159 | |||
160 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
161 | |||
162 | if (replyData != null) | ||
163 | { | ||
164 | if (replyData.ContainsKey("result") && replyData.ContainsKey("result").ToString() == "null") | ||
165 | { | ||
166 | return accounts; | ||
167 | } | ||
168 | |||
169 | Dictionary<string, object>.ValueCollection accountList = replyData.Values; | ||
170 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count); | ||
171 | foreach (object acc in accountList) | ||
172 | { | ||
173 | if (acc is Dictionary<string, object>) | ||
174 | { | ||
175 | UserAccount pinfo = new UserAccount((Dictionary<string, object>)acc); | ||
176 | accounts.Add(pinfo); | ||
177 | } | ||
178 | else | ||
179 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received invalid response type {0}", | ||
180 | acc.GetType()); | ||
181 | } | ||
182 | } | ||
183 | else | ||
184 | m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccounts received null response"); | ||
185 | |||
186 | return accounts; | ||
187 | } | ||
188 | |||
189 | public bool SetUserAccount(UserAccount data) | ||
190 | { | ||
191 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
192 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
193 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
194 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
195 | sendData["METHOD"] = "setaccount"; | ||
196 | |||
197 | sendData["account"] = data.ToKeyValuePairs(); | ||
198 | |||
199 | return SendAndGetBoolReply(sendData); | ||
200 | } | ||
201 | |||
202 | public bool CreateUserAccount(UserAccount data) | ||
203 | { | ||
204 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
205 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
206 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
207 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
208 | sendData["METHOD"] = "createaccount"; | ||
209 | |||
210 | sendData["account"] = data.ToKeyValuePairs(); | ||
211 | |||
212 | return SendAndGetBoolReply(sendData); | ||
213 | } | ||
214 | |||
215 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) | ||
216 | { | ||
217 | string reply = string.Empty; | ||
218 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
219 | // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); | ||
220 | try | ||
221 | { | ||
222 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
223 | m_ServerURI + "/accounts", | ||
224 | reqString); | ||
225 | if (reply == null || (reply != null && reply == string.Empty)) | ||
226 | { | ||
227 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); | ||
228 | return null; | ||
229 | } | ||
230 | } | ||
231 | catch (Exception e) | ||
232 | { | ||
233 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user account server: {0}", e.Message); | ||
234 | } | ||
235 | |||
236 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
237 | UserAccount account = null; | ||
238 | |||
239 | if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) | ||
240 | { | ||
241 | if (replyData["result"] is Dictionary<string, object>) | ||
242 | { | ||
243 | account = new UserAccount((Dictionary<string, object>)replyData["result"]); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | return account; | ||
248 | |||
249 | } | ||
250 | |||
251 | private bool SendAndGetBoolReply(Dictionary<string, object> sendData) | ||
252 | { | ||
253 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
254 | // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); | ||
255 | try | ||
256 | { | ||
257 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
258 | m_ServerURI + "/accounts", | ||
259 | reqString); | ||
260 | if (reply != string.Empty) | ||
261 | { | ||
262 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
263 | |||
264 | if (replyData.ContainsKey("result")) | ||
265 | { | ||
266 | if (replyData["result"].ToString().ToLower() == "success") | ||
267 | return true; | ||
268 | else | ||
269 | return false; | ||
270 | } | ||
271 | else | ||
272 | m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Set or Create UserAccount reply data does not contain result field"); | ||
273 | |||
274 | } | ||
275 | else | ||
276 | m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Set or Create UserAccount received empty reply"); | ||
277 | } | ||
278 | catch (Exception e) | ||
279 | { | ||
280 | m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Exception when contacting user account server: {0}", e.Message); | ||
281 | } | ||
282 | |||
283 | return false; | ||
284 | } | ||
285 | |||
286 | } | ||
287 | } | ||
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs index aa1c5bf..2dad7e6 100644 --- a/OpenSim/Services/Interfaces/IPresenceService.cs +++ b/OpenSim/Services/Interfaces/IPresenceService.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -33,13 +34,74 @@ namespace OpenSim.Services.Interfaces | |||
33 | { | 34 | { |
34 | public class PresenceInfo | 35 | public class PresenceInfo |
35 | { | 36 | { |
36 | public UUID PrincipalID; | 37 | public string UserID; |
37 | public UUID RegionID; | 38 | public UUID RegionID; |
38 | public Dictionary<string, string> Data; | 39 | public bool Online; |
40 | public DateTime Login; | ||
41 | public DateTime Logout; | ||
42 | public Vector3 Position; | ||
43 | public Vector3 LookAt; | ||
44 | public UUID HomeRegionID; | ||
45 | public Vector3 HomePosition; | ||
46 | public Vector3 HomeLookAt; | ||
47 | |||
48 | public PresenceInfo() | ||
49 | { | ||
50 | } | ||
51 | |||
52 | public PresenceInfo(Dictionary<string, object> kvp) | ||
53 | { | ||
54 | if (kvp.ContainsKey("UserID")) | ||
55 | UserID = kvp["UserID"].ToString(); | ||
56 | if (kvp.ContainsKey("RegionID")) | ||
57 | UUID.TryParse(kvp["RegionID"].ToString(), out RegionID); | ||
58 | if (kvp.ContainsKey("login")) | ||
59 | DateTime.TryParse(kvp["login"].ToString(), out Login); | ||
60 | if (kvp.ContainsKey("logout")) | ||
61 | DateTime.TryParse(kvp["logout"].ToString(), out Logout); | ||
62 | if (kvp.ContainsKey("lookAt")) | ||
63 | Vector3.TryParse(kvp["lookAt"].ToString(), out LookAt); | ||
64 | if (kvp.ContainsKey("online")) | ||
65 | Boolean.TryParse(kvp["online"].ToString(), out Online); | ||
66 | if (kvp.ContainsKey("position")) | ||
67 | Vector3.TryParse(kvp["position"].ToString(), out Position); | ||
68 | if (kvp.ContainsKey("HomeRegionID")) | ||
69 | UUID.TryParse(kvp["HomeRegionID"].ToString(), out HomeRegionID); | ||
70 | if (kvp.ContainsKey("HomePosition")) | ||
71 | Vector3.TryParse(kvp["HomePosition"].ToString(), out HomePosition); | ||
72 | if (kvp.ContainsKey("HomeLookAt")) | ||
73 | Vector3.TryParse(kvp["HomeLookAt"].ToString(), out HomeLookAt); | ||
74 | |||
75 | } | ||
76 | |||
77 | public Dictionary<string, object> ToKeyValuePairs() | ||
78 | { | ||
79 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
80 | result["UserID"] = UserID; | ||
81 | result["RegionID"] = RegionID.ToString(); | ||
82 | result["online"] = Online.ToString(); | ||
83 | result["login"] = Login.ToString(); | ||
84 | result["logout"] = Logout.ToString(); | ||
85 | result["position"] = Position.ToString(); | ||
86 | result["lookAt"] = LookAt.ToString(); | ||
87 | result["HomeRegionID"] = HomeRegionID.ToString(); | ||
88 | result["HomePosition"] = HomePosition.ToString(); | ||
89 | result["HomeLookAt"] = HomeLookAt.ToString(); | ||
90 | |||
91 | return result; | ||
92 | } | ||
39 | } | 93 | } |
40 | 94 | ||
41 | public interface IPresenceService | 95 | public interface IPresenceService |
42 | { | 96 | { |
43 | bool Report(PresenceInfo presence); | 97 | bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID); |
98 | bool LogoutAgent(UUID sessionID); | ||
99 | bool LogoutRegionAgents(UUID regionID); | ||
100 | |||
101 | bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt); | ||
102 | bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt); | ||
103 | |||
104 | PresenceInfo GetAgent(UUID sessionID); | ||
105 | PresenceInfo[] GetAgents(string[] userIDs); | ||
44 | } | 106 | } |
45 | } | 107 | } |
diff --git a/OpenSim/Services/Interfaces/IUserService.cs b/OpenSim/Services/Interfaces/IUserService.cs index 92bd8ef..1bdaaab 100644 --- a/OpenSim/Services/Interfaces/IUserService.cs +++ b/OpenSim/Services/Interfaces/IUserService.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | 31 | ||
@@ -36,68 +37,69 @@ namespace OpenSim.Services.Interfaces | |||
36 | { | 37 | { |
37 | } | 38 | } |
38 | 39 | ||
39 | public UserAccount(UUID userID, UUID homeRegionID, float homePositionX, | 40 | public UserAccount(UUID principalID) |
40 | float homePositionY, float homePositionZ, float homeLookAtX, | ||
41 | float homeLookAtY, float homeLookAtZ) | ||
42 | { | 41 | { |
43 | UserID = userID; | 42 | PrincipalID = principalID; |
44 | HomeRegionID = homeRegionID; | ||
45 | HomePositionX = homePositionX; | ||
46 | HomePositionY = homePositionY; | ||
47 | HomePositionZ = homePositionZ; | ||
48 | HomeLookAtX = homeLookAtX; | ||
49 | HomeLookAtY = homeLookAtY; | ||
50 | HomeLookAtZ = homeLookAtZ; | ||
51 | } | 43 | } |
52 | 44 | ||
53 | public string FirstName; | 45 | public string FirstName; |
54 | public string LastName; | 46 | public string LastName; |
55 | public UUID UserID; | 47 | public string Email; |
48 | public UUID PrincipalID; | ||
56 | public UUID ScopeID; | 49 | public UUID ScopeID; |
57 | 50 | ||
58 | // For informational purposes only! | 51 | public Dictionary<string, object> ServiceURLs; |
59 | // | ||
60 | public string HomeRegionName; | ||
61 | 52 | ||
62 | public UUID HomeRegionID; | 53 | public int Created; |
63 | public float HomePositionX; | ||
64 | public float HomePositionY; | ||
65 | public float HomePositionZ; | ||
66 | public float HomeLookAtX; | ||
67 | public float HomeLookAtY; | ||
68 | public float HomeLookAtZ; | ||
69 | 54 | ||
70 | // These are here because they | 55 | public UserAccount(Dictionary<string, object> kvp) |
71 | // concern the account rather than | 56 | { |
72 | // the profile. They just happen to | 57 | if (kvp.ContainsKey("FirstName")) |
73 | // be used in the Linden profile as well | 58 | FirstName = kvp["FirstName"].ToString(); |
74 | // | 59 | if (kvp.ContainsKey("LastName")) |
75 | public int GodLevel; | 60 | LastName = kvp["LastName"].ToString(); |
76 | public int UserFlags; | 61 | if (kvp.ContainsKey("Email")) |
77 | public string AccountType; | 62 | Email = kvp["Email"].ToString(); |
63 | if (kvp.ContainsKey("PrincipalID")) | ||
64 | UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID); | ||
65 | if (kvp.ContainsKey("ScopeID")) | ||
66 | UUID.TryParse(kvp["ScopeID"].ToString(), out ScopeID); | ||
67 | if (kvp.ContainsKey("Created")) | ||
68 | Convert.ToInt32(kvp["Created"].ToString()); | ||
69 | if (kvp.ContainsKey("ServiceURLs") && kvp["ServiceURLs"] != null && (kvp["ServiceURLs"] is Dictionary<string, string>)) | ||
70 | ServiceURLs = (Dictionary<string, object>)kvp["ServiceURLs"]; | ||
71 | } | ||
72 | |||
73 | public Dictionary<string, object> ToKeyValuePairs() | ||
74 | { | ||
75 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
76 | result["FirstName"] = FirstName; | ||
77 | result["LastName"] = LastName; | ||
78 | result["Email"] = Email; | ||
79 | result["PrincipalID"] = PrincipalID.ToString(); | ||
80 | result["ScopeID"] = ScopeID.ToString(); | ||
81 | result["Created"] = Created.ToString(); | ||
82 | result["ServiceURLs"] = ServiceURLs; | ||
78 | 83 | ||
84 | return result; | ||
85 | } | ||
79 | }; | 86 | }; |
80 | 87 | ||
81 | public interface IUserAccountService | 88 | public interface IUserAccountService |
82 | { | 89 | { |
83 | UserAccount GetUserAccount(UUID scopeID, UUID userID); | 90 | UserAccount GetUserAccount(UUID scopeID, UUID userID); |
84 | UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); | 91 | UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); |
92 | UserAccount GetUserAccount(UUID scopeID, string Email); | ||
85 | // Returns the list of avatars that matches both the search | 93 | // Returns the list of avatars that matches both the search |
86 | // criterion and the scope ID passed | 94 | // criterion and the scope ID passed |
87 | // | 95 | // |
88 | List<UserAccount> GetUserAccount(UUID scopeID, string query); | 96 | List<UserAccount> GetUserAccounts(UUID scopeID, string query); |
89 | |||
90 | |||
91 | // This will set only the home region portion of the data! | ||
92 | // Can't be used to set god level, flags, type or change the name! | ||
93 | // | ||
94 | bool SetHomePosition(UserAccount data, UUID RegionID, UUID RegionSecret); | ||
95 | 97 | ||
96 | // Update all updatable fields | 98 | // Update all updatable fields |
97 | // | 99 | // |
98 | bool SetUserAccount(UserAccount data, UUID PrincipalID, string token); | 100 | bool SetUserAccount(UserAccount data); |
99 | 101 | ||
100 | // Creates a user data record | 102 | // Creates a user data record |
101 | bool CreateUserAccount(UserAccount data, UUID PrincipalID, string token); | 103 | bool CreateUserAccount(UserAccount data); |
102 | } | 104 | } |
103 | } | 105 | } |
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 2157462..fc6a6e1 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs | |||
@@ -41,27 +41,151 @@ namespace OpenSim.Services.PresenceService | |||
41 | { | 41 | { |
42 | public class PresenceService : PresenceServiceBase, IPresenceService | 42 | public class PresenceService : PresenceServiceBase, IPresenceService |
43 | { | 43 | { |
44 | // private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | // LogManager.GetLogger( | 45 | LogManager.GetLogger( |
46 | // MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | public PresenceService(IConfigSource config) | 48 | public PresenceService(IConfigSource config) |
49 | : base(config) | 49 | : base(config) |
50 | { | 50 | { |
51 | m_log.Debug("[PRESENCE SERVICE]: Starting presence service"); | ||
51 | } | 52 | } |
52 | 53 | ||
53 | public bool Report(PresenceInfo presence) | 54 | public bool LoginAgent(string userID, UUID sessionID, |
55 | UUID secureSessionID) | ||
54 | { | 56 | { |
55 | PresenceData p = new PresenceData(); | 57 | m_Database.Prune(userID); |
56 | p.Data = new Dictionary<string, string>(); | ||
57 | 58 | ||
58 | p.UUID = presence.PrincipalID; | 59 | PresenceData[] d = m_Database.Get("UserID", userID); |
59 | p.currentRegion = presence.RegionID; | ||
60 | 60 | ||
61 | foreach (KeyValuePair<string, string> kvp in presence.Data) | 61 | PresenceData data = new PresenceData(); |
62 | p.Data[kvp.Key] = kvp.Value; | ||
63 | 62 | ||
64 | return false; | 63 | data.UserID = userID; |
64 | data.RegionID = UUID.Zero; | ||
65 | data.SessionID = sessionID; | ||
66 | data.Data["SecureSessionID"] = secureSessionID.ToString(); | ||
67 | data.Data["Online"] = "true"; | ||
68 | data.Data["Login"] = Util.UnixTimeSinceEpoch().ToString(); | ||
69 | if (d.Length > 0) | ||
70 | { | ||
71 | data.Data["HomeRegionID"] = d[0].Data["HomeRegionID"]; | ||
72 | data.Data["HomePosition"] = d[0].Data["HomePosition"]; | ||
73 | data.Data["HomeLookAt"] = d[0].Data["HomeLookAt"]; | ||
74 | } | ||
75 | |||
76 | m_Database.Store(data); | ||
77 | |||
78 | return true; | ||
79 | } | ||
80 | |||
81 | public bool LogoutAgent(UUID sessionID) | ||
82 | { | ||
83 | PresenceData data = m_Database.Get(sessionID); | ||
84 | if (data == null) | ||
85 | return false; | ||
86 | |||
87 | PresenceData[] d = m_Database.Get("UserID", data.UserID); | ||
88 | |||
89 | if (d.Length > 1) | ||
90 | { | ||
91 | m_Database.Delete("SessionID", sessionID.ToString()); | ||
92 | } | ||
93 | |||
94 | data.Data["Online"] = "false"; | ||
95 | data.Data["Logout"] = Util.UnixTimeSinceEpoch().ToString(); | ||
96 | |||
97 | m_Database.Store(data); | ||
98 | |||
99 | return true; | ||
100 | } | ||
101 | |||
102 | public bool LogoutRegionAgents(UUID regionID) | ||
103 | { | ||
104 | m_Database.LogoutRegionAgents(regionID); | ||
105 | |||
106 | return true; | ||
107 | } | ||
108 | |||
109 | |||
110 | public bool ReportAgent(UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
111 | { | ||
112 | m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); | ||
113 | PresenceData pdata = m_Database.Get(sessionID); | ||
114 | if (pdata == null) | ||
115 | return false; | ||
116 | if (pdata.Data["Online"] == "false") | ||
117 | return false; | ||
118 | |||
119 | return m_Database.ReportAgent(sessionID, regionID, | ||
120 | position.ToString(), lookAt.ToString()); | ||
121 | } | ||
122 | |||
123 | public PresenceInfo GetAgent(UUID sessionID) | ||
124 | { | ||
125 | PresenceInfo ret = new PresenceInfo(); | ||
126 | |||
127 | PresenceData data = m_Database.Get(sessionID); | ||
128 | if (data == null) | ||
129 | return null; | ||
130 | |||
131 | ret.UserID = data.UserID; | ||
132 | ret.RegionID = data.RegionID; | ||
133 | if (data.Data.ContainsKey("Online")) | ||
134 | ret.Online = bool.Parse(data.Data["Online"]); | ||
135 | if (data.Data.ContainsKey("Login")) | ||
136 | ret.Login = Util.ToDateTime(Convert.ToInt32(data.Data["Login"])); | ||
137 | if (data.Data.ContainsKey("Logout")) | ||
138 | ret.Logout = Util.ToDateTime(Convert.ToInt32(data.Data["Logout"])); | ||
139 | if (data.Data.ContainsKey("Position")) | ||
140 | ret.Position = Vector3.Parse(data.Data["Position"]); | ||
141 | if (data.Data.ContainsKey("LookAt")) | ||
142 | ret.LookAt = Vector3.Parse(data.Data["LookAt"]); | ||
143 | if (data.Data.ContainsKey("HomeRegionID")) | ||
144 | ret.HomeRegionID = new UUID(data.Data["HomeRegionID"]); | ||
145 | if (data.Data.ContainsKey("HomePosition")) | ||
146 | ret.HomePosition = Vector3.Parse(data.Data["HomePosition"]); | ||
147 | if (data.Data.ContainsKey("HomeLookAt")) | ||
148 | ret.HomeLookAt = Vector3.Parse(data.Data["HomeLookAt"]); | ||
149 | |||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | public PresenceInfo[] GetAgents(string[] userIDs) | ||
154 | { | ||
155 | List<PresenceInfo> info = new List<PresenceInfo>(); | ||
156 | |||
157 | foreach (string userIDStr in userIDs) | ||
158 | { | ||
159 | PresenceData[] data = m_Database.Get("UserID", | ||
160 | userIDStr); | ||
161 | |||
162 | foreach (PresenceData d in data) | ||
163 | { | ||
164 | PresenceInfo ret = new PresenceInfo(); | ||
165 | |||
166 | ret.UserID = d.UserID; | ||
167 | ret.RegionID = d.RegionID; | ||
168 | ret.Online = bool.Parse(d.Data["Online"]); | ||
169 | ret.Login = Util.ToDateTime(Convert.ToInt32( | ||
170 | d.Data["Login"])); | ||
171 | ret.Logout = Util.ToDateTime(Convert.ToInt32( | ||
172 | d.Data["Logout"])); | ||
173 | ret.Position = Vector3.Parse(d.Data["Position"]); | ||
174 | ret.LookAt = Vector3.Parse(d.Data["LookAt"]); | ||
175 | ret.HomeRegionID = new UUID(d.Data["HomeRegionID"]); | ||
176 | ret.HomePosition = Vector3.Parse(d.Data["HomePosition"]); | ||
177 | ret.HomeLookAt = Vector3.Parse(d.Data["HomeLookAt"]); | ||
178 | |||
179 | info.Add(ret); | ||
180 | } | ||
181 | } | ||
182 | |||
183 | return info.ToArray(); | ||
184 | } | ||
185 | |||
186 | public bool SetHomeLocation(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | ||
187 | { | ||
188 | return m_Database.SetHomeLocation(userID, regionID, position, lookAt); | ||
65 | } | 189 | } |
66 | } | 190 | } |
67 | } | 191 | } |
diff --git a/OpenSim/Services/PresenceService/PresenceServiceBase.cs b/OpenSim/Services/PresenceService/PresenceServiceBase.cs index 60a246b..3ca70c1 100644 --- a/OpenSim/Services/PresenceService/PresenceServiceBase.cs +++ b/OpenSim/Services/PresenceService/PresenceServiceBase.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Services.PresenceService | |||
44 | { | 44 | { |
45 | string dllName = String.Empty; | 45 | string dllName = String.Empty; |
46 | string connString = String.Empty; | 46 | string connString = String.Empty; |
47 | string realm = "agents"; | 47 | string realm = "presence"; |
48 | 48 | ||
49 | // | 49 | // |
50 | // Try reading the [DatabaseService] section, if it exists | 50 | // Try reading the [DatabaseService] section, if it exists |
diff --git a/OpenSim/Services/UserService/UserService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index e8b9fc3..ee9ea94 100644 --- a/OpenSim/Services/UserService/UserService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -44,31 +44,45 @@ namespace OpenSim.Services.UserAccountService | |||
44 | public UserAccount GetUserAccount(UUID scopeID, string firstName, | 44 | public UserAccount GetUserAccount(UUID scopeID, string firstName, |
45 | string lastName) | 45 | string lastName) |
46 | { | 46 | { |
47 | UserAccountData[] d = m_Database.Get( | ||
48 | new string[] {"ScopeID", "FirstName", "LastName"}, | ||
49 | new string[] {scopeID.ToString(), firstName, lastName}); | ||
50 | |||
51 | if (d.Length < 1) | ||
52 | return null; | ||
53 | |||
54 | UserAccount u = new UserAccount(); | ||
55 | u.FirstName = d[0].FirstName; | ||
56 | u.LastName = d[0].LastName; | ||
57 | u.PrincipalID = d[0].PrincipalID; | ||
58 | u.ScopeID = d[0].ScopeID; | ||
59 | u.Email = d[0].Data["Email"].ToString(); | ||
60 | u.Created = Convert.ToInt32(d[0].Data["Created"].ToString()); | ||
61 | |||
47 | return null; | 62 | return null; |
48 | } | 63 | } |
49 | 64 | ||
50 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | 65 | public UserAccount GetUserAccount(UUID scopeID, string email) |
51 | { | 66 | { |
52 | return null; | 67 | return null; |
53 | } | 68 | } |
54 | 69 | ||
55 | public bool SetHomePosition(UserAccount data, UUID regionID, UUID regionSecret) | 70 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) |
56 | { | 71 | { |
57 | return false; | 72 | return null; |
58 | } | 73 | } |
59 | 74 | ||
60 | public bool SetUserAccount(UserAccount data, UUID principalID, string token) | 75 | public bool SetUserAccount(UserAccount data) |
61 | { | 76 | { |
62 | return false; | 77 | return false; |
63 | } | 78 | } |
64 | 79 | ||
65 | public bool CreateUserAccount(UserAccount data, UUID principalID, string token) | 80 | public bool CreateUserAccount(UserAccount data) |
66 | { | 81 | { |
67 | return false; | 82 | return false; |
68 | } | 83 | } |
69 | 84 | ||
70 | public List<UserAccount> GetUserAccount(UUID scopeID, | 85 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
71 | string query) | ||
72 | { | 86 | { |
73 | return null; | 87 | return null; |
74 | } | 88 | } |
diff --git a/OpenSim/Services/UserService/UserServiceBase.cs b/OpenSim/Services/UserAccountService/UserAccountServiceBase.cs index fea8b01..70ed594 100644 --- a/OpenSim/Services/UserService/UserServiceBase.cs +++ b/OpenSim/Services/UserAccountService/UserAccountServiceBase.cs | |||
@@ -40,20 +40,29 @@ namespace OpenSim.Services.UserAccountService | |||
40 | 40 | ||
41 | public UserAccountServiceBase(IConfigSource config) : base(config) | 41 | public UserAccountServiceBase(IConfigSource config) : base(config) |
42 | { | 42 | { |
43 | string dllName = String.Empty; | ||
44 | string connString = String.Empty; | ||
45 | string realm = "useraccounts"; | ||
46 | |||
47 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
48 | if (dbConfig != null) | ||
49 | { | ||
50 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
51 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
52 | } | ||
53 | |||
43 | IConfig userConfig = config.Configs["UserAccountService"]; | 54 | IConfig userConfig = config.Configs["UserAccountService"]; |
44 | if (userConfig == null) | 55 | if (userConfig == null) |
45 | throw new Exception("No UserAccountService configuration"); | 56 | throw new Exception("No UserAccountService configuration"); |
46 | 57 | ||
47 | string dllName = userConfig.GetString("StorageProvider", | 58 | dllName = userConfig.GetString("StorageProvider", dllName); |
48 | String.Empty); | ||
49 | 59 | ||
50 | if (dllName == String.Empty) | 60 | if (dllName == String.Empty) |
51 | throw new Exception("No StorageProvider configured"); | 61 | throw new Exception("No StorageProvider configured"); |
52 | 62 | ||
53 | string connString = userConfig.GetString("ConnectionString", | 63 | connString = userConfig.GetString("ConnectionString", connString); |
54 | String.Empty); | ||
55 | 64 | ||
56 | string realm = userConfig.GetString("Realm", "users"); | 65 | realm = userConfig.GetString("Realm", realm); |
57 | 66 | ||
58 | m_Database = LoadPlugin<IUserAccountData>(dllName, new Object[] {connString, realm}); | 67 | m_Database = LoadPlugin<IUserAccountData>(dllName, new Object[] {connString, realm}); |
59 | 68 | ||