cinderblocks / libremetaverse

An fork of the libopenmetaverse library striving for performance improvements and up-to-date compatibility with SL/OS/Halcyon
BSD 3-Clause "New" or "Revised" License
61 stars 40 forks source link

InventoryManager.RequestUploadNotecardAsset always fails. #8

Closed zontreck closed 2 years ago

zontreck commented 4 years ago

When uploading a notecard's contents using this method: RequestUploadNotecardAsset, the function always returns a fail. The asset In world when opened with a viewer reports it isn't in the database.

I can share a snippet of how I invoked this when next at the computer.

nopjmp commented 4 years ago

Can you share a snippet of how you are invoking the method?

zontreck commented 4 years ago

Sorry was busy with RL. Heres that snippet i promised

                    inv.RequestUploadNotecardAsset(Encode2Bytes(QT.Text), actualItem.UUID, delegate (bool success, string status, UUID itemID, UUID assetID)
                    {
                        if (success)
                        {
                            Queue.Instance.UploadSuccess = success;
                            Queue.Instance.ARE.Set();
                        }
                    });
Madpeterz commented 3 years ago

if anyone ever needs it, here is the function my bot uses to write notecards

public bool SendNotecard(string name, string content, UUID sendToUUID)
        {
            bool returnstatus = true;
            name = name + " " + DateTime.Now;
            Client.Inventory.RequestCreateItem(
                Client.Inventory.FindFolderForType(AssetType.Notecard),
                name,
                name + " Created via SecondBot notecard API",
                AssetType.Notecard,
                UUID.Random(),
                InventoryType.Notecard,
                PermissionMask.All,
                (bool Success, InventoryItem item) =>
                {
                    if (Success)
                    {
                        AssetNotecard empty = new AssetNotecard { BodyText = "\n" };
                        empty.Encode();
                        Client.Inventory.RequestUploadNotecardAsset(empty.AssetData, item.UUID,
                        (bool emptySuccess, string emptyStatus, UUID emptyItemID, UUID emptyAssetID) =>
                        {
                            if (emptySuccess)
                            {
                                empty.BodyText = content;
                                empty.Encode();
                                Client.Inventory.RequestUploadNotecardAsset(empty.AssetData, emptyItemID,
                                (bool finalSuccess, string finalStatus, UUID finalItemID, UUID finalID) =>
                                {
                                    if (finalSuccess)
                                    {
                                        Info("Sending notecard now");
                                        Client.Inventory.GiveItem(finalItemID, name, AssetType.Notecard, sendToUUID, false);
                                    }
                                    else
                                    {
                                        returnstatus = false;
                                        Warn("Unable to request notecard upload");
                                    }

                                });
                            }
                            else
                            {
                                Crit("The fuck empty success notecard create");
                                returnstatus = false;
                            }
                        });
                    }
                    else
                    {
                        Warn("Unable to find default notecards folder");
                        returnstatus = false;
                    }
                }
            );
            return returnstatus;
        }
cinderblocks commented 2 years ago

Are you uploading the notecard in task inventory (in a prim) or into avatar inventory? It works flawlessly in Radegast: https://github.com/cinderblocks/radegast/blob/master/Radegast/GUI/Consoles/Assets/Notecard.cs#L325

cinderblocks commented 2 years ago

If this is still an issue, please open a new ticket.