diff options
Diffstat (limited to 'OpenSim/Services')
11 files changed, 623 insertions, 186 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 44f5e01..36d4ae2 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -84,6 +84,30 @@ namespace OpenSim.Services.Connectors | |||
84 | m_ServerURI = serviceURI; | 84 | m_ServerURI = serviceURI; |
85 | } | 85 | } |
86 | 86 | ||
87 | private bool CheckReturn(Dictionary<string, object> ret) | ||
88 | { | ||
89 | if (ret == null) | ||
90 | return false; | ||
91 | |||
92 | if (ret.Count == 0) | ||
93 | return false; | ||
94 | |||
95 | if (ret.ContainsKey("RESULT")) | ||
96 | { | ||
97 | if (ret["RESULT"] is string) | ||
98 | { | ||
99 | bool result; | ||
100 | |||
101 | if (bool.TryParse((string)ret["RESULT"], out result)) | ||
102 | return result; | ||
103 | |||
104 | return false; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | return true; | ||
109 | } | ||
110 | |||
87 | public bool CreateUserInventory(UUID principalID) | 111 | public bool CreateUserInventory(UUID principalID) |
88 | { | 112 | { |
89 | Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY", | 113 | Dictionary<string,object> ret = MakeRequest("CREATEUSERINVENTORY", |
@@ -91,12 +115,7 @@ namespace OpenSim.Services.Connectors | |||
91 | { "PRINCIPAL", principalID.ToString() } | 115 | { "PRINCIPAL", principalID.ToString() } |
92 | }); | 116 | }); |
93 | 117 | ||
94 | if (ret == null) | 118 | return CheckReturn(ret); |
95 | return false; | ||
96 | if (ret.Count == 0) | ||
97 | return false; | ||
98 | |||
99 | return bool.Parse(ret["RESULT"].ToString()); | ||
100 | } | 119 | } |
101 | 120 | ||
102 | public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) | 121 | public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) |
@@ -106,9 +125,7 @@ namespace OpenSim.Services.Connectors | |||
106 | { "PRINCIPAL", principalID.ToString() } | 125 | { "PRINCIPAL", principalID.ToString() } |
107 | }); | 126 | }); |
108 | 127 | ||
109 | if (ret == null) | 128 | if (!CheckReturn(ret)) |
110 | return null; | ||
111 | if (ret.Count == 0) | ||
112 | return null; | 129 | return null; |
113 | 130 | ||
114 | Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"]; | 131 | Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"]; |
@@ -135,9 +152,7 @@ namespace OpenSim.Services.Connectors | |||
135 | { "PRINCIPAL", principalID.ToString() } | 152 | { "PRINCIPAL", principalID.ToString() } |
136 | }); | 153 | }); |
137 | 154 | ||
138 | if (ret == null) | 155 | if (!CheckReturn(ret)) |
139 | return null; | ||
140 | if (ret.Count == 0) | ||
141 | return null; | 156 | return null; |
142 | 157 | ||
143 | return BuildFolder((Dictionary<string, object>)ret["folder"]); | 158 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
@@ -151,9 +166,7 @@ namespace OpenSim.Services.Connectors | |||
151 | { "TYPE", ((int)type).ToString() } | 166 | { "TYPE", ((int)type).ToString() } |
152 | }); | 167 | }); |
153 | 168 | ||
154 | if (ret == null) | 169 | if (!CheckReturn(ret)) |
155 | return null; | ||
156 | if (ret.Count == 0) | ||
157 | return null; | 170 | return null; |
158 | 171 | ||
159 | return BuildFolder((Dictionary<string, object>)ret["folder"]); | 172 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
@@ -174,9 +187,7 @@ namespace OpenSim.Services.Connectors | |||
174 | { "FOLDER", folderID.ToString() } | 187 | { "FOLDER", folderID.ToString() } |
175 | }); | 188 | }); |
176 | 189 | ||
177 | if (ret == null) | 190 | if (!CheckReturn(ret)) |
178 | return null; | ||
179 | if (ret.Count == 0) | ||
180 | return null; | 191 | return null; |
181 | 192 | ||
182 | Dictionary<string,object> folders = | 193 | Dictionary<string,object> folders = |
@@ -205,9 +216,7 @@ namespace OpenSim.Services.Connectors | |||
205 | { "FOLDER", folderID.ToString() } | 216 | { "FOLDER", folderID.ToString() } |
206 | }); | 217 | }); |
207 | 218 | ||
208 | if (ret == null) | 219 | if (!CheckReturn(ret)) |
209 | return null; | ||
210 | if (ret.Count == 0) | ||
211 | return null; | 220 | return null; |
212 | 221 | ||
213 | Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"]; | 222 | Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"]; |
@@ -230,10 +239,7 @@ namespace OpenSim.Services.Connectors | |||
230 | { "ID", folder.ID.ToString() } | 239 | { "ID", folder.ID.ToString() } |
231 | }); | 240 | }); |
232 | 241 | ||
233 | if (ret == null) | 242 | return CheckReturn(ret); |
234 | return false; | ||
235 | |||
236 | return bool.Parse(ret["RESULT"].ToString()); | ||
237 | } | 243 | } |
238 | 244 | ||
239 | public bool UpdateFolder(InventoryFolderBase folder) | 245 | public bool UpdateFolder(InventoryFolderBase folder) |
@@ -248,10 +254,7 @@ namespace OpenSim.Services.Connectors | |||
248 | { "ID", folder.ID.ToString() } | 254 | { "ID", folder.ID.ToString() } |
249 | }); | 255 | }); |
250 | 256 | ||
251 | if (ret == null) | 257 | return CheckReturn(ret); |
252 | return false; | ||
253 | |||
254 | return bool.Parse(ret["RESULT"].ToString()); | ||
255 | } | 258 | } |
256 | 259 | ||
257 | public bool MoveFolder(InventoryFolderBase folder) | 260 | public bool MoveFolder(InventoryFolderBase folder) |
@@ -263,10 +266,7 @@ namespace OpenSim.Services.Connectors | |||
263 | { "PRINCIPAL", folder.Owner.ToString() } | 266 | { "PRINCIPAL", folder.Owner.ToString() } |
264 | }); | 267 | }); |
265 | 268 | ||
266 | if (ret == null) | 269 | return CheckReturn(ret); |
267 | return false; | ||
268 | |||
269 | return bool.Parse(ret["RESULT"].ToString()); | ||
270 | } | 270 | } |
271 | 271 | ||
272 | public bool DeleteFolders(UUID principalID, List<UUID> folderIDs) | 272 | public bool DeleteFolders(UUID principalID, List<UUID> folderIDs) |
@@ -282,10 +282,7 @@ namespace OpenSim.Services.Connectors | |||
282 | { "FOLDERS", slist } | 282 | { "FOLDERS", slist } |
283 | }); | 283 | }); |
284 | 284 | ||
285 | if (ret == null) | 285 | return CheckReturn(ret); |
286 | return false; | ||
287 | |||
288 | return bool.Parse(ret["RESULT"].ToString()); | ||
289 | } | 286 | } |
290 | 287 | ||
291 | public bool PurgeFolder(InventoryFolderBase folder) | 288 | public bool PurgeFolder(InventoryFolderBase folder) |
@@ -295,10 +292,7 @@ namespace OpenSim.Services.Connectors | |||
295 | { "ID", folder.ID.ToString() } | 292 | { "ID", folder.ID.ToString() } |
296 | }); | 293 | }); |
297 | 294 | ||
298 | if (ret == null) | 295 | return CheckReturn(ret); |
299 | return false; | ||
300 | |||
301 | return bool.Parse(ret["RESULT"].ToString()); | ||
302 | } | 296 | } |
303 | 297 | ||
304 | public bool AddItem(InventoryItemBase item) | 298 | public bool AddItem(InventoryItemBase item) |
@@ -330,10 +324,7 @@ namespace OpenSim.Services.Connectors | |||
330 | { "CreationDate", item.CreationDate.ToString() } | 324 | { "CreationDate", item.CreationDate.ToString() } |
331 | }); | 325 | }); |
332 | 326 | ||
333 | if (ret == null) | 327 | return CheckReturn(ret); |
334 | return false; | ||
335 | |||
336 | return bool.Parse(ret["RESULT"].ToString()); | ||
337 | } | 328 | } |
338 | 329 | ||
339 | public bool UpdateItem(InventoryItemBase item) | 330 | public bool UpdateItem(InventoryItemBase item) |
@@ -365,10 +356,7 @@ namespace OpenSim.Services.Connectors | |||
365 | { "CreationDate", item.CreationDate.ToString() } | 356 | { "CreationDate", item.CreationDate.ToString() } |
366 | }); | 357 | }); |
367 | 358 | ||
368 | if (ret == null) | 359 | return CheckReturn(ret); |
369 | return false; | ||
370 | |||
371 | return bool.Parse(ret["RESULT"].ToString()); | ||
372 | } | 360 | } |
373 | 361 | ||
374 | public bool MoveItems(UUID principalID, List<InventoryItemBase> items) | 362 | public bool MoveItems(UUID principalID, List<InventoryItemBase> items) |
@@ -389,10 +377,7 @@ namespace OpenSim.Services.Connectors | |||
389 | { "DESTLIST", destlist } | 377 | { "DESTLIST", destlist } |
390 | }); | 378 | }); |
391 | 379 | ||
392 | if (ret == null) | 380 | return CheckReturn(ret); |
393 | return false; | ||
394 | |||
395 | return bool.Parse(ret["RESULT"].ToString()); | ||
396 | } | 381 | } |
397 | 382 | ||
398 | public bool DeleteItems(UUID principalID, List<UUID> itemIDs) | 383 | public bool DeleteItems(UUID principalID, List<UUID> itemIDs) |
@@ -408,10 +393,7 @@ namespace OpenSim.Services.Connectors | |||
408 | { "ITEMS", slist } | 393 | { "ITEMS", slist } |
409 | }); | 394 | }); |
410 | 395 | ||
411 | if (ret == null) | 396 | return CheckReturn(ret); |
412 | return false; | ||
413 | |||
414 | return bool.Parse(ret["RESULT"].ToString()); | ||
415 | } | 397 | } |
416 | 398 | ||
417 | public InventoryItemBase GetItem(InventoryItemBase item) | 399 | public InventoryItemBase GetItem(InventoryItemBase item) |
@@ -423,9 +405,7 @@ namespace OpenSim.Services.Connectors | |||
423 | { "ID", item.ID.ToString() } | 405 | { "ID", item.ID.ToString() } |
424 | }); | 406 | }); |
425 | 407 | ||
426 | if (ret == null) | 408 | if (!CheckReturn(ret)) |
427 | return null; | ||
428 | if (ret.Count == 0) | ||
429 | return null; | 409 | return null; |
430 | 410 | ||
431 | return BuildItem((Dictionary<string, object>)ret["item"]); | 411 | return BuildItem((Dictionary<string, object>)ret["item"]); |
@@ -447,9 +427,7 @@ namespace OpenSim.Services.Connectors | |||
447 | { "ID", folder.ID.ToString() } | 427 | { "ID", folder.ID.ToString() } |
448 | }); | 428 | }); |
449 | 429 | ||
450 | if (ret == null) | 430 | if (!CheckReturn(ret)) |
451 | return null; | ||
452 | if (ret.Count == 0) | ||
453 | return null; | 431 | return null; |
454 | 432 | ||
455 | return BuildFolder((Dictionary<string, object>)ret["folder"]); | 433 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
@@ -469,7 +447,7 @@ namespace OpenSim.Services.Connectors | |||
469 | { "PRINCIPAL", principalID.ToString() } | 447 | { "PRINCIPAL", principalID.ToString() } |
470 | }); | 448 | }); |
471 | 449 | ||
472 | if (ret == null) | 450 | if (!CheckReturn(ret)) |
473 | return null; | 451 | return null; |
474 | 452 | ||
475 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 453 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
@@ -488,10 +466,22 @@ namespace OpenSim.Services.Connectors | |||
488 | { "ASSET", assetID.ToString() } | 466 | { "ASSET", assetID.ToString() } |
489 | }); | 467 | }); |
490 | 468 | ||
469 | // We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int | ||
491 | if (ret == null) | 470 | if (ret == null) |
492 | return 0; | 471 | return 0; |
493 | 472 | ||
494 | return int.Parse(ret["RESULT"].ToString()); | 473 | if (ret.ContainsKey("RESULT")) |
474 | { | ||
475 | if (ret["RESULT"] is string) | ||
476 | { | ||
477 | int intResult; | ||
478 | |||
479 | if (int.TryParse ((string)ret["RESULT"], out intResult)) | ||
480 | return intResult; | ||
481 | } | ||
482 | } | ||
483 | |||
484 | return 0; | ||
495 | } | 485 | } |
496 | 486 | ||
497 | public InventoryCollection GetUserInventory(UUID principalID) | 487 | public InventoryCollection GetUserInventory(UUID principalID) |
@@ -508,9 +498,7 @@ namespace OpenSim.Services.Connectors | |||
508 | { "PRINCIPAL", principalID.ToString() } | 498 | { "PRINCIPAL", principalID.ToString() } |
509 | }); | 499 | }); |
510 | 500 | ||
511 | if (ret == null) | 501 | if (!CheckReturn(ret)) |
512 | return null; | ||
513 | if (ret.Count == 0) | ||
514 | return null; | 502 | return null; |
515 | 503 | ||
516 | Dictionary<string, object> folders = | 504 | Dictionary<string, object> folders = |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 854bea4..7bb06fb 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs | |||
@@ -137,10 +137,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
137 | userID, sessionID, secureSessionID); | 137 | userID, sessionID, secureSessionID); |
138 | 138 | ||
139 | NameValueCollection requestArgs = new NameValueCollection | 139 | NameValueCollection requestArgs = new NameValueCollection |
140 | { | 140 | { |
141 | { "RequestMethod", "AddSession" }, | 141 | { "RequestMethod", "AddSession" }, |
142 | { "UserID", userID.ToString() } | 142 | { "UserID", userID.ToString() } |
143 | }; | 143 | }; |
144 | |||
144 | if (sessionID != UUID.Zero) | 145 | if (sessionID != UUID.Zero) |
145 | { | 146 | { |
146 | requestArgs["SessionID"] = sessionID.ToString(); | 147 | requestArgs["SessionID"] = sessionID.ToString(); |
@@ -158,13 +159,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
158 | 159 | ||
159 | public bool LogoutAgent(UUID sessionID) | 160 | public bool LogoutAgent(UUID sessionID) |
160 | { | 161 | { |
161 | // m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID); | 162 | // m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for agent with sessionID " + sessionID); |
162 | 163 | ||
163 | NameValueCollection requestArgs = new NameValueCollection | 164 | NameValueCollection requestArgs = new NameValueCollection |
164 | { | 165 | { |
165 | { "RequestMethod", "RemoveSession" }, | 166 | { "RequestMethod", "RemoveSession" }, |
166 | { "SessionID", sessionID.ToString() } | 167 | { "SessionID", sessionID.ToString() } |
167 | }; | 168 | }; |
168 | 169 | ||
169 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 170 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); |
170 | bool success = response["Success"].AsBoolean(); | 171 | bool success = response["Success"].AsBoolean(); |
@@ -177,13 +178,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
177 | 178 | ||
178 | public bool LogoutRegionAgents(UUID regionID) | 179 | public bool LogoutRegionAgents(UUID regionID) |
179 | { | 180 | { |
180 | // m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID); | 181 | // m_log.InfoFormat("[SIMIAN PRESENCE CONNECTOR]: Logout requested for all agents in region " + regionID); |
181 | 182 | ||
182 | NameValueCollection requestArgs = new NameValueCollection | 183 | NameValueCollection requestArgs = new NameValueCollection |
183 | { | 184 | { |
184 | { "RequestMethod", "RemoveSessions" }, | 185 | { "RequestMethod", "RemoveSessions" }, |
185 | { "SceneID", regionID.ToString() } | 186 | { "SceneID", regionID.ToString() } |
186 | }; | 187 | }; |
187 | 188 | ||
188 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 189 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); |
189 | bool success = response["Success"].AsBoolean(); | 190 | bool success = response["Success"].AsBoolean(); |
@@ -202,49 +203,46 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
202 | 203 | ||
203 | public PresenceInfo GetAgent(UUID sessionID) | 204 | public PresenceInfo GetAgent(UUID sessionID) |
204 | { | 205 | { |
205 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent with sessionID " + sessionID); | 206 | OSDMap sessionResponse = GetSessionDataFromSessionID(sessionID); |
206 | 207 | if (sessionResponse == null) | |
207 | NameValueCollection requestArgs = new NameValueCollection | ||
208 | { | ||
209 | { "RequestMethod", "GetSession" }, | ||
210 | { "SessionID", sessionID.ToString() } | ||
211 | }; | ||
212 | |||
213 | OSDMap sessionResponse = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
214 | if (sessionResponse["Success"].AsBoolean()) | ||
215 | { | 208 | { |
216 | UUID userID = sessionResponse["UserID"].AsUUID(); | 209 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session {0}: {1}",sessionID.ToString(),sessionResponse["Message"].AsString()); |
217 | m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); | 210 | return null; |
218 | |||
219 | requestArgs = new NameValueCollection | ||
220 | { | ||
221 | { "RequestMethod", "GetUser" }, | ||
222 | { "UserID", userID.ToString() } | ||
223 | }; | ||
224 | |||
225 | OSDMap userResponse = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
226 | if (userResponse["Success"].AsBoolean()) | ||
227 | return ResponseToPresenceInfo(sessionResponse, userResponse); | ||
228 | else | ||
229 | m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString()); | ||
230 | } | 211 | } |
231 | else | 212 | |
213 | UUID userID = sessionResponse["UserID"].AsUUID(); | ||
214 | OSDMap userResponse = GetUserData(userID); | ||
215 | if (userResponse == null) | ||
232 | { | 216 | { |
233 | m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session " + sessionID + ": " + sessionResponse["Message"].AsString()); | 217 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID.ToString(),userResponse["Message"].AsString()); |
218 | return null; | ||
234 | } | 219 | } |
235 | 220 | ||
236 | return null; | 221 | return ResponseToPresenceInfo(sessionResponse); |
237 | } | 222 | } |
238 | 223 | ||
239 | public PresenceInfo[] GetAgents(string[] userIDs) | 224 | public PresenceInfo[] GetAgents(string[] userIDs) |
240 | { | 225 | { |
241 | List<PresenceInfo> presences = new List<PresenceInfo>(userIDs.Length); | 226 | List<PresenceInfo> presences = new List<PresenceInfo>(); |
242 | 227 | ||
243 | for (int i = 0; i < userIDs.Length; i++) | 228 | NameValueCollection requestArgs = new NameValueCollection |
229 | { | ||
230 | { "RequestMethod", "GetSessions" }, | ||
231 | { "UserIDList", String.Join(",",userIDs) } | ||
232 | }; | ||
233 | |||
234 | OSDMap sessionListResponse = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
235 | if (! sessionListResponse["Success"].AsBoolean()) | ||
244 | { | 236 | { |
245 | UUID userID; | 237 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString()); |
246 | if (UUID.TryParse(userIDs[i], out userID) && userID != UUID.Zero) | 238 | return null; |
247 | presences.AddRange(GetSessions(userID)); | 239 | } |
240 | |||
241 | OSDArray sessionList = sessionListResponse["Sessions"] as OSDArray; | ||
242 | for (int i = 0; i < sessionList.Count; i++) | ||
243 | { | ||
244 | OSDMap sessionInfo = sessionList[i] as OSDMap; | ||
245 | presences.Add(ResponseToPresenceInfo(sessionInfo)); | ||
248 | } | 246 | } |
249 | 247 | ||
250 | return presences.ToArray(); | 248 | return presences.ToArray(); |
@@ -262,7 +260,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
262 | 260 | ||
263 | public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) | 261 | public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) |
264 | { | 262 | { |
265 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID); | 263 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID); |
266 | 264 | ||
267 | // Remove the session to mark this user offline | 265 | // Remove the session to mark this user offline |
268 | if (!LogoutAgent(sessionID)) | 266 | if (!LogoutAgent(sessionID)) |
@@ -270,11 +268,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
270 | 268 | ||
271 | // Save our last position as user data | 269 | // Save our last position as user data |
272 | NameValueCollection requestArgs = new NameValueCollection | 270 | NameValueCollection requestArgs = new NameValueCollection |
273 | { | 271 | { |
274 | { "RequestMethod", "AddUserData" }, | 272 | { "RequestMethod", "AddUserData" }, |
275 | { "UserID", userID.ToString() }, | 273 | { "UserID", userID.ToString() }, |
276 | { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) } | 274 | { "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) } |
277 | }; | 275 | }; |
278 | 276 | ||
279 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 277 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); |
280 | bool success = response["Success"].AsBoolean(); | 278 | bool success = response["Success"].AsBoolean(); |
@@ -287,14 +285,14 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
287 | 285 | ||
288 | public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) | 286 | public bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt) |
289 | { | 287 | { |
290 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID); | 288 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Setting home location for user " + userID); |
291 | 289 | ||
292 | NameValueCollection requestArgs = new NameValueCollection | 290 | NameValueCollection requestArgs = new NameValueCollection |
293 | { | 291 | { |
294 | { "RequestMethod", "AddUserData" }, | 292 | { "RequestMethod", "AddUserData" }, |
295 | { "UserID", userID.ToString() }, | 293 | { "UserID", userID.ToString() }, |
296 | { "HomeLocation", SerializeLocation(regionID, position, lookAt) } | 294 | { "HomeLocation", SerializeLocation(regionID, position, lookAt) } |
297 | }; | 295 | }; |
298 | 296 | ||
299 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 297 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); |
300 | bool success = response["Success"].AsBoolean(); | 298 | bool success = response["Success"].AsBoolean(); |
@@ -312,23 +310,14 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
312 | 310 | ||
313 | public GridUserInfo GetGridUserInfo(string user) | 311 | public GridUserInfo GetGridUserInfo(string user) |
314 | { | 312 | { |
315 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user); | 313 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user); |
316 | 314 | ||
317 | UUID userID = new UUID(user); | 315 | UUID userID = new UUID(user); |
318 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); | 316 | OSDMap userResponse = GetUserData(userID); |
319 | 317 | if (userResponse != null) | |
320 | NameValueCollection requestArgs = new NameValueCollection | ||
321 | { | ||
322 | { "RequestMethod", "GetUser" }, | ||
323 | { "UserID", userID.ToString() } | ||
324 | }; | ||
325 | |||
326 | OSDMap userResponse = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
327 | if (userResponse["Success"].AsBoolean()) | ||
328 | return ResponseToGridUserInfo(userResponse); | 318 | return ResponseToGridUserInfo(userResponse); |
329 | else | ||
330 | m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + userResponse["Message"].AsString()); | ||
331 | 319 | ||
320 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID,userResponse["Message"].AsString()); | ||
332 | return null; | 321 | return null; |
333 | } | 322 | } |
334 | 323 | ||
@@ -338,65 +327,49 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
338 | 327 | ||
339 | private OSDMap GetUserData(UUID userID) | 328 | private OSDMap GetUserData(UUID userID) |
340 | { | 329 | { |
341 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); | 330 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting user data for " + userID); |
342 | 331 | ||
343 | NameValueCollection requestArgs = new NameValueCollection | 332 | NameValueCollection requestArgs = new NameValueCollection |
344 | { | 333 | { |
345 | { "RequestMethod", "GetUser" }, | 334 | { "RequestMethod", "GetUser" }, |
346 | { "UserID", userID.ToString() } | 335 | { "UserID", userID.ToString() } |
347 | }; | 336 | }; |
348 | 337 | ||
349 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 338 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); |
350 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) | 339 | if (response["Success"].AsBoolean() && response["User"] is OSDMap) |
351 | return response; | 340 | return response; |
352 | else | ||
353 | m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for " + userID + ": " + response["Message"].AsString()); | ||
354 | 341 | ||
342 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}; {1}",userID.ToString(),response["Message"].AsString()); | ||
355 | return null; | 343 | return null; |
356 | } | 344 | } |
357 | 345 | ||
358 | private List<PresenceInfo> GetSessions(UUID userID) | 346 | private OSDMap GetSessionDataFromSessionID(UUID sessionID) |
359 | { | 347 | { |
360 | List<PresenceInfo> presences = new List<PresenceInfo>(1); | 348 | NameValueCollection requestArgs = new NameValueCollection |
361 | |||
362 | OSDMap userResponse = GetUserData(userID); | ||
363 | if (userResponse != null) | ||
364 | { | ||
365 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting sessions for " + userID); | ||
366 | |||
367 | NameValueCollection requestArgs = new NameValueCollection | ||
368 | { | 349 | { |
369 | { "RequestMethod", "GetSession" }, | 350 | { "RequestMethod", "GetSession" }, |
370 | { "UserID", userID.ToString() } | 351 | { "SessionID", sessionID.ToString() } |
371 | }; | 352 | }; |
372 | 353 | ||
373 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 354 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); |
374 | if (response["Success"].AsBoolean()) | 355 | if (response["Success"].AsBoolean()) |
375 | { | 356 | return response; |
376 | PresenceInfo presence = ResponseToPresenceInfo(response, userResponse); | ||
377 | if (presence != null) | ||
378 | presences.Add(presence); | ||
379 | } | ||
380 | // else | ||
381 | // { | ||
382 | // m_log.Debug("[SIMIAN PRESENCE CONNECTOR]: No session returned for " + userID + ": " + response["Message"].AsString()); | ||
383 | // } | ||
384 | } | ||
385 | 357 | ||
386 | return presences; | 358 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for {0}; {1}",sessionID.ToString(),response["Message"].AsString()); |
359 | return null; | ||
387 | } | 360 | } |
388 | 361 | ||
389 | private bool UpdateSession(UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) | 362 | private bool UpdateSession(UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt) |
390 | { | 363 | { |
391 | // Save our current location as session data | 364 | // Save our current location as session data |
392 | NameValueCollection requestArgs = new NameValueCollection | 365 | NameValueCollection requestArgs = new NameValueCollection |
393 | { | 366 | { |
394 | { "RequestMethod", "UpdateSession" }, | 367 | { "RequestMethod", "UpdateSession" }, |
395 | { "SessionID", sessionID.ToString() }, | 368 | { "SessionID", sessionID.ToString() }, |
396 | { "SceneID", regionID.ToString() }, | 369 | { "SceneID", regionID.ToString() }, |
397 | { "ScenePosition", lastPosition.ToString() }, | 370 | { "ScenePosition", lastPosition.ToString() }, |
398 | { "SceneLookAt", lastLookAt.ToString() } | 371 | { "SceneLookAt", lastLookAt.ToString() } |
399 | }; | 372 | }; |
400 | 373 | ||
401 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | 374 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); |
402 | bool success = response["Success"].AsBoolean(); | 375 | bool success = response["Success"].AsBoolean(); |
@@ -407,7 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
407 | return success; | 380 | return success; |
408 | } | 381 | } |
409 | 382 | ||
410 | private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) | 383 | private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse) |
411 | { | 384 | { |
412 | if (sessionResponse == null) | 385 | if (sessionResponse == null) |
413 | return null; | 386 | return null; |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 97a0afc..0cf1c14 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -58,6 +58,7 @@ namespace OpenSim.Services.HypergridService | |||
58 | private static IUserAgentService m_UserAgentService; | 58 | private static IUserAgentService m_UserAgentService; |
59 | private static ISimulationService m_SimulationService; | 59 | private static ISimulationService m_SimulationService; |
60 | private static IGridUserService m_GridUserService; | 60 | private static IGridUserService m_GridUserService; |
61 | private static IBansService m_BansService; | ||
61 | 62 | ||
62 | private static string m_AllowedClients = string.Empty; | 63 | private static string m_AllowedClients = string.Empty; |
63 | private static string m_DeniedClients = string.Empty; | 64 | private static string m_DeniedClients = string.Empty; |
@@ -87,6 +88,7 @@ namespace OpenSim.Services.HypergridService | |||
87 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); | 88 | string presenceService = serverConfig.GetString("PresenceService", String.Empty); |
88 | string simulationService = serverConfig.GetString("SimulationService", String.Empty); | 89 | string simulationService = serverConfig.GetString("SimulationService", String.Empty); |
89 | string gridUserService = serverConfig.GetString("GridUserService", String.Empty); | 90 | string gridUserService = serverConfig.GetString("GridUserService", String.Empty); |
91 | string bansService = serverConfig.GetString("BansService", String.Empty); | ||
90 | 92 | ||
91 | // These are mandatory, the others aren't | 93 | // These are mandatory, the others aren't |
92 | if (gridService == string.Empty || presenceService == string.Empty) | 94 | if (gridService == string.Empty || presenceService == string.Empty) |
@@ -121,6 +123,8 @@ namespace OpenSim.Services.HypergridService | |||
121 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); | 123 | m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); |
122 | if (gridUserService != string.Empty) | 124 | if (gridUserService != string.Empty) |
123 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); | 125 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); |
126 | if (bansService != string.Empty) | ||
127 | m_BansService = ServerUtils.LoadPlugin<IBansService>(bansService, args); | ||
124 | 128 | ||
125 | if (simService != null) | 129 | if (simService != null) |
126 | m_SimulationService = simService; | 130 | m_SimulationService = simService; |
@@ -223,7 +227,7 @@ namespace OpenSim.Services.HypergridService | |||
223 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}", | 227 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}", |
224 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, | 228 | aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, |
225 | aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString()); | 229 | aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString()); |
226 | 230 | ||
227 | // | 231 | // |
228 | // Check client | 232 | // Check client |
229 | // | 233 | // |
@@ -287,17 +291,16 @@ namespace OpenSim.Services.HypergridService | |||
287 | } | 291 | } |
288 | } | 292 | } |
289 | } | 293 | } |
290 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User is ok"); | ||
291 | 294 | ||
292 | // | 295 | // |
293 | // Foreign agents allowed? Exceptions? | 296 | // Foreign agents allowed? Exceptions? |
294 | // | 297 | // |
295 | if (account == null) | 298 | if (account == null) |
296 | { | 299 | { |
297 | bool allowed = m_ForeignAgentsAllowed; | 300 | bool allowed = m_ForeignAgentsAllowed; |
298 | 301 | ||
299 | if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) | 302 | if (m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsAllowedExceptions)) |
300 | allowed = false; | 303 | allowed = false; |
301 | 304 | ||
302 | if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions)) | 305 | if (!m_ForeignAgentsAllowed && IsException(aCircuit, m_ForeignsDisallowedExceptions)) |
303 | allowed = true; | 306 | allowed = true; |
@@ -311,6 +314,20 @@ namespace OpenSim.Services.HypergridService | |||
311 | } | 314 | } |
312 | } | 315 | } |
313 | 316 | ||
317 | // | ||
318 | // Is the user banned? | ||
319 | // This uses a Ban service that's more powerful than the configs | ||
320 | // | ||
321 | string uui = (account != null ? aCircuit.AgentID.ToString() : Util.ProduceUserUniversalIdentifier(aCircuit)); | ||
322 | if (m_BansService != null && m_BansService.IsBanned(uui, aCircuit.IPAddress, aCircuit.Id0, authURL)) | ||
323 | { | ||
324 | reason = "You are banned from this world"; | ||
325 | m_log.InfoFormat("[GATEKEEPER SERVICE]: Login failed, reason: user {0} is banned", uui); | ||
326 | return false; | ||
327 | } | ||
328 | |||
329 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User is OK"); | ||
330 | |||
314 | bool isFirstLogin = false; | 331 | bool isFirstLogin = false; |
315 | // | 332 | // |
316 | // Login the presence, if it's not there yet (by the login service) | 333 | // Login the presence, if it's not there yet (by the login service) |
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index eecf757..410916f 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -115,6 +115,12 @@ namespace OpenSim.Services.HypergridService | |||
115 | { | 115 | { |
116 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 116 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
117 | 117 | ||
118 | if (suitcase == null) | ||
119 | { | ||
120 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for inventory skeleton", principalID); | ||
121 | return null; | ||
122 | } | ||
123 | |||
118 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); | 124 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); |
119 | if (tree == null || (tree != null && tree.Count == 0)) | 125 | if (tree == null || (tree != null && tree.Count == 0)) |
120 | return null; | 126 | return null; |
@@ -134,6 +140,7 @@ namespace OpenSim.Services.HypergridService | |||
134 | public override InventoryCollection GetUserInventory(UUID userID) | 140 | public override InventoryCollection GetUserInventory(UUID userID) |
135 | { | 141 | { |
136 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); | 142 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); |
143 | |||
137 | InventoryCollection userInventory = new InventoryCollection(); | 144 | InventoryCollection userInventory = new InventoryCollection(); |
138 | userInventory.UserID = userID; | 145 | userInventory.UserID = userID; |
139 | userInventory.Folders = new List<InventoryFolderBase>(); | 146 | userInventory.Folders = new List<InventoryFolderBase>(); |
@@ -141,6 +148,12 @@ namespace OpenSim.Services.HypergridService | |||
141 | 148 | ||
142 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); | 149 | XInventoryFolder suitcase = GetSuitcaseXFolder(userID); |
143 | 150 | ||
151 | if (suitcase == null) | ||
152 | { | ||
153 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for user inventory", userID); | ||
154 | return null; | ||
155 | } | ||
156 | |||
144 | List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); | 157 | List<XInventoryFolder> tree = GetFolderTree(userID, suitcase.folderID); |
145 | if (tree == null || (tree != null && tree.Count == 0)) | 158 | if (tree == null || (tree != null && tree.Count == 0)) |
146 | { | 159 | { |
@@ -182,7 +195,8 @@ namespace OpenSim.Services.HypergridService | |||
182 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); | 195 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); |
183 | 196 | ||
184 | // Let's find out the local root folder | 197 | // Let's find out the local root folder |
185 | XInventoryFolder root = GetRootXFolder(principalID); ; | 198 | XInventoryFolder root = GetRootXFolder(principalID); |
199 | |||
186 | if (root == null) | 200 | if (root == null) |
187 | { | 201 | { |
188 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); | 202 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); |
@@ -255,6 +269,13 @@ namespace OpenSim.Services.HypergridService | |||
255 | { | 269 | { |
256 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); | 270 | //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); |
257 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 271 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
272 | |||
273 | if (suitcase == null) | ||
274 | { | ||
275 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for child type folder {1}", principalID, type); | ||
276 | return null; | ||
277 | } | ||
278 | |||
258 | XInventoryFolder[] folders = m_Database.GetFolders( | 279 | XInventoryFolder[] folders = m_Database.GetFolders( |
259 | new string[] { "agentID", "type", "parentFolderID" }, | 280 | new string[] { "agentID", "type", "parentFolderID" }, |
260 | new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() }); | 281 | new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() }); |
@@ -546,6 +567,7 @@ namespace OpenSim.Services.HypergridService | |||
546 | private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) | 567 | private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) |
547 | { | 568 | { |
548 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); | 569 | XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); |
570 | |||
549 | if (suitcase == null) | 571 | if (suitcase == null) |
550 | { | 572 | { |
551 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); | 573 | m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); |
diff --git a/OpenSim/Services/Interfaces/IBansService.cs b/OpenSim/Services/Interfaces/IBansService.cs new file mode 100644 index 0000000..8fd3521 --- /dev/null +++ b/OpenSim/Services/Interfaces/IBansService.cs | |||
@@ -0,0 +1,48 @@ | |||
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 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | |||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IBansService | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Are any of the given arguments banned from the grid? | ||
39 | /// </summary> | ||
40 | /// <param name="userID"></param> | ||
41 | /// <param name="ip"></param> | ||
42 | /// <param name="id0"></param> | ||
43 | /// <param name="origin"></param> | ||
44 | /// <returns></returns> | ||
45 | bool IsBanned(string userID, string ip, string id0, string origin); | ||
46 | } | ||
47 | |||
48 | } | ||
diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs new file mode 100644 index 0000000..319d307 --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs | |||
@@ -0,0 +1,75 @@ | |||
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 OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IUserProfilesService | ||
36 | { | ||
37 | #region Classifieds | ||
38 | OSD AvatarClassifiedsRequest(UUID creatorId); | ||
39 | bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result); | ||
40 | bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result); | ||
41 | bool ClassifiedDelete(UUID recordId); | ||
42 | #endregion Classifieds | ||
43 | |||
44 | #region Picks | ||
45 | OSD AvatarPicksRequest(UUID creatorId); | ||
46 | bool PickInfoRequest(ref UserProfilePick pick, ref string result); | ||
47 | bool PicksUpdate(ref UserProfilePick pick, ref string result); | ||
48 | bool PicksDelete(UUID pickId); | ||
49 | #endregion Picks | ||
50 | |||
51 | #region Notes | ||
52 | bool AvatarNotesRequest(ref UserProfileNotes note); | ||
53 | bool NotesUpdate(ref UserProfileNotes note, ref string result); | ||
54 | #endregion Notes | ||
55 | |||
56 | #region Profile Properties | ||
57 | bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); | ||
58 | bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); | ||
59 | #endregion Profile Properties | ||
60 | |||
61 | #region Interests | ||
62 | bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); | ||
63 | #endregion Interests | ||
64 | |||
65 | #region Utility | ||
66 | OSD AvatarImageAssetsRequest(UUID avatarId); | ||
67 | #endregion Utility | ||
68 | |||
69 | #region UserData | ||
70 | bool RequestUserAppData(ref UserAppData prop, ref string result); | ||
71 | bool SetUserAppData(UserAppData prop, ref string result); | ||
72 | #endregion UserData | ||
73 | } | ||
74 | } | ||
75 | |||
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index e2f947c..057c492 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -196,6 +196,7 @@ namespace OpenSim.Services.LLLoginService | |||
196 | private BuddyList m_buddyList = null; | 196 | private BuddyList m_buddyList = null; |
197 | 197 | ||
198 | private string currency; | 198 | private string currency; |
199 | private string classifiedFee; | ||
199 | 200 | ||
200 | static LLLoginResponse() | 201 | static LLLoginResponse() |
201 | { | 202 | { |
@@ -233,7 +234,7 @@ namespace OpenSim.Services.LLLoginService | |||
233 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, | 234 | GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, |
234 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, | 235 | string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, |
235 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, | 236 | GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency, |
236 | string DSTZone, UUID realID) | 237 | string DSTZone, string destinationsURL, string avatarsURL, UUID realID, string classifiedFee) |
237 | : this() | 238 | : this() |
238 | { | 239 | { |
239 | FillOutInventoryData(invSkel, libService); | 240 | FillOutInventoryData(invSkel, libService); |
@@ -253,9 +254,13 @@ namespace OpenSim.Services.LLLoginService | |||
253 | MapTileURL = mapTileURL; | 254 | MapTileURL = mapTileURL; |
254 | ProfileURL = profileURL; | 255 | ProfileURL = profileURL; |
255 | OpenIDURL = openIDURL; | 256 | OpenIDURL = openIDURL; |
257 | DestinationsURL = destinationsURL; | ||
258 | AvatarsURL = avatarsURL; | ||
256 | 259 | ||
257 | SearchURL = searchURL; | 260 | SearchURL = searchURL; |
258 | Currency = currency; | 261 | Currency = currency; |
262 | ClassifiedFee = classifiedFee; | ||
263 | |||
259 | 264 | ||
260 | FillOutHomeData(pinfo, home); | 265 | FillOutHomeData(pinfo, home); |
261 | LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); | 266 | LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); |
@@ -470,6 +475,7 @@ namespace OpenSim.Services.LLLoginService | |||
470 | searchURL = String.Empty; | 475 | searchURL = String.Empty; |
471 | 476 | ||
472 | currency = String.Empty; | 477 | currency = String.Empty; |
478 | ClassifiedFee = "0"; | ||
473 | } | 479 | } |
474 | 480 | ||
475 | 481 | ||
@@ -543,6 +549,12 @@ namespace OpenSim.Services.LLLoginService | |||
543 | if (profileURL != String.Empty) | 549 | if (profileURL != String.Empty) |
544 | responseData["profile-server-url"] = profileURL; | 550 | responseData["profile-server-url"] = profileURL; |
545 | 551 | ||
552 | if (DestinationsURL != String.Empty) | ||
553 | responseData["destination_guide_url"] = DestinationsURL; | ||
554 | |||
555 | if (AvatarsURL != String.Empty) | ||
556 | responseData["avatar_picker_url"] = AvatarsURL; | ||
557 | |||
546 | // We need to send an openid_token back in the response too | 558 | // We need to send an openid_token back in the response too |
547 | if (openIDURL != String.Empty) | 559 | if (openIDURL != String.Empty) |
548 | responseData["openid_url"] = openIDURL; | 560 | responseData["openid_url"] = openIDURL; |
@@ -557,6 +569,9 @@ namespace OpenSim.Services.LLLoginService | |||
557 | // responseData["real_currency"] = currency; | 569 | // responseData["real_currency"] = currency; |
558 | responseData["currency"] = currency; | 570 | responseData["currency"] = currency; |
559 | } | 571 | } |
572 | |||
573 | if (ClassifiedFee != String.Empty) | ||
574 | responseData["classified_fee"] = ClassifiedFee; | ||
560 | 575 | ||
561 | responseData["login"] = "true"; | 576 | responseData["login"] = "true"; |
562 | 577 | ||
@@ -662,6 +677,9 @@ namespace OpenSim.Services.LLLoginService | |||
662 | if (searchURL != String.Empty) | 677 | if (searchURL != String.Empty) |
663 | map["search"] = OSD.FromString(searchURL); | 678 | map["search"] = OSD.FromString(searchURL); |
664 | 679 | ||
680 | if (ClassifiedFee != String.Empty) | ||
681 | map["classified_fee"] = OSD.FromString(ClassifiedFee); | ||
682 | |||
665 | if (m_buddyList != null) | 683 | if (m_buddyList != null) |
666 | { | 684 | { |
667 | map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray()); | 685 | map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray()); |
@@ -1073,6 +1091,22 @@ namespace OpenSim.Services.LLLoginService | |||
1073 | set { currency = value; } | 1091 | set { currency = value; } |
1074 | } | 1092 | } |
1075 | 1093 | ||
1094 | public string ClassifiedFee | ||
1095 | { | ||
1096 | get { return classifiedFee; } | ||
1097 | set { classifiedFee = value; } | ||
1098 | } | ||
1099 | |||
1100 | public string DestinationsURL | ||
1101 | { | ||
1102 | get; set; | ||
1103 | } | ||
1104 | |||
1105 | public string AvatarsURL | ||
1106 | { | ||
1107 | get; set; | ||
1108 | } | ||
1109 | |||
1076 | #endregion | 1110 | #endregion |
1077 | 1111 | ||
1078 | public class UserInfo | 1112 | public class UserInfo |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index ede2353..81712f6 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -78,6 +78,9 @@ namespace OpenSim.Services.LLLoginService | |||
78 | protected string m_OpenIDURL; | 78 | protected string m_OpenIDURL; |
79 | protected string m_SearchURL; | 79 | protected string m_SearchURL; |
80 | protected string m_Currency; | 80 | protected string m_Currency; |
81 | protected string m_ClassifiedFee; | ||
82 | protected string m_DestinationGuide; | ||
83 | protected string m_AvatarPicker; | ||
81 | 84 | ||
82 | protected string m_AllowedClients; | 85 | protected string m_AllowedClients; |
83 | protected string m_DeniedClients; | 86 | protected string m_DeniedClients; |
@@ -117,6 +120,9 @@ namespace OpenSim.Services.LLLoginService | |||
117 | m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); | 120 | m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); |
118 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); | 121 | m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); |
119 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); | 122 | m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); |
123 | m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty); | ||
124 | m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty); | ||
125 | m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty); | ||
120 | 126 | ||
121 | m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); | 127 | m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); |
122 | m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); | 128 | m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); |
@@ -461,7 +467,8 @@ namespace OpenSim.Services.LLLoginService | |||
461 | = new LLLoginResponse( | 467 | = new LLLoginResponse( |
462 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, | 468 | account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, |
463 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, | 469 | where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, |
464 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, realID); | 470 | m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone, |
471 | m_DestinationGuide, m_AvatarPicker, realID, m_ClassifiedFee); | ||
465 | 472 | ||
466 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); | 473 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); |
467 | 474 | ||
diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index 43fa04b..8388180 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs | |||
@@ -73,7 +73,7 @@ namespace OpenSim.Services.UserAccountService | |||
73 | return info; | 73 | return info; |
74 | } | 74 | } |
75 | 75 | ||
76 | public GridUserInfo[] GetGridUserInfo(string[] userIDs) | 76 | public virtual GridUserInfo[] GetGridUserInfo(string[] userIDs) |
77 | { | 77 | { |
78 | List<GridUserInfo> ret = new List<GridUserInfo>(); | 78 | List<GridUserInfo> ret = new List<GridUserInfo>(); |
79 | 79 | ||
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs new file mode 100644 index 0000000..d00f34d --- /dev/null +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs | |||
@@ -0,0 +1,187 @@ | |||
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.Reflection; | ||
30 | using System.Text; | ||
31 | using Nini.Config; | ||
32 | using log4net; | ||
33 | using OpenSim.Server.Base; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | using OpenSim.Services.UserAccountService; | ||
36 | using OpenSim.Data; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Framework; | ||
40 | |||
41 | namespace OpenSim.Services.ProfilesService | ||
42 | { | ||
43 | public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService | ||
44 | { | ||
45 | static readonly ILog m_log = | ||
46 | LogManager.GetLogger( | ||
47 | MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | IUserAccountService userAccounts; | ||
50 | IAuthenticationService authService; | ||
51 | |||
52 | public UserProfilesService(IConfigSource config, string configName): | ||
53 | base(config, configName) | ||
54 | { | ||
55 | IConfig Config = config.Configs[configName]; | ||
56 | if (Config == null) | ||
57 | { | ||
58 | m_log.Warn("[PROFILES]: No configuration found!"); | ||
59 | return; | ||
60 | } | ||
61 | Object[] args = null; | ||
62 | |||
63 | args = new Object[] { config }; | ||
64 | string accountService = Config.GetString("UserAccountService", String.Empty); | ||
65 | if (accountService != string.Empty) | ||
66 | userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | ||
67 | |||
68 | args = new Object[] { config }; | ||
69 | string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty); | ||
70 | if (accountService != string.Empty) | ||
71 | authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args); | ||
72 | } | ||
73 | |||
74 | #region Classifieds | ||
75 | public OSD AvatarClassifiedsRequest(UUID creatorId) | ||
76 | { | ||
77 | OSDArray records = ProfilesData.GetClassifiedRecords(creatorId); | ||
78 | |||
79 | return records; | ||
80 | } | ||
81 | |||
82 | public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result) | ||
83 | { | ||
84 | if(!ProfilesData.UpdateClassifiedRecord(ad, ref result)) | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | result = "success"; | ||
89 | return true; | ||
90 | } | ||
91 | |||
92 | public bool ClassifiedDelete(UUID recordId) | ||
93 | { | ||
94 | if(ProfilesData.DeleteClassifiedRecord(recordId)) | ||
95 | return true; | ||
96 | |||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result) | ||
101 | { | ||
102 | if(ProfilesData.GetClassifiedInfo(ref ad, ref result)) | ||
103 | return true; | ||
104 | |||
105 | return false; | ||
106 | } | ||
107 | #endregion Classifieds | ||
108 | |||
109 | #region Picks | ||
110 | public OSD AvatarPicksRequest(UUID creatorId) | ||
111 | { | ||
112 | OSDArray records = ProfilesData.GetAvatarPicks(creatorId); | ||
113 | |||
114 | return records; | ||
115 | } | ||
116 | |||
117 | public bool PickInfoRequest(ref UserProfilePick pick, ref string result) | ||
118 | { | ||
119 | pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId); | ||
120 | result = "OK"; | ||
121 | return true; | ||
122 | } | ||
123 | |||
124 | public bool PicksUpdate(ref UserProfilePick pick, ref string result) | ||
125 | { | ||
126 | return ProfilesData.UpdatePicksRecord(pick); | ||
127 | } | ||
128 | |||
129 | public bool PicksDelete(UUID pickId) | ||
130 | { | ||
131 | return ProfilesData.DeletePicksRecord(pickId); | ||
132 | } | ||
133 | #endregion Picks | ||
134 | |||
135 | #region Notes | ||
136 | public bool AvatarNotesRequest(ref UserProfileNotes note) | ||
137 | { | ||
138 | return ProfilesData.GetAvatarNotes(ref note); | ||
139 | } | ||
140 | |||
141 | public bool NotesUpdate(ref UserProfileNotes note, ref string result) | ||
142 | { | ||
143 | return ProfilesData.UpdateAvatarNotes(ref note, ref result); | ||
144 | } | ||
145 | #endregion Notes | ||
146 | |||
147 | #region Profile Properties | ||
148 | public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result) | ||
149 | { | ||
150 | return ProfilesData.GetAvatarProperties(ref prop, ref result); | ||
151 | } | ||
152 | |||
153 | public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result) | ||
154 | { | ||
155 | return ProfilesData.UpdateAvatarProperties(ref prop, ref result); | ||
156 | } | ||
157 | #endregion Profile Properties | ||
158 | |||
159 | #region Interests | ||
160 | public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result) | ||
161 | { | ||
162 | return ProfilesData.UpdateAvatarInterests(prop, ref result); | ||
163 | } | ||
164 | #endregion Interests | ||
165 | |||
166 | #region Utility | ||
167 | public OSD AvatarImageAssetsRequest(UUID avatarId) | ||
168 | { | ||
169 | OSDArray records = ProfilesData.GetUserImageAssets(avatarId); | ||
170 | return records; | ||
171 | } | ||
172 | #endregion Utility | ||
173 | |||
174 | #region UserData | ||
175 | public bool RequestUserAppData(ref UserAppData prop, ref string result) | ||
176 | { | ||
177 | return ProfilesData.GetUserAppData(ref prop, ref result); | ||
178 | } | ||
179 | |||
180 | public bool SetUserAppData(UserAppData prop, ref string result) | ||
181 | { | ||
182 | return true; | ||
183 | } | ||
184 | #endregion UserData | ||
185 | } | ||
186 | } | ||
187 | |||
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs new file mode 100644 index 0000000..927f7c9 --- /dev/null +++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs | |||
@@ -0,0 +1,86 @@ | |||
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.Reflection; | ||
30 | using Nini.Config; | ||
31 | using log4net; | ||
32 | using OpenSim.Services.Base; | ||
33 | using OpenSim.Data; | ||
34 | |||
35 | namespace OpenSim.Services.ProfilesService | ||
36 | { | ||
37 | public class UserProfilesServiceBase: ServiceBase | ||
38 | { | ||
39 | static readonly ILog m_log = | ||
40 | LogManager.GetLogger( | ||
41 | MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
43 | public IProfilesData ProfilesData; | ||
44 | |||
45 | public string ConfigName | ||
46 | { | ||
47 | get; private set; | ||
48 | } | ||
49 | |||
50 | public UserProfilesServiceBase(IConfigSource config, string configName): | ||
51 | base(config) | ||
52 | { | ||
53 | if(string.IsNullOrEmpty(configName)) | ||
54 | { | ||
55 | m_log.WarnFormat("[PROFILES]: Configuration section not given!"); | ||
56 | return; | ||
57 | } | ||
58 | |||
59 | string dllName = String.Empty; | ||
60 | string connString = null; | ||
61 | string realm = String.Empty; | ||
62 | |||
63 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
64 | if (dbConfig != null) | ||
65 | { | ||
66 | if (dllName == String.Empty) | ||
67 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
68 | if (string.IsNullOrEmpty(connString)) | ||
69 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
70 | } | ||
71 | |||
72 | IConfig ProfilesConfig = config.Configs[configName]; | ||
73 | if (ProfilesConfig != null) | ||
74 | { | ||
75 | connString = ProfilesConfig.GetString("ConnectionString", connString); | ||
76 | realm = ProfilesConfig.GetString("Realm", realm); | ||
77 | } | ||
78 | |||
79 | ProfilesData = LoadPlugin<IProfilesData>(dllName, new Object[] { connString }); | ||
80 | if (ProfilesData == null) | ||
81 | throw new Exception("Could not find a storage interface in the given module"); | ||
82 | |||
83 | } | ||
84 | } | ||
85 | } | ||
86 | |||