aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps')
-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
5 files changed, 386 insertions, 128 deletions
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);