diff options
author | Charles Krinke | 2008-04-16 03:55:21 +0000 |
---|---|---|
committer | Charles Krinke | 2008-04-16 03:55:21 +0000 |
commit | bf7e7b2c57d9b1d7d00f76bbae41093eaf267921 (patch) | |
tree | 31ab1bc76ee105b67225857850fd59073da0d131 | |
parent | * A tweak of the caps system so that new caps have random paths instead of a ... (diff) | |
download | opensim-SC_OLD-bf7e7b2c57d9b1d7d00f76bbae41093eaf267921.zip opensim-SC_OLD-bf7e7b2c57d9b1d7d00f76bbae41093eaf267921.tar.gz opensim-SC_OLD-bf7e7b2c57d9b1d7d00f76bbae41093eaf267921.tar.bz2 opensim-SC_OLD-bf7e7b2c57d9b1d7d00f76bbae41093eaf267921.tar.xz |
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.
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 44 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 |
6 files changed, 82 insertions, 3 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index cd59fa0..c0f7fce 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -435,6 +435,8 @@ namespace OpenSim.Framework | |||
435 | 435 | ||
436 | public delegate void EconomyDataRequest(LLUUID agentID); | 436 | public delegate void EconomyDataRequest(LLUUID agentID); |
437 | 437 | ||
438 | public delegate void ObjectIncludeInSearch(IClientAPI remoteClient, bool IncludeInSearch, uint localID); | ||
439 | |||
438 | public interface IClientAPI | 440 | public interface IClientAPI |
439 | { | 441 | { |
440 | event ImprovedInstantMessage OnInstantMessage; | 442 | event ImprovedInstantMessage OnInstantMessage; |
@@ -549,7 +551,7 @@ namespace OpenSim.Framework | |||
549 | event UpdateAvatarProperties OnUpdateAvatarProperties; | 551 | event UpdateAvatarProperties OnUpdateAvatarProperties; |
550 | event ParcelBuy OnParcelBuy; | 552 | event ParcelBuy OnParcelBuy; |
551 | 553 | ||
552 | 554 | event ObjectIncludeInSearch OnObjectIncludeInSearch; | |
553 | 555 | ||
554 | LLVector3 StartPos { get; set; } | 556 | LLVector3 StartPos { get; set; } |
555 | 557 | ||
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 0baddb8..de15923 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -440,6 +440,7 @@ namespace OpenSim.Framework.Servers | |||
440 | string[] querystringkeys = request.QueryString.AllKeys; | 440 | string[] querystringkeys = request.QueryString.AllKeys; |
441 | string[] rHeaders = request.Headers.AllKeys; | 441 | string[] rHeaders = request.Headers.AllKeys; |
442 | 442 | ||
443 | |||
443 | foreach (string queryname in querystringkeys) | 444 | foreach (string queryname in querystringkeys) |
444 | { | 445 | { |
445 | keysvals.Add(queryname, request.QueryString[queryname]); | 446 | keysvals.Add(queryname, request.QueryString[queryname]); |
@@ -487,7 +488,16 @@ namespace OpenSim.Framework.Servers | |||
487 | { | 488 | { |
488 | int responsecode = (int)responsedata["int_response_code"]; | 489 | int responsecode = (int)responsedata["int_response_code"]; |
489 | string responseString = (string)responsedata["str_response_string"]; | 490 | string responseString = (string)responsedata["str_response_string"]; |
490 | 491 | string contentType = (string)responsedata["content_type"]; | |
492 | |||
493 | //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this | ||
494 | //and should check for NullReferenceExceptions | ||
495 | |||
496 | if (contentType == null || contentType == "") | ||
497 | { | ||
498 | contentType = "text/html"; | ||
499 | } | ||
500 | |||
491 | // We're forgoing the usual error status codes here because the client | 501 | // We're forgoing the usual error status codes here because the client |
492 | // ignores anything but 200 and 301 | 502 | // ignores anything but 200 and 301 |
493 | 503 | ||
@@ -498,7 +508,8 @@ namespace OpenSim.Framework.Servers | |||
498 | response.RedirectLocation = (string)responsedata["str_redirect_location"]; | 508 | response.RedirectLocation = (string)responsedata["str_redirect_location"]; |
499 | response.StatusCode = responsecode; | 509 | response.StatusCode = responsecode; |
500 | } | 510 | } |
501 | response.AddHeader("Content-type", "text/html"); | 511 | |
512 | response.AddHeader("Content-type", contentType); | ||
502 | 513 | ||
503 | byte[] buffer = Encoding.UTF8.GetBytes(responseString); | 514 | byte[] buffer = Encoding.UTF8.GetBytes(responseString); |
504 | 515 | ||
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index f065bae..dba5b38 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -163,6 +163,7 @@ namespace OpenSim.Region.ClientStack | |||
163 | private ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null; | 163 | private ObjectDuplicateOnRay handlerObjectDuplicateOnRay = null; |
164 | private ObjectSelect handlerObjectSelect = null; | 164 | private ObjectSelect handlerObjectSelect = null; |
165 | private ObjectDeselect handlerObjectDeselect = null; | 165 | private ObjectDeselect handlerObjectDeselect = null; |
166 | private ObjectIncludeInSearch handlerObjectIncludeInSearch = null; | ||
166 | private UpdatePrimFlags handlerUpdatePrimFlags = null; //OnUpdatePrimFlags; | 167 | private UpdatePrimFlags handlerUpdatePrimFlags = null; //OnUpdatePrimFlags; |
167 | private UpdatePrimTexture handlerUpdatePrimTexture = null; | 168 | private UpdatePrimTexture handlerUpdatePrimTexture = null; |
168 | private UpdateVector handlerGrabObject = null; //OnGrabObject; | 169 | private UpdateVector handlerGrabObject = null; //OnGrabObject; |
@@ -699,6 +700,7 @@ namespace OpenSim.Region.ClientStack | |||
699 | public event ObjectDeselect OnObjectDeselect; | 700 | public event ObjectDeselect OnObjectDeselect; |
700 | public event GenericCall7 OnObjectDescription; | 701 | public event GenericCall7 OnObjectDescription; |
701 | public event GenericCall7 OnObjectName; | 702 | public event GenericCall7 OnObjectName; |
703 | public event ObjectIncludeInSearch OnObjectIncludeInSearch; | ||
702 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 704 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
703 | public event UpdatePrimFlags OnUpdatePrimFlags; | 705 | public event UpdatePrimFlags OnUpdatePrimFlags; |
704 | public event UpdatePrimTexture OnUpdatePrimTexture; | 706 | public event UpdatePrimTexture OnUpdatePrimTexture; |
@@ -3791,6 +3793,22 @@ namespace OpenSim.Region.ClientStack | |||
3791 | } | 3793 | } |
3792 | 3794 | ||
3793 | break; | 3795 | break; |
3796 | case PacketType.ObjectIncludeInSearch: | ||
3797 | //This lets us set objects to appear in search (stuff like DataSnapshot, etc) | ||
3798 | ObjectIncludeInSearchPacket packInSearch = (ObjectIncludeInSearchPacket)Pack; | ||
3799 | handlerObjectIncludeInSearch = null; | ||
3800 | |||
3801 | foreach (ObjectIncludeInSearchPacket.ObjectDataBlock objData in packInSearch.ObjectData) { | ||
3802 | bool inSearch = objData.IncludeInSearch; | ||
3803 | uint localID = objData.ObjectLocalID; | ||
3804 | |||
3805 | handlerObjectIncludeInSearch = OnObjectIncludeInSearch; | ||
3806 | |||
3807 | if (handlerObjectIncludeInSearch != null) { | ||
3808 | handlerObjectIncludeInSearch(this, inSearch, localID); | ||
3809 | } | ||
3810 | } | ||
3811 | break; | ||
3794 | 3812 | ||
3795 | #endregion | 3813 | #endregion |
3796 | 3814 | ||
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 0838387..ea4283f 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -1236,6 +1236,50 @@ namespace OpenSim.Region.Environment.Scenes | |||
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | public void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) | ||
1240 | { | ||
1241 | LLUUID user = remoteClient.AgentId; | ||
1242 | LLUUID objid = null; | ||
1243 | SceneObjectPart obj = null; | ||
1244 | |||
1245 | List<EntityBase> EntityList = GetEntities(); | ||
1246 | foreach (EntityBase ent in EntityList) | ||
1247 | { | ||
1248 | if (ent is SceneObjectGroup) | ||
1249 | { | ||
1250 | foreach (KeyValuePair<LLUUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children) | ||
1251 | { | ||
1252 | if (subent.Value.LocalId == localID) | ||
1253 | { | ||
1254 | objid = subent.Key; | ||
1255 | obj = subent.Value; | ||
1256 | } | ||
1257 | } | ||
1258 | } | ||
1259 | } | ||
1260 | |||
1261 | //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints | ||
1262 | //aka ObjectFlags.JointWheel = IncludeInSearch | ||
1263 | |||
1264 | //Permissions model: Object can be REMOVED from search IFF: | ||
1265 | // * User owns object | ||
1266 | //use CanEditObject | ||
1267 | |||
1268 | //Object can be ADDED to search IFF: | ||
1269 | // * User owns object | ||
1270 | // * Asset/DRM permission bit "modify" is enabled | ||
1271 | //use CanEditObjectPosition | ||
1272 | |||
1273 | if (IncludeInSearch && PermissionsMngr.CanEditObject(user, objid)) | ||
1274 | { | ||
1275 | obj.AddFlag(LLObject.ObjectFlags.JointWheel); | ||
1276 | } | ||
1277 | else if (!IncludeInSearch && PermissionsMngr.CanEditObjectPosition(user, objid)) | ||
1278 | { | ||
1279 | obj.RemFlag(LLObject.ObjectFlags.JointWheel); | ||
1280 | } | ||
1281 | } | ||
1282 | |||
1239 | /// <summary> | 1283 | /// <summary> |
1240 | /// Duplicate the given object. | 1284 | /// Duplicate the given object. |
1241 | /// </summary> | 1285 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 957c75c..464926d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1578,6 +1578,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1578 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 1578 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
1579 | client.OnPacketStats += AddPacketStats; | 1579 | client.OnPacketStats += AddPacketStats; |
1580 | 1580 | ||
1581 | client.OnObjectIncludeInSearch += m_innerScene.MakeObjectSearchable; | ||
1582 | |||
1581 | EventManager.TriggerOnNewClient(client); | 1583 | EventManager.TriggerOnNewClient(client); |
1582 | } | 1584 | } |
1583 | 1585 | ||
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 23b3015..d5dc937 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -161,6 +161,8 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
161 | public event MoneyBalanceRequest OnMoneyBalanceRequest; | 161 | public event MoneyBalanceRequest OnMoneyBalanceRequest; |
162 | public event UpdateAvatarProperties OnUpdateAvatarProperties; | 162 | public event UpdateAvatarProperties OnUpdateAvatarProperties; |
163 | 163 | ||
164 | public event ObjectIncludeInSearch OnObjectIncludeInSearch; | ||
165 | |||
164 | 166 | ||
165 | #pragma warning restore 67 | 167 | #pragma warning restore 67 |
166 | 168 | ||