diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Inventory')
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | 48 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 265 |
2 files changed, 226 insertions, 87 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 3c92209..1d422a7 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Inventory | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private IInventoryService m_InventoryService; | 49 | protected IInventoryService m_InventoryService; |
50 | 50 | ||
51 | private bool m_doLookup = false; | 51 | private bool m_doLookup = false; |
52 | 52 | ||
@@ -54,11 +54,14 @@ namespace OpenSim.Server.Handlers.Inventory | |||
54 | //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); | 54 | //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); |
55 | 55 | ||
56 | private string m_userserver_url; | 56 | private string m_userserver_url; |
57 | private string m_ConfigName = "InventoryService"; | 57 | protected string m_ConfigName = "InventoryService"; |
58 | 58 | ||
59 | public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : | 59 | public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : |
60 | base(config, server, configName) | 60 | base(config, server, configName) |
61 | { | 61 | { |
62 | if (configName != string.Empty) | ||
63 | m_ConfigName = configName; | ||
64 | |||
62 | IConfig serverConfig = config.Configs[m_ConfigName]; | 65 | IConfig serverConfig = config.Configs[m_ConfigName]; |
63 | if (serverConfig == null) | 66 | if (serverConfig == null) |
64 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); | 67 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
@@ -328,46 +331,9 @@ namespace OpenSim.Server.Handlers.Inventory | |||
328 | /// <param name="session_id"></param> | 331 | /// <param name="session_id"></param> |
329 | /// <param name="avatar_id"></param> | 332 | /// <param name="avatar_id"></param> |
330 | /// <returns></returns> | 333 | /// <returns></returns> |
331 | public bool CheckAuthSession(string session_id, string avatar_id) | 334 | public virtual bool CheckAuthSession(string session_id, string avatar_id) |
332 | { | 335 | { |
333 | if (m_doLookup) | 336 | return true; |
334 | { | ||
335 | m_log.InfoFormat("[INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id); | ||
336 | |||
337 | //if (m_session_cache.getCachedSession(session_id, avatar_id) == null) | ||
338 | //{ | ||
339 | // cache miss, ask userserver | ||
340 | Hashtable requestData = new Hashtable(); | ||
341 | requestData["avatar_uuid"] = avatar_id; | ||
342 | requestData["session_id"] = session_id; | ||
343 | ArrayList SendParams = new ArrayList(); | ||
344 | SendParams.Add(requestData); | ||
345 | XmlRpcRequest UserReq = new XmlRpcRequest("check_auth_session", SendParams); | ||
346 | XmlRpcResponse UserResp = UserReq.Send(m_userserver_url, 3000); | ||
347 | |||
348 | Hashtable responseData = (Hashtable)UserResp.Value; | ||
349 | if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE") | ||
350 | { | ||
351 | m_log.Info("[INVENTORY IN CONNECTOR]: got authed session from userserver"); | ||
352 | //// add to cache; the session time will be automatically renewed | ||
353 | //m_session_cache.Add(session_id, avatar_id); | ||
354 | return true; | ||
355 | } | ||
356 | //} | ||
357 | //else | ||
358 | //{ | ||
359 | // // cache hits | ||
360 | // m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache"); | ||
361 | // return true; | ||
362 | //} | ||
363 | |||
364 | m_log.Warn("[INVENTORY IN CONNECTOR]: unknown session_id, request rejected"); | ||
365 | return false; | ||
366 | } | ||
367 | else | ||
368 | { | ||
369 | return true; | ||
370 | } | ||
371 | } | 337 | } |
372 | 338 | ||
373 | } | 339 | } |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 7e3e68b..f9db859 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -157,6 +157,16 @@ namespace OpenSim.Server.Handlers.Asset | |||
157 | 157 | ||
158 | private byte[] FailureResult() | 158 | private byte[] FailureResult() |
159 | { | 159 | { |
160 | return BoolResult(false); | ||
161 | } | ||
162 | |||
163 | private byte[] SuccessResult() | ||
164 | { | ||
165 | return BoolResult(true); | ||
166 | } | ||
167 | |||
168 | private byte[] BoolResult(bool value) | ||
169 | { | ||
160 | XmlDocument doc = new XmlDocument(); | 170 | XmlDocument doc = new XmlDocument(); |
161 | 171 | ||
162 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | 172 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, |
@@ -170,7 +180,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
170 | doc.AppendChild(rootElement); | 180 | doc.AppendChild(rootElement); |
171 | 181 | ||
172 | XmlElement result = doc.CreateElement("", "RESULT", ""); | 182 | XmlElement result = doc.CreateElement("", "RESULT", ""); |
173 | result.AppendChild(doc.CreateTextNode("False")); | 183 | result.AppendChild(doc.CreateTextNode(value.ToString())); |
174 | 184 | ||
175 | rootElement.AppendChild(result); | 185 | rootElement.AppendChild(result); |
176 | 186 | ||
@@ -216,8 +226,9 @@ namespace OpenSim.Server.Handlers.Asset | |||
216 | 226 | ||
217 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); | 227 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); |
218 | 228 | ||
219 | foreach (InventoryFolderBase f in folders) | 229 | if (folders != null) |
220 | result[f.ID.ToString()] = EncodeFolder(f); | 230 | foreach (InventoryFolderBase f in folders) |
231 | result[f.ID.ToString()] = EncodeFolder(f); | ||
221 | 232 | ||
222 | string xmlString = ServerUtils.BuildXmlResponse(result); | 233 | string xmlString = ServerUtils.BuildXmlResponse(result); |
223 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 234 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
@@ -229,6 +240,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
229 | { | 240 | { |
230 | Dictionary<string,object> result = new Dictionary<string,object>(); | 241 | Dictionary<string,object> result = new Dictionary<string,object>(); |
231 | 242 | ||
243 | UUID principal = UUID.Zero; | ||
244 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
245 | InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal); | ||
246 | if (rfolder != null) | ||
247 | result[rfolder.ID.ToString()] = EncodeFolder(rfolder); | ||
248 | |||
232 | string xmlString = ServerUtils.BuildXmlResponse(result); | 249 | string xmlString = ServerUtils.BuildXmlResponse(result); |
233 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 250 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
234 | UTF8Encoding encoding = new UTF8Encoding(); | 251 | UTF8Encoding encoding = new UTF8Encoding(); |
@@ -238,6 +255,13 @@ namespace OpenSim.Server.Handlers.Asset | |||
238 | byte[] HandleGetFolderForType(Dictionary<string,object> request) | 255 | byte[] HandleGetFolderForType(Dictionary<string,object> request) |
239 | { | 256 | { |
240 | Dictionary<string,object> result = new Dictionary<string,object>(); | 257 | Dictionary<string,object> result = new Dictionary<string,object>(); |
258 | UUID principal = UUID.Zero; | ||
259 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
260 | int type = 0; | ||
261 | Int32.TryParse(request["TYPE"].ToString(), out type); | ||
262 | InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); | ||
263 | if (folder != null) | ||
264 | result[folder.ID.ToString()] = EncodeFolder(folder); | ||
241 | 265 | ||
242 | string xmlString = ServerUtils.BuildXmlResponse(result); | 266 | string xmlString = ServerUtils.BuildXmlResponse(result); |
243 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 267 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
@@ -248,6 +272,24 @@ namespace OpenSim.Server.Handlers.Asset | |||
248 | byte[] HandleGetFolderContent(Dictionary<string,object> request) | 272 | byte[] HandleGetFolderContent(Dictionary<string,object> request) |
249 | { | 273 | { |
250 | Dictionary<string,object> result = new Dictionary<string,object>(); | 274 | Dictionary<string,object> result = new Dictionary<string,object>(); |
275 | UUID principal = UUID.Zero; | ||
276 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
277 | UUID folderID = UUID.Zero; | ||
278 | UUID.TryParse(request["FOLDER"].ToString(), out folderID); | ||
279 | |||
280 | InventoryCollection icoll = m_InventoryService.GetFolderContent(principal, folderID); | ||
281 | if (icoll != null) | ||
282 | { | ||
283 | Dictionary<string, object> folders = new Dictionary<string, object>(); | ||
284 | foreach (InventoryFolderBase f in icoll.Folders) | ||
285 | folders[f.ID.ToString()] = EncodeFolder(f); | ||
286 | result["FOLDERS"] = folders; | ||
287 | |||
288 | Dictionary<string, object> items = new Dictionary<string, object>(); | ||
289 | foreach (InventoryItemBase i in icoll.Items) | ||
290 | items[i.ID.ToString()] = EncodeItem(i); | ||
291 | result["ITEMS"] = items; | ||
292 | } | ||
251 | 293 | ||
252 | string xmlString = ServerUtils.BuildXmlResponse(result); | 294 | string xmlString = ServerUtils.BuildXmlResponse(result); |
253 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 295 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
@@ -258,7 +300,16 @@ namespace OpenSim.Server.Handlers.Asset | |||
258 | byte[] HandleGetFolderItems(Dictionary<string,object> request) | 300 | byte[] HandleGetFolderItems(Dictionary<string,object> request) |
259 | { | 301 | { |
260 | Dictionary<string,object> result = new Dictionary<string,object>(); | 302 | Dictionary<string,object> result = new Dictionary<string,object>(); |
261 | 303 | UUID principal = UUID.Zero; | |
304 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
305 | UUID folderID = UUID.Zero; | ||
306 | UUID.TryParse(request["FOLDER"].ToString(), out folderID); | ||
307 | |||
308 | List<InventoryItemBase> items = m_InventoryService.GetFolderItems(principal, folderID); | ||
309 | if (items != null) | ||
310 | foreach (InventoryItemBase item in items) | ||
311 | result[item.ID.ToString()] = EncodeItem(item); | ||
312 | |||
262 | string xmlString = ServerUtils.BuildXmlResponse(result); | 313 | string xmlString = ServerUtils.BuildXmlResponse(result); |
263 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 314 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
264 | UTF8Encoding encoding = new UTF8Encoding(); | 315 | UTF8Encoding encoding = new UTF8Encoding(); |
@@ -268,96 +319,169 @@ namespace OpenSim.Server.Handlers.Asset | |||
268 | byte[] HandleAddFolder(Dictionary<string,object> request) | 319 | byte[] HandleAddFolder(Dictionary<string,object> request) |
269 | { | 320 | { |
270 | Dictionary<string,object> result = new Dictionary<string,object>(); | 321 | Dictionary<string,object> result = new Dictionary<string,object>(); |
322 | InventoryFolderBase folder = BuildFolder(request); | ||
271 | 323 | ||
272 | string xmlString = ServerUtils.BuildXmlResponse(result); | 324 | if (m_InventoryService.AddFolder(folder)) |
273 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 325 | return SuccessResult(); |
274 | UTF8Encoding encoding = new UTF8Encoding(); | 326 | else |
275 | return encoding.GetBytes(xmlString); | 327 | return FailureResult(); |
276 | } | 328 | } |
277 | 329 | ||
278 | byte[] HandleUpdateFolder(Dictionary<string,object> request) | 330 | byte[] HandleUpdateFolder(Dictionary<string,object> request) |
279 | { | 331 | { |
280 | Dictionary<string,object> result = new Dictionary<string,object>(); | 332 | Dictionary<string, object> result = new Dictionary<string, object>(); |
333 | InventoryFolderBase folder = BuildFolder(request); | ||
281 | 334 | ||
282 | string xmlString = ServerUtils.BuildXmlResponse(result); | 335 | if (m_InventoryService.UpdateFolder(folder)) |
283 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 336 | return SuccessResult(); |
284 | UTF8Encoding encoding = new UTF8Encoding(); | 337 | else |
285 | return encoding.GetBytes(xmlString); | 338 | return FailureResult(); |
286 | } | 339 | } |
287 | 340 | ||
288 | byte[] HandleMoveFolder(Dictionary<string,object> request) | 341 | byte[] HandleMoveFolder(Dictionary<string,object> request) |
289 | { | 342 | { |
290 | Dictionary<string,object> result = new Dictionary<string,object>(); | 343 | Dictionary<string, object> result = new Dictionary<string, object>(); |
344 | UUID parentID = UUID.Zero; | ||
345 | UUID.TryParse(request["ParentID"].ToString(), out parentID); | ||
346 | UUID folderID = UUID.Zero; | ||
347 | UUID.TryParse(request["ID"].ToString(), out folderID); | ||
348 | UUID principal = UUID.Zero; | ||
349 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
350 | |||
351 | InventoryFolderBase folder = new InventoryFolderBase(folderID, "", principal, parentID); | ||
352 | if (m_InventoryService.MoveFolder(folder)) | ||
353 | return SuccessResult(); | ||
354 | else | ||
355 | return FailureResult(); | ||
291 | 356 | ||
292 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
293 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | ||
294 | UTF8Encoding encoding = new UTF8Encoding(); | ||
295 | return encoding.GetBytes(xmlString); | ||
296 | } | 357 | } |
297 | 358 | ||
298 | byte[] HandleDeleteFolders(Dictionary<string,object> request) | 359 | byte[] HandleDeleteFolders(Dictionary<string,object> request) |
299 | { | 360 | { |
300 | Dictionary<string,object> result = new Dictionary<string,object>(); | 361 | Dictionary<string,object> result = new Dictionary<string,object>(); |
362 | UUID principal = UUID.Zero; | ||
363 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
364 | List<string> slist = (List<string>)request["FOLDERS"]; | ||
365 | List<UUID> uuids = new List<UUID>(); | ||
366 | foreach (string s in slist) | ||
367 | { | ||
368 | UUID u = UUID.Zero; | ||
369 | if (UUID.TryParse(s, out u)) | ||
370 | uuids.Add(u); | ||
371 | } | ||
301 | 372 | ||
302 | string xmlString = ServerUtils.BuildXmlResponse(result); | 373 | if (m_InventoryService.DeleteFolders(principal, uuids)) |
303 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 374 | return SuccessResult(); |
304 | UTF8Encoding encoding = new UTF8Encoding(); | 375 | else |
305 | return encoding.GetBytes(xmlString); | 376 | return |
377 | FailureResult(); | ||
306 | } | 378 | } |
307 | 379 | ||
308 | byte[] HandlePurgeFolder(Dictionary<string,object> request) | 380 | byte[] HandlePurgeFolder(Dictionary<string,object> request) |
309 | { | 381 | { |
310 | Dictionary<string,object> result = new Dictionary<string,object>(); | 382 | Dictionary<string,object> result = new Dictionary<string,object>(); |
383 | UUID folderID = UUID.Zero; | ||
384 | UUID.TryParse(request["ID"].ToString(), out folderID); | ||
311 | 385 | ||
312 | string xmlString = ServerUtils.BuildXmlResponse(result); | 386 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
313 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 387 | if (m_InventoryService.PurgeFolder(folder)) |
314 | UTF8Encoding encoding = new UTF8Encoding(); | 388 | return SuccessResult(); |
315 | return encoding.GetBytes(xmlString); | 389 | else |
390 | return FailureResult(); | ||
316 | } | 391 | } |
317 | 392 | ||
318 | byte[] HandleAddItem(Dictionary<string,object> request) | 393 | byte[] HandleAddItem(Dictionary<string,object> request) |
319 | { | 394 | { |
320 | Dictionary<string,object> result = new Dictionary<string,object>(); | 395 | Dictionary<string, object> result = new Dictionary<string, object>(); |
396 | InventoryItemBase item = BuildItem(request); | ||
321 | 397 | ||
322 | string xmlString = ServerUtils.BuildXmlResponse(result); | 398 | if (m_InventoryService.AddItem(item)) |
323 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 399 | return SuccessResult(); |
324 | UTF8Encoding encoding = new UTF8Encoding(); | 400 | else |
325 | return encoding.GetBytes(xmlString); | 401 | return FailureResult(); |
326 | } | 402 | } |
327 | 403 | ||
328 | byte[] HandleUpdateItem(Dictionary<string,object> request) | 404 | byte[] HandleUpdateItem(Dictionary<string,object> request) |
329 | { | 405 | { |
330 | Dictionary<string,object> result = new Dictionary<string,object>(); | 406 | Dictionary<string, object> result = new Dictionary<string, object>(); |
407 | InventoryItemBase item = BuildItem(request); | ||
331 | 408 | ||
332 | string xmlString = ServerUtils.BuildXmlResponse(result); | 409 | if (m_InventoryService.UpdateItem(item)) |
333 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 410 | return SuccessResult(); |
334 | UTF8Encoding encoding = new UTF8Encoding(); | 411 | else |
335 | return encoding.GetBytes(xmlString); | 412 | return FailureResult(); |
336 | } | 413 | } |
337 | 414 | ||
338 | byte[] HandleMoveItems(Dictionary<string,object> request) | 415 | byte[] HandleMoveItems(Dictionary<string,object> request) |
339 | { | 416 | { |
340 | Dictionary<string,object> result = new Dictionary<string,object>(); | 417 | Dictionary<string,object> result = new Dictionary<string,object>(); |
418 | List<string> idlist = (List<string>)request["IDLIST"]; | ||
419 | List<string> destlist = (List<string>)request["DESTLIST"]; | ||
420 | UUID principal = UUID.Zero; | ||
421 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
341 | 422 | ||
342 | string xmlString = ServerUtils.BuildXmlResponse(result); | 423 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
343 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 424 | int n = 0; |
344 | UTF8Encoding encoding = new UTF8Encoding(); | 425 | try |
345 | return encoding.GetBytes(xmlString); | 426 | { |
427 | foreach (string s in idlist) | ||
428 | { | ||
429 | UUID u = UUID.Zero; | ||
430 | if (UUID.TryParse(s, out u)) | ||
431 | { | ||
432 | UUID fid = UUID.Zero; | ||
433 | if (UUID.TryParse(destlist[n++], out fid)) | ||
434 | { | ||
435 | InventoryItemBase item = new InventoryItemBase(u, principal); | ||
436 | item.Folder = fid; | ||
437 | items.Add(item); | ||
438 | } | ||
439 | } | ||
440 | } | ||
441 | } | ||
442 | catch (Exception e) | ||
443 | { | ||
444 | m_log.DebugFormat("[XINVENTORY IN CONNECTOR]: Exception in HandleMoveItems: {0}", e.Message); | ||
445 | return FailureResult(); | ||
446 | } | ||
447 | |||
448 | if (m_InventoryService.MoveItems(principal, items)) | ||
449 | return SuccessResult(); | ||
450 | else | ||
451 | return FailureResult(); | ||
346 | } | 452 | } |
347 | 453 | ||
348 | byte[] HandleDeleteItems(Dictionary<string,object> request) | 454 | byte[] HandleDeleteItems(Dictionary<string,object> request) |
349 | { | 455 | { |
350 | Dictionary<string,object> result = new Dictionary<string,object>(); | 456 | Dictionary<string, object> result = new Dictionary<string, object>(); |
457 | UUID principal = UUID.Zero; | ||
458 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
459 | List<string> slist = (List<string>)request["ITEMS"]; | ||
460 | List<UUID> uuids = new List<UUID>(); | ||
461 | foreach (string s in slist) | ||
462 | { | ||
463 | UUID u = UUID.Zero; | ||
464 | if (UUID.TryParse(s, out u)) | ||
465 | uuids.Add(u); | ||
466 | } | ||
351 | 467 | ||
352 | string xmlString = ServerUtils.BuildXmlResponse(result); | 468 | if (m_InventoryService.DeleteItems(principal, uuids)) |
353 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 469 | return SuccessResult(); |
354 | UTF8Encoding encoding = new UTF8Encoding(); | 470 | else |
355 | return encoding.GetBytes(xmlString); | 471 | return |
472 | FailureResult(); | ||
356 | } | 473 | } |
357 | 474 | ||
358 | byte[] HandleGetItem(Dictionary<string,object> request) | 475 | byte[] HandleGetItem(Dictionary<string,object> request) |
359 | { | 476 | { |
360 | Dictionary<string,object> result = new Dictionary<string,object>(); | 477 | Dictionary<string,object> result = new Dictionary<string,object>(); |
478 | UUID id = UUID.Zero; | ||
479 | UUID.TryParse(request["ID"].ToString(), out id); | ||
480 | |||
481 | InventoryItemBase item = new InventoryItemBase(id); | ||
482 | item = m_InventoryService.GetItem(item); | ||
483 | if (item != null) | ||
484 | result[item.ID.ToString()] = EncodeItem(item); | ||
361 | 485 | ||
362 | string xmlString = ServerUtils.BuildXmlResponse(result); | 486 | string xmlString = ServerUtils.BuildXmlResponse(result); |
363 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 487 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
@@ -367,7 +491,14 @@ namespace OpenSim.Server.Handlers.Asset | |||
367 | 491 | ||
368 | byte[] HandleGetFolder(Dictionary<string,object> request) | 492 | byte[] HandleGetFolder(Dictionary<string,object> request) |
369 | { | 493 | { |
370 | Dictionary<string,object> result = new Dictionary<string,object>(); | 494 | Dictionary<string, object> result = new Dictionary<string, object>(); |
495 | UUID id = UUID.Zero; | ||
496 | UUID.TryParse(request["ID"].ToString(), out id); | ||
497 | |||
498 | InventoryFolderBase folder = new InventoryFolderBase(id); | ||
499 | folder = m_InventoryService.GetFolder(folder); | ||
500 | if (folder != null) | ||
501 | result[folder.ID.ToString()] = EncodeFolder(folder); | ||
371 | 502 | ||
372 | string xmlString = ServerUtils.BuildXmlResponse(result); | 503 | string xmlString = ServerUtils.BuildXmlResponse(result); |
373 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 504 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
@@ -378,6 +509,13 @@ namespace OpenSim.Server.Handlers.Asset | |||
378 | byte[] HandleGetActiveGestures(Dictionary<string,object> request) | 509 | byte[] HandleGetActiveGestures(Dictionary<string,object> request) |
379 | { | 510 | { |
380 | Dictionary<string,object> result = new Dictionary<string,object>(); | 511 | Dictionary<string,object> result = new Dictionary<string,object>(); |
512 | UUID principal = UUID.Zero; | ||
513 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
514 | |||
515 | List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(principal); | ||
516 | if (gestures != null) | ||
517 | foreach (InventoryItemBase item in gestures) | ||
518 | result[item.ID.ToString()] = EncodeItem(item); | ||
381 | 519 | ||
382 | string xmlString = ServerUtils.BuildXmlResponse(result); | 520 | string xmlString = ServerUtils.BuildXmlResponse(result); |
383 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 521 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
@@ -388,7 +526,14 @@ namespace OpenSim.Server.Handlers.Asset | |||
388 | byte[] HandleGetAssetPermissions(Dictionary<string,object> request) | 526 | byte[] HandleGetAssetPermissions(Dictionary<string,object> request) |
389 | { | 527 | { |
390 | Dictionary<string,object> result = new Dictionary<string,object>(); | 528 | Dictionary<string,object> result = new Dictionary<string,object>(); |
529 | UUID principal = UUID.Zero; | ||
530 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | ||
531 | UUID assetID = UUID.Zero; | ||
532 | UUID.TryParse(request["ASSET"].ToString(), out assetID); | ||
391 | 533 | ||
534 | int perms = m_InventoryService.GetAssetPermissions(principal, assetID); | ||
535 | |||
536 | result["RESULT"] = perms.ToString(); | ||
392 | string xmlString = ServerUtils.BuildXmlResponse(result); | 537 | string xmlString = ServerUtils.BuildXmlResponse(result); |
393 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 538 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
394 | UTF8Encoding encoding = new UTF8Encoding(); | 539 | UTF8Encoding encoding = new UTF8Encoding(); |
@@ -409,6 +554,34 @@ namespace OpenSim.Server.Handlers.Asset | |||
409 | return ret; | 554 | return ret; |
410 | } | 555 | } |
411 | 556 | ||
557 | private Dictionary<string, object> EncodeItem(InventoryItemBase item) | ||
558 | { | ||
559 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
560 | |||
561 | ret["AssetID"] = item.AssetID.ToString(); | ||
562 | ret["AssetType"] = item.AssetType.ToString(); | ||
563 | ret["BasePermissions"] = item.BasePermissions.ToString(); | ||
564 | ret["CreationDate"] = item.CreationDate.ToString(); | ||
565 | ret["CreatorId"] = item.CreatorId.ToString(); | ||
566 | ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); | ||
567 | ret["Description"] = item.Description.ToString(); | ||
568 | ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); | ||
569 | ret["Flags"] = item.Flags.ToString(); | ||
570 | ret["Folder"] = item.Folder.ToString(); | ||
571 | ret["GroupID"] = item.GroupID.ToString(); | ||
572 | ret["GroupedOwned"] = item.GroupOwned.ToString(); | ||
573 | ret["GroupPermissions"] = item.GroupPermissions.ToString(); | ||
574 | ret["ID"] = item.ID.ToString(); | ||
575 | ret["InvType"] = item.InvType.ToString(); | ||
576 | ret["Name"] = item.Name.ToString(); | ||
577 | ret["NextPermissions"] = item.NextPermissions.ToString(); | ||
578 | ret["Owner"] = item.Owner.ToString(); | ||
579 | ret["SalePrice"] = item.SalePrice.ToString(); | ||
580 | ret["SaleType"] = item.SaleType.ToString(); | ||
581 | |||
582 | return ret; | ||
583 | } | ||
584 | |||
412 | private InventoryFolderBase BuildFolder(Dictionary<string,object> data) | 585 | private InventoryFolderBase BuildFolder(Dictionary<string,object> data) |
413 | { | 586 | { |
414 | InventoryFolderBase folder = new InventoryFolderBase(); | 587 | InventoryFolderBase folder = new InventoryFolderBase(); |