Thank you very much, Kmeisthax for:

This patch makes the "Show in Search" checkbox on the viewer work. Additionally, I also discovered that show-in-search objects use the JointWheel flag, so this patch currently uses that flag. LibSL needs to add a flag to enum LLObject.ObjectFlags, "IncludeSearch = 32768" so we aren't using a legacy flag.

Additionally this patch also contains a small fix to BaseHTTPServer that lets the response content-type to be something other than text/html. For some reason this didn't get submitted with the DataSnapshot merge.
0.6.0-stable
Charles Krinke 2008-04-16 03:55:21 +00:00
parent e777f88028
commit bf7e7b2c57
6 changed files with 82 additions and 3 deletions

View File

@ -435,6 +435,8 @@ namespace OpenSim.Framework
public delegate void EconomyDataRequest(LLUUID agentID); public delegate void EconomyDataRequest(LLUUID agentID);
public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID);
public interface IClientAPI public interface IClientAPI
{ {
event ImprovedInstantMessage OnInstantMessage; event ImprovedInstantMessage OnInstantMessage;
@ -549,7 +551,7 @@ namespace OpenSim.Framework
event UpdateAvatarProperties OnUpdateAvatarProperties; event UpdateAvatarProperties OnUpdateAvatarProperties;
event ParcelBuy OnParcelBuy; event ParcelBuy OnParcelBuy;
event ObjectIncludeInSearch OnObjectIncludeInSearch;
LLVector3 StartPos { get; set; } LLVector3 StartPos { get; set; }

View File

@ -440,6 +440,7 @@ namespace OpenSim.Framework.Servers
string[] querystringkeys = request.QueryString.AllKeys; string[] querystringkeys = request.QueryString.AllKeys;
string[] rHeaders = request.Headers.AllKeys; string[] rHeaders = request.Headers.AllKeys;
foreach (string queryname in querystringkeys) foreach (string queryname in querystringkeys)
{ {
keysvals.Add(queryname, request.QueryString[queryname]); keysvals.Add(queryname, request.QueryString[queryname]);
@ -487,7 +488,16 @@ namespace OpenSim.Framework.Servers
{ {
int responsecode = (int)responsedata["int_response_code"]; int responsecode = (int)responsedata["int_response_code"];
string responseString = (string)responsedata["str_response_string"]; string responseString = (string)responsedata["str_response_string"];
string contentType = (string)responsedata["content_type"];
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
//and should check for NullReferenceExceptions
if (contentType == null || contentType == "")
{
contentType = "text/html";
}
// We're forgoing the usual error status codes here because the client // We're forgoing the usual error status codes here because the client
// ignores anything but 200 and 301 // ignores anything but 200 and 301
@ -498,7 +508,8 @@ namespace OpenSim.Framework.Servers
response.RedirectLocation = (string)responsedata["str_redirect_location"]; response.RedirectLocation = (string)responsedata["str_redirect_location"];
response.StatusCode = responsecode; response.StatusCode = responsecode;
} }
response.AddHeader("Content-type", "text/html");
response.AddHeader("Content-type", contentType);
byte[] buffer = Encoding.UTF8.GetBytes(responseString); byte[] buffer = Encoding.UTF8.GetBytes(responseString);

View File

@ -163,6 +163,7 @@ namespace OpenSim.Region.ClientStack
private ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null; private ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null;
private ObjectSelect handlerObjectSelect = null; private ObjectSelect handlerObjectSelect = null;
private ObjectDeselect handlerObjectDeselect = null; private ObjectDeselect handlerObjectDeselect = null;
private ObjectIncludeInSearch handlerObjectIncludeInSearch = null;
private UpdatePrimFlags handlerUpdatePrimFlags = null; //OnUpdatePrimFlags; private UpdatePrimFlags handlerUpdatePrimFlags = null; //OnUpdatePrimFlags;
private UpdatePrimTexture handlerUpdatePrimTexture = null; private UpdatePrimTexture handlerUpdatePrimTexture = null;
private UpdateVector handlerGrabObject = null; //OnGrabObject; private UpdateVector handlerGrabObject = null; //OnGrabObject;
@ -699,6 +700,7 @@ namespace OpenSim.Region.ClientStack
public event ObjectDeselect OnObjectDeselect; public event ObjectDeselect OnObjectDeselect;
public event GenericCall7 OnObjectDescription; public event GenericCall7 OnObjectDescription;
public event GenericCall7 OnObjectName; public event GenericCall7 OnObjectName;
public event ObjectIncludeInSearch OnObjectIncludeInSearch;
public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
public event UpdatePrimFlags OnUpdatePrimFlags; public event UpdatePrimFlags OnUpdatePrimFlags;
public event UpdatePrimTexture OnUpdatePrimTexture; public event UpdatePrimTexture OnUpdatePrimTexture;
@ -3791,6 +3793,22 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
case PacketType.ObjectIncludeInSearch:
//This lets us set objects to appear in search (stuff like DataSnapshot, etc)
ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack;
handlerObjectIncludeInSearch = null;
foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData) {
bool inSearch = objData.IncludeInSearch;
uint localID = objData.ObjectLocalID;
handlerObjectIncludeInSearch = OnObjectIncludeInSearch;
if (handlerObjectIncludeInSearch != null) {
handlerObjectIncludeInSearch(this, inSearch, localID);
}
}
break;
#endregion #endregion

View File

@ -1236,6 +1236,50 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
{
LLUUID user = remoteClient.AgentId;
LLUUID objid = null;
SceneObjectPart obj = null;
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
{
foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children)
{
if (subent.Value.LocalId == localID)
{
objid = subent.Key;
obj = subent.Value;
}
}
}
}
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
//aka ObjectFlags.JointWheel = IncludeInSearch
//Permissions model: Object can be REMOVED from search IFF:
// * User owns object
//use CanEditObject
//Object can be ADDED to search IFF:
// * User owns object
// * Asset/DRM permission bit "modify" is enabled
//use CanEditObjectPosition
if (IncludeInSearch && PermissionsMngr.CanEditObject(user, objid))
{
obj.AddFlag(LLObject.ObjectFlags.JointWheel);
}
else if (!IncludeInSearch && PermissionsMngr.CanEditObjectPosition(user, objid))
{
obj.RemFlag(LLObject.ObjectFlags.JointWheel);
}
}
/// <summary> /// <summary>
/// Duplicate the given object. /// Duplicate the given object.
/// </summary> /// </summary>

View File

@ -1578,6 +1578,8 @@ namespace OpenSim.Region.Environment.Scenes
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
client.OnPacketStats += AddPacketStats; client.OnPacketStats += AddPacketStats;
client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable;
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
} }

View File

@ -161,6 +161,8 @@ namespace OpenSim.Region.Examples.SimpleModule
public event MoneyBalanceRequest OnMoneyBalanceRequest; public event MoneyBalanceRequest OnMoneyBalanceRequest;
public event UpdateAvatarProperties OnUpdateAvatarProperties; public event UpdateAvatarProperties OnUpdateAvatarProperties;
public event ObjectIncludeInSearch OnObjectIncludeInSearch;
#pragma warning restore 67 #pragma warning restore 67