diff options
Diffstat (limited to 'OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | 147 |
1 files changed, 102 insertions, 45 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 0cc1978..52294da 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | |||
@@ -112,8 +112,15 @@ namespace OpenSim.Services.Connectors | |||
112 | 112 | ||
113 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 113 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
114 | 114 | ||
115 | foreach (Object o in ret.Values) | 115 | try |
116 | folders.Add(BuildFolder((Dictionary<string,object>)o)); | 116 | { |
117 | foreach (Object o in ret.Values) | ||
118 | folders.Add(BuildFolder((Dictionary<string, object>)o)); | ||
119 | } | ||
120 | catch (Exception e) | ||
121 | { | ||
122 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message); | ||
123 | } | ||
117 | 124 | ||
118 | return folders; | 125 | return folders; |
119 | } | 126 | } |
@@ -130,7 +137,7 @@ namespace OpenSim.Services.Connectors | |||
130 | if (ret.Count == 0) | 137 | if (ret.Count == 0) |
131 | return null; | 138 | return null; |
132 | 139 | ||
133 | return BuildFolder(ret); | 140 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
134 | } | 141 | } |
135 | 142 | ||
136 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 143 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) |
@@ -146,7 +153,7 @@ namespace OpenSim.Services.Connectors | |||
146 | if (ret.Count == 0) | 153 | if (ret.Count == 0) |
147 | return null; | 154 | return null; |
148 | 155 | ||
149 | return BuildFolder(ret); | 156 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
150 | } | 157 | } |
151 | 158 | ||
152 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | 159 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) |
@@ -173,10 +180,17 @@ namespace OpenSim.Services.Connectors | |||
173 | Dictionary<string,object> items = | 180 | Dictionary<string,object> items = |
174 | (Dictionary<string,object>)ret["ITEMS"]; | 181 | (Dictionary<string,object>)ret["ITEMS"]; |
175 | 182 | ||
176 | foreach (Object o in folders.Values) | 183 | try |
177 | inventory.Folders.Add(BuildFolder((Dictionary<string,object>)o)); | 184 | { |
178 | foreach (Object o in items.Values) | 185 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i |
179 | inventory.Items.Add(BuildItem((Dictionary<string,object>)o)); | 186 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); |
187 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | ||
188 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | ||
189 | } | ||
190 | catch (Exception e) | ||
191 | { | ||
192 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message); | ||
193 | } | ||
180 | 194 | ||
181 | return inventory; | 195 | return inventory; |
182 | } | 196 | } |
@@ -194,13 +208,12 @@ namespace OpenSim.Services.Connectors | |||
194 | if (ret.Count == 0) | 208 | if (ret.Count == 0) |
195 | return null; | 209 | return null; |
196 | 210 | ||
197 | 211 | Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"]; | |
198 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 212 | List<InventoryItemBase> fitems = new List<InventoryItemBase>(); |
199 | 213 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | |
200 | foreach (Object o in ret.Values) | 214 | fitems.Add(BuildItem((Dictionary<string, object>)o)); |
201 | items.Add(BuildItem((Dictionary<string,object>)o)); | ||
202 | 215 | ||
203 | return items; | 216 | return fitems; |
204 | } | 217 | } |
205 | 218 | ||
206 | public bool AddFolder(InventoryFolderBase folder) | 219 | public bool AddFolder(InventoryFolderBase folder) |
@@ -405,7 +418,7 @@ namespace OpenSim.Services.Connectors | |||
405 | if (ret.Count == 0) | 418 | if (ret.Count == 0) |
406 | return null; | 419 | return null; |
407 | 420 | ||
408 | return BuildItem(ret); | 421 | return BuildItem((Dictionary<string, object>)ret["item"]); |
409 | } | 422 | } |
410 | 423 | ||
411 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 424 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
@@ -420,7 +433,7 @@ namespace OpenSim.Services.Connectors | |||
420 | if (ret.Count == 0) | 433 | if (ret.Count == 0) |
421 | return null; | 434 | return null; |
422 | 435 | ||
423 | return BuildFolder(ret); | 436 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
424 | } | 437 | } |
425 | 438 | ||
426 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) | 439 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) |
@@ -435,8 +448,8 @@ namespace OpenSim.Services.Connectors | |||
435 | 448 | ||
436 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 449 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
437 | 450 | ||
438 | foreach (Object o in ret.Values) | 451 | foreach (Object o in ret.Values) // getting the values directly, we don't care about the keys item_i |
439 | items.Add(BuildItem((Dictionary<string,object>)o)); | 452 | items.Add(BuildItem((Dictionary<string, object>)o)); |
440 | 453 | ||
441 | return items; | 454 | return items; |
442 | } | 455 | } |
@@ -455,6 +468,36 @@ namespace OpenSim.Services.Connectors | |||
455 | return int.Parse(ret["RESULT"].ToString()); | 468 | return int.Parse(ret["RESULT"].ToString()); |
456 | } | 469 | } |
457 | 470 | ||
471 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
472 | { | ||
473 | Dictionary<string, object> ret = MakeRequest("GETSYSTEMFOLDERS", | ||
474 | new Dictionary<string, object> { | ||
475 | { "PRINCIPAL", userID.ToString() }, | ||
476 | }); | ||
477 | |||
478 | if (ret == null) | ||
479 | return new Dictionary<AssetType,InventoryFolderBase>(); | ||
480 | |||
481 | Dictionary<AssetType, InventoryFolderBase> sfolders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
482 | |||
483 | try | ||
484 | { | ||
485 | Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"]; | ||
486 | |||
487 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i | ||
488 | { | ||
489 | InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)o); | ||
490 | sfolders.Add((AssetType)folder.Type, folder); | ||
491 | } | ||
492 | |||
493 | } | ||
494 | catch (Exception e) | ||
495 | { | ||
496 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: exception {0}", e.Message); | ||
497 | } | ||
498 | |||
499 | return sfolders; | ||
500 | } | ||
458 | 501 | ||
459 | // These are either obsolete or unused | 502 | // These are either obsolete or unused |
460 | // | 503 | // |
@@ -493,13 +536,20 @@ namespace OpenSim.Services.Connectors | |||
493 | { | 536 | { |
494 | InventoryFolderBase folder = new InventoryFolderBase(); | 537 | InventoryFolderBase folder = new InventoryFolderBase(); |
495 | 538 | ||
496 | folder.ParentID = new UUID(data["ParentID"].ToString()); | 539 | try |
497 | folder.Type = short.Parse(data["Type"].ToString()); | 540 | { |
498 | folder.Version = ushort.Parse(data["Version"].ToString()); | 541 | folder.ParentID = new UUID(data["ParentID"].ToString()); |
499 | folder.Name = data["Name"].ToString(); | 542 | folder.Type = short.Parse(data["Type"].ToString()); |
500 | folder.Owner = new UUID(data["Owner"].ToString()); | 543 | folder.Version = ushort.Parse(data["Version"].ToString()); |
501 | folder.ID = new UUID(data["ID"].ToString()); | 544 | folder.Name = data["Name"].ToString(); |
502 | 545 | folder.Owner = new UUID(data["Owner"].ToString()); | |
546 | folder.ID = new UUID(data["ID"].ToString()); | ||
547 | } | ||
548 | catch (Exception e) | ||
549 | { | ||
550 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building folder: {0}", e.Message); | ||
551 | } | ||
552 | |||
503 | return folder; | 553 | return folder; |
504 | } | 554 | } |
505 | 555 | ||
@@ -507,26 +557,33 @@ namespace OpenSim.Services.Connectors | |||
507 | { | 557 | { |
508 | InventoryItemBase item = new InventoryItemBase(); | 558 | InventoryItemBase item = new InventoryItemBase(); |
509 | 559 | ||
510 | item.AssetID = new UUID(data["AssetID"].ToString()); | 560 | try |
511 | item.AssetType = int.Parse(data["AssetType"].ToString()); | 561 | { |
512 | item.Name = data["Name"].ToString(); | 562 | item.AssetID = new UUID(data["AssetID"].ToString()); |
513 | item.Owner = new UUID(data["Owner"].ToString()); | 563 | item.AssetType = int.Parse(data["AssetType"].ToString()); |
514 | item.ID = new UUID(data["ID"].ToString()); | 564 | item.Name = data["Name"].ToString(); |
515 | item.InvType = int.Parse(data["InvType"].ToString()); | 565 | item.Owner = new UUID(data["Owner"].ToString()); |
516 | item.Folder = new UUID(data["Folder"].ToString()); | 566 | item.ID = new UUID(data["ID"].ToString()); |
517 | item.CreatorId = data["CreatorId"].ToString(); | 567 | item.InvType = int.Parse(data["InvType"].ToString()); |
518 | item.Description = data["Description"].ToString(); | 568 | item.Folder = new UUID(data["Folder"].ToString()); |
519 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); | 569 | item.CreatorId = data["CreatorId"].ToString(); |
520 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); | 570 | item.Description = data["Description"].ToString(); |
521 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); | 571 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); |
522 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); | 572 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); |
523 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); | 573 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); |
524 | item.GroupID = new UUID(data["GroupID"].ToString()); | 574 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); |
525 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); | 575 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); |
526 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); | 576 | item.GroupID = new UUID(data["GroupID"].ToString()); |
527 | item.SaleType = byte.Parse(data["SaleType"].ToString()); | 577 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); |
528 | item.Flags = uint.Parse(data["Flags"].ToString()); | 578 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); |
529 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | 579 | item.SaleType = byte.Parse(data["SaleType"].ToString()); |
580 | item.Flags = uint.Parse(data["Flags"].ToString()); | ||
581 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | ||
582 | } | ||
583 | catch (Exception e) | ||
584 | { | ||
585 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building item: {0}", e.Message); | ||
586 | } | ||
530 | 587 | ||
531 | return item; | 588 | return item; |
532 | } | 589 | } |