mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
@@ -301,10 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
// If we're an NPC then skip all the item checks and manipulations since we don't have an
|
||||
// inventory right now.
|
||||
if (sp.PresenceType == PresenceType.Npc)
|
||||
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null, true);
|
||||
else
|
||||
RezSingleAttachmentFromInventory(sp, attach.ItemID, p | (uint)0x80, d);
|
||||
RezSingleAttachmentFromInventoryInternal(sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p | (uint)0x80, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -519,26 +516,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
"[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}",
|
||||
(AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name);
|
||||
|
||||
bool append = (AttachmentPt & 0x80) != 0;
|
||||
AttachmentPt &= 0x7f;
|
||||
|
||||
// Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such).
|
||||
// This often happens during login - not sure the exact reason.
|
||||
// For now, we will ignore the request. Unfortunately, this means that we need to dig through all the
|
||||
// ScenePresence attachments. We can't use the data in AvatarAppearance because that's present at login
|
||||
// before anything has actually been attached.
|
||||
// We check the attachments in the avatar appearance here rather than the objects attached to the
|
||||
// ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup. We are
|
||||
// already doing this in ScenePresence.MakeRootAgent(). Simulator-side attaching needs to be done
|
||||
// because pre-outfit folder viewers (most version 1 viewers) require it.
|
||||
bool alreadyOn = false;
|
||||
List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
|
||||
foreach (SceneObjectGroup so in existingAttachments)
|
||||
List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments();
|
||||
foreach (AvatarAttachment existingAttachment in existingAttachments)
|
||||
{
|
||||
if (so.FromItemID == itemID)
|
||||
if (existingAttachment.ItemID == itemID)
|
||||
{
|
||||
alreadyOn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if (sp.Appearance.GetAttachmentForItem(itemID) != null)
|
||||
if (alreadyOn)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
@@ -549,7 +541,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
return null;
|
||||
}
|
||||
|
||||
return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc, append);
|
||||
return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc);
|
||||
}
|
||||
|
||||
public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
|
||||
@@ -558,7 +550,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
return;
|
||||
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Rezzing {0} attachments from inventory for {1} in {2}",
|
||||
rezlist.Count, sp.Name, m_scene.Name);
|
||||
|
||||
foreach (KeyValuePair<UUID, uint> rez in rezlist)
|
||||
{
|
||||
@@ -957,11 +951,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
}
|
||||
|
||||
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
|
||||
IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc, bool append)
|
||||
IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc)
|
||||
{
|
||||
if (m_invAccessModule == null)
|
||||
return null;
|
||||
|
||||
bool append = (attachmentPt & 0x80) != 0;
|
||||
attachmentPt &= 0x7f;
|
||||
|
||||
SceneObjectGroup objatt;
|
||||
|
||||
if (itemID != UUID.Zero)
|
||||
|
||||
@@ -130,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
modules.Add(new AttachmentsModule());
|
||||
AttachmentsModule attMod = new AttachmentsModule();
|
||||
attMod.DebugLevel = 1;
|
||||
modules.Add(attMod);
|
||||
modules.Add(new BasicInventoryAccessModule());
|
||||
}
|
||||
|
||||
@@ -728,7 +730,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
public void TestRezAttachmentsOnAvatarEntrance()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
Scene scene = CreateTestScene();
|
||||
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||
|
||||
@@ -189,6 +189,45 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
|
||||
htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
|
||||
break;
|
||||
|
||||
case (int)HttpRequestConstants.HTTP_VERBOSE_THROTTLE:
|
||||
|
||||
// TODO implement me
|
||||
break;
|
||||
|
||||
case (int)HttpRequestConstants.HTTP_CUSTOM_HEADER:
|
||||
//Parameters are in pairs and custom header takes
|
||||
//arguments in pairs so adjust for header marker.
|
||||
++i;
|
||||
|
||||
//Maximum of 8 headers are allowed based on the
|
||||
//Second Life documentation for llHTTPRequest.
|
||||
for (int count = 1; count <= 8; ++count)
|
||||
{
|
||||
//Not enough parameters remaining for a header?
|
||||
if (parms.Length - i < 2)
|
||||
break;
|
||||
|
||||
//Have we reached the end of the list of headers?
|
||||
//End is marked by a string with a single digit.
|
||||
//We already know we have at least one parameter
|
||||
//so it is safe to do this check at top of loop.
|
||||
if (Char.IsDigit(parms[i][0]))
|
||||
break;
|
||||
|
||||
if (htc.HttpCustomHeaders == null)
|
||||
htc.HttpCustomHeaders = new List<string>();
|
||||
|
||||
htc.HttpCustomHeaders.Add(parms[i]);
|
||||
htc.HttpCustomHeaders.Add(parms[i+1]);
|
||||
|
||||
i += 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE:
|
||||
htc.HttpPragmaNoCache = (int.Parse(parms[i + 1]) != 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,9 +392,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
// public const int HTTP_METHOD = 0;
|
||||
// public const int HTTP_MIMETYPE = 1;
|
||||
// public const int HTTP_VERIFY_CERT = 3;
|
||||
// public const int HTTP_VERBOSE_THROTTLE = 4;
|
||||
// public const int HTTP_CUSTOM_HEADER = 5;
|
||||
// public const int HTTP_PRAGMA_NO_CACHE = 6;
|
||||
private bool _finished;
|
||||
public bool Finished
|
||||
{
|
||||
{
|
||||
get { return _finished; }
|
||||
}
|
||||
// public int HttpBodyMaxLen = 2048; // not implemented
|
||||
@@ -367,9 +409,14 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
public bool HttpVerifyCert = true;
|
||||
public IWorkItemResult WorkItem = null;
|
||||
|
||||
//public bool HttpVerboseThrottle = true; // not implemented
|
||||
public List<string> HttpCustomHeaders = null;
|
||||
public bool HttpPragmaNoCache = true;
|
||||
private Thread httpThread;
|
||||
|
||||
// Request info
|
||||
private UUID _itemID;
|
||||
public UUID ItemID
|
||||
public UUID ItemID
|
||||
{
|
||||
get { return _itemID; }
|
||||
set { _itemID = value; }
|
||||
@@ -385,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
public string proxyexcepts;
|
||||
public string OutboundBody;
|
||||
private UUID _reqID;
|
||||
public UUID ReqID
|
||||
public UUID ReqID
|
||||
{
|
||||
get { return _reqID; }
|
||||
set { _reqID = value; }
|
||||
@@ -434,20 +481,34 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
Request.Method = HttpMethod;
|
||||
Request.ContentType = HttpMIMEType;
|
||||
|
||||
if(!HttpVerifyCert)
|
||||
if (!HttpVerifyCert)
|
||||
{
|
||||
// We could hijack Connection Group Name to identify
|
||||
// a desired security exception. But at the moment we'll use a dummy header instead.
|
||||
Request.Headers.Add("NoVerifyCert", "true");
|
||||
}
|
||||
if (proxyurl != null && proxyurl.Length > 0)
|
||||
// else
|
||||
// {
|
||||
// Request.ConnectionGroupName="Verify";
|
||||
// }
|
||||
if (!HttpPragmaNoCache)
|
||||
{
|
||||
if (proxyexcepts != null && proxyexcepts.Length > 0)
|
||||
Request.Headers.Add("Pragma", "no-cache");
|
||||
}
|
||||
if (HttpCustomHeaders != null)
|
||||
{
|
||||
for (int i = 0; i < HttpCustomHeaders.Count; i += 2)
|
||||
Request.Headers.Add(HttpCustomHeaders[i],
|
||||
HttpCustomHeaders[i+1]);
|
||||
}
|
||||
if (proxyurl != null && proxyurl.Length > 0)
|
||||
{
|
||||
if (proxyexcepts != null && proxyexcepts.Length > 0)
|
||||
{
|
||||
string[] elist = proxyexcepts.Split(';');
|
||||
Request.Proxy = new WebProxy(proxyurl, true, elist);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
Request.Proxy = new WebProxy(proxyurl, true);
|
||||
}
|
||||
@@ -460,7 +521,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||
Request.Headers[entry.Key] = entry.Value;
|
||||
|
||||
// Encode outbound data
|
||||
if (OutboundBody.Length > 0)
|
||||
if (OutboundBody.Length > 0)
|
||||
{
|
||||
byte[] data = Util.UTF8.GetBytes(OutboundBody);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user