mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
make use of some of those on inventory caps; fix some set of sp osutf8 fields
This commit is contained in:
@@ -131,18 +131,18 @@ namespace OpenSim.Capabilities.Handlers
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = osStringBuilderCache.Acquire();
|
||||
sb.Append("[WEB FETCH INV DESC HANDLER]: Unable to fetch folders owned by ");
|
||||
sb.Append("Unknown");
|
||||
sb.Append(" :");
|
||||
osUTF8 sb = OSUTF8Cached.Acquire();
|
||||
sb.AppendASCII("[WEB FETCH INV DESC HANDLER]: Unable to fetch folders owned by ");
|
||||
sb.AppendASCII("Unknown");
|
||||
sb.AppendASCII(" :");
|
||||
int limit = 5;
|
||||
int count = 0;
|
||||
foreach (UUID bad in bad_folders)
|
||||
{
|
||||
if (BadRequests.ContainsKey(bad))
|
||||
continue;
|
||||
sb.Append(" ");
|
||||
sb.Append(bad.ToString());
|
||||
sb.Append((byte)' ');
|
||||
sb.AppendASCII(bad.ToString());
|
||||
++count;
|
||||
if (--limit < 0)
|
||||
break;
|
||||
@@ -151,22 +151,21 @@ namespace OpenSim.Capabilities.Handlers
|
||||
if(count > 0)
|
||||
{
|
||||
if (limit < 0)
|
||||
sb.Append(" ...");
|
||||
m_log.Warn(osStringBuilderCache.GetStringAndRelease(sb));
|
||||
sb.AppendASCII(" ...");
|
||||
m_log.Warn(sb.ToString());
|
||||
}
|
||||
else
|
||||
osStringBuilderCache.Release(sb);
|
||||
|
||||
sb = osStringBuilderCache.Acquire();
|
||||
sb.Append("<llsd><map><key>folders</key><array /></map><map><key>bad_folders</key><array>");
|
||||
sb.Clear();
|
||||
|
||||
sb.AppendASCII("<llsd><map><key>folders</key><array /></map><map><key>bad_folders</key><array>");
|
||||
foreach (UUID bad in bad_folders)
|
||||
{
|
||||
sb.Append("<map><key>folder_id</key><uuid>");
|
||||
sb.Append(bad.ToString());
|
||||
sb.Append("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
sb.AppendASCII("<map><key>folder_id</key><uuid>");
|
||||
sb.AppendASCII(bad.ToString());
|
||||
sb.AppendASCII("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
}
|
||||
sb.Append("</array></map></llsd>");
|
||||
httpResponse.RawBuffer = Util.UTF8NBGetbytes(osStringBuilderCache.GetStringAndRelease(sb));
|
||||
sb.AppendASCII("</array></map></llsd>");
|
||||
httpResponse.RawBuffer = OSUTF8Cached.GetArrayAndRelease(sb);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -187,12 +186,11 @@ namespace OpenSim.Capabilities.Handlers
|
||||
1024 * total_items +
|
||||
128 * bad_folders.Count) & 0x7ffff000);
|
||||
|
||||
StringBuilder lastresponse = new StringBuilder(mem);
|
||||
lastresponse.Append("<llsd>");
|
||||
osUTF8 lastresponse = LLSDxmlEncode2.Start(mem);
|
||||
|
||||
if (invcollSetCount > 0)
|
||||
{
|
||||
lastresponse.Append("<map><key>folders</key><array>");
|
||||
lastresponse.AppendASCII("<map><key>folders</key><array>");
|
||||
int i = 0;
|
||||
InventoryCollection thiscoll;
|
||||
for (i = 0; i < invcollSetCount; i++)
|
||||
@@ -200,70 +198,70 @@ namespace OpenSim.Capabilities.Handlers
|
||||
thiscoll = invcollSet[i];
|
||||
invcollSet[i] = null;
|
||||
|
||||
LLSDxmlEncode.AddMap(lastresponse);
|
||||
LLSDxmlEncode.AddElem("agent_id", thiscoll.OwnerID, lastresponse);
|
||||
LLSDxmlEncode.AddElem("descendents", thiscoll.Descendents, lastresponse);
|
||||
LLSDxmlEncode.AddElem("folder_id", thiscoll.FolderID, lastresponse);
|
||||
LLSDxmlEncode2.AddMap(lastresponse);
|
||||
LLSDxmlEncode2.AddElem_agent_id(thiscoll.OwnerID, lastresponse);
|
||||
LLSDxmlEncode2.AddElem("descendents", thiscoll.Descendents, lastresponse);
|
||||
LLSDxmlEncode2.AddElem_folder_id(thiscoll.FolderID, lastresponse);
|
||||
|
||||
if (thiscoll.Folders == null || thiscoll.Folders.Count == 0)
|
||||
LLSDxmlEncode.AddEmptyArray("categories", lastresponse);
|
||||
LLSDxmlEncode2.AddEmptyArray("categories", lastresponse);
|
||||
else
|
||||
{
|
||||
LLSDxmlEncode.AddArray("categories", lastresponse);
|
||||
LLSDxmlEncode2.AddArray("categories", lastresponse);
|
||||
foreach (InventoryFolderBase invFolder in thiscoll.Folders)
|
||||
{
|
||||
LLSDxmlEncode.AddMap(lastresponse);
|
||||
LLSDxmlEncode2.AddMap(lastresponse);
|
||||
|
||||
LLSDxmlEncode.AddElem("folder_id", invFolder.ID, lastresponse);
|
||||
LLSDxmlEncode.AddElem("parent_id", invFolder.ParentID, lastresponse);
|
||||
LLSDxmlEncode.AddElem("name", invFolder.Name, lastresponse);
|
||||
LLSDxmlEncode.AddElem("type", invFolder.Type, lastresponse);
|
||||
LLSDxmlEncode.AddElem("preferred_type", (int)-1, lastresponse);
|
||||
LLSDxmlEncode.AddElem("version", invFolder.Version, lastresponse);
|
||||
LLSDxmlEncode2.AddElem_folder_id(invFolder.ID, lastresponse);
|
||||
LLSDxmlEncode2.AddElem_parent_id(invFolder.ParentID, lastresponse);
|
||||
LLSDxmlEncode2.AddElem_name(invFolder.Name, lastresponse);
|
||||
LLSDxmlEncode2.AddElem("type", invFolder.Type, lastresponse);
|
||||
LLSDxmlEncode2.AddElem("preferred_type", (int)-1, lastresponse);
|
||||
LLSDxmlEncode2.AddElem("version", invFolder.Version, lastresponse);
|
||||
|
||||
LLSDxmlEncode.AddEndMap(lastresponse);
|
||||
LLSDxmlEncode2.AddEndMap(lastresponse);
|
||||
}
|
||||
LLSDxmlEncode.AddEndArray(lastresponse);
|
||||
LLSDxmlEncode2.AddEndArray(lastresponse);
|
||||
}
|
||||
|
||||
if (thiscoll.Items == null || thiscoll.Items.Count == 0)
|
||||
LLSDxmlEncode.AddEmptyArray("items", lastresponse);
|
||||
LLSDxmlEncode2.AddEmptyArray("items", lastresponse);
|
||||
else
|
||||
{
|
||||
LLSDxmlEncode.AddArray("items", lastresponse);
|
||||
LLSDxmlEncode2.AddArray("items", lastresponse);
|
||||
foreach (InventoryItemBase invItem in thiscoll.Items)
|
||||
{
|
||||
invItem.ToLLSDxml(lastresponse);
|
||||
}
|
||||
|
||||
LLSDxmlEncode.AddEndArray(lastresponse);
|
||||
LLSDxmlEncode2.AddEndArray(lastresponse);
|
||||
}
|
||||
|
||||
LLSDxmlEncode.AddElem("owner_id", thiscoll.OwnerID, lastresponse);
|
||||
LLSDxmlEncode.AddElem("version", thiscoll.Version, lastresponse);
|
||||
LLSDxmlEncode2.AddElem_owner_id(thiscoll.OwnerID, lastresponse);
|
||||
LLSDxmlEncode2.AddElem("version", thiscoll.Version, lastresponse);
|
||||
|
||||
LLSDxmlEncode.AddEndMap(lastresponse);
|
||||
LLSDxmlEncode2.AddEndMap(lastresponse);
|
||||
invcollSet[i] = null;
|
||||
}
|
||||
lastresponse.Append("</array></map>");
|
||||
LLSDxmlEncode2.AddEndArrayAndMap(lastresponse);
|
||||
thiscoll = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastresponse.Append("<map><key>folders</key><array /></map>");
|
||||
lastresponse.AppendASCII("<map><key>folders</key><array /></map>");
|
||||
}
|
||||
|
||||
if (bad_folders.Count > 0)
|
||||
{
|
||||
lastresponse.Append("<map><key>bad_folders</key><array>");
|
||||
lastresponse.AppendASCII("<map><key>bad_folders</key><array>");
|
||||
foreach (UUID bad in bad_folders)
|
||||
{
|
||||
BadRequests.Add(bad);
|
||||
lastresponse.Append("<map><key>folder_id</key><uuid>");
|
||||
lastresponse.Append(bad.ToString());
|
||||
lastresponse.Append("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
lastresponse.AppendASCII("<map><key>folder_id</key><uuid>");
|
||||
lastresponse.AppendASCII(bad.ToString());
|
||||
lastresponse.AppendASCII("</uuid><key>error</key><string>Unknown</string></map>");
|
||||
}
|
||||
lastresponse.Append("</array></map>");
|
||||
lastresponse.AppendASCII("</array></map>");
|
||||
|
||||
StringBuilder sb = osStringBuilderCache.Acquire();
|
||||
sb.Append("[WEB FETCH INV DESC HANDLER]: Unable to fetch folders owned by ");
|
||||
@@ -281,9 +279,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||
sb.Append(" ...");
|
||||
m_log.Warn(osStringBuilderCache.GetStringAndRelease(sb));
|
||||
}
|
||||
lastresponse.Append("</llsd>");
|
||||
|
||||
httpResponse.RawBuffer = Util.UTF8NBGetbytes(lastresponse.ToString());
|
||||
httpResponse.RawBuffer = LLSDxmlEncode2.EndToBytes(lastresponse);
|
||||
}
|
||||
|
||||
private void AddLibraryFolders(List<LLSDFetchInventoryDescendents> libFolders, List<InventoryCollection> result, ref int total_folders, ref int total_items)
|
||||
|
||||
@@ -81,31 +81,31 @@ namespace OpenSim.Capabilities.Handlers
|
||||
items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
|
||||
}
|
||||
|
||||
StringBuilder lsl = LLSDxmlEncode.Start(4096);
|
||||
LLSDxmlEncode.AddMap(lsl);
|
||||
osUTF8 lsl = LLSDxmlEncode2.Start(4096);
|
||||
LLSDxmlEncode2.AddMap(lsl);
|
||||
|
||||
if(m_agentID == UUID.Zero && items.Length > 0)
|
||||
LLSDxmlEncode.AddElem("agent_id", items[0].Owner, lsl);
|
||||
LLSDxmlEncode2.AddElem("agent_id", items[0].Owner, lsl);
|
||||
else
|
||||
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
|
||||
LLSDxmlEncode2.AddElem("agent_id", m_agentID, lsl);
|
||||
|
||||
if(items == null || items.Length == 0)
|
||||
{
|
||||
LLSDxmlEncode.AddEmptyArray("items", lsl);
|
||||
LLSDxmlEncode2.AddEmptyArray("items", lsl);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSDxmlEncode.AddArray("items", lsl);
|
||||
LLSDxmlEncode2.AddArray("items", lsl);
|
||||
foreach (InventoryItemBase item in items)
|
||||
{
|
||||
if (item != null)
|
||||
item.ToLLSDxml(lsl, 0xff);
|
||||
}
|
||||
LLSDxmlEncode.AddEndArray(lsl);
|
||||
LLSDxmlEncode2.AddEndArray(lsl);
|
||||
}
|
||||
|
||||
LLSDxmlEncode.AddEndMap(lsl);
|
||||
return LLSDxmlEncode.End(lsl);
|
||||
LLSDxmlEncode2.AddEndMap(lsl);
|
||||
return LLSDxmlEncode2.End(lsl);
|
||||
}
|
||||
|
||||
public void FetchInventorySimpleRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap requestmap, ExpiringKey<UUID> BadRequests)
|
||||
@@ -137,28 +137,28 @@ namespace OpenSim.Capabilities.Handlers
|
||||
}
|
||||
catch{ }
|
||||
|
||||
StringBuilder lsl = LLSDxmlEncode.Start(4096);
|
||||
LLSDxmlEncode.AddMap(lsl);
|
||||
osUTF8 lsl = LLSDxmlEncode2.Start(4096);
|
||||
LLSDxmlEncode2.AddMap(lsl);
|
||||
|
||||
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
|
||||
LLSDxmlEncode2.AddElem("agent_id", m_agentID, lsl);
|
||||
|
||||
if (items == null || items.Length == 0)
|
||||
{
|
||||
LLSDxmlEncode.AddEmptyArray("items", lsl);
|
||||
LLSDxmlEncode2.AddEmptyArray("items", lsl);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSDxmlEncode.AddArray("items", lsl);
|
||||
LLSDxmlEncode2.AddArray("items", lsl);
|
||||
foreach (InventoryItemBase item in items)
|
||||
{
|
||||
if (item != null)
|
||||
item.ToLLSDxml(lsl, 0xff);
|
||||
}
|
||||
LLSDxmlEncode.AddEndArray(lsl);
|
||||
LLSDxmlEncode2.AddEndArray(lsl);
|
||||
}
|
||||
|
||||
LLSDxmlEncode.AddEndMap(lsl);
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
|
||||
LLSDxmlEncode2.AddEndMap(lsl);
|
||||
httpResponse.RawBuffer = LLSDxmlEncode2.EndToBytes(lsl);
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
@@ -411,39 +412,39 @@ namespace OpenSim.Framework
|
||||
return MemberwiseClone();
|
||||
}
|
||||
|
||||
public void ToLLSDxml(StringBuilder lsl, uint flagsMask = 0xffffffff)
|
||||
public void ToLLSDxml(osUTF8 lsl, uint flagsMask = 0xffffffff)
|
||||
{
|
||||
LLSDxmlEncode.AddMap(lsl);
|
||||
LLSDxmlEncode.AddElem("parent_id", Folder, lsl);
|
||||
LLSDxmlEncode.AddElem("asset_id", AssetID, lsl);
|
||||
LLSDxmlEncode.AddElem("item_id", ID, lsl);
|
||||
LLSDxmlEncode2.AddMap(lsl);
|
||||
LLSDxmlEncode2.AddElem_parent_id(Folder, lsl);
|
||||
LLSDxmlEncode2.AddElem("asset_id", AssetID, lsl);
|
||||
LLSDxmlEncode2.AddElem("item_id", ID, lsl);
|
||||
|
||||
LLSDxmlEncode.AddMap("permissions",lsl);
|
||||
LLSDxmlEncode.AddElem("creator_id", CreatorIdAsUuid, lsl);
|
||||
LLSDxmlEncode.AddElem("owner_id", Owner, lsl);
|
||||
LLSDxmlEncode.AddElem("group_id", GroupID, lsl);
|
||||
LLSDxmlEncode.AddElem("base_mask", (int)CurrentPermissions, lsl);
|
||||
LLSDxmlEncode.AddElem("owner_mask", (int)CurrentPermissions, lsl);
|
||||
LLSDxmlEncode.AddElem("group_mask", (int)GroupPermissions, lsl);
|
||||
LLSDxmlEncode.AddElem("everyone_mask", (int)EveryOnePermissions, lsl);
|
||||
LLSDxmlEncode.AddElem("next_owner_mask", (int)NextPermissions, lsl);
|
||||
LLSDxmlEncode.AddElem("is_owner_group", GroupOwned, lsl);
|
||||
LLSDxmlEncode.AddEndMap(lsl);
|
||||
LLSDxmlEncode2.AddMap("permissions",lsl);
|
||||
LLSDxmlEncode2.AddElem("creator_id", CreatorIdAsUuid, lsl);
|
||||
LLSDxmlEncode2.AddElem_owner_id( Owner, lsl);
|
||||
LLSDxmlEncode2.AddElem("group_id", GroupID, lsl);
|
||||
LLSDxmlEncode2.AddElem("base_mask", (int)CurrentPermissions, lsl);
|
||||
LLSDxmlEncode2.AddElem("owner_mask", (int)CurrentPermissions, lsl);
|
||||
LLSDxmlEncode2.AddElem("group_mask", (int)GroupPermissions, lsl);
|
||||
LLSDxmlEncode2.AddElem("everyone_mask", (int)EveryOnePermissions, lsl);
|
||||
LLSDxmlEncode2.AddElem("next_owner_mask", (int)NextPermissions, lsl);
|
||||
LLSDxmlEncode2.AddElem("is_owner_group", GroupOwned, lsl);
|
||||
LLSDxmlEncode2.AddEndMap(lsl);
|
||||
|
||||
LLSDxmlEncode.AddElem("type", AssetType, lsl);
|
||||
LLSDxmlEncode.AddElem("inv_type", InvType, lsl);
|
||||
LLSDxmlEncode.AddElem("flags", (int)(Flags & flagsMask), lsl);
|
||||
LLSDxmlEncode2.AddElem("type", AssetType, lsl);
|
||||
LLSDxmlEncode2.AddElem("inv_type", InvType, lsl);
|
||||
LLSDxmlEncode2.AddElem("flags", (int)(Flags & flagsMask), lsl);
|
||||
|
||||
LLSDxmlEncode.AddMap("sale_info",lsl);
|
||||
LLSDxmlEncode.AddElem("sale_price", SalePrice, lsl);
|
||||
LLSDxmlEncode.AddElem("sale_type", SaleType, lsl);
|
||||
LLSDxmlEncode.AddEndMap(lsl);
|
||||
LLSDxmlEncode2.AddMap("sale_info",lsl);
|
||||
LLSDxmlEncode2.AddElem("sale_price", SalePrice, lsl);
|
||||
LLSDxmlEncode2.AddElem("sale_type", SaleType, lsl);
|
||||
LLSDxmlEncode2.AddEndMap(lsl);
|
||||
|
||||
LLSDxmlEncode.AddElem("name", Name, lsl);
|
||||
LLSDxmlEncode.AddElem("desc", Description, lsl);
|
||||
LLSDxmlEncode.AddElem("created_at", CreationDate, lsl);
|
||||
LLSDxmlEncode2.AddElem_name(Name, lsl);
|
||||
LLSDxmlEncode2.AddElem("desc", Description, lsl);
|
||||
LLSDxmlEncode2.AddElem("created_at", CreationDate, lsl);
|
||||
|
||||
LLSDxmlEncode.AddEndMap(lsl);
|
||||
LLSDxmlEncode2.AddEndMap(lsl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,6 +480,7 @@ namespace OpenSim.Framework
|
||||
ret = OSDParser.SerializeLLSDXmlToBytes(map);
|
||||
m_cachedbytes = ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4075,12 +4075,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void SetText(string text)
|
||||
{
|
||||
osUTF8 old = osUTF8Text;
|
||||
osUTF8Text = new osUTF8(text, 254);
|
||||
|
||||
if (ParentGroup != null && !osUTF8Text.Equals(old))
|
||||
if(string.IsNullOrEmpty(text))
|
||||
{
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
osUTF8Text = null;
|
||||
if (old != null && ParentGroup != null)
|
||||
{
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
osUTF8Text = new osUTF8(text, 254);
|
||||
|
||||
if (ParentGroup != null && !osUTF8Text.Equals(old))
|
||||
{
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4099,11 +4111,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
(int) (color.Y*0xff),
|
||||
(int) (color.Z*0xff));
|
||||
osUTF8 old = osUTF8Text;
|
||||
osUTF8Text = new osUTF8(text, 254);
|
||||
if (ParentGroup != null && (oldcolor != Color || !osUTF8Text.Equals(old)))
|
||||
if(string.IsNullOrEmpty(text))
|
||||
{
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
osUTF8Text = new osUTF8(text, 254);
|
||||
if (ParentGroup != null && (oldcolor != Color || !osUTF8Text.Equals(old)))
|
||||
{
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
osUTF8Text = null;
|
||||
if (ParentGroup != null && (oldcolor != Color || old != null))
|
||||
{
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user