From 268ab32fef6f7482ae814cb10cd7d127a37389a1 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 10 Jul 2009 20:20:49 +0000 Subject: [PATCH] * Better error message fetching from failed notecard uploads * createnotecard command will now add a link to the embedded item at the end of the note (still broken with "Invalid asset type.") git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2966 52acb1d6-8a22-11de-b505-999d5b087335 --- OpenMetaverse/InventoryManager.cs | 3 ++- .../Commands/Inventory/CreateNotecardCommand.cs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/OpenMetaverse/InventoryManager.cs b/OpenMetaverse/InventoryManager.cs index b418a45b..c246f049 100644 --- a/OpenMetaverse/InventoryManager.cs +++ b/OpenMetaverse/InventoryManager.cs @@ -3791,7 +3791,8 @@ namespace OpenMetaverse { if (error is WebException) message = ((HttpWebResponse)((WebException)error).Response).StatusDescription; - else + + if (message == null || message == "None") message = error.Message; } diff --git a/Programs/examples/TestClient/Commands/Inventory/CreateNotecardCommand.cs b/Programs/examples/TestClient/Commands/Inventory/CreateNotecardCommand.cs index 5425a13c..204cfe40 100644 --- a/Programs/examples/TestClient/Commands/Inventory/CreateNotecardCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/CreateNotecardCommand.cs @@ -59,13 +59,27 @@ namespace OpenMetaverse.TestClient // Try to fetch the inventory item InventoryItem item = FetchItem(embedItemID); if (item != null) + { notecard.EmbeddedItems = new List { item }; + notecard.BodyText += "xxxx"; + } else + { return "Failed to fetch inventory item " + embedItemID; + } } notecard.Encode(); + if (notecard.EmbeddedItems != null && notecard.EmbeddedItems.Count > 0) + { + // Replace xxxx in the notecard text with a link to the embedded item + notecard.AssetData[notecard.AssetData.Length - 7] = 0xF4; + notecard.AssetData[notecard.AssetData.Length - 6] = 0x80; + notecard.AssetData[notecard.AssetData.Length - 5] = 0x80; + notecard.AssetData[notecard.AssetData.Length - 4] = 0x80; + } + Client.Inventory.RequestCreateItem(Client.Inventory.FindFolderForType(AssetType.Notecard), filename, filename + " created by OpenMetaverse TestClient " + DateTime.Now, AssetType.Notecard, UUID.Random(), InventoryType.Notecard, PermissionMask.All,