aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2016-08-19 03:05:25 +0100
committerUbitUmarov2016-08-19 03:05:25 +0100
commit7ba3fb7b5d9c883b7a99d19f893ff6d43689b629 (patch)
tree1ea4937e30520d440979ab02e92882f6f54a3e73 /OpenSim
parentfix entity update flags update (diff)
parent catch some NULL refs (diff)
downloadopensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.zip
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.gz
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.bz2
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.xz
merge issue
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs4
-rw-r--r--OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs58
-rw-r--r--OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs2
-rw-r--r--OpenSim/Framework/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/Util.cs3
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs472
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs21
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs7
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs12
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs60
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs146
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs19
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs13
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs53
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs60
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs12
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEventQueue.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs67
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs55
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs352
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs32
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs8
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs5
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs100
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs5
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs13
-rw-r--r--OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs4
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs2
-rw-r--r--OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs48
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs5
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs92
-rw-r--r--OpenSim/Services/HypergridService/UserAccountCache.cs5
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs1
-rw-r--r--OpenSim/Services/Interfaces/IUserManagement.cs1
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs13
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs5
44 files changed, 1135 insertions, 681 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index 73fc22c..57fbbf7 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -764,7 +764,7 @@ namespace OpenSim.Groups
764 } 764 }
765 765
766 // check funds 766 // check funds
767 // is there is a money module present ? 767 // is there a money module present ?
768 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); 768 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
769 if (money != null) 769 if (money != null)
770 { 770 {
@@ -784,7 +784,7 @@ namespace OpenSim.Groups
784 if (money != null) 784 if (money != null)
785 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate); 785 money.ApplyCharge(remoteClient.AgentId, money.GroupCreationCharge, MoneyTransactionType.GroupCreate);
786 786
787 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 787 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
788 788
789 // Update the founder with new group information. 789 // Update the founder with new group information.
790 SendAgentGroupDataUpdate(remoteClient, false); 790 SendAgentGroupDataUpdate(remoteClient, false);
diff --git a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs
index 155196c..3e01bbb 100644
--- a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesHandler.cs
@@ -29,8 +29,6 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections.Specialized; 31using System.Collections.Specialized;
32using System.Drawing;
33using System.Drawing.Imaging;
34using System.Reflection; 32using System.Reflection;
35using System.IO; 33using System.IO;
36using System.Web; 34using System.Web;
@@ -38,12 +36,7 @@ using log4net;
38using Nini.Config; 36using Nini.Config;
39using OpenMetaverse; 37using OpenMetaverse;
40using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
41using OpenMetaverse.Imaging;
42using OpenSim.Framework;
43using OpenSim.Framework.Capabilities;
44using OpenSim.Framework.Servers;
45using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
48using Caps = OpenSim.Framework.Capabilities.Caps; 41using Caps = OpenSim.Framework.Capabilities.Caps;
49using OSDMap = OpenMetaverse.StructuredData.OSDMap; 42using OSDMap = OpenMetaverse.StructuredData.OSDMap;
@@ -70,7 +63,6 @@ namespace OpenSim.Capabilities.Handlers
70 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); 63 NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
71 string[] ids = query.GetValues("ids"); 64 string[] ids = query.GetValues("ids");
72 65
73
74 if (m_UserManagement == null) 66 if (m_UserManagement == null)
75 { 67 {
76 m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component"); 68 m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component");
@@ -78,35 +70,39 @@ namespace OpenSim.Capabilities.Handlers
78 return new byte[0]; 70 return new byte[0];
79 } 71 }
80 72
73 Dictionary<UUID,string> names = m_UserManagement.GetUsersNames(ids);
74
81 OSDMap osdReply = new OSDMap(); 75 OSDMap osdReply = new OSDMap();
82 OSDArray agents = new OSDArray(); 76 OSDArray agents = new OSDArray();
83 77
84 osdReply["agents"] = agents; 78 osdReply["agents"] = agents;
85 foreach (string id in ids) 79 foreach (KeyValuePair<UUID,string> kvp in names)
86 { 80 {
87 UUID uuid = UUID.Zero; 81 if (string.IsNullOrEmpty(kvp.Value))
88 if (UUID.TryParse(id, out uuid)) 82 continue;
89 { 83 if(kvp.Key == UUID.Zero)
90 string name = m_UserManagement.GetUserName(uuid); 84 continue;
91 if (!string.IsNullOrEmpty(name))
92 {
93 string[] parts = name.Split(new char[] {' '});
94 OSDMap osdname = new OSDMap();
95 // a date that is valid
96// osdname["display_name_next_update"] = OSD.FromDate(new DateTime(1970,1,1));
97 // but send one that blocks edition, since we actually don't suport this
98 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
99 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
100 osdname["display_name"] = OSD.FromString(name);
101 osdname["legacy_first_name"] = parts[0];
102 osdname["legacy_last_name"] = parts[1];
103 osdname["username"] = OSD.FromString(name);
104 osdname["id"] = OSD.FromUUID(uuid);
105 osdname["is_display_name_default"] = OSD.FromBoolean(true);
106 85
107 agents.Add(osdname); 86 string[] parts = kvp.Value.Split(new char[] {' '});
108 } 87 OSDMap osdname = new OSDMap();
88 if(parts[0] == "Unknown")
89 {
90 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
91 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
109 } 92 }
93 else
94 {
95 osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
96 osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
97 }
98 osdname["display_name"] = OSD.FromString(kvp.Value);
99 osdname["legacy_first_name"] = parts[0];
100 osdname["legacy_last_name"] = parts[1];
101 osdname["username"] = OSD.FromString(kvp.Value);
102 osdname["id"] = OSD.FromUUID(kvp.Key);
103 osdname["is_display_name_default"] = OSD.FromBoolean(true);
104
105 agents.Add(osdname);
110 } 106 }
111 107
112 // Full content request 108 // Full content request
@@ -116,8 +112,6 @@ namespace OpenSim.Capabilities.Handlers
116 112
117 string reply = OSDParser.SerializeLLSDXmlString(osdReply); 113 string reply = OSDParser.SerializeLLSDXmlString(osdReply);
118 return System.Text.Encoding.UTF8.GetBytes(reply); 114 return System.Text.Encoding.UTF8.GetBytes(reply);
119
120 } 115 }
121
122 } 116 }
123} 117}
diff --git a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs
index d42de56..8f70c97 100644
--- a/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs
+++ b/OpenSim/Capabilities/Handlers/GetDisplayNames/GetDisplayNamesServerConnector.cs
@@ -61,8 +61,6 @@ namespace OpenSim.Capabilities.Handlers
61 61
62 if (m_UserManagement == null) 62 if (m_UserManagement == null)
63 throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName)); 63 throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
64
65 string rurl = serverConfig.GetString("GetTextureRedirectURL");
66 64
67 server.AddStreamHandler( 65 server.AddStreamHandler(
68 new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null)); 66 new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 848d574..c046010 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1256,9 +1256,11 @@ namespace OpenSim.Framework
1256 void SendAttachedSoundGainChange(UUID objectID, float gain); 1256 void SendAttachedSoundGainChange(UUID objectID, float gain);
1257 1257
1258 void SendNameReply(UUID profileId, string firstname, string lastname); 1258 void SendNameReply(UUID profileId, string firstname, string lastname);
1259 void SendAlertMessage(string message);
1260 1259
1260 void SendAlertMessage(string message);
1261 void SendAlertMessage(string message, string into);
1261 void SendAgentAlertMessage(string message, bool modal); 1262 void SendAgentAlertMessage(string message, bool modal);
1263
1262 void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url); 1264 void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url);
1263 1265
1264 /// <summary> 1266 /// <summary>
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5250d30..96b91ff 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -382,7 +382,8 @@ namespace OpenSim.Framework
382 382
383 public static ulong RegionGridLocToHandle(uint X, uint Y) 383 public static ulong RegionGridLocToHandle(uint X, uint Y)
384 { 384 {
385 ulong handle = X << 40; // shift to higher half and mult by 256) 385 ulong handle = X;
386 handle <<= 40; // shift to higher half and mult by 256)
386 handle |= (Y << 8); // mult by 256) 387 handle |= (Y << 8); // mult by 256)
387 return handle; 388 return handle;
388 } 389 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 19619c1..60bfaa5 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -41,6 +41,7 @@ using log4net;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Capabilities; 42using OpenSim.Framework.Capabilities;
43using OpenSim.Region.Framework; 43using OpenSim.Region.Framework;
44using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Framework.Scenes.Serialization; 46using OpenSim.Region.Framework.Scenes.Serialization;
46using OpenSim.Framework.Servers; 47using OpenSim.Framework.Servers;
@@ -89,23 +90,11 @@ namespace OpenSim.Region.ClientStack.Linden
89 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 90 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
90 91
91 private Scene m_Scene; 92 private Scene m_Scene;
93 private UUID m_AgentID;
92 private Caps m_HostCapsObj; 94 private Caps m_HostCapsObj;
93 private ModelCost m_ModelCost; 95 private ModelCost m_ModelCost;
94 96
95 private static readonly string m_requestPath = "0000/";
96 // private static readonly string m_mapLayerPath = "0001/";
97 private static readonly string m_newInventory = "0002/";
98 //private static readonly string m_requestTexture = "0003/";
99 private static readonly string m_notecardUpdatePath = "0004/";
100 private static readonly string m_notecardTaskUpdatePath = "0005/";
101 // private static readonly string m_fetchInventoryPath = "0006/";
102 private static readonly string m_copyFromNotecardPath = "0007/";
103 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule. 97 // private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
104 private static readonly string m_getObjectPhysicsDataPath = "0101/";
105 private static readonly string m_getObjectCostPath = "0102/";
106 private static readonly string m_ResourceCostSelectedPath = "0103/";
107 private static readonly string m_UpdateAgentInformationPath = "0500/";
108 private static readonly string m_animSetTaskUpdatePath = "0260/";
109 98
110 // These are callbacks which will be setup by the scene so that we can update scene data when we 99 // These are callbacks which will be setup by the scene so that we can update scene data when we
111 // receive capability calls 100 // receive capability calls
@@ -134,6 +123,9 @@ namespace OpenSim.Region.ClientStack.Linden
134 123
135 private float m_PrimScaleMin = 0.001f; 124 private float m_PrimScaleMin = 0.001f;
136 125
126 private bool m_AllowCapHomeLocation = true;
127 private bool m_AllowCapGroupMemberData = true;
128
137 private enum FileAgentInventoryState : int 129 private enum FileAgentInventoryState : int
138 { 130 {
139 idle = 0, 131 idle = 0,
@@ -143,27 +135,16 @@ namespace OpenSim.Region.ClientStack.Linden
143 } 135 }
144 private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle; 136 private FileAgentInventoryState m_FileAgentInventoryState = FileAgentInventoryState.idle;
145 137
146 public BunchOfCaps(Scene scene, Caps caps) 138 public BunchOfCaps(Scene scene, UUID agentID, Caps caps)
147 { 139 {
148 m_Scene = scene; 140 m_Scene = scene;
141 m_AgentID = agentID;
149 m_HostCapsObj = caps; 142 m_HostCapsObj = caps;
150 143
151 // create a model upload cost provider 144 // create a model upload cost provider
152 m_ModelCost = new ModelCost(); 145 m_ModelCost = new ModelCost(scene);
153 // tell it about scene object limits 146
154 m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys;
155 m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys;
156 m_ModelCost.ObjectLinkedPartsMax = m_Scene.m_linksetCapacity;
157
158// m_ModelCost.ObjectLinkedPartsMax = ??
159// m_ModelCost.PrimScaleMin = ??
160
161 m_PrimScaleMin = m_ModelCost.PrimScaleMin; 147 m_PrimScaleMin = m_ModelCost.PrimScaleMin;
162 float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor;
163 float modelUploadFactor = m_ModelCost.ModelMeshCostFactor;
164 float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor;
165 float modelPrimCreationCost = m_ModelCost.primCreationCost;
166 float modelMeshByteCost = m_ModelCost.bytecost;
167 148
168 IConfigSource config = m_Scene.Config; 149 IConfigSource config = m_Scene.Config;
169 if (config != null) 150 if (config != null)
@@ -183,12 +164,7 @@ namespace OpenSim.Region.ClientStack.Linden
183 IConfig EconomyConfig = config.Configs["Economy"]; 164 IConfig EconomyConfig = config.Configs["Economy"];
184 if (EconomyConfig != null) 165 if (EconomyConfig != null)
185 { 166 {
186 modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); 167 m_ModelCost.Econfig(EconomyConfig);
187 modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor);
188 modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor);
189 // next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost
190 modelPrimCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", modelPrimCreationCost);
191 modelMeshByteCost = EconomyConfig.GetFloat("ModelMeshByteCost", modelMeshByteCost);
192 168
193 m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory); 169 m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory);
194 170
@@ -203,12 +179,18 @@ namespace OpenSim.Region.ClientStack.Linden
203 if (id != null) 179 if (id != null)
204 m_testAssetsCreatorID = id; 180 m_testAssetsCreatorID = id;
205 } 181 }
182 }
206 183
207 m_ModelCost.ModelMeshCostFactor = modelUploadFactor; 184 IConfig CapsConfig = config.Configs["ClientStack.LindenCaps"];
208 m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; 185 if (CapsConfig != null)
209 m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; 186 {
210 m_ModelCost.primCreationCost = modelPrimCreationCost; 187 string homeLocationUrl = CapsConfig.GetString("Cap_HomeLocation", "localhost");
211 m_ModelCost.bytecost = modelMeshByteCost; 188 if(homeLocationUrl == String.Empty)
189 m_AllowCapHomeLocation = false;
190
191 string GroupMemberDataUrl = CapsConfig.GetString("Cap_GroupMemberData", "localhost");
192 if(GroupMemberDataUrl == String.Empty)
193 m_AllowCapGroupMemberData = false;
212 } 194 }
213 } 195 }
214 196
@@ -225,51 +207,71 @@ namespace OpenSim.Region.ClientStack.Linden
225 m_FileAgentInventoryState = FileAgentInventoryState.idle; 207 m_FileAgentInventoryState = FileAgentInventoryState.idle;
226 } 208 }
227 209
210 public string GetNewCapPath()
211 {
212 return "/CAPS/" + UUID.Random();
213 }
214
228 /// <summary> 215 /// <summary>
229 /// Register a bunch of CAPS http service handlers 216 /// Register a bunch of CAPS http service handlers
230 /// </summary> 217 /// </summary>
231 public void RegisterHandlers() 218 public void RegisterHandlers()
232 { 219 {
233 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 220 // this path is also defined elsewhere so keeping it
221 string seedcapsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath +"0000/";
222
223 // the root of all evil path needs to be capsBase + m_requestPath
224 m_HostCapsObj.RegisterHandler(
225 "SEED", new RestStreamHandler("POST", seedcapsBase, SeedCapRequest, "SEED", null));
234 226
235 RegisterRegionServiceHandlers(capsBase); 227// m_log.DebugFormat(
236 RegisterInventoryServiceHandlers(capsBase); 228// "[CAPS]: Registered seed capability {0} for {1}", seedcapsBase, m_HostCapsObj.AgentID);
229
230 RegisterRegionServiceHandlers();
231 RegisterInventoryServiceHandlers();
237 } 232 }
238 233
239 public void RegisterRegionServiceHandlers(string capsBase) 234 public void RegisterRegionServiceHandlers()
240 { 235 {
241 try 236 try
242 { 237 {
243 // the root of all evil
244 m_HostCapsObj.RegisterHandler(
245 "SEED", new RestStreamHandler("POST", capsBase + m_requestPath, SeedCapRequest, "SEED", null));
246
247// m_log.DebugFormat(
248// "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_HostCapsObj.AgentID);
249
250 //m_capsHandlers["MapLayer"] = 238 //m_capsHandlers["MapLayer"] =
251 // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", 239 // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
252 // capsBase + m_mapLayerPath, 240 // GetNewCapPath(),
253 // GetMapLayer); 241 // GetMapLayer);
254 242
255 IRequestHandler getObjectPhysicsDataHandler 243 IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler(
256 = new RestStreamHandler( 244 "POST", GetNewCapPath(), GetObjectPhysicsData, "GetObjectPhysicsData", null);
257 "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null);
258 m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); 245 m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
259 246
260 IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); 247 IRequestHandler getObjectCostHandler = new RestStreamHandler(
248 "POST", GetNewCapPath(), GetObjectCost, "GetObjectCost", null );
261 m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); 249 m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
262 IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected);
263 m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
264
265 250
266 IRequestHandler req 251 IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler(
267 = new RestStreamHandler( 252 "POST", GetNewCapPath(), ResourceCostSelected, "ResourceCostSelected", null);
268 "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); 253 m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
269 254
255 IRequestHandler req = new RestStreamHandler(
256 "POST", GetNewCapPath(), ScriptTaskInventory, "UpdateScript", null);
270 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); 257 m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req);
271 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); 258 m_HostCapsObj.RegisterHandler("UpdateScriptTask", req);
272 259
260 if(m_AllowCapHomeLocation)
261 {
262 IRequestHandler HomeLocationHandler = new RestStreamHandler(
263 "POST", GetNewCapPath(), HomeLocation, "HomeLocation", null);
264 m_HostCapsObj.RegisterHandler("HomeLocation", HomeLocationHandler);
265 }
266
267 if(m_AllowCapGroupMemberData)
268 {
269 IRequestHandler GroupMemberDataHandler = new RestStreamHandler(
270 "POST", GetNewCapPath(), GroupMemberData, "GroupMemberData", null);
271 m_HostCapsObj.RegisterHandler("GroupMemberData", GroupMemberDataHandler);
272 }
273
274
273// IRequestHandler animSetRequestHandler 275// IRequestHandler animSetRequestHandler
274// = new RestStreamHandler( 276// = new RestStreamHandler(
275// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null); 277// "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null);
@@ -282,65 +284,29 @@ namespace OpenSim.Region.ClientStack.Linden
282 } 284 }
283 } 285 }
284 286
285 public void RegisterInventoryServiceHandlers(string capsBase) 287 public void RegisterInventoryServiceHandlers()
286 { 288 {
287 try 289 try
288 { 290 {
289 m_HostCapsObj.RegisterHandler( 291 m_HostCapsObj.RegisterHandler("NewFileAgentInventory",
290 "NewFileAgentInventory",
291 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>( 292 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>(
292 "POST", 293 "POST", GetNewCapPath(), NewAgentInventoryRequest, "NewFileAgentInventory", null));
293 capsBase + m_newInventory,
294 NewAgentInventoryRequest,
295 "NewFileAgentInventory",
296 null));
297
298 IRequestHandler req
299 = new RestStreamHandler(
300 "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null);
301 294
295 IRequestHandler req = new RestStreamHandler(
296 "POST", GetNewCapPath(), NoteCardAgentInventory, "Update*", null);
302 m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); 297 m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
303 m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req); 298 m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req);
304 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); 299 m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
305 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); 300 m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
306 301
307 302 IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler(
308 303 "POST", GetNewCapPath(), UpdateAgentInformation, "UpdateAgentInformation", null);
309 IRequestHandler UpdateAgentInformationHandler
310 = new RestStreamHandler(
311 "POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation, "UpdateAgentInformation", null);
312 m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); 304 m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler);
313 305
314 m_HostCapsObj.RegisterHandler( 306 IRequestHandler CopyInventoryFromNotecardHandler = new RestStreamHandler(
315 "CopyInventoryFromNotecard", 307 "POST", GetNewCapPath(), CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null);
316 new RestStreamHandler( 308 m_HostCapsObj.RegisterHandler("CopyInventoryFromNotecard", CopyInventoryFromNotecardHandler);
317 "POST", capsBase + m_copyFromNotecardPath, CopyInventoryFromNotecard, "CopyInventoryFromNotecard", null));
318 309
319 // As of RC 1.22.9 of the Linden client this is
320 // supported
321
322 //m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
323
324 // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
325 // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
326 // enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service,
327 // but when I went on the Linden grid, the
328 // simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead,
329 // the 1.19.1.4 client appeared to be happily flowing inventory data over UDP
330 //
331 // This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid
332 // we will be
333 // able to get the data we need to implement the necessary part of the protocol to fix the issue above.
334 // m_capsHandlers["FetchInventoryDescendents"] =
335 // new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest);
336
337 // m_capsHandlers["FetchInventoryDescendents"] =
338 // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
339 // capsBase + m_fetchInventory,
340 // FetchInventory));
341 // m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST",
342 // capsBase + m_requestTexture,
343 // RequestTexture);
344 } 310 }
345 catch (Exception e) 311 catch (Exception e)
346 { 312 {
@@ -409,30 +375,28 @@ namespace OpenSim.Region.ClientStack.Linden
409 LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); 375 LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate();
410 LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest); 376 LLSDHelpers.DeserialiseOSDMap(hash, llsdUpdateRequest);
411 377
412 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 378 string uploaderPath = GetNewCapPath();
413 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
414 379
415 TaskInventoryScriptUpdater uploader = 380 TaskInventoryScriptUpdater uploader =
416 new TaskInventoryScriptUpdater( 381 new TaskInventoryScriptUpdater(
417 llsdUpdateRequest.item_id, 382 llsdUpdateRequest.item_id,
418 llsdUpdateRequest.task_id, 383 llsdUpdateRequest.task_id,
419 llsdUpdateRequest.is_script_running, 384 llsdUpdateRequest.is_script_running,
420 capsBase + uploaderPath, 385 uploaderPath,
421 m_HostCapsObj.HttpListener, 386 m_HostCapsObj.HttpListener,
422 m_dumpAssetsToFile); 387 m_dumpAssetsToFile);
423 uploader.OnUpLoad += TaskScriptUpdated; 388 uploader.OnUpLoad += TaskScriptUpdated;
424 389
425 m_HostCapsObj.HttpListener.AddStreamHandler( 390 m_HostCapsObj.HttpListener.AddStreamHandler(
426 new BinaryStreamHandler( 391 new BinaryStreamHandler(
427 "POST", capsBase + uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null)); 392 "POST", uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null));
428 393
429 string protocol = "http://"; 394 string protocol = "http://";
430 395
431 if (m_HostCapsObj.SSLCaps) 396 if (m_HostCapsObj.SSLCaps)
432 protocol = "https://"; 397 protocol = "https://";
433 398
434 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + 399 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
435 uploaderPath;
436 400
437 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 401 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
438 uploadResponse.uploader = uploaderURL; 402 uploadResponse.uploader = uploaderURL;
@@ -653,11 +617,10 @@ namespace OpenSim.Region.ClientStack.Linden
653 } 617 }
654 618
655 string assetDes = llsdRequest.description; 619 string assetDes = llsdRequest.description;
656 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
657 UUID newAsset = UUID.Random(); 620 UUID newAsset = UUID.Random();
658 UUID newInvItem = UUID.Random(); 621 UUID newInvItem = UUID.Random();
659 UUID parentFolder = llsdRequest.folder_id; 622 UUID parentFolder = llsdRequest.folder_id;
660 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 623 string uploaderPath = GetNewCapPath();
661 UUID texturesFolder = UUID.Zero; 624 UUID texturesFolder = UUID.Zero;
662 625
663 if(!IsAtestUpload && m_enableModelUploadTextureToInventory) 626 if(!IsAtestUpload && m_enableModelUploadTextureToInventory)
@@ -665,26 +628,23 @@ namespace OpenSim.Region.ClientStack.Linden
665 628
666 AssetUploader uploader = 629 AssetUploader uploader =
667 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, 630 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
668 llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, 631 llsdRequest.asset_type, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
669 texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, 632 texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload,
670 llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask); 633 llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask);
671 634
672 m_HostCapsObj.HttpListener.AddStreamHandler( 635 m_HostCapsObj.HttpListener.AddStreamHandler(
673 new BinaryStreamHandler( 636 new BinaryStreamHandler(
674 "POST", 637 "POST",
675 capsBase + uploaderPath, 638 uploaderPath,
676 uploader.uploaderCaps, 639 uploader.uploaderCaps,
677 "NewAgentInventoryRequest", 640 "NewAgentInventoryRequest",
678 m_HostCapsObj.AgentID.ToString())); 641 m_HostCapsObj.AgentID.ToString()));
679 642
680 string protocol = "http://"; 643 string protocol = "http://";
681
682 if (m_HostCapsObj.SSLCaps) 644 if (m_HostCapsObj.SSLCaps)
683 protocol = "https://"; 645 protocol = "https://";
684 646
685 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + 647 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
686 uploaderPath;
687
688 648
689 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 649 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
690 uploadResponse.uploader = uploaderURL; 650 uploadResponse.uploader = uploaderURL;
@@ -1313,24 +1273,22 @@ namespace OpenSim.Region.ClientStack.Linden
1313 LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); 1273 LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
1314 LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest); 1274 LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);
1315 1275
1316 string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; 1276 string uploaderPath = GetNewCapPath();
1317 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
1318 1277
1319 ItemUpdater uploader = 1278 ItemUpdater uploader =
1320 new ItemUpdater(llsdRequest.item_id, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile); 1279 new ItemUpdater(llsdRequest.item_id, uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile);
1321 uploader.OnUpLoad += ItemUpdated; 1280 uploader.OnUpLoad += ItemUpdated;
1322 1281
1323 m_HostCapsObj.HttpListener.AddStreamHandler( 1282 m_HostCapsObj.HttpListener.AddStreamHandler(
1324 new BinaryStreamHandler( 1283 new BinaryStreamHandler(
1325 "POST", capsBase + uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null)); 1284 "POST", uploaderPath, uploader.uploaderCaps, "NoteCardAgentInventory", null));
1326 1285
1327 string protocol = "http://"; 1286 string protocol = "http://";
1328 1287
1329 if (m_HostCapsObj.SSLCaps) 1288 if (m_HostCapsObj.SSLCaps)
1330 protocol = "https://"; 1289 protocol = "https://";
1331 1290
1332 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + capsBase + 1291 string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
1333 uploaderPath;
1334 1292
1335 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 1293 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
1336 uploadResponse.uploader = uploaderURL; 1294 uploadResponse.uploader = uploaderURL;
@@ -1576,6 +1534,266 @@ namespace OpenSim.Region.ClientStack.Linden
1576 string response = OSDParser.SerializeLLSDXmlString(resp); 1534 string response = OSDParser.SerializeLLSDXmlString(resp);
1577 return response; 1535 return response;
1578 } 1536 }
1537
1538 public bool OSDMapTOVector3(OSDMap map, out Vector3 v)
1539 {
1540 v = Vector3.Zero;
1541 if(!map.ContainsKey("X"))
1542 return false;
1543 if(!map.ContainsKey("Y"))
1544 return false;
1545 if(!map.ContainsKey("Z"))
1546 return false;
1547 v.X = (float)map["X"].AsReal();
1548 v.Y = (float)map["Y"].AsReal();
1549 v.Z = (float)map["Z"].AsReal();
1550 return true;
1551 }
1552
1553 public string HomeLocation(string request, string path, string param, IOSHttpRequest httpRequest,
1554 IOSHttpResponse httpResponse)
1555 {
1556 OSDMap resp = new OSDMap();
1557
1558 resp["success"] = "false";
1559
1560
1561 bool fail = true;
1562 string message = "Set Home request failed";
1563 int locationID = 1;
1564 Vector3 pos = Vector3.Zero;
1565 Vector3 lookAt = Vector3.Zero;
1566
1567 IClientAPI client = null;
1568 ScenePresence sp;
1569
1570 while(true)
1571 {
1572 if(m_Scene.GridUserService == null)
1573 break;
1574
1575 if(m_Scene.UserManagementModule == null)
1576 break;
1577
1578 m_Scene.TryGetScenePresence(m_AgentID, out sp);
1579 if(sp == null || sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit)
1580 break;
1581
1582 client = sp.ControllingClient;
1583
1584 if(!m_Scene.UserManagementModule.IsLocalGridUser(m_AgentID))
1585 break;
1586
1587 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1588 if(!req.ContainsKey("HomeLocation"))
1589 break;
1590
1591 OSDMap HLocation = (OSDMap)req["HomeLocation"];
1592 if(!HLocation.ContainsKey("LocationPos"))
1593 break;
1594 if(!HLocation.ContainsKey("LocationLookAt"))
1595 break;
1596
1597 locationID = HLocation["LocationId"].AsInteger();
1598
1599 if(!OSDMapTOVector3((OSDMap)HLocation["LocationPos"], out pos))
1600 break;
1601
1602 if(!OSDMapTOVector3((OSDMap)HLocation["LocationLookAt"], out lookAt))
1603 break;
1604
1605 ILandObject land = m_Scene.LandChannel.GetLandObject(pos);
1606 if(land == null)
1607 break;
1608
1609 ulong gpowers = client.GetGroupPowers(land.LandData.GroupID);
1610 SceneObjectGroup telehub = null;
1611 if (m_Scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
1612 // Does the telehub exist in the scene?
1613 telehub = m_Scene.GetSceneObjectGroup(m_Scene.RegionInfo.RegionSettings.TelehubObject);
1614
1615 if (!m_Scene.Permissions.IsAdministrator(m_AgentID) && // (a) gods and land managers can set home
1616 !m_Scene.Permissions.IsGod(m_AgentID) &&
1617 m_AgentID != land.LandData.OwnerID && // (b) land owners can set home
1618 // (c) members of the land-associated group in roles that can set home
1619 ((gpowers & (ulong)GroupPowers.AllowSetHome) != (ulong)GroupPowers.AllowSetHome) &&
1620 // (d) parcels with telehubs can be the home of anyone
1621 (telehub == null || !land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
1622 {
1623 message = "You are not allowed to set your home location in this parcel.";
1624 break;
1625 }
1626
1627 string userId;
1628 UUID test;
1629 if (!m_Scene.UserManagementModule.GetUserUUI(m_AgentID, out userId))
1630 {
1631 message = "Set Home request failed. (User Lookup)";
1632 break;
1633 }
1634
1635 if (!UUID.TryParse(userId, out test))
1636 {
1637 message = "Set Home request failed. (HG visitor)";
1638 break;
1639 }
1640
1641 if (m_Scene.GridUserService.SetHome(userId, land.RegionUUID, pos, lookAt))
1642 fail = false;
1643
1644 break;
1645 }
1646
1647 string response;
1648
1649 if(fail)
1650 {
1651 if(client != null)
1652 client.SendAlertMessage(message, "HomePositionSet");
1653 response = OSDParser.SerializeLLSDXmlString(resp);
1654 return response;
1655 }
1656
1657 // so its http but still needs a udp reply to inform user? crap :p
1658 if(client != null)
1659 client.SendAlertMessage("Home position set.","HomePositionSet");
1660
1661 resp["success"] = "true";
1662 OSDMap homeloc = new OSDMap();
1663 OSDMap homelocpos = new OSDMap();
1664 // for some odd reason viewers send pos as reals but read as integer
1665 homelocpos["X"] = new OSDReal(pos.X);
1666 homelocpos["Y"] = new OSDReal(pos.Y);
1667 homelocpos["Z"] = new OSDReal(pos.Z);
1668 homeloc["LocationPos"] = homelocpos;
1669
1670 resp["HomeLocation"] = homeloc;
1671
1672 response = OSDParser.SerializeLLSDXmlString(resp);
1673 return response;
1674 }
1675
1676 private static int CompareRolesByMembersDesc(GroupRolesData x, GroupRolesData y)
1677 {
1678 return -(x.Members.CompareTo(y.Members));
1679 }
1680
1681 public string GroupMemberData(string request, string path, string param, IOSHttpRequest httpRequest,
1682 IOSHttpResponse httpResponse)
1683 {
1684 OSDMap resp = new OSDMap();
1685
1686 string response;
1687
1688 bool fail = true;
1689 IClientAPI client = null;
1690 ScenePresence sp;
1691 IGroupsModule m_GroupsModule;
1692 UUID groupID = UUID.Zero;
1693
1694 while(true)
1695 {
1696 m_GroupsModule = m_Scene.RequestModuleInterface<IGroupsModule>();
1697 if(m_GroupsModule == null)
1698 break;
1699
1700 m_Scene.TryGetScenePresence(m_AgentID, out sp);
1701 if(sp == null || sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit)
1702 break;
1703
1704 client = sp.ControllingClient;
1705
1706 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1707 if(!req.ContainsKey("group_id"))
1708 break;
1709
1710 groupID = req["group_id"].AsUUID();
1711 if(groupID == UUID.Zero)
1712 break;
1713
1714 List<GroupRolesData> roles = m_GroupsModule.GroupRoleDataRequest(client, groupID);
1715 if(roles == null || roles.Count == 0)
1716 break;
1717
1718 List<GroupMembersData> members = m_GroupsModule.GroupMembersRequest(client, groupID);
1719 if(members == null || members.Count == 0)
1720 break;
1721
1722 int memberCount = members.Count;
1723
1724 Dictionary<string,int> titles = new Dictionary<string,int>();
1725 int i = 0;
1726
1727 ulong defaultPowers = 0;
1728
1729
1730 // build titles array and index
1731 roles.Sort(CompareRolesByMembersDesc);
1732
1733 OSDArray osdtitles = new OSDArray();
1734 foreach(GroupRolesData grd in roles)
1735 {
1736 if(grd.Title == null)
1737 continue;
1738 string title = grd.Title;
1739 if(i==0)
1740 defaultPowers = grd.Powers;
1741
1742 if(!titles.ContainsKey(title))
1743 {
1744 titles[title] = i++;
1745 osdtitles.Add(new OSDString(title));
1746 }
1747 }
1748
1749 if(titles.Count == 0)
1750 break;
1751
1752 OSDMap osdmembers = new OSDMap();
1753 foreach(GroupMembersData gmd in members)
1754 {
1755 OSDMap m = new OSDMap();
1756 if(gmd.OnlineStatus != null && gmd.OnlineStatus != "")
1757 m["last_login"] = new OSDString(gmd.OnlineStatus);
1758 if(gmd.AgentPowers != defaultPowers)
1759 m["powers"] = new OSDString((gmd.AgentPowers).ToString("X"));
1760 if(gmd.Title != null && titles.ContainsKey(gmd.Title) && titles[gmd.Title] != 0)
1761 m["title"] = new OSDInteger(titles[gmd.Title]);
1762 if(gmd.IsOwner)
1763 m["owner"] = new OSDString("true");
1764 if(gmd.Contribution != 0)
1765 m["donated_square_meters"] = new OSDInteger(gmd.Contribution);
1766
1767 osdmembers[(gmd.AgentID).ToString()] = m;
1768 }
1769
1770 OSDMap osddefaults = new OSDMap();
1771 osddefaults["default_powers"] = new OSDString(defaultPowers.ToString("X"));
1772
1773 resp["group_id"] = new OSDUUID(groupID);
1774 resp["agent_id"] = new OSDUUID(m_AgentID);
1775 resp["member_count"] = new OSDInteger(memberCount);
1776 resp["defaults"] = osddefaults;
1777 resp["titles"] = osdtitles;
1778 resp["members"] = osdmembers;
1779
1780 fail = false;
1781 break;
1782 }
1783
1784 if(fail)
1785 {
1786 resp["group_id"] = new OSDUUID(groupID);
1787 resp["agent_id"] = new OSDUUID(m_AgentID);
1788 resp["member_count"] = new OSDInteger(0);
1789 resp["defaults"] = new OSDMap();
1790 resp["titles"] = new OSDArray();
1791 resp["members"] = new OSDMap();
1792 }
1793
1794 response = OSDParser.SerializeLLSDXmlString(resp);
1795 return response;
1796 }
1579 } 1797 }
1580 1798
1581 public class AssetUploader 1799 public class AssetUploader
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
index c241075..5b4e0da 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack.Linden
84 84
85 private void OnRegisterCaps(UUID agentID, Caps caps) 85 private void OnRegisterCaps(UUID agentID, Caps caps)
86 { 86 {
87 new BunchOfCaps(m_Scene, caps); 87 new BunchOfCaps(m_Scene, agentID, caps);
88 } 88 }
89 89
90 } 90 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
index 29bde6c..fb22694 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
@@ -45,6 +45,8 @@ using ComponentAce.Compression.Libs.zlib;
45using OSDArray = OpenMetaverse.StructuredData.OSDArray; 45using OSDArray = OpenMetaverse.StructuredData.OSDArray;
46using OSDMap = OpenMetaverse.StructuredData.OSDMap; 46using OSDMap = OpenMetaverse.StructuredData.OSDMap;
47 47
48using Nini.Config;
49
48namespace OpenSim.Region.ClientStack.Linden 50namespace OpenSim.Region.ClientStack.Linden
49{ 51{
50 public struct ModelPrimLimits 52 public struct ModelPrimLimits
@@ -100,6 +102,25 @@ namespace OpenSim.Region.ClientStack.Linden
100 public float PhysicalPrimScaleMax = 10f; 102 public float PhysicalPrimScaleMax = 10f;
101 public int ObjectLinkedPartsMax = 512; 103 public int ObjectLinkedPartsMax = 512;
102 104
105
106 public ModelCost(Scene scene)
107 {
108 PrimScaleMin = scene.m_minNonphys;
109 NonPhysicalPrimScaleMax = scene.m_maxNonphys;
110 PhysicalPrimScaleMax = scene.m_maxPhys;
111 ObjectLinkedPartsMax = scene.m_linksetCapacity;
112 }
113
114 public void Econfig(IConfig EconomyConfig)
115 {
116 ModelMeshCostFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", ModelMeshCostFactor);
117 ModelTextureCostFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", ModelTextureCostFactor);
118 ModelMinCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", ModelMinCostFactor);
119 // next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost
120 primCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", primCreationCost);
121 bytecost = EconomyConfig.GetFloat("ModelMeshByteCost", bytecost);
122 }
123
103 // storage for a single mesh asset cost parameters 124 // storage for a single mesh asset cost parameters
104 private class ameshCostParam 125 private class ameshCostParam
105 { 126 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index f3acacd..11e8075 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -577,6 +577,13 @@ namespace OpenSim.Region.ClientStack.Linden
577 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); 577 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
578 } 578 }
579 579
580 public void ChatterBoxForceClose(UUID toAgent, UUID sessionID, string reason)
581 {
582 OSD item = EventQueueHelper.ChatterBoxForceClose(sessionID, reason);
583
584 Enqueue(item, toAgent);
585 }
586
580 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) 587 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
581 { 588 {
582 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); 589 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
index d552914..5e0bd71 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
@@ -342,6 +342,18 @@ namespace OpenSim.Region.ClientStack.Linden
342 return chatterBoxSessionAgentListUpdates; 342 return chatterBoxSessionAgentListUpdates;
343 } 343 }
344 344
345 public static OSD ChatterBoxForceClose(UUID sessionID, string reason)
346 {
347 OSDMap body = new OSDMap(2);
348 body.Add("session_id", new OSDUUID(sessionID));
349 body.Add("reason", new OSDString(reason));
350
351 OSDMap chatterBoxForceClose = new OSDMap(2);
352 chatterBoxForceClose.Add("message", new OSDString("ForceCloseChatterBoxSession"));
353 chatterBoxForceClose.Add("body", body);
354 return chatterBoxForceClose;
355 }
356
345 public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data) 357 public static OSD GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data)
346 { 358 {
347 OSDArray AgentData = new OSDArray(1); 359 OSDArray AgentData = new OSDArray(1);
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 6beb9b4..f580e5a 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1711,11 +1711,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1711 1711
1712 public void SendKillObject(List<uint> localIDs) 1712 public void SendKillObject(List<uint> localIDs)
1713 { 1713 {
1714 // think we do need this
1715 // foreach (uint id in localIDs) 1714 // foreach (uint id in localIDs)
1716 // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); 1715 // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
1717 1716
1718 // remove pending entities 1717 // remove pending entities to reduce looping chances.
1719 lock (m_entityProps.SyncRoot) 1718 lock (m_entityProps.SyncRoot)
1720 m_entityProps.Remove(localIDs); 1719 m_entityProps.Remove(localIDs);
1721 lock (m_entityUpdates.SyncRoot) 1720 lock (m_entityUpdates.SyncRoot)
@@ -2412,6 +2411,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2412 OutPacket(alertPack, ThrottleOutPacketType.Task); 2411 OutPacket(alertPack, ThrottleOutPacketType.Task);
2413 } 2412 }
2414 2413
2414 public void SendAlertMessage(string message, string info)
2415 {
2416 AlertMessagePacket alertPack = (AlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AlertMessage);
2417 alertPack.AlertData = new AlertMessagePacket.AlertDataBlock();
2418 alertPack.AlertData.Message = Util.StringToBytes256(message);
2419 alertPack.AlertInfo = new AlertMessagePacket.AlertInfoBlock[1];
2420 alertPack.AlertInfo[0] = new AlertMessagePacket.AlertInfoBlock();
2421 alertPack.AlertInfo[0].Message = Util.StringToBytes256(info);
2422 alertPack.AlertInfo[0].ExtraParams = new Byte[0];
2423 OutPacket(alertPack, ThrottleOutPacketType.Task);
2424 }
2425
2415 /// <summary> 2426 /// <summary>
2416 /// Send an agent alert message to the client. 2427 /// Send an agent alert message to the client.
2417 /// </summary> 2428 /// </summary>
@@ -4007,7 +4018,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4007 bool doCulling = m_scene.ObjectsCullingByDistance; 4018 bool doCulling = m_scene.ObjectsCullingByDistance;
4008 float cullingrange = 64.0f; 4019 float cullingrange = 64.0f;
4009 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>(); 4020 HashSet<SceneObjectGroup> GroupsNeedFullUpdate = new HashSet<SceneObjectGroup>();
4010 List<SceneObjectGroup> kills = new List<SceneObjectGroup>();
4011// Vector3 mycamera = Vector3.Zero; 4021// Vector3 mycamera = Vector3.Zero;
4012 Vector3 mypos = Vector3.Zero; 4022 Vector3 mypos = Vector3.Zero;
4013 ScenePresence mysp = (ScenePresence)SceneAgent; 4023 ScenePresence mysp = (ScenePresence)SceneAgent;
@@ -4047,8 +4057,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4047 // Don't send updates for objects that have been marked deleted. 4057 // Don't send updates for objects that have been marked deleted.
4048 // Instead send another kill object, because the first one may have gotten 4058 // Instead send another kill object, because the first one may have gotten
4049 // into a race condition 4059 // into a race condition
4050 if (!m_killRecord.Contains(grp.LocalId)) 4060 if (part == grp.RootPart && !m_killRecord.Contains(grp.LocalId))
4061 {
4051 m_killRecord.Add(grp.LocalId); 4062 m_killRecord.Add(grp.LocalId);
4063 maxUpdatesBytes -= 30;
4064 }
4052 continue; 4065 continue;
4053 } 4066 }
4054 4067
@@ -4336,16 +4349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4336 m_killRecord.Clear(); 4349 m_killRecord.Clear();
4337 } 4350 }
4338 4351
4339 if (kills.Count > 0)
4340 {
4341 foreach(SceneObjectGroup grp in kills)
4342 {
4343 foreach(SceneObjectPart p in grp.Parts)
4344 SendEntityUpdate(p,PrimUpdateFlags.Kill);
4345 }
4346 kills.Clear();
4347 }
4348
4349 if(GroupsNeedFullUpdate.Count > 0) 4352 if(GroupsNeedFullUpdate.Count > 0)
4350 { 4353 {
4351 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate) 4354 foreach(SceneObjectGroup grp in GroupsNeedFullUpdate)
@@ -4471,12 +4474,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4471 4474
4472 if (kills.Count > 0) 4475 if (kills.Count > 0)
4473 { 4476 {
4477 List<uint> partIDs = new List<uint>();
4474 foreach(SceneObjectGroup grp in kills) 4478 foreach(SceneObjectGroup grp in kills)
4475 { 4479 {
4480 SendEntityUpdate(grp.RootPart,PrimUpdateFlags.Kill);
4476 foreach(SceneObjectPart p in grp.Parts) 4481 foreach(SceneObjectPart p in grp.Parts)
4477 SendEntityUpdate(p,PrimUpdateFlags.Kill); 4482 {
4483 if(p != grp.RootPart)
4484 partIDs.Add(p.LocalId);
4485 }
4478 } 4486 }
4479 kills.Clear(); 4487 kills.Clear();
4488 if(partIDs.Count > 0)
4489 {
4490 lock (m_entityProps.SyncRoot)
4491 m_entityProps.Remove(partIDs);
4492 lock (m_entityUpdates.SyncRoot)
4493 m_entityUpdates.Remove(partIDs);
4494 }
4480 } 4495 }
4481 4496
4482 if(GroupsNeedFullUpdate.Count > 0) 4497 if(GroupsNeedFullUpdate.Count > 0)
@@ -11418,12 +11433,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11418 m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID); 11433 m_GroupsModule.GroupMembersRequest(this, groupMembersRequestPacket.GroupData.GroupID);
11419 11434
11420 int memberCount = members.Count; 11435 int memberCount = members.Count;
11421 11436 int indx = 0;
11422 while (true) 11437 while (indx < memberCount)
11423 { 11438 {
11424 int blockCount = members.Count; 11439 int blockCount = memberCount - indx;
11425 if (blockCount > 40) 11440 if (blockCount > 25)
11426 blockCount = 40; 11441 blockCount = 25;
11427 11442
11428 GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply); 11443 GroupMembersReplyPacket groupMembersReply = (GroupMembersReplyPacket)PacketPool.Instance.GetPacket(PacketType.GroupMembersReply);
11429 11444
@@ -11444,8 +11459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11444 11459
11445 for (int i = 0; i < blockCount; i++) 11460 for (int i = 0; i < blockCount; i++)
11446 { 11461 {
11447 GroupMembersData m = members[0]; 11462 GroupMembersData m = members[indx++];
11448 members.RemoveAt(0);
11449 11463
11450 groupMembersReply.MemberData[i] = 11464 groupMembersReply.MemberData[i] =
11451 new GroupMembersReplyPacket.MemberDataBlock(); 11465 new GroupMembersReplyPacket.MemberDataBlock();
@@ -11463,8 +11477,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11463 m.IsOwner; 11477 m.IsOwner;
11464 } 11478 }
11465 OutPacket(groupMembersReply, ThrottleOutPacketType.Task); 11479 OutPacket(groupMembersReply, ThrottleOutPacketType.Task);
11466 if (members.Count == 0)
11467 return true;
11468 } 11480 }
11469 } 11481 }
11470 return true; 11482 return true;
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index b72593c..eabeaf1 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -481,6 +481,151 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
481 return user.FirstName + " " + user.LastName; 481 return user.FirstName + " " + user.LastName;
482 } 482 }
483 483
484 public virtual Dictionary<UUID,string> GetUsersNames(string[] ids)
485 {
486 Dictionary<UUID,string> ret = new Dictionary<UUID,string>();
487 if(m_Scenes.Count <= 0)
488 return ret;
489
490 List<string> missing = new List<string>();
491 Dictionary<UUID,string> untried = new Dictionary<UUID, string>();
492
493 // look in cache
494 UserData userdata = new UserData();
495
496 UUID uuid = UUID.Zero;
497 foreach(string id in ids)
498 {
499 if(UUID.TryParse(id, out uuid))
500 {
501 lock (m_UserCache)
502 {
503 if (m_UserCache.TryGetValue(uuid, out userdata) &&
504 userdata.FirstName != "Unknown" && userdata.FirstName != string.Empty)
505 {
506 string name = userdata.FirstName + " " + userdata.LastName;
507
508 if(userdata.HasGridUserTried)
509 ret[uuid] = name;
510 else
511 {
512 untried[uuid] = name;
513 missing.Add(id);
514 }
515 }
516 else
517 missing.Add(id);
518 }
519 }
520 }
521
522 if(missing.Count == 0)
523 return ret;
524
525 // try user account service
526 List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts(
527 m_Scenes[0].RegionInfo.ScopeID, missing);
528
529 if(accounts.Count != 0)
530 {
531 foreach(UserAccount uac in accounts)
532 {
533 if(uac != null)
534 {
535 string name = uac.FirstName + " " + uac.LastName;
536 ret[uac.PrincipalID] = name;
537 missing.Remove(uac.PrincipalID.ToString()); // slowww
538 untried.Remove(uac.PrincipalID);
539
540 userdata = new UserData();
541 userdata.Id = uac.PrincipalID;
542 userdata.FirstName = uac.FirstName;
543 userdata.LastName = uac.LastName;
544 userdata.HomeURL = string.Empty;
545 userdata.IsUnknownUser = false;
546 userdata.HasGridUserTried = true;
547 lock (m_UserCache)
548 m_UserCache[uac.PrincipalID] = userdata;
549 }
550 }
551 }
552
553 if (missing.Count == 0 || m_Scenes[0].GridUserService == null)
554 return ret;
555
556 // try grid user service
557
558 GridUserInfo[] pinfos = m_Scenes[0].GridUserService.GetGridUserInfo(missing.ToArray());
559 if(pinfos.Length > 0)
560 {
561 foreach(GridUserInfo uInfo in pinfos)
562 {
563 if (uInfo != null)
564 {
565 string url, first, last, tmp;
566
567 if(uInfo.UserID.Length <= 36)
568 continue;
569
570 if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out uuid, out url, out first, out last, out tmp))
571 {
572 if (url != string.Empty)
573 {
574 try
575 {
576 userdata = new UserData();
577 userdata.FirstName = first.Replace(" ", ".") + "." + last.Replace(" ", ".");
578 userdata.LastName = "@" + new Uri(url).Authority;
579 userdata.Id = uuid;
580 userdata.HomeURL = url;
581 userdata.IsUnknownUser = false;
582 userdata.HasGridUserTried = true;
583 lock (m_UserCache)
584 m_UserCache[uuid] = userdata;
585
586 string name = userdata.FirstName + " " + userdata.LastName;
587 ret[uuid] = name;
588 missing.Remove(uuid.ToString());
589 untried.Remove(uuid);
590 }
591 catch
592 {
593 }
594 }
595 }
596 }
597 }
598 }
599
600 // add the untried in cache that still failed
601 if(untried.Count > 0)
602 {
603 foreach(KeyValuePair<UUID, string> kvp in untried)
604 {
605 ret[kvp.Key] = kvp.Value;
606 missing.Remove((kvp.Key).ToString());
607 }
608 }
609
610 // add the UMMthings ( not sure we should)
611 if(missing.Count > 0)
612 {
613 foreach(string id in missing)
614 {
615 if(UUID.TryParse(id, out uuid) && uuid != UUID.Zero)
616 {
617 if (m_Scenes[0].LibraryService != null &&
618 (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid))
619 ret[uuid] = "Mr OpenSim";
620 else
621 ret[uuid] = "Unknown UserUMMAU43";
622 }
623 }
624 }
625
626 return ret;
627 }
628
484 public virtual string GetUserHomeURL(UUID userID) 629 public virtual string GetUserHomeURL(UUID userID)
485 { 630 {
486 UserData user; 631 UserData user;
@@ -584,7 +729,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
584 else 729 else
585 { 730 {
586 userdata = new UserData(); 731 userdata = new UserData();
587 userdata.HasGridUserTried = false;
588 userdata.Id = uuid; 732 userdata.Id = uuid;
589 userdata.FirstName = "Unknown"; 733 userdata.FirstName = "Unknown";
590 userdata.LastName = "UserUMMAU42"; 734 userdata.LastName = "UserUMMAU42";
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 863560b..c48186f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -203,21 +203,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
203 203
204 void OnClientClosed(UUID clientID, Scene scene) 204 void OnClientClosed(UUID clientID, Scene scene)
205 { 205 {
206 if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache 206 ScenePresence sp = null;
207 foreach (Scene s in m_Scenes)
207 { 208 {
208 ScenePresence sp = null; 209 s.TryGetScenePresence(clientID, out sp);
209 foreach (Scene s in m_Scenes) 210 if ((sp != null) && !sp.IsChildAgent && (s != scene))
210 { 211 {
211 s.TryGetScenePresence(clientID, out sp); 212 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache",
212 if ((sp != null) && !sp.IsChildAgent && (s != scene))
213 {
214 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache",
215 scene.RegionInfo.RegionName, clientID); 213 scene.RegionInfo.RegionName, clientID);
216 return; 214 return;
217 }
218 } 215 }
219 DropInventoryServiceURL(clientID);
220 } 216 }
217
218 if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache
219 DropInventoryServiceURL(clientID);
220
221 m_Cache.RemoveAll(clientID);
221 } 222 }
222 223
223 /// <summary> 224 /// <summary>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 3195e6b..f7ef2ea 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -38,12 +38,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
38 /// </summary> 38 /// </summary>
39 public class InventoryCache 39 public class InventoryCache
40 { 40 {
41 private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour 41 private const double CACHE_EXPIRATION_SECONDS = 60.0; // 1 minute
42 42
43 private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>(); 43 private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>();
44 private static ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>>(); 44 private static ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>>();
45 private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>(); 45 private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>();
46 46
47
48 public void RemoveAll(UUID userID)
49 {
50 if(m_RootFolders.Contains(userID))
51 m_RootFolders.Remove(userID);
52 if(m_FolderTypes.Contains(userID))
53 m_FolderTypes.Remove(userID);
54 if(m_Inventories.Contains(userID))
55 m_Inventories.Remove(userID);
56 }
57
47 public void Cache(UUID userID, InventoryFolderBase root) 58 public void Cache(UUID userID, InventoryFolderBase root)
48 { 59 {
49 m_RootFolders.AddOrUpdate(userID, root, CACHE_EXPIRATION_SECONDS); 60 m_RootFolders.AddOrUpdate(userID, root, CACHE_EXPIRATION_SECONDS);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
index cf9a7b4..3127199 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
@@ -153,12 +153,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
153 public UserAccount GetUserAccount(UUID scopeID, UUID userID) 153 public UserAccount GetUserAccount(UUID scopeID, UUID userID)
154 { 154 {
155 bool inCache = false; 155 bool inCache = false;
156 UserAccount account = m_Cache.Get(userID, out inCache); 156 UserAccount account;
157 lock(m_Cache)
158 account = m_Cache.Get(userID, out inCache);
157 if (inCache) 159 if (inCache)
158 return account; 160 return account;
159 161
160 account = UserAccountService.GetUserAccount(scopeID, userID); 162 account = UserAccountService.GetUserAccount(scopeID, userID);
161 m_Cache.Cache(userID, account); 163 lock(m_Cache)
164 m_Cache.Cache(userID, account);
162 165
163 return account; 166 return account;
164 } 167 }
@@ -166,13 +169,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
166 public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) 169 public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
167 { 170 {
168 bool inCache = false; 171 bool inCache = false;
169 UserAccount account = m_Cache.Get(firstName + " " + lastName, out inCache); 172 UserAccount account;
173 lock(m_Cache)
174 account = m_Cache.Get(firstName + " " + lastName, out inCache);
170 if (inCache) 175 if (inCache)
171 return account; 176 return account;
172 177
173 account = UserAccountService.GetUserAccount(scopeID, firstName, lastName); 178 account = UserAccountService.GetUserAccount(scopeID, firstName, lastName);
174 if (account != null) 179 if (account != null)
175 m_Cache.Cache(account.PrincipalID, account); 180 lock(m_Cache)
181 m_Cache.Cache(account.PrincipalID, account);
176 182
177 return account; 183 return account;
178 } 184 }
@@ -182,6 +188,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
182 return UserAccountService.GetUserAccount(scopeID, Email); 188 return UserAccountService.GetUserAccount(scopeID, Email);
183 } 189 }
184 190
191 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
192 {
193 List<UserAccount> ret = new List<UserAccount>();
194 List<string> missing = new List<string>();
195
196 // still another cache..
197 bool inCache = false;
198 UUID uuid = UUID.Zero;
199 UserAccount account;
200 foreach(string id in IDs)
201 {
202 if(UUID.TryParse(id, out uuid))
203 {
204 lock(m_Cache)
205 account = m_Cache.Get(uuid, out inCache);
206 if (inCache)
207 ret.Add(account);
208 else
209 missing.Add(id);
210 }
211 }
212
213 if(missing.Count == 0)
214 return ret;
215
216 List<UserAccount> ext = UserAccountService.GetUserAccounts(scopeID, missing);
217 if(ext != null && ext.Count > 0)
218 {
219 ret.AddRange(ext);
220 foreach(UserAccount acc in ext)
221 {
222 if(acc != null)
223 lock(m_Cache)
224 m_Cache.Cache(acc.PrincipalID, acc);
225 }
226 }
227 return ret;
228 }
229
185 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) 230 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
186 { 231 {
187 return null; 232 return null;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
index afbba30..eead05d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic;
29using Nini.Config; 31using Nini.Config;
30using log4net; 32using log4net;
31using Mono.Addins; 33using Mono.Addins;
@@ -126,7 +128,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
126 // flags, title, etc. And country, don't forget country! 128 // flags, title, etc. And country, don't forget country!
127 private void OnNewClient(IClientAPI client) 129 private void OnNewClient(IClientAPI client)
128 { 130 {
129 m_Cache.Remove(client.Name); 131 lock(m_Cache)
132 m_Cache.Remove(client.Name);
130 } 133 }
131 134
132 #region Overwritten methods from IUserAccountService 135 #region Overwritten methods from IUserAccountService
@@ -134,12 +137,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
134 public override UserAccount GetUserAccount(UUID scopeID, UUID userID) 137 public override UserAccount GetUserAccount(UUID scopeID, UUID userID)
135 { 138 {
136 bool inCache = false; 139 bool inCache = false;
137 UserAccount account = m_Cache.Get(userID, out inCache); 140 UserAccount account;
141 lock(m_Cache)
142 account = m_Cache.Get(userID, out inCache);
138 if (inCache) 143 if (inCache)
139 return account; 144 return account;
140 145
141 account = base.GetUserAccount(scopeID, userID); 146 account = base.GetUserAccount(scopeID, userID);
142 m_Cache.Cache(userID, account); 147 lock(m_Cache)
148 if(account != null)
149 m_Cache.Cache(userID, account);
143 150
144 return account; 151 return account;
145 } 152 }
@@ -147,17 +154,60 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
147 public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) 154 public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
148 { 155 {
149 bool inCache = false; 156 bool inCache = false;
150 UserAccount account = m_Cache.Get(firstName + " " + lastName, out inCache); 157 UserAccount account;
158 lock(m_Cache)
159 account = m_Cache.Get(firstName + " " + lastName, out inCache);
151 if (inCache) 160 if (inCache)
152 return account; 161 return account;
153 162
154 account = base.GetUserAccount(scopeID, firstName, lastName); 163 account = base.GetUserAccount(scopeID, firstName, lastName);
155 if (account != null) 164 if (account != null)
156 m_Cache.Cache(account.PrincipalID, account); 165 lock(m_Cache)
166 m_Cache.Cache(account.PrincipalID, account);
157 167
158 return account; 168 return account;
159 } 169 }
160 170
171 public override List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
172 {
173 List<UserAccount> accs = new List<UserAccount>();
174 List<string> missing = new List<string>();
175
176 UUID uuid = UUID.Zero;
177 UserAccount account;
178 bool inCache = false;
179
180 foreach(string id in IDs)
181 {
182 if(UUID.TryParse(id, out uuid))
183 {
184 lock(m_Cache)
185 account = m_Cache.Get(uuid, out inCache);
186 if (inCache)
187 accs.Add(account);
188 else
189 missing.Add(id);
190 }
191 }
192
193 if(missing.Count > 0)
194 {
195 List<UserAccount> ext = base.GetUserAccounts(scopeID, missing);
196 if(ext != null && ext.Count >0 )
197 {
198 accs.AddRange(ext);
199 foreach(UserAccount acc in ext)
200 {
201 if(acc != null)
202 lock(m_Cache)
203 m_Cache.Cache(acc.PrincipalID, acc);
204 }
205 }
206 }
207
208 return accs;
209 }
210
161 public override bool StoreUserAccount(UserAccount data) 211 public override bool StoreUserAccount(UserAccount data)
162 { 212 {
163 // This remote connector refuses to serve this method 213 // This remote connector refuses to serve this method
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 3ded00c..56d41a8 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -572,6 +572,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
572 bool UseEstateSun, bool UseFixedSun, float SunHour, 572 bool UseEstateSun, bool UseFixedSun, float SunHour,
573 bool UseGlobal, bool EstateFixedSun, float EstateSunHour) 573 bool UseGlobal, bool EstateFixedSun, float EstateSunHour)
574 { 574 {
575 double lastwaterlevel = Scene.RegionInfo.RegionSettings.WaterHeight;
575 // Water Height 576 // Water Height
576 Scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; 577 Scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight;
577 578
@@ -584,6 +585,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
584 Scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; 585 Scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun;
585 Scene.RegionInfo.RegionSettings.SunPosition = SunHour; 586 Scene.RegionInfo.RegionSettings.SunPosition = SunHour;
586 587
588 if(Scene.PhysicsEnabled && Scene.PhysicsScene != null && lastwaterlevel != WaterHeight)
589 Scene.PhysicsScene.SetWaterLevel(WaterHeight);
590
587 Scene.TriggerEstateSunUpdate(); 591 Scene.TriggerEstateSunUpdate();
588 592
589 //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); 593 //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString());
@@ -1471,7 +1475,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1471 Scene.RegionInfo.EstateSettings.FixedSun, 1475 Scene.RegionInfo.EstateSettings.FixedSun,
1472 (float)Scene.RegionInfo.EstateSettings.SunPosition); 1476 (float)Scene.RegionInfo.EstateSettings.SunPosition);
1473 1477
1474 sendRegionInfoPacketToAll(); 1478// sendRegionInfoPacketToAll(); already done by setRegionTerrainSettings
1475 } 1479 }
1476 1480
1477 1481
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index b00f2b0..69a3455 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -374,9 +374,10 @@ namespace OpenSim.Region.CoreModules.World.Land
374 374
375 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 375 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
376 { 376 {
377 remote_client.SceneAgent.Invulnerable = 377 if(m_scene.RegionInfo.RegionSettings.AllowDamage)
378 !m_scene.RegionInfo.RegionSettings.AllowDamage || 378 remote_client.SceneAgent.Invulnerable = false;
379 (m_landData.Flags & (uint)ParcelFlags.AllowDamage) == 0; 379 else
380 remote_client.SceneAgent.Invulnerable = (m_landData.Flags & (uint)ParcelFlags.AllowDamage) == 0;
380 381
381 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) 382 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
382 return; 383 return;
@@ -779,11 +780,10 @@ namespace OpenSim.Region.CoreModules.World.Land
779 { 780 {
780 if (over.LandData.LocalID == LandData.LocalID) 781 if (over.LandData.LocalID == LandData.LocalID)
781 { 782 {
782 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && 783 if(m_scene.RegionInfo.RegionSettings.AllowDamage)
783 m_scene.RegionInfo.RegionSettings.AllowDamage)
784 avatar.Invulnerable = false; 784 avatar.Invulnerable = false;
785 else 785 else
786 avatar.Invulnerable = true; 786 avatar.Invulnerable = (over.LandData.Flags & (uint)ParcelFlags.AllowDamage) == 0;
787 787
788 SendLandUpdateToClient(snap_selection, avatar.ControllingClient); 788 SendLandUpdateToClient(snap_selection, avatar.ControllingClient);
789 avatar.currentParcelUUID = LandData.GlobalID; 789 avatar.currentParcelUUID = LandData.GlobalID;
diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
index b525769..3f54ea5 100644
--- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
@@ -52,11 +52,12 @@ namespace OpenSim.Region.Framework.Interfaces
52 string capsURL, UUID avatarID, UUID sessionID, 52 string capsURL, UUID avatarID, UUID sessionID,
53 int regionSizeX, int regionSizeY); 53 int regionSizeX, int regionSizeY);
54 void ChatterboxInvitation(UUID sessionID, string sessionName, 54 void ChatterboxInvitation(UUID sessionID, string sessionName,
55 UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, 55 UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog,
56 uint timeStamp, bool offline, int parentEstateID, Vector3 position, 56 uint timeStamp, bool offline, int parentEstateID, Vector3 position,
57 uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket); 57 uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket);
58 void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent, bool canVoiceChat, 58 void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID anotherAgent,
59 bool isModerator, bool textMute, bool isEnterorLeave); 59 bool canVoiceChat, bool isModerator, bool textMute, bool isEnterorLeave);
60 void ChatterBoxForceClose(UUID toAgent, UUID sessionID, string reason);
60 void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID); 61 void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID);
61 void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data); 62 void GroupMembershipData(UUID receiverAgent, GroupMembershipData[] data);
62 OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono); 63 OSD ScriptRunningEvent(UUID objectID, UUID itemID, bool running, bool mono);
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index c913ec2..5669c43 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -108,6 +108,9 @@ namespace OpenSim.Region.Framework.Scenes
108 priority = GetPriorityByFrontBack(client, entity); 108 priority = GetPriorityByFrontBack(client, entity);
109 break; 109 break;
110*/ 110*/
111 case UpdatePrioritizationSchemes.SimpleAngularDistance:
112 priority = GetPriorityByAngularDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
113 break;
111 case UpdatePrioritizationSchemes.BestAvatarResponsiveness: 114 case UpdatePrioritizationSchemes.BestAvatarResponsiveness:
112 default: 115 default:
113 priority = GetPriorityByBestAvatarResponsiveness(client, entity); 116 priority = GetPriorityByBestAvatarResponsiveness(client, entity);
@@ -241,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes
241*/ 244*/
242 if (distance > 10f) 245 if (distance > 10f)
243 { 246 {
244 float tmp = (float)Math.Log((double)distance) * 1.4426950408889634073599246810019f - 3.3219280948873623478703194294894f; 247 float tmp = (float)Math.Log((double)distance) * 1.442695f - 3.321928f;
245 // for a map identical to original: 248 // for a map identical to original:
246 // now 249 // now
247 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance) 250 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance)
@@ -269,5 +272,67 @@ namespace OpenSim.Region.Framework.Scenes
269 return pqueue; 272 return pqueue;
270 } 273 }
271 274
275 private uint GetPriorityByAngularDistance(IClientAPI client, ISceneEntity entity)
276 {
277 uint pqueue = 2; // keep compiler happy
278
279 ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
280 if (presence == null)
281 return PriorityQueue.NumberOfQueues - 1;
282
283 // All avatars other than our own go into pqueue 1
284 if (entity is ScenePresence)
285 return 1;
286
287 if (entity is SceneObjectPart)
288 {
289 // Attachments are high priority,
290 if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
291 return 2;
292
293 pqueue = ComputeAngleDistancePriority(presence, entity);
294
295 // Non physical prims are lower priority than physical prims
296 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
297 if (physActor == null || !physActor.IsPhysical)
298 pqueue++;
299 }
300
301 return pqueue;
302 }
303
304 private uint ComputeAngleDistancePriority(ScenePresence presence, ISceneEntity entity)
305 {
306 double distance;
307
308 Vector3 presencePos = presence.AbsolutePosition;
309
310 SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
311 float bradius = group.GetBoundsRadius();
312 Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter();
313 distance = Vector3.Distance(presencePos, grppos);
314 distance -= bradius;
315 distance *= group.getAreaFactor();
316
317 // And convert the distance to a priority queue, this computation gives queues
318 // at 10, 20, 40, 80, 160, 320, 640, and 1280m
319 uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue
320 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
321
322 if (distance > 10f)
323 {
324 float tmp = (float)Math.Log(distance) * 1.442695f - 3.321928f;
325 // for a map identical to original:
326 // now
327 // 1st constant is 1/(log(2)) (natural log) so we get log2(distance)
328 // 2st constant makes it be log2(distance/10)
329
330 pqueue += (uint)tmp;
331 if (pqueue > queues - 1)
332 pqueue = queues - 1;
333 }
334
335 return pqueue;
336 }
272 } 337 }
273} 338}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 33418e6..d5dbcaf 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3866,15 +3866,9 @@ namespace OpenSim.Region.Framework.Scenes
3866 foreach (uint localID in localIDs) 3866 foreach (uint localID in localIDs)
3867 { 3867 {
3868 SceneObjectPart part = GetSceneObjectPart(localID); 3868 SceneObjectPart part = GetSceneObjectPart(localID);
3869 if (part != null) // It is a prim 3869 if (part != null && part.ParentGroup != null &&
3870 { 3870 part.ParentGroup.RootPart == part)
3871 if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid 3871 deleteIDs.Add(localID);
3872 {
3873 if (part.ParentGroup.RootPart != part) // Child part
3874 continue;
3875 }
3876 }
3877 deleteIDs.Add(localID);
3878 } 3872 }
3879 3873
3880 ForEachClient(c => c.SendKillObject(deleteIDs)); 3874 ForEachClient(c => c.SendKillObject(deleteIDs));
@@ -4458,7 +4452,7 @@ Label_GroupsDone:
4458 { 4452 {
4459 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", 4453 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
4460 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 4454 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
4461 reason = String.Format("Denied access to private region {0}: You are do not have access to that region.", 4455 reason = String.Format("Denied access to private region {0}: You do not have access to that region.",
4462 RegionInfo.RegionName); 4456 RegionInfo.RegionName);
4463 return false; 4457 return false;
4464 } 4458 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index efc1413..df6a1cf 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1586,12 +1586,22 @@ namespace OpenSim.Region.Framework.Scenes
1586 return m_boundsCenter; 1586 return m_boundsCenter;
1587 } 1587 }
1588 1588
1589 private float m_areaFactor;
1590 public float getAreaFactor()
1591 {
1592 // math is done in GetBoundsRadius();
1593 if(m_boundsRadius == null)
1594 GetBoundsRadius();
1595 return m_areaFactor;
1596 }
1597
1589 public float GetBoundsRadius() 1598 public float GetBoundsRadius()
1590 { 1599 {
1591 // this may need more threading work 1600 // this may need more threading work
1592 if(m_boundsRadius == null) 1601 if(m_boundsRadius == null)
1593 { 1602 {
1594 float res = 0; 1603 float res = 0;
1604 float areaF = 0;
1595 SceneObjectPart p; 1605 SceneObjectPart p;
1596 SceneObjectPart[] parts; 1606 SceneObjectPart[] parts;
1597 float partR; 1607 float partR;
@@ -1613,12 +1623,19 @@ namespace OpenSim.Region.Framework.Scenes
1613 } 1623 }
1614 if(partR > res) 1624 if(partR > res)
1615 res = partR; 1625 res = partR;
1626 if(p.maxSimpleArea() > areaF)
1627 areaF = p.maxSimpleArea();
1616 } 1628 }
1617 if(parts.Length > 1) 1629 if(parts.Length > 1)
1618 { 1630 {
1619 offset /= parts.Length; // basicly geometric center 1631 offset /= parts.Length; // basicly geometric center
1620 offset = offset * RootPart.RotationOffset; 1632 offset = offset * RootPart.RotationOffset;
1621 } 1633 }
1634
1635 areaF = 10.0f / areaF; // scale it
1636 areaF = Util.Clamp(areaF, 0.001f, 1000f); // clamp it
1637
1638 m_areaFactor = (float)Math.Sqrt(areaF);
1622 m_boundsCenter = offset; 1639 m_boundsCenter = offset;
1623 m_boundsRadius = res; 1640 m_boundsRadius = res;
1624 return res; 1641 return res;
@@ -2048,41 +2065,37 @@ namespace OpenSim.Region.Framework.Scenes
2048 { 2065 {
2049 // We need to keep track of this state in case this group is still queued for backup. 2066 // We need to keep track of this state in case this group is still queued for backup.
2050 IsDeleted = true; 2067 IsDeleted = true;
2051 HasGroupChanged = true;
2052 2068
2053 DetachFromBackup(); 2069 DetachFromBackup();
2054 2070
2071 if(Scene == null) // should not happen unless restart/shutdown ?
2072 return;
2073
2055 SceneObjectPart[] parts = m_parts.GetArray(); 2074 SceneObjectPart[] parts = m_parts.GetArray();
2056 for (int i = 0; i < parts.Length; i++) 2075 for (int i = 0; i < parts.Length; i++)
2057 { 2076 {
2058 SceneObjectPart part = parts[i]; 2077 SceneObjectPart part = parts[i];
2059 2078
2060 if (Scene != null) 2079 Scene.ForEachScenePresence(delegate(ScenePresence avatar)
2061 { 2080 {
2062 Scene.ForEachScenePresence(delegate(ScenePresence avatar) 2081 if (!avatar.IsChildAgent && avatar.ParentID == LocalId)
2063 { 2082 avatar.StandUp();
2064 if (!avatar.IsChildAgent && avatar.ParentID == LocalId)
2065 avatar.StandUp();
2066 2083
2067 if (!silent) 2084 if (!silent)
2085 {
2086 part.ClearUpdateSchedule();
2087 if (part == m_rootPart)
2068 { 2088 {
2069 part.ClearUpdateSchedule(); 2089 if (!IsAttachment
2070 if (part == m_rootPart) 2090 || AttachedAvatar == avatar.ControllingClient.AgentId
2091 || !HasPrivateAttachmentPoint)
2071 { 2092 {
2072 if (!IsAttachment 2093 // Send a kill object immediately
2073 || AttachedAvatar == avatar.ControllingClient.AgentId 2094 avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId });
2074 || !HasPrivateAttachmentPoint)
2075 {
2076 // Send a kill object immediately
2077 avatar.ControllingClient.SendKillObject(new List<uint> { part.LocalId });
2078 // Also, send a terse update; in case race conditions make the object pop again in the client,
2079 // this update will send another kill object
2080 m_rootPart.SendTerseUpdateToClient(avatar.ControllingClient);
2081 }
2082 } 2095 }
2083 } 2096 }
2084 }); 2097 }
2085 } 2098 });
2086 } 2099 }
2087 } 2100 }
2088 2101
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0847b0b..01a323e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -285,7 +285,23 @@ namespace OpenSim.Region.Framework.Scenes
285 // but reversed logic: bit cleared means free to rotate 285 // but reversed logic: bit cleared means free to rotate
286 public byte RotationAxisLocks = 0; 286 public byte RotationAxisLocks = 0;
287 287
288 public bool VolumeDetectActive; 288 // WRONG flag in libOmvPrimFlags
289 private const uint primFlagVolumeDetect = (uint)PrimFlags.JointLP2P;
290
291 public bool VolumeDetectActive
292 {
293 get
294 {
295 return (Flags & (PrimFlags)primFlagVolumeDetect) != 0;
296 }
297 set
298 {
299 if(value)
300 Flags |= (PrimFlags)primFlagVolumeDetect;
301 else
302 Flags &= (PrimFlags)(~primFlagVolumeDetect);
303 }
304 }
289 305
290 public bool IsWaitingForFirstSpinUpdatePacket; 306 public bool IsWaitingForFirstSpinUpdatePacket;
291 307
@@ -1188,6 +1204,33 @@ namespace OpenSim.Region.Framework.Scenes
1188 } 1204 }
1189 } 1205 }
1190 1206
1207 public float maxSimpleArea()
1208 {
1209 float a,b;
1210 float sx = m_shape.Scale.X;
1211 float sy = m_shape.Scale.Y;
1212 float sz = m_shape.Scale.Z;
1213
1214 if( sx > sy)
1215 {
1216 a = sx;
1217 if(sy > sz)
1218 b = sy;
1219 else
1220 b = sz;
1221 }
1222 else
1223 {
1224 a = sy;
1225 if(sx > sz)
1226 b = sx;
1227 else
1228 b = sz;
1229 }
1230
1231 return a * b;
1232 }
1233
1191 public UpdateRequired UpdateFlag { get; set; } 1234 public UpdateRequired UpdateFlag { get; set; }
1192 public bool UpdatePhysRequired { get; set; } 1235 public bool UpdatePhysRequired { get; set; }
1193 1236
@@ -2078,12 +2121,6 @@ namespace OpenSim.Region.Framework.Scenes
2078 2121
2079 if (localGlobalTF) 2122 if (localGlobalTF)
2080 { 2123 {
2081/*
2082 Quaternion grot = GetWorldRotation();
2083 Quaternion AXgrot = grot;
2084 Vector3 AXimpulsei = impulsei;
2085 Vector3 newimpulse = AXimpulsei * AXgrot;
2086 */
2087 torque *= GetWorldRotation(); 2124 torque *= GetWorldRotation();
2088 } 2125 }
2089 2126
@@ -2222,16 +2259,8 @@ namespace OpenSim.Region.Framework.Scenes
2222 2259
2223 if (userExposed) 2260 if (userExposed)
2224 { 2261 {
2225/*
2226 if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero)
2227 {
2228 ParentGroup.Scene.AssetService.Get(
2229 dupe.m_shape.SculptTexture.ToString(), dupe, dupe.AssetReceived);
2230 }
2231*/
2232 bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); 2262 bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0);
2233 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 2263 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
2234// dupe.UpdatePhysicsSubscribedEvents(); // not sure...
2235 } 2264 }
2236 2265
2237 if (dupe.PhysActor != null) 2266 if (dupe.PhysActor != null)
@@ -2245,23 +2274,6 @@ namespace OpenSim.Region.Framework.Scenes
2245 } 2274 }
2246 2275
2247 /// <summary> 2276 /// <summary>
2248 /// Called back by asynchronous asset fetch.
2249 /// </summary>
2250 /// <param name="id">ID of asset received</param>
2251 /// <param name="sender">Register</param>
2252 /// <param name="asset"></param>
2253/*
2254 protected void AssetReceived(string id, Object sender, AssetBase asset)
2255 {
2256 if (asset != null)
2257 SculptTextureCallback(asset);
2258// else
2259// m_log.WarnFormat(
2260// "[SCENE OBJECT PART]: Part {0} {1} requested mesh/sculpt data for asset id {2} from asset service but received no data",
2261// Name, UUID, id);
2262 }
2263*/
2264 /// <summary>
2265 /// Do a physics property update for a NINJA joint. 2277 /// Do a physics property update for a NINJA joint.
2266 /// </summary> 2278 /// </summary>
2267 /// <param name="UsePhysics"></param> 2279 /// <param name="UsePhysics"></param>
@@ -3243,39 +3255,6 @@ namespace OpenSim.Region.Framework.Scenes
3243 } 3255 }
3244 3256
3245 /// <summary> 3257 /// <summary>
3246 /// Set sculpt and mesh data, and tell the physics engine to process the change.
3247 /// </summary>
3248 /// <param name="texture">The mesh itself.</param>
3249/*
3250 public void SculptTextureCallback(AssetBase texture)
3251 {
3252 if (m_shape.SculptEntry)
3253 {
3254 // commented out for sculpt map caching test - null could mean a cached sculpt map has been found
3255 //if (texture != null)
3256 {
3257 if (texture != null)
3258 {
3259// m_log.DebugFormat(
3260// "[SCENE OBJECT PART]: Setting sculpt data for {0} on SculptTextureCallback()", Name);
3261
3262 m_shape.SculptData = texture.Data;
3263 }
3264
3265 PhysicsActor pa = PhysActor;
3266
3267 if (pa != null)
3268 {
3269 // Update the physics actor with the new loaded sculpt data and set the taint signal.
3270 pa.Shape = m_shape;
3271
3272 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa);
3273 }
3274 }
3275 }
3276 }
3277*/
3278 /// <summary>
3279 /// Send a full update to the client for the given part 3258 /// Send a full update to the client for the given part
3280 /// </summary> 3259 /// </summary>
3281 /// <param name="remoteClient"></param> 3260 /// <param name="remoteClient"></param>
@@ -4015,103 +3994,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4015 } 3994 }
4016 } 3995 }
4017 3996
4018 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot)
4019 {
4020 // In this case we're using a sphere with a radius of the largest dimension of the prim
4021 // TODO: Change to take shape into account
4022
4023 EntityIntersection result = new EntityIntersection();
4024 Vector3 vAbsolutePosition = AbsolutePosition;
4025 Vector3 vScale = Scale;
4026 Vector3 rOrigin = iray.Origin;
4027 Vector3 rDirection = iray.Direction;
4028
4029 //rDirection = rDirection.Normalize();
4030 // Buidling the first part of the Quadratic equation
4031 Vector3 r2ndDirection = rDirection*rDirection;
4032 float itestPart1 = r2ndDirection.X + r2ndDirection.Y + r2ndDirection.Z;
4033
4034 // Buidling the second part of the Quadratic equation
4035 Vector3 tmVal2 = rOrigin - vAbsolutePosition;
4036 Vector3 r2Direction = rDirection*2.0f;
4037 Vector3 tmVal3 = r2Direction*tmVal2;
4038
4039 float itestPart2 = tmVal3.X + tmVal3.Y + tmVal3.Z;
4040
4041 // Buidling the third part of the Quadratic equation
4042 Vector3 tmVal4 = rOrigin*rOrigin;
4043 Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition;
4044
4045 Vector3 tmVal6 = vAbsolutePosition*rOrigin;
4046
4047 // Set Radius to the largest dimension of the prim
4048 float radius = 0f;
4049 if (vScale.X > radius)
4050 radius = vScale.X;
4051 if (vScale.Y > radius)
4052 radius = vScale.Y;
4053 if (vScale.Z > radius)
4054 radius = vScale.Z;
4055
4056 // the second part of this is the default prim size
4057 // once we factor in the aabb of the prim we're adding we can
4058 // change this to;
4059 // radius = (radius / 2) - 0.01f;
4060 //
4061 radius = (radius / 2) + (0.5f / 2) - 0.1f;
4062
4063 //radius = radius;
4064
4065 float itestPart3 = tmVal4.X + tmVal4.Y + tmVal4.Z + tmVal5.X + tmVal5.Y + tmVal5.Z -
4066 (2.0f*(tmVal6.X + tmVal6.Y + tmVal6.Z + (radius*radius)));
4067
4068 // Yuk Quadradrics.. Solve first
4069 float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3);
4070 if (rootsqr < 0.0f)
4071 {
4072 // No intersection
4073 return result;
4074 }
4075 float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
4076
4077 if (root < 0.0f)
4078 {
4079 // perform second quadratic root solution
4080 root = ((-itestPart2) + (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
4081
4082 // is there any intersection?
4083 if (root < 0.0f)
4084 {
4085 // nope, no intersection
4086 return result;
4087 }
4088 }
4089
4090 // We got an intersection. putting together an EntityIntersection object with the
4091 // intersection information
4092 Vector3 ipoint =
4093 new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root),
4094 iray.Origin.Z + (iray.Direction.Z*root));
4095
4096 result.HitTF = true;
4097 result.ipoint = ipoint;
4098
4099 // Normal is calculated by the difference and then normalizing the result
4100 Vector3 normalpart = ipoint - vAbsolutePosition;
4101 result.normal = normalpart / normalpart.Length();
4102
4103 // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't.
4104 // I can write a function to do it.. but I like the fact that this one is Static.
4105
4106 Vector3 distanceConvert1 = new Vector3(iray.Origin.X, iray.Origin.Y, iray.Origin.Z);
4107 Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z);
4108 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2);
4109
4110 result.distance = distance;
4111
4112 return result;
4113 }
4114
4115 public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) 3997 public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters)
4116 { 3998 {
4117 // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes 3999 // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes
@@ -4479,15 +4361,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4479 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 4361 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
4480 { 4362 {
4481 m_shape.ReadInUpdateExtraParam(type, inUse, data); 4363 m_shape.ReadInUpdateExtraParam(type, inUse, data);
4482/* 4364
4483 if (type == 0x30)
4484 {
4485 if (m_shape.SculptEntry && m_shape.SculptTexture != UUID.Zero)
4486 {
4487 ParentGroup.Scene.AssetService.Get(m_shape.SculptTexture.ToString(), this, AssetReceived);
4488 }
4489 }
4490*/
4491 if (ParentGroup != null) 4365 if (ParentGroup != null)
4492 { 4366 {
4493 ParentGroup.HasGroupChanged = true; 4367 ParentGroup.HasGroupChanged = true;
@@ -4714,9 +4588,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4714 4588
4715 VolumeDetectActive = SetVD; 4589 VolumeDetectActive = SetVD;
4716 4590
4717 // volume detector implies phantom 4591 // volume detector implies phantom we need to decouple this mess
4718 if (VolumeDetectActive) 4592 if (SetVD)
4719 SetPhantom = true; 4593 SetPhantom = true;
4594 else if(wasVD)
4595 SetPhantom = false;
4720 4596
4721 if (UsePhysics) 4597 if (UsePhysics)
4722 AddFlag(PrimFlags.Physics); 4598 AddFlag(PrimFlags.Physics);
@@ -4733,7 +4609,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4733 else 4609 else
4734 RemFlag(PrimFlags.TemporaryOnRez); 4610 RemFlag(PrimFlags.TemporaryOnRez);
4735 4611
4736
4737 if (ParentGroup.Scene == null) 4612 if (ParentGroup.Scene == null)
4738 return; 4613 return;
4739 4614
@@ -4763,26 +4638,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4763 { 4638 {
4764 AddToPhysics(UsePhysics, SetPhantom, building, false); 4639 AddToPhysics(UsePhysics, SetPhantom, building, false);
4765 pa = PhysActor; 4640 pa = PhysActor;
4766/* 4641
4767 if (pa != null)
4768 {
4769 if (
4770// ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
4771// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
4772// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4773// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4774// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4775// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
4776 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4777 ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) ||
4778 (CollisionSound != UUID.Zero)
4779 )
4780 {
4781 pa.OnCollisionUpdate += PhysicsCollision;
4782 pa.SubscribeEvents(1000);
4783 }
4784 }
4785*/
4786 if (pa != null) 4642 if (pa != null)
4787 { 4643 {
4788 pa.SetMaterial(Material); 4644 pa.SetMaterial(Material);
@@ -4793,12 +4649,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4793 { 4649 {
4794 4650
4795 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. 4651 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
4796/* moved into DoPhysicsPropertyUpdate
4797 if(VolumeDetectActive)
4798 pa.SetVolumeDetect(1);
4799 else
4800 pa.SetVolumeDetect(0);
4801*/
4802 4652
4803 if (pa.Building != building) 4653 if (pa.Building != building)
4804 pa.Building = building; 4654 pa.Building = building;
@@ -4807,32 +4657,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4807 UpdatePhysicsSubscribedEvents(); 4657 UpdatePhysicsSubscribedEvents();
4808 } 4658 }
4809 } 4659 }
4810 if (SetVD)
4811 {
4812 // If the above logic worked (this is urgent candidate to unit tests!)
4813 // we now have a physicsactor.
4814 // Defensive programming calls for a check here.
4815 // Better would be throwing an exception that could be catched by a unit test as the internal
4816 // logic should make sure, this Physactor is always here.
4817 if (pa != null)
4818 {
4819 pa.SetVolumeDetect(1);
4820 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
4821 VolumeDetectActive = true;
4822 }
4823 // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
4824 }
4825 else if (SetVD != wasVD)
4826 {
4827 // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
4828 // (mumbles, well, at least if you have infinte CPU powers :-))
4829 if (pa != null)
4830 pa.SetVolumeDetect(0);
4831 4660
4832 RemFlag(PrimFlags.Phantom); 4661 // and last in case we have a new actor and not building
4833 VolumeDetectActive = false;
4834 }
4835 // and last in case we have a new actor and not building
4836 4662
4837 if (ParentGroup != null) 4663 if (ParentGroup != null)
4838 { 4664 {
@@ -5094,42 +4920,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5094 } 4920 }
5095 4921
5096 /// <summary> 4922 /// <summary>
5097 /// If the part is a sculpt/mesh, retrieve the mesh data and reinsert it into the shape so that the physics
5098 /// engine can use it.
5099 /// </summary>
5100 /// <remarks>
5101 /// When the physics engine has finished with it, the sculpt data is discarded to save memory.
5102 /// </remarks>
5103/*
5104 public void CheckSculptAndLoad()
5105 {
5106// m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
5107
5108 return;
5109
5110 if (ParentGroup.IsDeleted)
5111 return;
5112
5113 if ((ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
5114 return;
5115
5116 if (Shape.SculptEntry && Shape.SculptTexture != UUID.Zero)
5117 {
5118 // check if a previously decoded sculpt map has been cached
5119 // We don't read the file here - the meshmerizer will do that later.
5120 // TODO: Could we simplify the meshmerizer code by reading and setting the data here?
5121 if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + Shape.SculptTexture.ToString())))
5122 {
5123 SculptTextureCallback(null);
5124 }
5125 else
5126 {
5127 ParentGroup.Scene.AssetService.Get(Shape.SculptTexture.ToString(), this, AssetReceived);
5128 }
5129 }
5130 }
5131*/
5132 /// <summary>
5133 /// Update the texture entry for this part. 4923 /// Update the texture entry for this part.
5134 /// </summary> 4924 /// </summary>
5135 /// <param name="serializedTextureEntry"></param> 4925 /// <param name="serializedTextureEntry"></param>
@@ -5259,7 +5049,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5259 { 5049 {
5260 // subscribe to physics updates. 5050 // subscribe to physics updates.
5261 pa.OnCollisionUpdate += PhysicsCollision; 5051 pa.OnCollisionUpdate += PhysicsCollision;
5262 pa.SubscribeEvents(100); // 10 reports per second 5052 pa.SubscribeEvents(50); // 20 reports per second
5263 } 5053 }
5264 else 5054 else
5265 { 5055 {
@@ -5304,41 +5094,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5304 { 5094 {
5305 objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; 5095 objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop;
5306 } 5096 }
5307/*
5308 PhysicsActor pa = PhysActor;
5309 if (pa != null)
5310 {
5311 if (
5312// ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
5313// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
5314// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
5315// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
5316// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
5317// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
5318 ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero)
5319 )
5320 {
5321 // subscribe to physics updates.
5322 pa.OnCollisionUpdate += PhysicsCollision;
5323 pa.SubscribeEvents(1000);
5324 }
5325 else
5326 {
5327 pa.UnSubscribeEvents();
5328 pa.OnCollisionUpdate -= PhysicsCollision;
5329 }
5330 }
5331 */
5332 UpdatePhysicsSubscribedEvents();
5333 5097
5334 //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) 5098 UpdatePhysicsSubscribedEvents();
5335 //{
5336 // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
5337 //}
5338 //else
5339 //{
5340 // ParentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
5341 //}
5342 5099
5343 LocalFlags = (PrimFlags)objectflagupdate; 5100 LocalFlags = (PrimFlags)objectflagupdate;
5344 5101
@@ -5393,6 +5150,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5393 5150
5394 public void SendTerseUpdateToClient(IClientAPI remoteClient) 5151 public void SendTerseUpdateToClient(IClientAPI remoteClient)
5395 { 5152 {
5153 if (ParentGroup.IsDeleted)
5154 return;
5155
5396 if (ParentGroup.IsAttachment 5156 if (ParentGroup.IsAttachment
5397 && (ParentGroup.RootPart != this 5157 && (ParentGroup.RootPart != this
5398 || ParentGroup.AttachedAvatar != remoteClient.AgentId && ParentGroup.HasPrivateAttachmentPoint)) 5158 || ParentGroup.AttachedAvatar != remoteClient.AgentId && ParentGroup.HasPrivateAttachmentPoint))
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 1737e3c..e98e631 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -107,7 +107,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
107 m_so1.ScriptSetVolumeDetect(true); 107 m_so1.ScriptSetVolumeDetect(true);
108 108
109// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); 109// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
110 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); 110 // PrimFlags.JointLP2P is incorrect it now means VolumeDetect (as defined by viewers)
111 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.JointLP2P));
111 112
112 m_so1.ScriptSetVolumeDetect(false); 113 m_so1.ScriptSetVolumeDetect(false);
113 114
@@ -146,7 +147,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
146 m_so1.ScriptSetPhysicsStatus(true); 147 m_so1.ScriptSetPhysicsStatus(true);
147 m_so1.ScriptSetVolumeDetect(true); 148 m_so1.ScriptSetVolumeDetect(true);
148 149
149 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics)); 150 // PrimFlags.JointLP2P is incorrect it now means VolumeDetect (as defined by viewers)
151 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics | PrimFlags.JointLP2P));
150 152
151 m_so1.ScriptSetVolumeDetect(false); 153 m_so1.ScriptSetVolumeDetect(false);
152 154
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 50be3ac..e21d69f 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1217,6 +1217,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1217 1217
1218 } 1218 }
1219 1219
1220 public void SendAlertMessage(string message, string info)
1221 {
1222
1223 }
1224
1220 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) 1225 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
1221 { 1226 {
1222 IRC_SendChannelPrivmsg(objectname,url); 1227 IRC_SendChannelPrivmsg(objectname,url);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 112a41f..626937c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -862,7 +862,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
862 { 862 {
863 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 863 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
864 864
865 if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null) 865 GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name);
866
867 if (groupRecord != null)
866 { 868 {
867 remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); 869 remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
868 return UUID.Zero; 870 return UUID.Zero;
@@ -877,26 +879,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
877 { 879 {
878 if (avatar.UserLevel < m_levelGroupCreate) 880 if (avatar.UserLevel < m_levelGroupCreate)
879 { 881 {
880 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient permissions to create a group."); 882 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group.");
881 return UUID.Zero; 883 return UUID.Zero;
882 } 884 }
883 } 885 }
884 886
885 // check funds 887 // check funds
886 // is there is a money module present ? 888 // is there a money module present ?
887 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); 889 IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
888 if (money != null) 890 if (money != null && money.GroupCreationCharge > 0)
889 { 891 {
890 // do the transaction, that is if the agent has got sufficient funds 892 // do the transaction, that is if the agent has sufficient funds
891 if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { 893 if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) {
892 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); 894 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to create a group.");
893 return UUID.Zero; 895 return UUID.Zero;
894 } 896 }
895 money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate); 897 money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
896 } 898 }
897 UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); 899 UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));
898 900
899 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 901 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
900 902
901 // Update the founder with new group information. 903 // Update the founder with new group information.
902 SendAgentGroupDataUpdate(remoteClient, false); 904 SendAgentGroupDataUpdate(remoteClient, false);
@@ -1092,6 +1094,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1092 // Should check to see if OpenEnrollment, or if there's an outstanding invitation 1094 // Should check to see if OpenEnrollment, or if there's an outstanding invitation
1093 m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); 1095 m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero);
1094 1096
1097 // check funds
1098 // is there a money module present ?
1099 GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null);
1100 IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
1101 if (money != null && groupRecord.MembershipFee > 0)
1102 {
1103 // do the transaction, that is if the agent has sufficient funds
1104 if (!money.AmountCovered(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee)) {
1105 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to join the group.");
1106 return;
1107 }
1108 money.ApplyCharge(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName);
1109 }
1110
1095 remoteClient.SendJoinGroupReply(groupID, true); 1111 remoteClient.SendJoinGroupReply(groupID, true);
1096 1112
1097 SendAgentGroupDataUpdate(remoteClient, true); 1113 SendAgentGroupDataUpdate(remoteClient, true);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 83f08e0..eb64f71 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -1008,11 +1008,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1008 respData.Add("error", e.ToString()); 1008 respData.Add("error", e.ToString());
1009 return respData; 1009 return respData;
1010 } 1010 }
1011 }
1012 1011
1013 if ((m_cacheTimeout > 0) && (CacheKey != null)) 1012 if ((m_cacheTimeout > 0) && (CacheKey != null))
1014 { 1013 {
1015 m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); 1014 m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0);
1015 }
1016 } 1016 }
1017 1017
1018 if (resp.Value is Hashtable) 1018 if (resp.Value is Hashtable)
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
index 7ae4223..770b1f2 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
@@ -108,8 +108,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
108 { 108 {
109 if (m_Enabled) 109 if (m_Enabled)
110 { 110 {
111 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>(); 111 m_Helper = new SimulatorFeaturesHelper(scene);
112 m_Helper = new SimulatorFeaturesHelper(scene, et);
113 112
114 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>(); 113 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
115 if (featuresModule != null) 114 if (featuresModule != null)
@@ -124,7 +123,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
124 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) 123 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
125 { 124 {
126 m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); 125 m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
127 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) 126 if (m_Helper.UserLevel(agentID) <= m_UserLevel)
128 { 127 {
129 OSDMap extrasMap; 128 OSDMap extrasMap;
130 if (features.ContainsKey("OpenSimExtras")) 129 if (features.ContainsKey("OpenSimExtras"))
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
index 2661522..1ae18dd 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
@@ -53,86 +53,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private IEntityTransferModule m_TransferModule;
57 private Scene m_scene; 56 private Scene m_scene;
58 57
59 private struct RegionSend { 58 public SimulatorFeaturesHelper(Scene scene)
60 public UUID region;
61 public bool send;
62 };
63 // Using a static cache so that we don't have to perform the time-consuming tests
64 // in ShouldSend on Extra SimFeatures that go on the same response but come from
65 // different modules.
66 // This cached is indexed on the agentID and maps to a list of regions
67 private static ExpiringCache<UUID, List<RegionSend>> m_Cache = new ExpiringCache<UUID, List<RegionSend>>();
68 private const double TIMEOUT = 1.0; // time in cache
69
70 public SimulatorFeaturesHelper(Scene scene, IEntityTransferModule et)
71 { 59 {
72 m_scene = scene; 60 m_scene = scene;
73 m_TransferModule = et;
74 }
75
76 public bool ShouldSend(UUID agentID)
77 {
78 List<RegionSend> rsendlist;
79 RegionSend rsend;
80 if (m_Cache.TryGetValue(agentID, out rsendlist))
81 {
82 rsend = rsendlist.Find(r => r.region == m_scene.RegionInfo.RegionID);
83 if (rsend.region != UUID.Zero) // Found it
84 {
85 return rsend.send;
86 }
87 }
88
89 // Relatively complex logic for deciding whether to send the extra SimFeature or not.
90 // This is because the viewer calls this cap to all sims that it knows about,
91 // including the departing sims and non-neighbors (those that are cached).
92 rsend.region = m_scene.RegionInfo.RegionID;
93 rsend.send = false;
94 IClientAPI client = null;
95 int counter = 200;
96
97 // Let's wait a little to see if we get a client here
98 while (!m_scene.TryGetClient(agentID, out client) && counter-- > 0)
99 Thread.Sleep(50);
100
101 if (client != null)
102 {
103 ScenePresence sp = WaitGetScenePresence(agentID);
104
105 if (sp != null)
106 {
107 // On the receiving region, the call to this cap may arrive before
108 // the agent is root. Make sure we only proceed from here when the agent
109 // has been made root
110 counter = 200;
111 while ((sp.IsInTransit || sp.IsChildAgent) && counter-- > 0)
112 {
113 Thread.Sleep(50);
114 }
115
116 // The viewer calls this cap on the departing sims too. Make sure
117 // that we only proceed after the agent is not in transit anymore.
118 // The agent must be root and not going anywhere
119 if (!sp.IsChildAgent && !m_TransferModule.IsInTransit(agentID))
120 rsend.send = true;
121
122 }
123 }
124 //else
125 // m_log.DebugFormat("[XXX]: client is null");
126
127
128 if (rsendlist == null)
129 {
130 rsendlist = new List<RegionSend>();
131 m_Cache.AddOrUpdate(agentID, rsendlist, TIMEOUT);
132 }
133 rsendlist.Add(rsend);
134
135 return rsend.send;
136 } 61 }
137 62
138 public int UserLevel(UUID agentID) 63 public int UserLevel(UUID agentID)
@@ -144,28 +69,5 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
144 69
145 return level; 70 return level;
146 } 71 }
147
148 protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
149 {
150 int ntimes = 20;
151 ScenePresence sp = null;
152 while ((sp = m_scene.GetScenePresence(agentID)) == null && (ntimes-- > 0))
153 Thread.Sleep(1000);
154
155 if (sp == null)
156 m_log.WarnFormat(
157 "[XXX]: Did not find presence with id {0} in {1} before timeout",
158 agentID, m_scene.RegionInfo.RegionName);
159 else
160 {
161 ntimes = 10;
162 while (sp.IsInTransit && (ntimes-- > 0))
163 Thread.Sleep(1000);
164 }
165
166 return sp;
167 }
168
169 } 72 }
170
171} 73}
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
index 3fe922d..fa8fc66 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
@@ -102,8 +102,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
102 { 102 {
103 if (m_Enabled) 103 if (m_Enabled)
104 { 104 {
105 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>(); 105 m_Helper = new SimulatorFeaturesHelper(scene);
106 m_Helper = new SimulatorFeaturesHelper(scene, et);
107 106
108 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>(); 107 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
109 if (featuresModule != null) 108 if (featuresModule != null)
@@ -118,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
118 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) 117 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
119 { 118 {
120 m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName); 119 m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
121 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel) 120 if (m_Helper.UserLevel(agentID) <= m_UserLevel)
122 { 121 {
123 OSDMap extrasMap; 122 OSDMap extrasMap;
124 OSDMap specialUI = new OSDMap(); 123 OSDMap specialUI = new OSDMap();
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 4275192..52e8660 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -885,6 +885,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
885 { 885 {
886 } 886 }
887 887
888 public void SendAlertMessage(string message, string info)
889 {
890 }
891
888 public void SendSystemAlertMessage(string message) 892 public void SendSystemAlertMessage(string message)
889 { 893 {
890 } 894 }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index cef7063..c9489d2 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -1605,18 +1605,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1605 if (m_cureventsubscription < m_eventsubscription) 1605 if (m_cureventsubscription < m_eventsubscription)
1606 return; 1606 return;
1607 1607
1608 m_cureventsubscription = 0;
1609
1610 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; 1608 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
1611 1609
1612 if (!SentEmptyCollisionsEvent || ncolisions > 0) 1610 if (!SentEmptyCollisionsEvent || ncolisions > 0)
1613 { 1611 {
1614 base.SendCollisionUpdate(CollisionEventsThisFrame); 1612 base.SendCollisionUpdate(CollisionEventsThisFrame);
1613 m_cureventsubscription = 0;
1615 1614
1616 if (ncolisions == 0) 1615 if (ncolisions == 0)
1617 { 1616 {
1618 SentEmptyCollisionsEvent = true; 1617 SentEmptyCollisionsEvent = true;
1619 _parent_scene.RemoveCollisionEventReporting(this); 1618// _parent_scene.RemoveCollisionEventReporting(this);
1620 } 1619 }
1621 else 1620 else
1622 { 1621 {
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 9f62644..6f2cbbe 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -1000,9 +1000,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1000 1000
1001 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 1001 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
1002 { 1002 {
1003
1004 if (CollisionEventsThisFrame == null) 1003 if (CollisionEventsThisFrame == null)
1005 CollisionEventsThisFrame = new CollisionEventUpdate(); 1004 CollisionEventsThisFrame = new CollisionEventUpdate();
1005
1006 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 1006 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
1007 _parent_scene.AddCollisionEventReporting(this); 1007 _parent_scene.AddCollisionEventReporting(this);
1008 } 1008 }
@@ -1033,28 +1033,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1033 if (CollisionEventsThisFrame == null) 1033 if (CollisionEventsThisFrame == null)
1034 return; 1034 return;
1035 1035
1036 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
1037
1036 if (m_cureventsubscription < m_eventsubscription) 1038 if (m_cureventsubscription < m_eventsubscription)
1037 return; 1039 return;
1038 1040
1039 m_cureventsubscription = 0;
1040
1041 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
1042
1043 if (!SentEmptyCollisionsEvent || ncolisions > 0) 1041 if (!SentEmptyCollisionsEvent || ncolisions > 0)
1044 { 1042 {
1045 base.SendCollisionUpdate(CollisionEventsThisFrame); 1043 base.SendCollisionUpdate(CollisionEventsThisFrame);
1044 m_cureventsubscription = 0;
1046 1045
1047 if (ncolisions == 0) 1046 if (ncolisions == 0)
1048 { 1047 {
1049 SentEmptyCollisionsEvent = true; 1048 SentEmptyCollisionsEvent = true;
1050 _parent_scene.RemoveCollisionEventReporting(this); 1049// _parent_scene.RemoveCollisionEventReporting(this);
1051 } 1050 }
1052 else if(Body == IntPtr.Zero || d.BodyIsEnabled(Body)) 1051 else if(Body == IntPtr.Zero || d.BodyIsEnabled(Body))
1053 { 1052 {
1054 SentEmptyCollisionsEvent = false; 1053 SentEmptyCollisionsEvent = false;
1055 CollisionEventsThisFrame.Clear(); 1054 CollisionEventsThisFrame.Clear();
1056 } 1055 }
1057 } 1056 }
1058 } 1057 }
1059 1058
1060 public override bool SubscribedEvents() 1059 public override bool SubscribedEvents()
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
index bcf8e2b..6e43cf8 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
@@ -417,7 +417,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
417 meshOsd = (OSDMap)osd; 417 meshOsd = (OSDMap)osd;
418 else 418 else
419 { 419 {
420 m_log.Warn("[Mesh}: unable to cast mesh asset to OSDMap"); 420 m_log.WarnFormat("[Mesh}: unable to cast mesh asset to OSDMap prim: {0}",primName);
421 return false; 421 return false;
422 } 422 }
423 } 423 }
@@ -451,7 +451,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
451 451
452 if (physicsParms == null) 452 if (physicsParms == null)
453 { 453 {
454 m_log.Warn("[MESH]: unknown mesh type"); 454 m_log.WarnFormat("[MESH]: unknown mesh type for {0}",primName);
455 return false; 455 return false;
456 } 456 }
457 457
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index b63b594..8806c2c 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -228,6 +228,8 @@ namespace OpenSim.Server.Handlers.GridUser
228 int i = 0; 228 int i = 0;
229 foreach (GridUserInfo pinfo in pinfos) 229 foreach (GridUserInfo pinfo in pinfos)
230 { 230 {
231 if(pinfo == null)
232 continue;
231 Dictionary<string, object> rinfoDict = pinfo.ToKeyValuePairs(); 233 Dictionary<string, object> rinfoDict = pinfo.ToKeyValuePairs();
232 result["griduser" + i] = rinfoDict; 234 result["griduser" + i] = rinfoDict;
233 i++; 235 i++;
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
index 21eb790..237ffc7 100644
--- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs
@@ -103,6 +103,8 @@ namespace OpenSim.Server.Handlers.UserAccounts
103 return GetAccount(request); 103 return GetAccount(request);
104 case "getaccounts": 104 case "getaccounts":
105 return GetAccounts(request); 105 return GetAccounts(request);
106 case "getmultiaccounts":
107 return GetMultiAccounts(request);
106 case "setaccount": 108 case "setaccount":
107 if (m_AllowSetAccount) 109 if (m_AllowSetAccount)
108 return StoreAccount(request); 110 return StoreAccount(request);
@@ -201,6 +203,52 @@ namespace OpenSim.Server.Handlers.UserAccounts
201 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 203 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
202 } 204 }
203 205
206 byte[] GetMultiAccounts(Dictionary<string, object> request)
207 {
208 UUID scopeID = UUID.Zero;
209 if (request.ContainsKey("ScopeID") && !UUID.TryParse(request["ScopeID"].ToString(), out scopeID))
210 return FailureResult();
211
212 if (!request.ContainsKey("IDS"))
213 {
214 m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts called without required uuids argument");
215 return FailureResult();
216 }
217
218 if (!(request["IDS"] is List<string>))
219 {
220 m_log.DebugFormat("[USER SERVICE HANDLER]: GetMultiAccounts input argument was of unexpected type {0}", request["IDS"].GetType().ToString());
221 return FailureResult();
222 }
223
224 List<string> userIDs = (List<string>)request["IDS"];
225
226 List<UserAccount> accounts = m_UserAccountService.GetUserAccounts(scopeID, userIDs);
227
228 Dictionary<string, object> result = new Dictionary<string, object>();
229 if ((accounts == null) || ((accounts != null) && (accounts.Count == 0)))
230 {
231 result["result"] = "null";
232 }
233 else
234 {
235 int i = 0;
236 foreach (UserAccount acc in accounts)
237 {
238 if(acc == null)
239 continue;
240 Dictionary<string, object> rinfoDict = acc.ToKeyValuePairs();
241 result["account" + i] = rinfoDict;
242 i++;
243 }
244 }
245
246 string xmlString = ServerUtils.BuildXmlResponse(result);
247
248 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
249 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
250 }
251
204 byte[] StoreAccount(Dictionary<string, object> request) 252 byte[] StoreAccount(Dictionary<string, object> request)
205 { 253 {
206 UUID principalID = UUID.Zero; 254 UUID principalID = UUID.Zero;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 563a1e7..6f613c1 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -201,6 +201,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
201 return null; 201 return null;
202 } 202 }
203 203
204 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
205 {
206 return null;
207 }
208
204 public bool StoreUserAccount(UserAccount data) 209 public bool StoreUserAccount(UserAccount data)
205 { 210 {
206// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); 211// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
index 3de0a20..5bc7a1c 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
@@ -191,6 +191,98 @@ namespace OpenSim.Services.Connectors
191 return accounts; 191 return accounts;
192 } 192 }
193 193
194 public virtual List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
195 {
196 List<UserAccount> accs = new List<UserAccount>();
197 bool multisuported = true;
198 accs = doGetMultiUserAccounts(scopeID, IDs, out multisuported);
199 if(multisuported)
200 return accs;
201
202 // service does not do multi accounts so need to do it one by one
203
204 UUID uuid = UUID.Zero;
205 foreach(string id in IDs)
206 {
207 if(UUID.TryParse(id, out uuid) && uuid != UUID.Zero)
208 accs.Add(GetUserAccount(scopeID,uuid));
209 }
210
211 return accs;
212 }
213
214 private List<UserAccount> doGetMultiUserAccounts(UUID scopeID, List<string> IDs, out bool suported)
215 {
216 suported = true;
217 Dictionary<string, object> sendData = new Dictionary<string, object>();
218 //sendData["SCOPEID"] = scopeID.ToString();
219 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
220 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
221 sendData["METHOD"] = "getmultiaccounts";
222
223 sendData["ScopeID"] = scopeID.ToString();
224 sendData["IDS"] = new List<string>(IDs);
225
226 string reply = string.Empty;
227 string reqString = ServerUtils.BuildQueryString(sendData);
228 string uri = m_ServerURI + "/accounts";
229 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
230 try
231 {
232 reply = SynchronousRestFormsRequester.MakeRequest("POST",
233 uri,
234 reqString,
235 m_Auth);
236 if (reply == null || (reply != null && reply == string.Empty))
237 {
238 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received null or empty reply");
239 return null;
240 }
241 }
242 catch (Exception e)
243 {
244 m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user accounts server at {0}: {1}", uri, e.Message);
245 }
246
247 List<UserAccount> accounts = new List<UserAccount>();
248
249 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
250
251 if (replyData != null)
252 {
253 if (replyData.ContainsKey("result"))
254 {
255 if(replyData["result"].ToString() == "null")
256 return accounts;
257
258 if(replyData["result"].ToString() == "Failure")
259 {
260 suported = false;
261 return accounts;
262 }
263 }
264
265 Dictionary<string, object>.ValueCollection accountList = replyData.Values;
266 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count);
267 foreach (object acc in accountList)
268 {
269 if (acc is Dictionary<string, object>)
270 {
271 UserAccount pinfo = new UserAccount((Dictionary<string, object>)acc);
272 accounts.Add(pinfo);
273 }
274 else
275 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received invalid response type {0}",
276 acc.GetType());
277 }
278 }
279 else
280 m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetMultiUserAccounts received null response");
281
282 return accounts;
283 }
284
285
194 public void InvalidateCache(UUID userID) 286 public void InvalidateCache(UUID userID)
195 { 287 {
196 } 288 }
diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs
index 6c3c655..25ffb63 100644
--- a/OpenSim/Services/HypergridService/UserAccountCache.cs
+++ b/OpenSim/Services/HypergridService/UserAccountCache.cs
@@ -100,6 +100,11 @@ namespace OpenSim.Services.HypergridService
100 return null; 100 return null;
101 } 101 }
102 102
103 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
104 {
105 return null;
106 }
107
103 public void InvalidateCache(UUID userID) 108 public void InvalidateCache(UUID userID)
104 { 109 {
105 m_UUIDCache.Remove(userID); 110 m_UUIDCache.Remove(userID);
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 1814699..c6f3ef3 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -187,6 +187,7 @@ namespace OpenSim.Services.Interfaces
187 /// <returns></returns> 187 /// <returns></returns>
188 List<UserAccount> GetUserAccounts(UUID scopeID, string query); 188 List<UserAccount> GetUserAccounts(UUID scopeID, string query);
189 List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where); 189 List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where);
190 List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs);
190 191
191 /// <summary> 192 /// <summary>
192 /// Store the data given, wich replaces the stored data, therefore must be complete. 193 /// Store the data given, wich replaces the stored data, therefore must be complete.
diff --git a/OpenSim/Services/Interfaces/IUserManagement.cs b/OpenSim/Services/Interfaces/IUserManagement.cs
index 9e560d5..225560e 100644
--- a/OpenSim/Services/Interfaces/IUserManagement.cs
+++ b/OpenSim/Services/Interfaces/IUserManagement.cs
@@ -42,6 +42,7 @@ namespace OpenSim.Services.Interfaces
42 string GetUserUUI(UUID uuid); 42 string GetUserUUI(UUID uuid);
43 bool GetUserUUI(UUID userID, out string uui); 43 bool GetUserUUI(UUID userID, out string uui);
44 string GetUserServerURL(UUID uuid, string serverType); 44 string GetUserServerURL(UUID uuid, string serverType);
45 Dictionary<UUID,string> GetUsersNames(string[] ids);
45 46
46 /// <summary> 47 /// <summary>
47 /// Get user ID by the given name. 48 /// Get user ID by the given name.
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 6010f0c..668fe53 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -265,6 +265,19 @@ namespace OpenSim.Services.UserAccountService
265 return MakeUserAccount(d[0]); 265 return MakeUserAccount(d[0]);
266 } 266 }
267 267
268 public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs)
269 {
270 // do it one at a time db access should be fast, so no need to break its api
271 List<UserAccount> accs = new List<UserAccount>();
272 UUID uuid = UUID.Zero;
273 foreach(string id in IDs)
274 {
275 if (UUID.TryParse(id, out uuid) && uuid != UUID.Zero)
276 accs.Add(GetUserAccount(scopeID, uuid));
277 }
278 return accs;
279 }
280
268 public void InvalidateCache(UUID userID) 281 public void InvalidateCache(UUID userID)
269 { 282 {
270 } 283 }
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 4f8e986..9b087c9 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -861,6 +861,10 @@ namespace OpenSim.Tests.Common
861 { 861 {
862 } 862 }
863 863
864 public void SendAlertMessage(string message, string info)
865 {
866 }
867
864 public void SendSystemAlertMessage(string message) 868 public void SendSystemAlertMessage(string message)
865 { 869 {
866 } 870 }
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
index 417efce..bc30945 100644
--- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
+++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs
@@ -152,6 +152,11 @@ namespace OpenSim.Tests.Common
152 AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute, isEnterorLeave); 152 AddEvent(toAgent, "ChatterBoxSessionAgentListUpdates", sessionID, fromAgent, canVoiceChat, isModerator, textMute, isEnterorLeave);
153 } 153 }
154 154
155 public void ChatterBoxForceClose (UUID toAgent, UUID sessionID, string reason)
156 {
157 AddEvent(toAgent, "ForceCloseChatterBoxSession", sessionID, reason);
158 }
159
155 public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) 160 public void ParcelProperties (OpenMetaverse.Messages.Linden.ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
156 { 161 {
157 AddEvent(avatarID, "ParcelProperties", parcelPropertiesMessage); 162 AddEvent(avatarID, "ParcelProperties", parcelPropertiesMessage);