aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs987
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs5
-rw-r--r--OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs5
-rw-r--r--OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs5
-rw-r--r--OpenSim/Data/IRegionData.cs1
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs27
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs23
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs25
-rw-r--r--OpenSim/Data/Resources/OpenSim.Data.addin.xml9
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs4
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs4
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs2
-rw-r--r--OpenSim/Framework/ACL.cs252
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs2
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs65
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs2
-rw-r--r--OpenSim/Framework/FriendRegionInfo.cs38
-rw-r--r--OpenSim/Framework/GridConfig.cs162
-rw-r--r--OpenSim/Framework/HGNetworkServersInfo.cs107
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rw-r--r--OpenSim/Framework/IClientFileTransfer.cs40
-rw-r--r--OpenSim/Framework/ILoginServiceToRegionsConnector.cs41
-rw-r--r--OpenSim/Framework/IMoneyModule.cs30
-rw-r--r--OpenSim/Framework/MessageServerConfig.cs152
-rw-r--r--OpenSim/Framework/NetworkUtil.cs84
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs15
-rw-r--r--OpenSim/Framework/Tests/ACLTest.cs125
-rw-r--r--OpenSim/Framework/UserConfig.cs231
-rw-r--r--OpenSim/Framework/WebUtil.cs7
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs15
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs16
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs120
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs367
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs5
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs8
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs168
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs96
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs139
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs (renamed from OpenSim/Framework/ConfigBase.cs)16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs111
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs125
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs126
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs46
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs (renamed from OpenSim/Region/CoreModules/World/Terrain/DefaultEffects/ChannelDigger.cs)2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/SnapshotStore.cs21
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IHyperService.cs37
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs209
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs95
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs431
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs269
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs59
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs4
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs89
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs264
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs4
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs24
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs35
-rw-r--r--OpenSim/Services/GridService/GridService.cs11
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs47
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs128
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs38
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs46
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs21
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs10
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs4
-rw-r--r--OpenSim/Tools/Configger/ConfigurationLoader.cs30
97 files changed, 2341 insertions, 3615 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index e57aaa0..7e4a8e8 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -58,12 +58,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
58 { 58 {
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60 60
61 private static bool daload = false; 61 private static bool m_defaultAvatarsLoaded = false;
62 private static Object rslock = new Object(); 62 private static Object m_requestLock = new Object();
63 private static Object SOLock = new Object(); 63 private static Object m_saveOarLock = new Object();
64 64
65 private OpenSimBase m_app; 65 private OpenSimBase m_application;
66 private IHttpServer m_httpd; 66 private IHttpServer m_httpServer;
67 private IConfig m_config; 67 private IConfig m_config;
68 private IConfigSource m_configSource; 68 private IConfigSource m_configSource;
69 private string m_requiredPassword = String.Empty; 69 private string m_requiredPassword = String.Empty;
@@ -115,8 +115,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
115 m_requiredPassword = m_config.GetString("access_password", String.Empty); 115 m_requiredPassword = m_config.GetString("access_password", String.Empty);
116 int port = m_config.GetInt("port", 0); 116 int port = m_config.GetInt("port", 0);
117 117
118 m_app = openSim; 118 m_application = openSim;
119 m_httpd = MainServer.GetHttpServer((uint)port); 119 m_httpServer = MainServer.GetHttpServer((uint)port);
120 120
121 Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>(); 121 Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>();
122 availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; 122 availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod;
@@ -160,14 +160,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
160 { 160 {
161 foreach (string method in availableMethods.Keys) 161 foreach (string method in availableMethods.Keys)
162 { 162 {
163 m_httpd.AddXmlRPCHandler(method, availableMethods[method], false); 163 m_httpServer.AddXmlRPCHandler(method, availableMethods[method], false);
164 } 164 }
165 } 165 }
166 else 166 else
167 { 167 {
168 foreach (string enabledMethod in enabledMethods.Split('|')) 168 foreach (string enabledMethod in enabledMethods.Split('|'))
169 { 169 {
170 m_httpd.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]); 170 m_httpServer.AddXmlRPCHandler(enabledMethod, availableMethods[enabledMethod]);
171 } 171 }
172 } 172 }
173 } 173 }
@@ -180,7 +180,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
180 180
181 public void PostInitialise() 181 public void PostInitialise()
182 { 182 {
183 if (!createDefaultAvatars()) 183 if (!CreateDefaultAvatars())
184 { 184 {
185 m_log.Info("[RADMIN]: Default avatars not loaded"); 185 m_log.Info("[RADMIN]: Default avatars not loaded");
186 } 186 }
@@ -196,7 +196,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
196 Hashtable requestData = (Hashtable) request.Params[0]; 196 Hashtable requestData = (Hashtable) request.Params[0];
197 197
198 m_log.Info("[RADMIN]: Request to restart Region."); 198 m_log.Info("[RADMIN]: Request to restart Region.");
199 checkStringParameters(request, new string[] {"password", "regionID"}); 199 CheckStringParameters(request, new string[] {"password", "regionID"});
200 200
201 if (m_requiredPassword != String.Empty && 201 if (m_requiredPassword != String.Empty &&
202 (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) 202 (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword))
@@ -212,7 +212,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
212 212
213 Scene rebootedScene; 213 Scene rebootedScene;
214 214
215 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) 215 if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
216 throw new Exception("region not found"); 216 throw new Exception("region not found");
217 217
218 responseData["rebooting"] = true; 218 responseData["rebooting"] = true;
@@ -245,7 +245,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
245 { 245 {
246 Hashtable requestData = (Hashtable) request.Params[0]; 246 Hashtable requestData = (Hashtable) request.Params[0];
247 247
248 checkStringParameters(request, new string[] {"password", "message"}); 248 CheckStringParameters(request, new string[] {"password", "message"});
249 249
250 if (m_requiredPassword != String.Empty && 250 if (m_requiredPassword != String.Empty &&
251 (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) 251 (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword))
@@ -258,7 +258,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
258 responseData["success"] = true; 258 responseData["success"] = true;
259 response.Value = responseData; 259 response.Value = responseData;
260 260
261 m_app.SceneManager.ForEachScene( 261 m_application.SceneManager.ForEachScene(
262 delegate(Scene scene) 262 delegate(Scene scene)
263 { 263 {
264 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 264 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
@@ -299,7 +299,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
299 // k, (string)requestData[k], ((string)requestData[k]).Length); 299 // k, (string)requestData[k], ((string)requestData[k]).Length);
300 // } 300 // }
301 301
302 checkStringParameters(request, new string[] {"password", "filename", "regionid"}); 302 CheckStringParameters(request, new string[] {"password", "filename", "regionid"});
303 303
304 if (m_requiredPassword != String.Empty && 304 if (m_requiredPassword != String.Empty &&
305 (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword)) 305 (!requestData.Contains("password") || (string) requestData["password"] != m_requiredPassword))
@@ -313,7 +313,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
313 313
314 Scene region = null; 314 Scene region = null;
315 315
316 if (!m_app.SceneManager.TryGetScene(regionID, out region)) 316 if (!m_application.SceneManager.TryGetScene(regionID, out region))
317 throw new Exception("1: unable to get a scene with that name"); 317 throw new Exception("1: unable to get a scene with that name");
318 318
319 ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); 319 ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
@@ -387,7 +387,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
387 message = "Region is going down now."; 387 message = "Region is going down now.";
388 } 388 }
389 389
390 m_app.SceneManager.ForEachScene( 390 m_application.SceneManager.ForEachScene(
391 delegate(Scene scene) 391 delegate(Scene scene)
392 { 392 {
393 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 393 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
@@ -422,7 +422,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
422 422
423 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e) 423 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
424 { 424 {
425 m_app.Shutdown(); 425 m_application.Shutdown();
426 } 426 }
427 427
428 /// <summary> 428 /// <summary>
@@ -489,7 +489,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
489 XmlRpcResponse response = new XmlRpcResponse(); 489 XmlRpcResponse response = new XmlRpcResponse();
490 Hashtable responseData = new Hashtable(); 490 Hashtable responseData = new Hashtable();
491 491
492 lock (rslock) 492 lock (m_requestLock)
493 { 493 {
494 int m_regionLimit = m_config.GetInt("region_limit", 0); 494 int m_regionLimit = m_config.GetInt("region_limit", 0);
495 bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false); 495 bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false);
@@ -499,7 +499,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
499 { 499 {
500 Hashtable requestData = (Hashtable) request.Params[0]; 500 Hashtable requestData = (Hashtable) request.Params[0];
501 501
502 checkStringParameters(request, new string[] 502 CheckStringParameters(request, new string[]
503 { 503 {
504 "password", 504 "password",
505 "region_name", 505 "region_name",
@@ -507,14 +507,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
507 "region_master_password", 507 "region_master_password",
508 "listen_ip", "external_address" 508 "listen_ip", "external_address"
509 }); 509 });
510 checkIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); 510 CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"});
511 511
512 // check password 512 // check password
513 if (!String.IsNullOrEmpty(m_requiredPassword) && 513 if (!String.IsNullOrEmpty(m_requiredPassword) &&
514 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); 514 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
515 515
516 // check whether we still have space left (iff we are using limits) 516 // check whether we still have space left (iff we are using limits)
517 if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit) 517 if (m_regionLimit != 0 && m_application.SceneManager.Scenes.Count >= m_regionLimit)
518 throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first", 518 throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first",
519 m_regionLimit)); 519 m_regionLimit));
520 // extract or generate region ID now 520 // extract or generate region ID now
@@ -524,7 +524,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
524 !String.IsNullOrEmpty((string) requestData["region_id"])) 524 !String.IsNullOrEmpty((string) requestData["region_id"]))
525 { 525 {
526 regionID = (UUID) (string) requestData["region_id"]; 526 regionID = (UUID) (string) requestData["region_id"];
527 if (m_app.SceneManager.TryGetScene(regionID, out scene)) 527 if (m_application.SceneManager.TryGetScene(regionID, out scene))
528 throw new Exception( 528 throw new Exception(
529 String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", 529 String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
530 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 530 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
@@ -547,13 +547,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
547 547
548 // check for collisions: region name, region UUID, 548 // check for collisions: region name, region UUID,
549 // region location 549 // region location
550 if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) 550 if (m_application.SceneManager.TryGetScene(region.RegionName, out scene))
551 throw new Exception( 551 throw new Exception(
552 String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", 552 String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
553 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, 553 scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
554 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); 554 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
555 555
556 if (m_app.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene)) 556 if (m_application.SceneManager.TryGetScene(region.RegionLocX, region.RegionLocY, out scene))
557 throw new Exception( 557 throw new Exception(
558 String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>", 558 String.Format("region location <{0},{1}> already in use by region {2}, UUID {3}, <{4},{5}>",
559 region.RegionLocX, region.RegionLocY, 559 region.RegionLocX, region.RegionLocY,
@@ -565,7 +565,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
565 565
566 region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]); 566 region.InternalEndPoint.Port = Convert.ToInt32(requestData["listen_port"]);
567 if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); 567 if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0");
568 if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) 568 if (m_application.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
569 throw new Exception( 569 throw new Exception(
570 String.Format( 570 String.Format(
571 "region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", 571 "region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
@@ -625,28 +625,28 @@ namespace OpenSim.ApplicationPlugins.RemoteController
625 625
626 // Create the region and perform any initial initialization 626 // Create the region and perform any initial initialization
627 627
628 IScene newscene; 628 IScene newScene;
629 m_app.CreateRegion(region, out newscene); 629 m_application.CreateRegion(region, out newScene);
630 630
631 // If an access specification was provided, use it. 631 // If an access specification was provided, use it.
632 // Otherwise accept the default. 632 // Otherwise accept the default.
633 newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess); 633 newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess);
634 newscene.RegionInfo.EstateSettings.EstateOwner = userID; 634 newScene.RegionInfo.EstateSettings.EstateOwner = userID;
635 if (persist) 635 if (persist)
636 newscene.RegionInfo.EstateSettings.Save(); 636 newScene.RegionInfo.EstateSettings.Save();
637 637
638 // enable voice on newly created region if 638 // enable voice on newly created region if
639 // requested by either the XmlRpc request or the 639 // requested by either the XmlRpc request or the
640 // configuration 640 // configuration
641 if (getBoolean(requestData, "enable_voice", m_enableVoiceForNewRegions)) 641 if (GetBoolean(requestData, "enable_voice", m_enableVoiceForNewRegions))
642 { 642 {
643 List<ILandObject> parcels = ((Scene)newscene).LandChannel.AllParcels(); 643 List<ILandObject> parcels = ((Scene)newScene).LandChannel.AllParcels();
644 644
645 foreach (ILandObject parcel in parcels) 645 foreach (ILandObject parcel in parcels)
646 { 646 {
647 parcel.LandData.Flags |= (uint) ParcelFlags.AllowVoiceChat; 647 parcel.LandData.Flags |= (uint) ParcelFlags.AllowVoiceChat;
648 parcel.LandData.Flags |= (uint) ParcelFlags.UseEstateVoiceChan; 648 parcel.LandData.Flags |= (uint) ParcelFlags.UseEstateVoiceChan;
649 ((Scene)newscene).LandChannel.UpdateLandObject(parcel.LandData.LocalID, parcel.LandData); 649 ((Scene)newScene).LandChannel.UpdateLandObject(parcel.LandData.LocalID, parcel.LandData);
650 } 650 }
651 } 651 }
652 652
@@ -704,19 +704,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
704 XmlRpcResponse response = new XmlRpcResponse(); 704 XmlRpcResponse response = new XmlRpcResponse();
705 Hashtable responseData = new Hashtable(); 705 Hashtable responseData = new Hashtable();
706 706
707 lock (rslock) 707 lock (m_requestLock)
708 { 708 {
709 try 709 try
710 { 710 {
711 Hashtable requestData = (Hashtable) request.Params[0]; 711 Hashtable requestData = (Hashtable) request.Params[0];
712 checkStringParameters(request, new string[] {"password", "region_name"}); 712 CheckStringParameters(request, new string[] {"password", "region_name"});
713 713
714 Scene scene = null; 714 Scene scene = null;
715 string regionName = (string) requestData["region_name"]; 715 string regionName = (string) requestData["region_name"];
716 if (!m_app.SceneManager.TryGetScene(regionName, out scene)) 716 if (!m_application.SceneManager.TryGetScene(regionName, out scene))
717 throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); 717 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
718 718
719 m_app.RemoveRegion(scene, true); 719 m_application.RemoveRegion(scene, true);
720 720
721 responseData["success"] = true; 721 responseData["success"] = true;
722 responseData["region_name"] = regionName; 722 responseData["region_name"] = regionName;
@@ -774,22 +774,22 @@ namespace OpenSim.ApplicationPlugins.RemoteController
774 Hashtable responseData = new Hashtable(); 774 Hashtable responseData = new Hashtable();
775 Scene scene = null; 775 Scene scene = null;
776 776
777 lock (rslock) 777 lock (m_requestLock)
778 { 778 {
779 try 779 try
780 { 780 {
781 Hashtable requestData = (Hashtable) request.Params[0]; 781 Hashtable requestData = (Hashtable) request.Params[0];
782 checkStringParameters(request, new string[] {"password"}); 782 CheckStringParameters(request, new string[] {"password"});
783 783
784 if (requestData.ContainsKey("region_id") && 784 if (requestData.ContainsKey("region_id") &&
785 !String.IsNullOrEmpty((string) requestData["region_id"])) 785 !String.IsNullOrEmpty((string) requestData["region_id"]))
786 { 786 {
787 // Region specified by UUID 787 // Region specified by UUID
788 UUID regionID = (UUID) (string) requestData["region_id"]; 788 UUID regionID = (UUID) (string) requestData["region_id"];
789 if (!m_app.SceneManager.TryGetScene(regionID, out scene)) 789 if (!m_application.SceneManager.TryGetScene(regionID, out scene))
790 throw new Exception(String.Format("region \"{0}\" does not exist", regionID)); 790 throw new Exception(String.Format("region \"{0}\" does not exist", regionID));
791 791
792 m_app.CloseRegion(scene); 792 m_application.CloseRegion(scene);
793 793
794 responseData["success"] = true; 794 responseData["success"] = true;
795 responseData["region_id"] = regionID; 795 responseData["region_id"] = regionID;
@@ -802,10 +802,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
802 // Region specified by name 802 // Region specified by name
803 803
804 string regionName = (string) requestData["region_name"]; 804 string regionName = (string) requestData["region_name"];
805 if (!m_app.SceneManager.TryGetScene(regionName, out scene)) 805 if (!m_application.SceneManager.TryGetScene(regionName, out scene))
806 throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); 806 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
807 807
808 m_app.CloseRegion(scene); 808 m_application.CloseRegion(scene);
809 809
810 responseData["success"] = true; 810 responseData["success"] = true;
811 responseData["region_name"] = regionName; 811 responseData["region_name"] = regionName;
@@ -869,27 +869,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
869 XmlRpcResponse response = new XmlRpcResponse(); 869 XmlRpcResponse response = new XmlRpcResponse();
870 Hashtable responseData = new Hashtable(); 870 Hashtable responseData = new Hashtable();
871 871
872 lock (rslock) 872 lock (m_requestLock)
873 { 873 {
874 try 874 try
875 { 875 {
876 Hashtable requestData = (Hashtable) request.Params[0]; 876 Hashtable requestData = (Hashtable) request.Params[0];
877 checkStringParameters(request, new string[] {"password", "region_name"}); 877 CheckStringParameters(request, new string[] {"password", "region_name"});
878 878
879 Scene scene = null; 879 Scene scene = null;
880 string regionName = (string) requestData["region_name"]; 880 string regionName = (string) requestData["region_name"];
881 if (!m_app.SceneManager.TryGetScene(regionName, out scene)) 881 if (!m_application.SceneManager.TryGetScene(regionName, out scene))
882 throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); 882 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
883 883
884 // Modify access 884 // Modify access
885 scene.RegionInfo.EstateSettings.PublicAccess = 885 scene.RegionInfo.EstateSettings.PublicAccess =
886 getBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess); 886 GetBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess);
887 if (scene.RegionInfo.Persistent) 887 if (scene.RegionInfo.Persistent)
888 scene.RegionInfo.EstateSettings.Save(); 888 scene.RegionInfo.EstateSettings.Save();
889 889
890 if (requestData.ContainsKey("enable_voice")) 890 if (requestData.ContainsKey("enable_voice"))
891 { 891 {
892 bool enableVoice = getBoolean(requestData, "enable_voice", true); 892 bool enableVoice = GetBoolean(requestData, "enable_voice", true);
893 List<ILandObject> parcels = ((Scene)scene).LandChannel.AllParcels(); 893 List<ILandObject> parcels = ((Scene)scene).LandChannel.AllParcels();
894 894
895 foreach (ILandObject parcel in parcels) 895 foreach (ILandObject parcel in parcels)
@@ -976,66 +976,66 @@ namespace OpenSim.ApplicationPlugins.RemoteController
976 XmlRpcResponse response = new XmlRpcResponse(); 976 XmlRpcResponse response = new XmlRpcResponse();
977 Hashtable responseData = new Hashtable(); 977 Hashtable responseData = new Hashtable();
978 978
979 lock (rslock) 979 lock (m_requestLock)
980 { 980 {
981 try 981 try
982 { 982 {
983 Hashtable requestData = (Hashtable) request.Params[0]; 983 Hashtable requestData = (Hashtable) request.Params[0];
984 984
985 // check completeness 985 // check completeness
986 checkStringParameters(request, new string[] 986 CheckStringParameters(request, new string[]
987 { 987 {
988 "password", "user_firstname", 988 "password", "user_firstname",
989 "user_lastname", "user_password", 989 "user_lastname", "user_password",
990 }); 990 });
991 checkIntegerParams(request, new string[] {"start_region_x", "start_region_y"}); 991 CheckIntegerParams(request, new string[] {"start_region_x", "start_region_y"});
992 992
993 // check password 993 // check password
994 if (!String.IsNullOrEmpty(m_requiredPassword) && 994 if (!String.IsNullOrEmpty(m_requiredPassword) &&
995 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); 995 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
996 996
997 // do the job 997 // do the job
998 string firstname = (string) requestData["user_firstname"]; 998 string firstName = (string) requestData["user_firstname"];
999 string lastname = (string) requestData["user_lastname"]; 999 string lastName = (string) requestData["user_lastname"];
1000 string passwd = (string) requestData["user_password"]; 1000 string password = (string) requestData["user_password"];
1001 1001
1002 uint regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); 1002 uint regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]);
1003 uint regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); 1003 uint regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]);
1004 1004
1005 string email = ""; // empty string for email 1005 string email = ""; // empty string for email
1006 if (requestData.Contains("user_email")) 1006 if (requestData.Contains("user_email"))
1007 email = (string)requestData["user_email"]; 1007 email = (string)requestData["user_email"];
1008 1008
1009 Scene scene = m_app.SceneManager.CurrentOrFirstScene; 1009 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
1010 UUID scopeID = scene.RegionInfo.ScopeID; 1010 UUID scopeID = scene.RegionInfo.ScopeID;
1011 1011
1012 UserAccount account = CreateUser(scopeID, firstname, lastname, passwd, email); 1012 UserAccount account = CreateUser(scopeID, firstName, lastName, password, email);
1013 1013
1014 if (null == account) 1014 if (null == account)
1015 throw new Exception(String.Format("failed to create new user {0} {1}", 1015 throw new Exception(String.Format("failed to create new user {0} {1}",
1016 firstname, lastname)); 1016 firstName, lastName));
1017 1017
1018 // Set home position 1018 // Set home position
1019 1019
1020 GridRegion home = scene.GridService.GetRegionByPosition(scopeID, 1020 GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
1021 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); 1021 (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize));
1022 if (null == home) { 1022 if (null == home) {
1023 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname); 1023 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstName, lastName);
1024 } else { 1024 } else {
1025 scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); 1025 scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1026 m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); 1026 m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstName, lastName);
1027 } 1027 }
1028 1028
1029 // Establish the avatar's initial appearance 1029 // Establish the avatar's initial appearance
1030 1030
1031 updateUserAppearance(responseData, requestData, account.PrincipalID); 1031 UpdateUserAppearance(responseData, requestData, account.PrincipalID);
1032 1032
1033 responseData["success"] = true; 1033 responseData["success"] = true;
1034 responseData["avatar_uuid"] = account.PrincipalID.ToString(); 1034 responseData["avatar_uuid"] = account.PrincipalID.ToString();
1035 1035
1036 response.Value = responseData; 1036 response.Value = responseData;
1037 1037
1038 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID); 1038 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstName, lastName, account.PrincipalID);
1039 } 1039 }
1040 catch (Exception e) 1040 catch (Exception e)
1041 { 1041 {
@@ -1099,17 +1099,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1099 Hashtable requestData = (Hashtable) request.Params[0]; 1099 Hashtable requestData = (Hashtable) request.Params[0];
1100 1100
1101 // check completeness 1101 // check completeness
1102 checkStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"}); 1102 CheckStringParameters(request, new string[] {"password", "user_firstname", "user_lastname"});
1103 1103
1104 string firstname = (string) requestData["user_firstname"]; 1104 string firstName = (string) requestData["user_firstname"];
1105 string lastname = (string) requestData["user_lastname"]; 1105 string lastName = (string) requestData["user_lastname"];
1106 1106
1107 responseData["user_firstname"] = firstname; 1107 responseData["user_firstname"] = firstName;
1108 responseData["user_lastname"] = lastname; 1108 responseData["user_lastname"] = lastName;
1109 1109
1110 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; 1110 UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1111 1111
1112 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); 1112 UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstName, lastName);
1113 1113
1114 if (null == account) 1114 if (null == account)
1115 { 1115 {
@@ -1118,9 +1118,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1118 } 1118 }
1119 else 1119 else
1120 { 1120 {
1121 GridUserInfo guinfo = m_app.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString()); 1121 GridUserInfo userInfo = m_application.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString());
1122 if (guinfo != null) 1122 if (userInfo != null)
1123 responseData["lastlogin"] = guinfo.Login; 1123 responseData["lastlogin"] = userInfo.Login;
1124 else 1124 else
1125 responseData["lastlogin"] = 0; 1125 responseData["lastlogin"] = 0;
1126 1126
@@ -1197,14 +1197,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1197 XmlRpcResponse response = new XmlRpcResponse(); 1197 XmlRpcResponse response = new XmlRpcResponse();
1198 Hashtable responseData = new Hashtable(); 1198 Hashtable responseData = new Hashtable();
1199 1199
1200 lock (rslock) 1200 lock (m_requestLock)
1201 { 1201 {
1202 try 1202 try
1203 { 1203 {
1204 Hashtable requestData = (Hashtable) request.Params[0]; 1204 Hashtable requestData = (Hashtable) request.Params[0];
1205 1205
1206 // check completeness 1206 // check completeness
1207 checkStringParameters(request, new string[] { 1207 CheckStringParameters(request, new string[] {
1208 "password", "user_firstname", 1208 "password", "user_firstname",
1209 "user_lastname"}); 1209 "user_lastname"});
1210 1210
@@ -1213,12 +1213,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1213 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); 1213 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
1214 1214
1215 // do the job 1215 // do the job
1216 string firstname = (string) requestData["user_firstname"]; 1216 string firstName = (string) requestData["user_firstname"];
1217 string lastname = (string) requestData["user_lastname"]; 1217 string lastName = (string) requestData["user_lastname"];
1218 1218
1219 string passwd = String.Empty; 1219 string password = String.Empty;
1220 uint? regX = null; 1220 uint? regionXLocation = null;
1221 uint? regY = null; 1221 uint? regionYLocation = null;
1222 // uint? ulaX = null; 1222 // uint? ulaX = null;
1223 // uint? ulaY = null; 1223 // uint? ulaY = null;
1224 // uint? ulaZ = null; 1224 // uint? ulaZ = null;
@@ -1228,11 +1228,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1228 // string aboutFirstLive = String.Empty; 1228 // string aboutFirstLive = String.Empty;
1229 // string aboutAvatar = String.Empty; 1229 // string aboutAvatar = String.Empty;
1230 1230
1231 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; 1231 if (requestData.ContainsKey("user_password")) password = (string) requestData["user_password"];
1232 if (requestData.ContainsKey("start_region_x")) 1232 if (requestData.ContainsKey("start_region_x"))
1233 regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); 1233 regionXLocation = Convert.ToUInt32((Int32) requestData["start_region_x"]);
1234 if (requestData.ContainsKey("start_region_y")) 1234 if (requestData.ContainsKey("start_region_y"))
1235 regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); 1235 regionYLocation = Convert.ToUInt32((Int32) requestData["start_region_y"]);
1236 1236
1237 // if (requestData.ContainsKey("start_lookat_x")) 1237 // if (requestData.ContainsKey("start_lookat_x"))
1238 // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); 1238 // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
@@ -1252,17 +1252,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1252 // if (requestData.ContainsKey("about_virtual_world")) 1252 // if (requestData.ContainsKey("about_virtual_world"))
1253 // aboutAvatar = (string)requestData["about_virtual_world"]; 1253 // aboutAvatar = (string)requestData["about_virtual_world"];
1254 1254
1255 Scene scene = m_app.SceneManager.CurrentOrFirstScene; 1255 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
1256 UUID scopeID = scene.RegionInfo.ScopeID; 1256 UUID scopeID = scene.RegionInfo.ScopeID;
1257 UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); 1257 UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstName, lastName);
1258 1258
1259 if (null == account) 1259 if (null == account)
1260 throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); 1260 throw new Exception(String.Format("avatar {0} {1} does not exist", firstName, lastName));
1261 1261
1262 if (!String.IsNullOrEmpty(passwd)) 1262 if (!String.IsNullOrEmpty(password))
1263 { 1263 {
1264 m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); 1264 m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstName, lastName);
1265 ChangeUserPassword(firstname, lastname, passwd); 1265 ChangeUserPassword(firstName, lastName, password);
1266 } 1266 }
1267 1267
1268 // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; 1268 // if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
@@ -1278,21 +1278,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1278 1278
1279 // Set home position 1279 // Set home position
1280 1280
1281 if ((null != regX) && (null != regY)) 1281 if ((null != regionXLocation) && (null != regionYLocation))
1282 { 1282 {
1283 GridRegion home = scene.GridService.GetRegionByPosition(scopeID, 1283 GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
1284 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); 1284 (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize));
1285 if (null == home) { 1285 if (null == home) {
1286 m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstname, lastname); 1286 m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName);
1287 } else { 1287 } else {
1288 scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); 1288 scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1289 m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstname, lastname); 1289 m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, firstName, lastName);
1290 } 1290 }
1291 } 1291 }
1292 1292
1293 // User has been created. Now establish gender and appearance. 1293 // User has been created. Now establish gender and appearance.
1294 1294
1295 updateUserAppearance(responseData, requestData, account.PrincipalID); 1295 UpdateUserAppearance(responseData, requestData, account.PrincipalID);
1296 1296
1297 responseData["success"] = true; 1297 responseData["success"] = true;
1298 responseData["avatar_uuid"] = account.PrincipalID.ToString(); 1298 responseData["avatar_uuid"] = account.PrincipalID.ToString();
@@ -1300,7 +1300,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1300 response.Value = responseData; 1300 response.Value = responseData;
1301 1301
1302 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", 1302 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
1303 firstname, lastname, 1303 firstName, lastName,
1304 account.PrincipalID); 1304 account.PrincipalID);
1305 } 1305 }
1306 catch (Exception e) 1306 catch (Exception e)
@@ -1328,13 +1328,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1328 /// This should probably get moved into somewhere more core eventually. 1328 /// This should probably get moved into somewhere more core eventually.
1329 /// </summary> 1329 /// </summary>
1330 1330
1331 private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) 1331 private void UpdateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
1332 { 1332 {
1333 m_log.DebugFormat("[RADMIN] updateUserAppearance"); 1333 m_log.DebugFormat("[RADMIN] updateUserAppearance");
1334 1334
1335 string dmale = m_config.GetString("default_male", "Default Male"); 1335 string defaultMale = m_config.GetString("default_male", "Default Male");
1336 string dfemale = m_config.GetString("default_female", "Default Female"); 1336 string defaultFemale = m_config.GetString("default_female", "Default Female");
1337 string dneut = m_config.GetString("default_female", "Default Default"); 1337 string defaultNeutral = m_config.GetString("default_female", "Default Default");
1338 string model = String.Empty; 1338 string model = String.Empty;
1339 1339
1340 // Has a gender preference been supplied? 1340 // Has a gender preference been supplied?
@@ -1345,16 +1345,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1345 { 1345 {
1346 case "m" : 1346 case "m" :
1347 case "male" : 1347 case "male" :
1348 model = dmale; 1348 model = defaultMale;
1349 break; 1349 break;
1350 case "f" : 1350 case "f" :
1351 case "female" : 1351 case "female" :
1352 model = dfemale; 1352 model = defaultFemale;
1353 break; 1353 break;
1354 case "n" : 1354 case "n" :
1355 case "neutral" : 1355 case "neutral" :
1356 default : 1356 default :
1357 model = dneut; 1357 model = defaultNeutral;
1358 break; 1358 break;
1359 } 1359 }
1360 } 1360 }
@@ -1376,19 +1376,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1376 1376
1377 m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model); 1377 m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model <{1}>", userid, model);
1378 1378
1379 string[] nomens = model.Split(); 1379 string[] modelSpecifiers = model.Split();
1380 if (nomens.Length != 2) 1380 if (modelSpecifiers.Length != 2)
1381 { 1381 {
1382 m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); 1382 m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
1383 // nomens = dmodel.Split(); 1383 // modelSpecifiers = dmodel.Split();
1384 return; 1384 return;
1385 } 1385 }
1386 1386
1387 Scene scene = m_app.SceneManager.CurrentOrFirstScene; 1387 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
1388 UUID scopeID = scene.RegionInfo.ScopeID; 1388 UUID scopeID = scene.RegionInfo.ScopeID;
1389 UserAccount mprof = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); 1389 UserAccount modelProfile = scene.UserAccountService.GetUserAccount(scopeID, modelSpecifiers[0], modelSpecifiers[1]);
1390 1390
1391 if (mprof == null) 1391 if (modelProfile == null)
1392 { 1392 {
1393 m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); 1393 m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model);
1394 return; 1394 return;
@@ -1398,7 +1398,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1398 // actual asset ids, however to complete the magic we need to populate the inventory with the 1398 // actual asset ids, however to complete the magic we need to populate the inventory with the
1399 // assets in question. 1399 // assets in question.
1400 1400
1401 establishAppearance(userid, mprof.PrincipalID); 1401 EstablishAppearance(userid, modelProfile.PrincipalID);
1402 1402
1403 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", 1403 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
1404 userid, model); 1404 userid, model);
@@ -1410,17 +1410,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1410 /// is known to exist, as is the target avatar. 1410 /// is known to exist, as is the target avatar.
1411 /// </summary> 1411 /// </summary>
1412 1412
1413 private void establishAppearance(UUID dest, UUID srca) 1413 private void EstablishAppearance(UUID destination, UUID source)
1414 { 1414 {
1415 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); 1415 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source);
1416 Scene scene = m_app.SceneManager.CurrentOrFirstScene; 1416 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
1417 AvatarAppearance ava = null; 1417 AvatarAppearance avatarAppearance = null;
1418 AvatarData avatar = scene.AvatarService.GetAvatar(srca); 1418 AvatarData avatar = scene.AvatarService.GetAvatar(source);
1419 if (avatar != null) 1419 if (avatar != null)
1420 ava = avatar.ToAvatarAppearance(srca); 1420 avatarAppearance = avatar.ToAvatarAppearance(source);
1421 1421
1422 // If the model has no associated appearance we're done. 1422 // If the model has no associated appearance we're done.
1423 if (ava == null) 1423 if (avatarAppearance == null)
1424 return; 1424 return;
1425 1425
1426 // Simple appearance copy or copy Clothing and Bodyparts folders? 1426 // Simple appearance copy or copy Clothing and Bodyparts folders?
@@ -1431,15 +1431,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1431 // Simple copy of wearables and appearance update 1431 // Simple copy of wearables and appearance update
1432 try 1432 try
1433 { 1433 {
1434 copyWearablesAndAttachments(dest, srca, ava); 1434 CopyWearablesAndAttachments(destination, source, avatarAppearance);
1435 1435
1436 AvatarData adata = new AvatarData(ava); 1436 AvatarData avatarData = new AvatarData(avatarAppearance);
1437 scene.AvatarService.SetAvatar(dest, adata); 1437 scene.AvatarService.SetAvatar(destination, avatarData);
1438 } 1438 }
1439 catch (Exception e) 1439 catch (Exception e)
1440 { 1440 {
1441 m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", 1441 m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}",
1442 dest, e.Message); 1442 destination, e.Message);
1443 } 1443 }
1444 1444
1445 return; 1445 return;
@@ -1448,30 +1448,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1448 // Copy Clothing and Bodypart folders and appearance update 1448 // Copy Clothing and Bodypart folders and appearance update
1449 try 1449 try
1450 { 1450 {
1451 Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>(); 1451 Dictionary<UUID,UUID> inventoryMap = new Dictionary<UUID,UUID>();
1452 copyInventoryFolders(dest, srca, AssetType.Clothing, imap, ava); 1452 CopyInventoryFolders(destination, source, AssetType.Clothing, inventoryMap, avatarAppearance);
1453 copyInventoryFolders(dest, srca, AssetType.Bodypart, imap, ava); 1453 CopyInventoryFolders(destination, source, AssetType.Bodypart, inventoryMap, avatarAppearance);
1454 1454
1455 AvatarWearable[] wearables = ava.Wearables; 1455 AvatarWearable[] wearables = avatarAppearance.Wearables;
1456 1456
1457 for (int i=0; i<wearables.Length; i++) 1457 for (int i=0; i<wearables.Length; i++)
1458 { 1458 {
1459 if (imap.ContainsKey(wearables[i].ItemID)) 1459 if (inventoryMap.ContainsKey(wearables[i].ItemID))
1460 { 1460 {
1461 AvatarWearable dw = new AvatarWearable(); 1461 AvatarWearable wearable = new AvatarWearable();
1462 dw.AssetID = wearables[i].AssetID; 1462 wearable.AssetID = wearables[i].AssetID;
1463 dw.ItemID = imap[wearables[i].ItemID]; 1463 wearable.ItemID = inventoryMap[wearables[i].ItemID];
1464 ava.SetWearable(i, dw); 1464 avatarAppearance.SetWearable(i, wearable);
1465 } 1465 }
1466 } 1466 }
1467 1467
1468 AvatarData adata = new AvatarData(ava); 1468 AvatarData avatarData = new AvatarData(avatarAppearance);
1469 scene.AvatarService.SetAvatar(dest, adata); 1469 scene.AvatarService.SetAvatar(destination, avatarData);
1470 } 1470 }
1471 catch (Exception e) 1471 catch (Exception e)
1472 { 1472 {
1473 m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}", 1473 m_log.WarnFormat("[RADMIN] Error transferring appearance for {0} : {1}",
1474 dest, e.Message); 1474 destination, e.Message);
1475 } 1475 }
1476 1476
1477 return; 1477 return;
@@ -1483,32 +1483,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1483 /// In parallel the avatar wearables and attachments are updated. 1483 /// In parallel the avatar wearables and attachments are updated.
1484 /// </summary> 1484 /// </summary>
1485 1485
1486 private void copyWearablesAndAttachments(UUID dest, UUID srca, AvatarAppearance ava) 1486 private void CopyWearablesAndAttachments(UUID destination, UUID source, AvatarAppearance avatarAppearance)
1487 { 1487 {
1488 IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; 1488 IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService;
1489 1489
1490 // Get Clothing folder of receiver 1490 // Get Clothing folder of receiver
1491 InventoryFolderBase dstf = iserv.GetFolderForType(dest, AssetType.Clothing); 1491 InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, AssetType.Clothing);
1492 1492
1493 if (dstf == null) 1493 if (destinationFolder == null)
1494 throw new Exception("Cannot locate folder(s)"); 1494 throw new Exception("Cannot locate folder(s)");
1495 1495
1496 // Missing destination folder? This should *never* be the case 1496 // Missing destination folder? This should *never* be the case
1497 if (dstf.Type != (short)AssetType.Clothing) 1497 if (destinationFolder.Type != (short)AssetType.Clothing)
1498 { 1498 {
1499 dstf = new InventoryFolderBase(); 1499 destinationFolder = new InventoryFolderBase();
1500 dstf.ID = UUID.Random(); 1500
1501 dstf.Name = "Clothing"; 1501 destinationFolder.ID = UUID.Random();
1502 dstf.Owner = dest; 1502 destinationFolder.Name = "Clothing";
1503 dstf.Type = (short)AssetType.Clothing; 1503 destinationFolder.Owner = destination;
1504 dstf.ParentID = iserv.GetRootFolder(dest).ID; 1504 destinationFolder.Type = (short)AssetType.Clothing;
1505 dstf.Version = 1; 1505 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
1506 iserv.AddFolder(dstf); // store base record 1506 destinationFolder.Version = 1;
1507 m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); 1507 inventoryService.AddFolder(destinationFolder); // store base record
1508 m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source);
1508 } 1509 }
1509 1510
1510 // Wearables 1511 // Wearables
1511 AvatarWearable[] wearables = ava.Wearables; 1512 AvatarWearable[] wearables = avatarAppearance.Wearables;
1512 AvatarWearable wearable; 1513 AvatarWearable wearable;
1513 1514
1514 for (int i=0; i<wearables.Length; i++) 1515 for (int i=0; i<wearables.Length; i++)
@@ -1517,95 +1518,95 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1517 if (wearable.ItemID != UUID.Zero) 1518 if (wearable.ItemID != UUID.Zero)
1518 { 1519 {
1519 // Get inventory item and copy it 1520 // Get inventory item and copy it
1520 InventoryItemBase item = new InventoryItemBase(wearable.ItemID, srca); 1521 InventoryItemBase item = new InventoryItemBase(wearable.ItemID, source);
1521 item = iserv.GetItem(item); 1522 item = inventoryService.GetItem(item);
1522 1523
1523 if (item != null) 1524 if (item != null)
1524 { 1525 {
1525 InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); 1526 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
1526 dsti.Name = item.Name; 1527 destinationItem.Name = item.Name;
1527 dsti.Description = item.Description; 1528 destinationItem.Description = item.Description;
1528 dsti.InvType = item.InvType; 1529 destinationItem.InvType = item.InvType;
1529 dsti.CreatorId = item.CreatorId; 1530 destinationItem.CreatorId = item.CreatorId;
1530 dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; 1531 destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
1531 dsti.NextPermissions = item.NextPermissions; 1532 destinationItem.NextPermissions = item.NextPermissions;
1532 dsti.CurrentPermissions = item.CurrentPermissions; 1533 destinationItem.CurrentPermissions = item.CurrentPermissions;
1533 dsti.BasePermissions = item.BasePermissions; 1534 destinationItem.BasePermissions = item.BasePermissions;
1534 dsti.EveryOnePermissions = item.EveryOnePermissions; 1535 destinationItem.EveryOnePermissions = item.EveryOnePermissions;
1535 dsti.GroupPermissions = item.GroupPermissions; 1536 destinationItem.GroupPermissions = item.GroupPermissions;
1536 dsti.AssetType = item.AssetType; 1537 destinationItem.AssetType = item.AssetType;
1537 dsti.AssetID = item.AssetID; 1538 destinationItem.AssetID = item.AssetID;
1538 dsti.GroupID = item.GroupID; 1539 destinationItem.GroupID = item.GroupID;
1539 dsti.GroupOwned = item.GroupOwned; 1540 destinationItem.GroupOwned = item.GroupOwned;
1540 dsti.SalePrice = item.SalePrice; 1541 destinationItem.SalePrice = item.SalePrice;
1541 dsti.SaleType = item.SaleType; 1542 destinationItem.SaleType = item.SaleType;
1542 dsti.Flags = item.Flags; 1543 destinationItem.Flags = item.Flags;
1543 dsti.CreationDate = item.CreationDate; 1544 destinationItem.CreationDate = item.CreationDate;
1544 dsti.Folder = dstf.ID; 1545 destinationItem.Folder = destinationFolder.ID;
1545 1546
1546 iserv.AddItem(dsti); 1547 inventoryService.AddItem(destinationItem);
1547 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); 1548 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1548 1549
1549 // Wear item 1550 // Wear item
1550 AvatarWearable dw = new AvatarWearable(); 1551 AvatarWearable newWearable = new AvatarWearable();
1551 dw.AssetID = wearable.AssetID; 1552 newWearable.AssetID = wearable.AssetID;
1552 dw.ItemID = dsti.ID; 1553 newWearable.ItemID = destinationItem.ID;
1553 ava.SetWearable(i, dw); 1554 avatarAppearance.SetWearable(i, newWearable);
1554 } 1555 }
1555 else 1556 else
1556 { 1557 {
1557 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, dstf.ID); 1558 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
1558 } 1559 }
1559 } 1560 }
1560 } 1561 }
1561 1562
1562 // Attachments 1563 // Attachments
1563 Dictionary<int, UUID[]> attachments = ava.GetAttachmentDictionary(); 1564 Dictionary<int, UUID[]> attachments = avatarAppearance.GetAttachmentDictionary();
1564 1565
1565 foreach (KeyValuePair<int, UUID[]> kvp in attachments) 1566 foreach (KeyValuePair<int, UUID[]> attachment in attachments)
1566 { 1567 {
1567 int attachpoint = kvp.Key; 1568 int attachpoint = attachment.Key;
1568 UUID itemID = kvp.Value[0]; 1569 UUID itemID = attachment.Value[0];
1569 1570
1570 if (itemID != UUID.Zero) 1571 if (itemID != UUID.Zero)
1571 { 1572 {
1572 // Get inventory item and copy it 1573 // Get inventory item and copy it
1573 InventoryItemBase item = new InventoryItemBase(itemID, srca); 1574 InventoryItemBase item = new InventoryItemBase(itemID, source);
1574 item = iserv.GetItem(item); 1575 item = inventoryService.GetItem(item);
1575 1576
1576 if (item != null) 1577 if (item != null)
1577 { 1578 {
1578 InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); 1579 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
1579 dsti.Name = item.Name; 1580 destinationItem.Name = item.Name;
1580 dsti.Description = item.Description; 1581 destinationItem.Description = item.Description;
1581 dsti.InvType = item.InvType; 1582 destinationItem.InvType = item.InvType;
1582 dsti.CreatorId = item.CreatorId; 1583 destinationItem.CreatorId = item.CreatorId;
1583 dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; 1584 destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
1584 dsti.NextPermissions = item.NextPermissions; 1585 destinationItem.NextPermissions = item.NextPermissions;
1585 dsti.CurrentPermissions = item.CurrentPermissions; 1586 destinationItem.CurrentPermissions = item.CurrentPermissions;
1586 dsti.BasePermissions = item.BasePermissions; 1587 destinationItem.BasePermissions = item.BasePermissions;
1587 dsti.EveryOnePermissions = item.EveryOnePermissions; 1588 destinationItem.EveryOnePermissions = item.EveryOnePermissions;
1588 dsti.GroupPermissions = item.GroupPermissions; 1589 destinationItem.GroupPermissions = item.GroupPermissions;
1589 dsti.AssetType = item.AssetType; 1590 destinationItem.AssetType = item.AssetType;
1590 dsti.AssetID = item.AssetID; 1591 destinationItem.AssetID = item.AssetID;
1591 dsti.GroupID = item.GroupID; 1592 destinationItem.GroupID = item.GroupID;
1592 dsti.GroupOwned = item.GroupOwned; 1593 destinationItem.GroupOwned = item.GroupOwned;
1593 dsti.SalePrice = item.SalePrice; 1594 destinationItem.SalePrice = item.SalePrice;
1594 dsti.SaleType = item.SaleType; 1595 destinationItem.SaleType = item.SaleType;
1595 dsti.Flags = item.Flags; 1596 destinationItem.Flags = item.Flags;
1596 dsti.CreationDate = item.CreationDate; 1597 destinationItem.CreationDate = item.CreationDate;
1597 dsti.Folder = dstf.ID; 1598 destinationItem.Folder = destinationFolder.ID;
1598 1599
1599 iserv.AddItem(dsti); 1600 inventoryService.AddItem(destinationItem);
1600 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, dstf.ID); 1601 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
1601 1602
1602 // Attach item 1603 // Attach item
1603 ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); 1604 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1604 m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); 1605 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID);
1605 } 1606 }
1606 else 1607 else
1607 { 1608 {
1608 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, dstf.ID); 1609 m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
1609 } 1610 }
1610 } 1611 }
1611 } 1612 }
@@ -1618,101 +1619,101 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1618 /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments 1619 /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments
1619 /// </summary> 1620 /// </summary>
1620 1621
1621 private void copyInventoryFolders(UUID dest, UUID srca, AssetType assettype, Dictionary<UUID,UUID> imap, 1622 private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap,
1622 AvatarAppearance ava) 1623 AvatarAppearance avatarAppearance)
1623 { 1624 {
1624 IInventoryService iserv = m_app.SceneManager.CurrentOrFirstScene.InventoryService; 1625 IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService;
1625 1626
1626 InventoryFolderBase srcf = iserv.GetFolderForType(srca, assettype); 1627 InventoryFolderBase sourceFolder = inventoryService.GetFolderForType(source, assetType);
1627 InventoryFolderBase dstf = iserv.GetFolderForType(dest, assettype); 1628 InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, assetType);
1628 1629
1629 if (srcf == null || dstf == null) 1630 if (sourceFolder == null || destinationFolder == null)
1630 throw new Exception("Cannot locate folder(s)"); 1631 throw new Exception("Cannot locate folder(s)");
1631 1632
1632 // Missing source folder? This should *never* be the case 1633 // Missing source folder? This should *never* be the case
1633 if (srcf.Type != (short)assettype) 1634 if (sourceFolder.Type != (short)assetType)
1634 { 1635 {
1635 srcf = new InventoryFolderBase(); 1636 sourceFolder = new InventoryFolderBase();
1636 srcf.ID = UUID.Random(); 1637 sourceFolder.ID = UUID.Random();
1637 if (assettype == AssetType.Clothing) { 1638 if (assetType == AssetType.Clothing) {
1638 srcf.Name = "Clothing"; 1639 sourceFolder.Name = "Clothing";
1639 } else { 1640 } else {
1640 srcf.Name = "Body Parts"; 1641 sourceFolder.Name = "Body Parts";
1641 } 1642 }
1642 srcf.Owner = srca; 1643 sourceFolder.Owner = source;
1643 srcf.Type = (short)assettype; 1644 sourceFolder.Type = (short)assetType;
1644 srcf.ParentID = iserv.GetRootFolder(srca).ID; 1645 sourceFolder.ParentID = inventoryService.GetRootFolder(source).ID;
1645 srcf.Version = 1; 1646 sourceFolder.Version = 1;
1646 iserv.AddFolder(srcf); // store base record 1647 inventoryService.AddFolder(sourceFolder); // store base record
1647 m_log.ErrorFormat("[RADMIN] Created folder for source {0}", srca); 1648 m_log.ErrorFormat("[RADMIN] Created folder for source {0}", source);
1648 } 1649 }
1649 1650
1650 // Missing destination folder? This should *never* be the case 1651 // Missing destination folder? This should *never* be the case
1651 if (dstf.Type != (short)assettype) 1652 if (destinationFolder.Type != (short)assetType)
1652 { 1653 {
1653 dstf = new InventoryFolderBase(); 1654 destinationFolder = new InventoryFolderBase();
1654 dstf.ID = UUID.Random(); 1655 destinationFolder.ID = UUID.Random();
1655 dstf.Name = assettype.ToString(); 1656 destinationFolder.Name = assetType.ToString();
1656 dstf.Owner = dest; 1657 destinationFolder.Owner = destination;
1657 dstf.Type = (short)assettype; 1658 destinationFolder.Type = (short)assetType;
1658 dstf.ParentID = iserv.GetRootFolder(dest).ID; 1659 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
1659 dstf.Version = 1; 1660 destinationFolder.Version = 1;
1660 iserv.AddFolder(dstf); // store base record 1661 inventoryService.AddFolder(destinationFolder); // store base record
1661 m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", srca); 1662 m_log.ErrorFormat("[RADMIN] Created folder for destination {0}", source);
1662 } 1663 }
1663 1664
1664 InventoryFolderBase efolder; 1665 InventoryFolderBase extraFolder;
1665 List<InventoryFolderBase> folders = iserv.GetFolderContent(srca, srcf.ID).Folders; 1666 List<InventoryFolderBase> folders = inventoryService.GetFolderContent(source, sourceFolder.ID).Folders;
1666 1667
1667 foreach (InventoryFolderBase folder in folders) 1668 foreach (InventoryFolderBase folder in folders)
1668 { 1669 {
1669 1670
1670 efolder = new InventoryFolderBase(); 1671 extraFolder = new InventoryFolderBase();
1671 efolder.ID = UUID.Random(); 1672 extraFolder.ID = UUID.Random();
1672 efolder.Name = folder.Name; 1673 extraFolder.Name = folder.Name;
1673 efolder.Owner = dest; 1674 extraFolder.Owner = destination;
1674 efolder.Type = folder.Type; 1675 extraFolder.Type = folder.Type;
1675 efolder.Version = folder.Version; 1676 extraFolder.Version = folder.Version;
1676 efolder.ParentID = dstf.ID; 1677 extraFolder.ParentID = destinationFolder.ID;
1677 iserv.AddFolder(efolder); 1678 inventoryService.AddFolder(extraFolder);
1678 1679
1679 m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", efolder.ID, srcf.ID); 1680 m_log.DebugFormat("[RADMIN] Added folder {0} to folder {1}", extraFolder.ID, sourceFolder.ID);
1680 1681
1681 List<InventoryItemBase> items = iserv.GetFolderContent(srca, folder.ID).Items; 1682 List<InventoryItemBase> items = inventoryService.GetFolderContent(source, folder.ID).Items;
1682 1683
1683 foreach (InventoryItemBase item in items) 1684 foreach (InventoryItemBase item in items)
1684 { 1685 {
1685 InventoryItemBase dsti = new InventoryItemBase(UUID.Random(), dest); 1686 InventoryItemBase destinationItem = new InventoryItemBase(UUID.Random(), destination);
1686 dsti.Name = item.Name; 1687 destinationItem.Name = item.Name;
1687 dsti.Description = item.Description; 1688 destinationItem.Description = item.Description;
1688 dsti.InvType = item.InvType; 1689 destinationItem.InvType = item.InvType;
1689 dsti.CreatorId = item.CreatorId; 1690 destinationItem.CreatorId = item.CreatorId;
1690 dsti.CreatorIdAsUuid = item.CreatorIdAsUuid; 1691 destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid;
1691 dsti.NextPermissions = item.NextPermissions; 1692 destinationItem.NextPermissions = item.NextPermissions;
1692 dsti.CurrentPermissions = item.CurrentPermissions; 1693 destinationItem.CurrentPermissions = item.CurrentPermissions;
1693 dsti.BasePermissions = item.BasePermissions; 1694 destinationItem.BasePermissions = item.BasePermissions;
1694 dsti.EveryOnePermissions = item.EveryOnePermissions; 1695 destinationItem.EveryOnePermissions = item.EveryOnePermissions;
1695 dsti.GroupPermissions = item.GroupPermissions; 1696 destinationItem.GroupPermissions = item.GroupPermissions;
1696 dsti.AssetType = item.AssetType; 1697 destinationItem.AssetType = item.AssetType;
1697 dsti.AssetID = item.AssetID; 1698 destinationItem.AssetID = item.AssetID;
1698 dsti.GroupID = item.GroupID; 1699 destinationItem.GroupID = item.GroupID;
1699 dsti.GroupOwned = item.GroupOwned; 1700 destinationItem.GroupOwned = item.GroupOwned;
1700 dsti.SalePrice = item.SalePrice; 1701 destinationItem.SalePrice = item.SalePrice;
1701 dsti.SaleType = item.SaleType; 1702 destinationItem.SaleType = item.SaleType;
1702 dsti.Flags = item.Flags; 1703 destinationItem.Flags = item.Flags;
1703 dsti.CreationDate = item.CreationDate; 1704 destinationItem.CreationDate = item.CreationDate;
1704 dsti.Folder = efolder.ID; 1705 destinationItem.Folder = extraFolder.ID;
1705 1706
1706 iserv.AddItem(dsti); 1707 inventoryService.AddItem(destinationItem);
1707 imap.Add(item.ID, dsti.ID); 1708 inventoryMap.Add(item.ID, destinationItem.ID);
1708 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", dsti.ID, efolder.ID); 1709 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
1709 1710
1710 // Attach item, if original is attached 1711 // Attach item, if original is attached
1711 int attachpoint = ava.GetAttachpoint(item.ID); 1712 int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
1712 if (attachpoint != 0) 1713 if (attachpoint != 0)
1713 { 1714 {
1714 ava.SetAttachment(attachpoint, dsti.ID, dsti.AssetID); 1715 avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
1715 m_log.DebugFormat("[RADMIN] Attached {0}", dsti.ID); 1716 m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID);
1716 } 1717 }
1717 } 1718 }
1718 } 1719 }
@@ -1728,63 +1729,63 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1728 /// other outfits are provided to allow "real" avatars a way to easily change their outfits. 1729 /// other outfits are provided to allow "real" avatars a way to easily change their outfits.
1729 /// </summary> 1730 /// </summary>
1730 1731
1731 private bool createDefaultAvatars() 1732 private bool CreateDefaultAvatars()
1732 { 1733 {
1733 // Only load once 1734 // Only load once
1734 1735
1735 if (daload) 1736 if (m_defaultAvatarsLoaded)
1736 { 1737 {
1737 return false; 1738 return false;
1738 } 1739 }
1739 1740
1740 m_log.DebugFormat("[RADMIN] Creating default avatar entries"); 1741 m_log.DebugFormat("[RADMIN] Creating default avatar entries");
1741 1742
1742 daload = true; 1743 m_defaultAvatarsLoaded = true;
1743 1744
1744 // Load processing starts here... 1745 // Load processing starts here...
1745 1746
1746 try 1747 try
1747 { 1748 {
1748 string dafn = null; 1749 string defaultAppearanceFileName = null;
1749 1750
1750 //m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini 1751 //m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini
1751 if (m_config != null) 1752 if (m_config != null)
1752 { 1753 {
1753 dafn = m_config.GetString("default_appearance", "default_appearance.xml"); 1754 defaultAppearanceFileName = m_config.GetString("default_appearance", "default_appearance.xml");
1754 } 1755 }
1755 1756
1756 if (File.Exists(dafn)) 1757 if (File.Exists(defaultAppearanceFileName))
1757 { 1758 {
1758 XmlDocument doc = new XmlDocument(); 1759 XmlDocument doc = new XmlDocument();
1759 string name = "*unknown*"; 1760 string name = "*unknown*";
1760 string email = "anon@anon"; 1761 string email = "anon@anon";
1761 uint regX = 1000; 1762 uint regionXLocation = 1000;
1762 uint regY = 1000; 1763 uint regionYLocation = 1000;
1763 string passwd = UUID.Random().ToString(); // No requirement to sign-in. 1764 string password = UUID.Random().ToString(); // No requirement to sign-in.
1764 UUID ID = UUID.Zero; 1765 UUID ID = UUID.Zero;
1765 AvatarAppearance mava; 1766 AvatarAppearance avatarAppearance;
1766 XmlNodeList avatars; 1767 XmlNodeList avatars;
1767 XmlNodeList assets; 1768 XmlNodeList assets;
1768 XmlNode perms = null; 1769 XmlNode perms = null;
1769 bool include = false; 1770 bool include = false;
1770 bool select = false; 1771 bool select = false;
1771 1772
1772 Scene scene = m_app.SceneManager.CurrentOrFirstScene; 1773 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
1773 IInventoryService iserv = scene.InventoryService; 1774 IInventoryService inventoryService = scene.InventoryService;
1774 IAssetService aserv = scene.AssetService; 1775 IAssetService assetService = scene.AssetService;
1775 1776
1776 doc.LoadXml(File.ReadAllText(dafn)); 1777 doc.LoadXml(File.ReadAllText(defaultAppearanceFileName));
1777 1778
1778 // Load up any included assets. Duplicates will be ignored 1779 // Load up any included assets. Duplicates will be ignored
1779 assets = doc.GetElementsByTagName("RequiredAsset"); 1780 assets = doc.GetElementsByTagName("RequiredAsset");
1780 foreach (XmlNode asset in assets) 1781 foreach (XmlNode assetNode in assets)
1781 { 1782 {
1782 AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset, "name", ""), SByte.Parse(GetStringAttribute(asset, "type", "")), UUID.Zero.ToString()); 1783 AssetBase asset = new AssetBase(UUID.Random(), GetStringAttribute(assetNode, "name", ""), SByte.Parse(GetStringAttribute(assetNode, "type", "")), UUID.Zero.ToString());
1783 rass.Description = GetStringAttribute(asset,"desc",""); 1784 asset.Description = GetStringAttribute(assetNode,"desc","");
1784 rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); 1785 asset.Local = Boolean.Parse(GetStringAttribute(assetNode,"local",""));
1785 rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); 1786 asset.Temporary = Boolean.Parse(GetStringAttribute(assetNode,"temporary",""));
1786 rass.Data = Convert.FromBase64String(asset.InnerText); 1787 asset.Data = Convert.FromBase64String(assetNode.InnerText);
1787 aserv.Store(rass); 1788 assetService.Store(asset);
1788 } 1789 }
1789 1790
1790 avatars = doc.GetElementsByTagName("Avatar"); 1791 avatars = doc.GetElementsByTagName("Avatar");
@@ -1803,19 +1804,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1803 // Only the name value is mandatory 1804 // Only the name value is mandatory
1804 name = GetStringAttribute(avatar,"name",name); 1805 name = GetStringAttribute(avatar,"name",name);
1805 email = GetStringAttribute(avatar,"email",email); 1806 email = GetStringAttribute(avatar,"email",email);
1806 regX = GetUnsignedAttribute(avatar,"regx",regX); 1807 regionXLocation = GetUnsignedAttribute(avatar,"regx",regionXLocation);
1807 regY = GetUnsignedAttribute(avatar,"regy",regY); 1808 regionYLocation = GetUnsignedAttribute(avatar,"regy",regionYLocation);
1808 passwd = GetStringAttribute(avatar,"password",passwd); 1809 password = GetStringAttribute(avatar,"password",password);
1809 1810
1810 string[] nomens = name.Split(); 1811 string[] names = name.Split();
1811 UUID scopeID = scene.RegionInfo.ScopeID; 1812 UUID scopeID = scene.RegionInfo.ScopeID;
1812 UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); 1813 UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, names[0], names[1]);
1813 if (null == account) 1814 if (null == account)
1814 { 1815 {
1815 account = CreateUser(scopeID, nomens[0], nomens[1], passwd, email); 1816 account = CreateUser(scopeID, names[0], names[1], password, email);
1816 if (null == account) 1817 if (null == account)
1817 { 1818 {
1818 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); 1819 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", names[0], names[1]);
1819 return false; 1820 return false;
1820 } 1821 }
1821 } 1822 }
@@ -1823,12 +1824,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1823 // Set home position 1824 // Set home position
1824 1825
1825 GridRegion home = scene.GridService.GetRegionByPosition(scopeID, 1826 GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
1826 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); 1827 (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize));
1827 if (null == home) { 1828 if (null == home) {
1828 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", nomens[0], nomens[1]); 1829 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]);
1829 } else { 1830 } else {
1830 scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); 1831 scene.GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1831 m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, nomens[0], nomens[1]); 1832 m_log.DebugFormat("[RADMIN]: Set home region {0} for updated user account {1} {2}", home.RegionID, names[0], names[1]);
1832 } 1833 }
1833 1834
1834 ID = account.PrincipalID; 1835 ID = account.PrincipalID;
@@ -1850,13 +1851,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1850 if (include) 1851 if (include)
1851 { 1852 {
1852 // Setup for appearance processing 1853 // Setup for appearance processing
1853 AvatarData adata = scene.AvatarService.GetAvatar(ID); 1854 AvatarData avatarData = scene.AvatarService.GetAvatar(ID);
1854 if (adata != null) 1855 if (avatarData != null)
1855 mava = adata.ToAvatarAppearance(ID); 1856 avatarAppearance = avatarData.ToAvatarAppearance(ID);
1856 else 1857 else
1857 mava = new AvatarAppearance(); 1858 avatarAppearance = new AvatarAppearance();
1858 1859
1859 AvatarWearable[] wearables = mava.Wearables; 1860 AvatarWearable[] wearables = avatarAppearance.Wearables;
1860 for (int i=0; i<wearables.Length; i++) 1861 for (int i=0; i<wearables.Length; i++)
1861 { 1862 {
1862 wearables[i] = new AvatarWearable(); 1863 wearables[i] = new AvatarWearable();
@@ -1867,19 +1868,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1867 // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", 1868 // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory",
1868 // uic.folders.Count, uic.items.Count); 1869 // uic.folders.Count, uic.items.Count);
1869 1870
1870 InventoryFolderBase cfolder = iserv.GetFolderForType(ID, AssetType.Clothing); 1871 InventoryFolderBase clothingFolder = inventoryService.GetFolderForType(ID, AssetType.Clothing);
1871 1872
1872 // This should *never* be the case 1873 // This should *never* be the case
1873 if (cfolder == null || cfolder.Type != (short)AssetType.Clothing) 1874 if (clothingFolder == null || clothingFolder.Type != (short)AssetType.Clothing)
1874 { 1875 {
1875 cfolder = new InventoryFolderBase(); 1876 clothingFolder = new InventoryFolderBase();
1876 cfolder.ID = UUID.Random(); 1877 clothingFolder.ID = UUID.Random();
1877 cfolder.Name = "Clothing"; 1878 clothingFolder.Name = "Clothing";
1878 cfolder.Owner = ID; 1879 clothingFolder.Owner = ID;
1879 cfolder.Type = (short)AssetType.Clothing; 1880 clothingFolder.Type = (short)AssetType.Clothing;
1880 cfolder.ParentID = iserv.GetRootFolder(ID).ID; 1881 clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID;
1881 cfolder.Version = 1; 1882 clothingFolder.Version = 1;
1882 iserv.AddFolder(cfolder); // store base record 1883 inventoryService.AddFolder(clothingFolder); // store base record
1883 m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID); 1884 m_log.ErrorFormat("[RADMIN] Created clothing folder for {0}/{1}", name, ID);
1884 } 1885 }
1885 1886
@@ -1887,8 +1888,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1887 // default appearance XMl file. 1888 // default appearance XMl file.
1888 1889
1889 XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble"); 1890 XmlNodeList outfits = avatar.GetElementsByTagName("Ensemble");
1890 InventoryFolderBase efolder; 1891 InventoryFolderBase extraFolder;
1891 string oname; 1892 string outfitName;
1892 UUID assetid; 1893 UUID assetid;
1893 1894
1894 foreach (XmlElement outfit in outfits) 1895 foreach (XmlElement outfit in outfits)
@@ -1896,37 +1897,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1896 m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}", 1897 m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}",
1897 GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?")); 1898 GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?"));
1898 1899
1899 oname = GetStringAttribute(outfit,"name",""); 1900 outfitName = GetStringAttribute(outfit,"name","");
1900 select = (GetStringAttribute(outfit,"default","no") == "yes"); 1901 select = (GetStringAttribute(outfit,"default","no") == "yes");
1901 1902
1902 // If the folder already exists, re-use it. The defaults may 1903 // If the folder already exists, re-use it. The defaults may
1903 // change over time. Augment only. 1904 // change over time. Augment only.
1904 1905
1905 List<InventoryFolderBase> folders = iserv.GetFolderContent(ID, cfolder.ID).Folders; 1906 List<InventoryFolderBase> folders = inventoryService.GetFolderContent(ID, clothingFolder.ID).Folders;
1906 efolder = null; 1907 extraFolder = null;
1907 1908
1908 foreach (InventoryFolderBase folder in folders) 1909 foreach (InventoryFolderBase folder in folders)
1909 { 1910 {
1910 if (folder.Name == oname) 1911 if (folder.Name == outfitName)
1911 { 1912 {
1912 efolder = folder; 1913 extraFolder = folder;
1913 break; 1914 break;
1914 } 1915 }
1915 } 1916 }
1916 1917
1917 // Otherwise, we must create the folder. 1918 // Otherwise, we must create the folder.
1918 if (efolder == null) 1919 if (extraFolder == null)
1919 { 1920 {
1920 m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", oname, name); 1921 m_log.DebugFormat("[RADMIN] Creating outfit folder {0} for {1}", outfitName, name);
1921 efolder = new InventoryFolderBase(); 1922 extraFolder = new InventoryFolderBase();
1922 efolder.ID = UUID.Random(); 1923 extraFolder.ID = UUID.Random();
1923 efolder.Name = oname; 1924 extraFolder.Name = outfitName;
1924 efolder.Owner = ID; 1925 extraFolder.Owner = ID;
1925 efolder.Type = (short)AssetType.Clothing; 1926 extraFolder.Type = (short)AssetType.Clothing;
1926 efolder.Version = 1; 1927 extraFolder.Version = 1;
1927 efolder.ParentID = cfolder.ID; 1928 extraFolder.ParentID = clothingFolder.ID;
1928 iserv.AddFolder(efolder); 1929 inventoryService.AddFolder(extraFolder);
1929 m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", efolder.ID, cfolder.ID); 1930 m_log.DebugFormat("[RADMIN] Adding outfile folder {0} to folder {1}", extraFolder.ID, clothingFolder.ID);
1930 } 1931 }
1931 1932
1932 // Now get the pieces that make up the outfit 1933 // Now get the pieces that make up the outfit
@@ -1950,55 +1951,55 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1950 } 1951 }
1951 } 1952 }
1952 1953
1953 InventoryItemBase iitem = null; 1954 InventoryItemBase inventoryItem = null;
1954 1955
1955 // Check if asset is in inventory already 1956 // Check if asset is in inventory already
1956 iitem = null; 1957 inventoryItem = null;
1957 List<InventoryItemBase> iitems = iserv.GetFolderContent(ID, efolder.ID).Items; 1958 List<InventoryItemBase> inventoryItems = inventoryService.GetFolderContent(ID, extraFolder.ID).Items;
1958 1959
1959 foreach (InventoryItemBase litem in iitems) 1960 foreach (InventoryItemBase listItem in inventoryItems)
1960 { 1961 {
1961 if (litem.AssetID == assetid) 1962 if (listItem.AssetID == assetid)
1962 { 1963 {
1963 iitem = litem; 1964 inventoryItem = listItem;
1964 break; 1965 break;
1965 } 1966 }
1966 } 1967 }
1967 1968
1968 // Create inventory item 1969 // Create inventory item
1969 if (iitem == null) 1970 if (inventoryItem == null)
1970 { 1971 {
1971 iitem = new InventoryItemBase(UUID.Random(), ID); 1972 inventoryItem = new InventoryItemBase(UUID.Random(), ID);
1972 iitem.Name = GetStringAttribute(item,"name",""); 1973 inventoryItem.Name = GetStringAttribute(item,"name","");
1973 iitem.Description = GetStringAttribute(item,"desc",""); 1974 inventoryItem.Description = GetStringAttribute(item,"desc","");
1974 iitem.InvType = GetIntegerAttribute(item,"invtype",-1); 1975 inventoryItem.InvType = GetIntegerAttribute(item,"invtype",-1);
1975 iitem.CreatorId = GetStringAttribute(item,"creatorid",""); 1976 inventoryItem.CreatorId = GetStringAttribute(item,"creatorid","");
1976 iitem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid",""); 1977 inventoryItem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid","");
1977 iitem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); 1978 inventoryItem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff);
1978 iitem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); 1979 inventoryItem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff);
1979 iitem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); 1980 inventoryItem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff);
1980 iitem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); 1981 inventoryItem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff);
1981 iitem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff); 1982 inventoryItem.GroupPermissions = GetUnsignedAttribute(perms,"group",0x7fffffff);
1982 iitem.AssetType = GetIntegerAttribute(item,"assettype",-1); 1983 inventoryItem.AssetType = GetIntegerAttribute(item,"assettype",-1);
1983 iitem.AssetID = assetid; // associated asset 1984 inventoryItem.AssetID = assetid; // associated asset
1984 iitem.GroupID = (UUID)GetStringAttribute(item,"groupid",""); 1985 inventoryItem.GroupID = (UUID)GetStringAttribute(item,"groupid","");
1985 iitem.GroupOwned = (GetStringAttribute(item,"groupowned","false") == "true"); 1986 inventoryItem.GroupOwned = (GetStringAttribute(item,"groupowned","false") == "true");
1986 iitem.SalePrice = GetIntegerAttribute(item,"saleprice",0); 1987 inventoryItem.SalePrice = GetIntegerAttribute(item,"saleprice",0);
1987 iitem.SaleType = (byte)GetIntegerAttribute(item,"saletype",0); 1988 inventoryItem.SaleType = (byte)GetIntegerAttribute(item,"saletype",0);
1988 iitem.Flags = GetUnsignedAttribute(item,"flags",0); 1989 inventoryItem.Flags = GetUnsignedAttribute(item,"flags",0);
1989 iitem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch()); 1990 inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch());
1990 iitem.Folder = efolder.ID; // Parent folder 1991 inventoryItem.Folder = extraFolder.ID; // Parent folder
1991 1992
1992 iserv.AddItem(iitem); 1993 inventoryService.AddItem(inventoryItem);
1993 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", iitem.ID, efolder.ID); 1994 m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
1994 } 1995 }
1995 1996
1996 // Attach item, if attachpoint is specified 1997 // Attach item, if attachpoint is specified
1997 int attachpoint = GetIntegerAttribute(item,"attachpoint",0); 1998 int attachpoint = GetIntegerAttribute(item,"attachpoint",0);
1998 if (attachpoint != 0) 1999 if (attachpoint != 0)
1999 { 2000 {
2000 mava.SetAttachment(attachpoint, iitem.ID, iitem.AssetID); 2001 avatarAppearance.SetAttachment(attachpoint, inventoryItem.ID, inventoryItem.AssetID);
2001 m_log.DebugFormat("[RADMIN] Attached {0}", iitem.ID); 2002 m_log.DebugFormat("[RADMIN] Attached {0}", inventoryItem.ID);
2002 } 2003 }
2003 2004
2004 // Record whether or not the item is to be initially worn 2005 // Record whether or not the item is to be initially worn
@@ -2006,20 +2007,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2006 { 2007 {
2007 if (select && (GetStringAttribute(item, "wear", "false") == "true")) 2008 if (select && (GetStringAttribute(item, "wear", "false") == "true"))
2008 { 2009 {
2009 mava.Wearables[iitem.Flags].ItemID = iitem.ID; 2010 avatarAppearance.Wearables[inventoryItem.Flags].ItemID = inventoryItem.ID;
2010 mava.Wearables[iitem.Flags].AssetID = iitem.AssetID; 2011 avatarAppearance.Wearables[inventoryItem.Flags].AssetID = inventoryItem.AssetID;
2011 } 2012 }
2012 } 2013 }
2013 catch (Exception e) 2014 catch (Exception e)
2014 { 2015 {
2015 m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", iitem.ID, e.Message); 2016 m_log.WarnFormat("[RADMIN] Error wearing item {0} : {1}", inventoryItem.ID, e.Message);
2016 } 2017 }
2017 } // foreach item in outfit 2018 } // foreach item in outfit
2018 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); 2019 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName);
2019 } // foreach outfit 2020 } // foreach outfit
2020 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); 2021 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name);
2021 AvatarData adata2 = new AvatarData(mava); 2022 AvatarData avatarData2 = new AvatarData(avatarAppearance);
2022 scene.AvatarService.SetAvatar(ID, adata2); 2023 scene.AvatarService.SetAvatar(ID, avatarData2);
2023 } 2024 }
2024 catch (Exception e) 2025 catch (Exception e)
2025 { 2026 {
@@ -2086,19 +2087,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2086 XmlRpcResponse response = new XmlRpcResponse(); 2087 XmlRpcResponse response = new XmlRpcResponse();
2087 Hashtable responseData = new Hashtable(); 2088 Hashtable responseData = new Hashtable();
2088 2089
2089 lock (rslock) 2090 lock (m_requestLock)
2090 { 2091 {
2091 try 2092 try
2092 { 2093 {
2093 Hashtable requestData = (Hashtable) request.Params[0]; 2094 Hashtable requestData = (Hashtable) request.Params[0];
2094 2095
2095 // check completeness 2096 // check completeness
2096 foreach (string p in new string[] {"password", "filename"}) 2097 foreach (string parameter in new string[] {"password", "filename"})
2097 { 2098 {
2098 if (!requestData.Contains(p)) 2099 if (!requestData.Contains(parameter))
2099 throw new Exception(String.Format("missing parameter {0}", p)); 2100 throw new Exception(String.Format("missing parameter {0}", parameter));
2100 if (String.IsNullOrEmpty((string) requestData[p])) 2101 if (String.IsNullOrEmpty((string) requestData[parameter]))
2101 throw new Exception(String.Format("parameter {0} is empty")); 2102 throw new Exception(String.Format("parameter {0} is empty", parameter));
2102 } 2103 }
2103 2104
2104 // check password 2105 // check password
@@ -2110,13 +2111,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2110 if (requestData.Contains("region_uuid")) 2111 if (requestData.Contains("region_uuid"))
2111 { 2112 {
2112 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2113 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2113 if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) 2114 if (!m_application.SceneManager.TryGetScene(region_uuid, out scene))
2114 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2115 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2115 } 2116 }
2116 else if (requestData.Contains("region_name")) 2117 else if (requestData.Contains("region_name"))
2117 { 2118 {
2118 string region_name = (string) requestData["region_name"]; 2119 string region_name = (string) requestData["region_name"];
2119 if (!m_app.SceneManager.TryGetScene(region_name, out scene)) 2120 if (!m_application.SceneManager.TryGetScene(region_name, out scene))
2120 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2121 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2121 } 2122 }
2122 else throw new Exception("neither region_name nor region_uuid given"); 2123 else throw new Exception("neither region_name nor region_uuid given");
@@ -2210,13 +2211,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2210 if (requestData.Contains("region_uuid")) 2211 if (requestData.Contains("region_uuid"))
2211 { 2212 {
2212 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2213 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2213 if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) 2214 if (!m_application.SceneManager.TryGetScene(region_uuid, out scene))
2214 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2215 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2215 } 2216 }
2216 else if (requestData.Contains("region_name")) 2217 else if (requestData.Contains("region_name"))
2217 { 2218 {
2218 string region_name = (string) requestData["region_name"]; 2219 string region_name = (string) requestData["region_name"];
2219 if (!m_app.SceneManager.TryGetScene(region_name, out scene)) 2220 if (!m_application.SceneManager.TryGetScene(region_name, out scene))
2220 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2221 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2221 } 2222 }
2222 else throw new Exception("neither region_name nor region_uuid given"); 2223 else throw new Exception("neither region_name nor region_uuid given");
@@ -2227,7 +2228,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2227 { 2228 {
2228 scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; 2229 scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted;
2229 archiver.ArchiveRegion(filename); 2230 archiver.ArchiveRegion(filename);
2230 lock (SOLock) Monitor.Wait(SOLock,5000); 2231 lock (m_saveOarLock) Monitor.Wait(m_saveOarLock,5000);
2231 scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; 2232 scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted;
2232 } 2233 }
2233 else 2234 else
@@ -2255,7 +2256,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2255 private void RemoteAdminOarSaveCompleted(Guid uuid, string name) 2256 private void RemoteAdminOarSaveCompleted(Guid uuid, string name)
2256 { 2257 {
2257 m_log.DebugFormat("[RADMIN] File processing complete for {0}", name); 2258 m_log.DebugFormat("[RADMIN] File processing complete for {0}", name);
2258 lock (SOLock) Monitor.Pulse(SOLock); 2259 lock (m_saveOarLock) Monitor.Pulse(m_saveOarLock);
2259 } 2260 }
2260 2261
2261 public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient) 2262 public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient)
@@ -2267,7 +2268,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2267 XmlRpcResponse response = new XmlRpcResponse(); 2268 XmlRpcResponse response = new XmlRpcResponse();
2268 Hashtable responseData = new Hashtable(); 2269 Hashtable responseData = new Hashtable();
2269 2270
2270 lock (rslock) 2271 lock (m_requestLock)
2271 { 2272 {
2272 try 2273 try
2273 { 2274 {
@@ -2290,14 +2291,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2290 if (requestData.Contains("region_uuid")) 2291 if (requestData.Contains("region_uuid"))
2291 { 2292 {
2292 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2293 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2293 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 2294 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2294 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2295 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2295 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2296 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
2296 } 2297 }
2297 else if (requestData.Contains("region_name")) 2298 else if (requestData.Contains("region_name"))
2298 { 2299 {
2299 string region_name = (string) requestData["region_name"]; 2300 string region_name = (string) requestData["region_name"];
2300 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 2301 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2301 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2302 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2302 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2303 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
2303 } 2304 }
@@ -2314,11 +2315,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2314 switch (xml_version) 2315 switch (xml_version)
2315 { 2316 {
2316 case "1": 2317 case "1":
2317 m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0)); 2318 m_application.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0));
2318 break; 2319 break;
2319 2320
2320 case "2": 2321 case "2":
2321 m_app.SceneManager.LoadCurrentSceneFromXml2(filename); 2322 m_application.SceneManager.LoadCurrentSceneFromXml2(filename);
2322 break; 2323 break;
2323 2324
2324 default: 2325 default:
@@ -2375,14 +2376,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2375 if (requestData.Contains("region_uuid")) 2376 if (requestData.Contains("region_uuid"))
2376 { 2377 {
2377 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2378 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2378 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 2379 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2379 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2380 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2380 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2381 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
2381 } 2382 }
2382 else if (requestData.Contains("region_name")) 2383 else if (requestData.Contains("region_name"))
2383 { 2384 {
2384 string region_name = (string) requestData["region_name"]; 2385 string region_name = (string) requestData["region_name"];
2385 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 2386 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2386 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2387 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2387 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2388 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
2388 } 2389 }
@@ -2399,11 +2400,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2399 switch (xml_version) 2400 switch (xml_version)
2400 { 2401 {
2401 case "1": 2402 case "1":
2402 m_app.SceneManager.SaveCurrentSceneToXml(filename); 2403 m_application.SceneManager.SaveCurrentSceneToXml(filename);
2403 break; 2404 break;
2404 2405
2405 case "2": 2406 case "2":
2406 m_app.SceneManager.SaveCurrentSceneToXml2(filename); 2407 m_application.SceneManager.SaveCurrentSceneToXml2(filename);
2407 break; 2408 break;
2408 2409
2409 default: 2410 default:
@@ -2454,21 +2455,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2454 if (requestData.Contains("region_uuid")) 2455 if (requestData.Contains("region_uuid"))
2455 { 2456 {
2456 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2457 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2457 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 2458 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2458 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2459 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2459 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2460 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
2460 } 2461 }
2461 else if (requestData.Contains("region_name")) 2462 else if (requestData.Contains("region_name"))
2462 { 2463 {
2463 string region_name = (string) requestData["region_name"]; 2464 string region_name = (string) requestData["region_name"];
2464 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 2465 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2465 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2466 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2466 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2467 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
2467 } 2468 }
2468 else throw new Exception("neither region_name nor region_uuid given"); 2469 else throw new Exception("neither region_name nor region_uuid given");
2469 2470
2470 Scene s = m_app.SceneManager.CurrentScene; 2471 Scene scene = m_application.SceneManager.CurrentScene;
2471 int health = s.GetHealth(); 2472 int health = scene.GetHealth();
2472 responseData["health"] = health; 2473 responseData["health"] = health;
2473 2474
2474 response.Value = responseData; 2475 response.Value = responseData;
@@ -2551,23 +2552,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2551 if (requestData.Contains("region_uuid")) 2552 if (requestData.Contains("region_uuid"))
2552 { 2553 {
2553 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2554 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2554 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 2555 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2555 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2556 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2556 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2557 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
2557 } 2558 }
2558 else if (requestData.Contains("region_name")) 2559 else if (requestData.Contains("region_name"))
2559 { 2560 {
2560 string region_name = (string) requestData["region_name"]; 2561 string region_name = (string) requestData["region_name"];
2561 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 2562 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2562 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2563 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2563 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2564 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
2564 } 2565 }
2565 else throw new Exception("neither region_name nor region_uuid given"); 2566 else throw new Exception("neither region_name nor region_uuid given");
2566 2567
2567 Scene s = m_app.SceneManager.CurrentScene; 2568 Scene scene = m_application.SceneManager.CurrentScene;
2568 s.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; 2569 scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{};
2569 if (s.RegionInfo.Persistent) 2570 if (scene.RegionInfo.Persistent)
2570 s.RegionInfo.EstateSettings.Save(); 2571 scene.RegionInfo.EstateSettings.Save();
2571 } 2572 }
2572 catch (Exception e) 2573 catch (Exception e)
2573 { 2574 {
@@ -2608,26 +2609,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2608 if (requestData.Contains("region_uuid")) 2609 if (requestData.Contains("region_uuid"))
2609 { 2610 {
2610 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2611 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2611 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 2612 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2612 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2613 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2613 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2614 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
2614 } 2615 }
2615 else if (requestData.Contains("region_name")) 2616 else if (requestData.Contains("region_name"))
2616 { 2617 {
2617 string region_name = (string) requestData["region_name"]; 2618 string region_name = (string) requestData["region_name"];
2618 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 2619 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2619 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2620 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2620 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2621 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
2621 } 2622 }
2622 else throw new Exception("neither region_name nor region_uuid given"); 2623 else throw new Exception("neither region_name nor region_uuid given");
2623 2624
2624 int addk = 0; 2625 int addedUsers = 0;
2625 2626
2626 if (requestData.Contains("users")) 2627 if (requestData.Contains("users"))
2627 { 2628 {
2628 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; 2629 UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2629 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; 2630 IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService;
2630 Scene s = m_app.SceneManager.CurrentScene; 2631 Scene scene = m_application.SceneManager.CurrentScene;
2631 Hashtable users = (Hashtable) requestData["users"]; 2632 Hashtable users = (Hashtable) requestData["users"];
2632 List<UUID> uuids = new List<UUID>(); 2633 List<UUID> uuids = new List<UUID>();
2633 foreach (string name in users.Values) 2634 foreach (string name in users.Values)
@@ -2637,24 +2638,24 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2637 if (account != null) 2638 if (account != null)
2638 { 2639 {
2639 uuids.Add(account.PrincipalID); 2640 uuids.Add(account.PrincipalID);
2640 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); 2641 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, scene.RegionInfo.RegionName);
2641 } 2642 }
2642 } 2643 }
2643 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); 2644 List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess);
2644 foreach (UUID uuid in uuids) 2645 foreach (UUID uuid in uuids)
2645 { 2646 {
2646 if (!acl.Contains(uuid)) 2647 if (!accessControlList.Contains(uuid))
2647 { 2648 {
2648 acl.Add(uuid); 2649 accessControlList.Add(uuid);
2649 addk++; 2650 addedUsers++;
2650 } 2651 }
2651 } 2652 }
2652 s.RegionInfo.EstateSettings.EstateAccess = acl.ToArray(); 2653 scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray();
2653 if (s.RegionInfo.Persistent) 2654 if (scene.RegionInfo.Persistent)
2654 s.RegionInfo.EstateSettings.Save(); 2655 scene.RegionInfo.EstateSettings.Save();
2655 } 2656 }
2656 2657
2657 responseData["added"] = addk; 2658 responseData["added"] = addedUsers;
2658 } 2659 }
2659 catch (Exception e) 2660 catch (Exception e)
2660 { 2661 {
@@ -2695,27 +2696,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2695 if (requestData.Contains("region_uuid")) 2696 if (requestData.Contains("region_uuid"))
2696 { 2697 {
2697 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2698 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2698 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 2699 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2699 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2700 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2700 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2701 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
2701 } 2702 }
2702 else if (requestData.Contains("region_name")) 2703 else if (requestData.Contains("region_name"))
2703 { 2704 {
2704 string region_name = (string) requestData["region_name"]; 2705 string region_name = (string) requestData["region_name"];
2705 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 2706 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2706 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2707 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2707 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2708 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
2708 } 2709 }
2709 else throw new Exception("neither region_name nor region_uuid given"); 2710 else throw new Exception("neither region_name nor region_uuid given");
2710 2711
2711 int remk = 0; 2712 int removedUsers = 0;
2712 2713
2713 if (requestData.Contains("users")) 2714 if (requestData.Contains("users"))
2714 { 2715 {
2715 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; 2716 UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2716 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; 2717 IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService;
2717 //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; 2718 //UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService;
2718 Scene s = m_app.SceneManager.CurrentScene; 2719 Scene scene = m_application.SceneManager.CurrentScene;
2719 Hashtable users = (Hashtable) requestData["users"]; 2720 Hashtable users = (Hashtable) requestData["users"];
2720 List<UUID> uuids = new List<UUID>(); 2721 List<UUID> uuids = new List<UUID>();
2721 foreach (string name in users.Values) 2722 foreach (string name in users.Values)
@@ -2727,21 +2728,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2727 uuids.Add(account.PrincipalID); 2728 uuids.Add(account.PrincipalID);
2728 } 2729 }
2729 } 2730 }
2730 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); 2731 List<UUID> accessControlList = new List<UUID>(scene.RegionInfo.EstateSettings.EstateAccess);
2731 foreach (UUID uuid in uuids) 2732 foreach (UUID uuid in uuids)
2732 { 2733 {
2733 if (acl.Contains(uuid)) 2734 if (accessControlList.Contains(uuid))
2734 { 2735 {
2735 acl.Remove(uuid); 2736 accessControlList.Remove(uuid);
2736 remk++; 2737 removedUsers++;
2737 } 2738 }
2738 } 2739 }
2739 s.RegionInfo.EstateSettings.EstateAccess = acl.ToArray(); 2740 scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray();
2740 if (s.RegionInfo.Persistent) 2741 if (scene.RegionInfo.Persistent)
2741 s.RegionInfo.EstateSettings.Save(); 2742 scene.RegionInfo.EstateSettings.Save();
2742 } 2743 }
2743 2744
2744 responseData["removed"] = remk; 2745 responseData["removed"] = removedUsers;
2745 } 2746 }
2746 catch (Exception e) 2747 catch (Exception e)
2747 { 2748 {
@@ -2782,27 +2783,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2782 if (requestData.Contains("region_uuid")) 2783 if (requestData.Contains("region_uuid"))
2783 { 2784 {
2784 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 2785 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
2785 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) 2786 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
2786 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); 2787 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
2787 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); 2788 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
2788 } 2789 }
2789 else if (requestData.Contains("region_name")) 2790 else if (requestData.Contains("region_name"))
2790 { 2791 {
2791 string region_name = (string) requestData["region_name"]; 2792 string region_name = (string) requestData["region_name"];
2792 if (!m_app.SceneManager.TrySetCurrentScene(region_name)) 2793 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
2793 throw new Exception(String.Format("failed to switch to region {0}", region_name)); 2794 throw new Exception(String.Format("failed to switch to region {0}", region_name));
2794 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); 2795 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
2795 } 2796 }
2796 else throw new Exception("neither region_name nor region_uuid given"); 2797 else throw new Exception("neither region_name nor region_uuid given");
2797 2798
2798 Scene s = m_app.SceneManager.CurrentScene; 2799 Scene scene = m_application.SceneManager.CurrentScene;
2799 UUID[] acl = s.RegionInfo.EstateSettings.EstateAccess; 2800 UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess;
2800 Hashtable users = new Hashtable(); 2801 Hashtable users = new Hashtable();
2801 2802
2802 foreach (UUID user in acl) 2803 foreach (UUID user in accessControlList)
2803 { 2804 {
2804 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; 2805 UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2805 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); 2806 UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user);
2806 if (account != null) 2807 if (account != null)
2807 { 2808 {
2808 users[user.ToString()] = account.FirstName + " " + account.LastName; 2809 users[user.ToString()] = account.FirstName + " " + account.LastName;
@@ -2827,29 +2828,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2827 return response; 2828 return response;
2828 } 2829 }
2829 2830
2830 private static void checkStringParameters(XmlRpcRequest request, string[] param) 2831 private static void CheckStringParameters(XmlRpcRequest request, string[] param)
2831 { 2832 {
2832 Hashtable requestData = (Hashtable) request.Params[0]; 2833 Hashtable requestData = (Hashtable) request.Params[0];
2833 foreach (string p in param) 2834 foreach (string parameter in param)
2834 { 2835 {
2835 if (!requestData.Contains(p)) 2836 if (!requestData.Contains(parameter))
2836 throw new Exception(String.Format("missing string parameter {0}", p)); 2837 throw new Exception(String.Format("missing string parameter {0}", parameter));
2837 if (String.IsNullOrEmpty((string) requestData[p])) 2838 if (String.IsNullOrEmpty((string) requestData[parameter]))
2838 throw new Exception(String.Format("parameter {0} is empty", p)); 2839 throw new Exception(String.Format("parameter {0} is empty", parameter));
2839 } 2840 }
2840 } 2841 }
2841 2842
2842 private static void checkIntegerParams(XmlRpcRequest request, string[] param) 2843 private static void CheckIntegerParams(XmlRpcRequest request, string[] param)
2843 { 2844 {
2844 Hashtable requestData = (Hashtable) request.Params[0]; 2845 Hashtable requestData = (Hashtable) request.Params[0];
2845 foreach (string p in param) 2846 foreach (string parameter in param)
2846 { 2847 {
2847 if (!requestData.Contains(p)) 2848 if (!requestData.Contains(parameter))
2848 throw new Exception(String.Format("missing integer parameter {0}", p)); 2849 throw new Exception(String.Format("missing integer parameter {0}", parameter));
2849 } 2850 }
2850 } 2851 }
2851 2852
2852 private bool getBoolean(Hashtable requestData, string tag, bool defv) 2853 private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue)
2853 { 2854 {
2854 // If an access value has been provided, apply it. 2855 // If an access value has been provided, apply it.
2855 if (requestData.Contains(tag)) 2856 if (requestData.Contains(tag))
@@ -2865,29 +2866,29 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2865 case "0" : 2866 case "0" :
2866 return false; 2867 return false;
2867 default : 2868 default :
2868 return defv; 2869 return defaultValue;
2869 } 2870 }
2870 } 2871 }
2871 else 2872 else
2872 return defv; 2873 return defaultValue;
2873 } 2874 }
2874 2875
2875 private int GetIntegerAttribute(XmlNode node, string attr, int dv) 2876 private int GetIntegerAttribute(XmlNode node, string attribute, int defaultValue)
2876 { 2877 {
2877 try { return Convert.ToInt32(node.Attributes[attr].Value); } catch{} 2878 try { return Convert.ToInt32(node.Attributes[attribute].Value); } catch{}
2878 return dv; 2879 return defaultValue;
2879 } 2880 }
2880 2881
2881 private uint GetUnsignedAttribute(XmlNode node, string attr, uint dv) 2882 private uint GetUnsignedAttribute(XmlNode node, string attribute, uint defaultValue)
2882 { 2883 {
2883 try { return Convert.ToUInt32(node.Attributes[attr].Value); } catch{} 2884 try { return Convert.ToUInt32(node.Attributes[attribute].Value); } catch{}
2884 return dv; 2885 return defaultValue;
2885 } 2886 }
2886 2887
2887 private string GetStringAttribute(XmlNode node, string attr, string dv) 2888 private string GetStringAttribute(XmlNode node, string attribute, string defaultValue)
2888 { 2889 {
2889 try { return node.Attributes[attr].Value; } catch{} 2890 try { return node.Attributes[attribute].Value; } catch{}
2890 return dv; 2891 return defaultValue;
2891 } 2892 }
2892 2893
2893 public void Dispose() 2894 public void Dispose()
@@ -2904,14 +2905,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2904 /// <param name="email"></param> 2905 /// <param name="email"></param>
2905 private UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email) 2906 private UserAccount CreateUser(UUID scopeID, string firstName, string lastName, string password, string email)
2906 { 2907 {
2907 Scene scene = m_app.SceneManager.CurrentOrFirstScene; 2908 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
2908 IUserAccountService m_UserAccountService = scene.UserAccountService; 2909 IUserAccountService userAccountService = scene.UserAccountService;
2909 IGridService m_GridService = scene.GridService; 2910 IGridService gridService = scene.GridService;
2910 IAuthenticationService m_AuthenticationService = scene.AuthenticationService; 2911 IAuthenticationService authenticationService = scene.AuthenticationService;
2911 IGridUserService m_GridUserService = scene.GridUserService; 2912 IGridUserService gridUserService = scene.GridUserService;
2912 IInventoryService m_InventoryService = scene.InventoryService; 2913 IInventoryService inventoryService = scene.InventoryService;
2913 2914
2914 UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); 2915 UserAccount account = userAccountService.GetUserAccount(scopeID, firstName, lastName);
2915 if (null == account) 2916 if (null == account)
2916 { 2917 {
2917 account = new UserAccount(scopeID, firstName, lastName, email); 2918 account = new UserAccount(scopeID, firstName, lastName, email);
@@ -2924,26 +2925,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2924 account.ServiceURLs["AssetServerURI"] = string.Empty; 2925 account.ServiceURLs["AssetServerURI"] = string.Empty;
2925 } 2926 }
2926 2927
2927 if (m_UserAccountService.StoreUserAccount(account)) 2928 if (userAccountService.StoreUserAccount(account))
2928 { 2929 {
2929 bool success; 2930 bool success;
2930 if (m_AuthenticationService != null) 2931 if (authenticationService != null)
2931 { 2932 {
2932 success = m_AuthenticationService.SetPassword(account.PrincipalID, password); 2933 success = authenticationService.SetPassword(account.PrincipalID, password);
2933 if (!success) 2934 if (!success)
2934 m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", 2935 m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.",
2935 firstName, lastName); 2936 firstName, lastName);
2936 } 2937 }
2937 2938
2938 GridRegion home = null; 2939 GridRegion home = null;
2939 if (m_GridService != null) 2940 if (gridService != null)
2940 { 2941 {
2941 List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero); 2942 List<GridRegion> defaultRegions = gridService.GetDefaultRegions(UUID.Zero);
2942 if (defaultRegions != null && defaultRegions.Count >= 1) 2943 if (defaultRegions != null && defaultRegions.Count >= 1)
2943 home = defaultRegions[0]; 2944 home = defaultRegions[0];
2944 2945
2945 if (m_GridUserService != null && home != null) 2946 if (gridUserService != null && home != null)
2946 m_GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); 2947 gridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
2947 else 2948 else
2948 m_log.WarnFormat("[RADMIN]: Unable to set home for account {0} {1}.", 2949 m_log.WarnFormat("[RADMIN]: Unable to set home for account {0} {1}.",
2949 firstName, lastName); 2950 firstName, lastName);
@@ -2952,9 +2953,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2952 m_log.WarnFormat("[RADMIN]: Unable to retrieve home region for account {0} {1}.", 2953 m_log.WarnFormat("[RADMIN]: Unable to retrieve home region for account {0} {1}.",
2953 firstName, lastName); 2954 firstName, lastName);
2954 2955
2955 if (m_InventoryService != null) 2956 if (inventoryService != null)
2956 { 2957 {
2957 success = m_InventoryService.CreateUserInventory(account.PrincipalID); 2958 success = inventoryService.CreateUserInventory(account.PrincipalID);
2958 if (!success) 2959 if (!success)
2959 m_log.WarnFormat("[RADMIN]: Unable to create inventory for account {0} {1}.", 2960 m_log.WarnFormat("[RADMIN]: Unable to create inventory for account {0} {1}.",
2960 firstName, lastName); 2961 firstName, lastName);
@@ -2981,16 +2982,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2981 /// <param name="password"></param> 2982 /// <param name="password"></param>
2982 private bool ChangeUserPassword(string firstName, string lastName, string password) 2983 private bool ChangeUserPassword(string firstName, string lastName, string password)
2983 { 2984 {
2984 Scene scene = m_app.SceneManager.CurrentOrFirstScene; 2985 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
2985 IUserAccountService m_UserAccountService = scene.UserAccountService; 2986 IUserAccountService userAccountService = scene.UserAccountService;
2986 IAuthenticationService m_AuthenticationService = scene.AuthenticationService; 2987 IAuthenticationService authenticationService = scene.AuthenticationService;
2987 2988
2988 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName); 2989 UserAccount account = userAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
2989 if (null != account) 2990 if (null != account)
2990 { 2991 {
2991 bool success = false; 2992 bool success = false;
2992 if (m_AuthenticationService != null) 2993 if (authenticationService != null)
2993 success = m_AuthenticationService.SetPassword(account.PrincipalID, password); 2994 success = authenticationService.SetPassword(account.PrincipalID, password);
2994 if (!success) { 2995 if (!success) {
2995 m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.", 2996 m_log.WarnFormat("[RADMIN]: Unable to set password for account {0} {1}.",
2996 firstName, lastName); 2997 firstName, lastName);
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index fa1f0d8..65921a2 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -1035,11 +1035,6 @@ namespace OpenSim.Client.MXP.ClientStack
1035 // Minimap function, not used. 1035 // Minimap function, not used.
1036 } 1036 }
1037 1037
1038 public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
1039 {
1040 // Need to translate to MXP somehow
1041 }
1042
1043 public void SetChildAgentThrottle(byte[] throttle) 1038 public void SetChildAgentThrottle(byte[] throttle)
1044 { 1039 {
1045 // Need to translate to MXP somehow 1040 // Need to translate to MXP somehow
diff --git a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
index cf7aaf2..b808e95 100644
--- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
+++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs
@@ -593,11 +593,6 @@ namespace OpenSim.Client.Sirikata.ClientStack
593 throw new System.NotImplementedException(); 593 throw new System.NotImplementedException();
594 } 594 }
595 595
596 public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
597 {
598 throw new System.NotImplementedException();
599 }
600
601 public void SetChildAgentThrottle(byte[] throttle) 596 public void SetChildAgentThrottle(byte[] throttle)
602 { 597 {
603 throw new System.NotImplementedException(); 598 throw new System.NotImplementedException();
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
index ab23484..a6c490b 100644
--- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
+++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
@@ -599,11 +599,6 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
599 throw new System.NotImplementedException(); 599 throw new System.NotImplementedException();
600 } 600 }
601 601
602 public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
603 {
604 throw new System.NotImplementedException();
605 }
606
607 public void SetChildAgentThrottle(byte[] throttle) 602 public void SetChildAgentThrottle(byte[] throttle)
608 { 603 {
609 throw new System.NotImplementedException(); 604 throw new System.NotImplementedException();
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs
index 8259f9b..42533c6 100644
--- a/OpenSim/Data/IRegionData.cs
+++ b/OpenSim/Data/IRegionData.cs
@@ -62,6 +62,7 @@ namespace OpenSim.Data
62 62
63 List<RegionData> GetDefaultRegions(UUID scopeID); 63 List<RegionData> GetDefaultRegions(UUID scopeID);
64 List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y); 64 List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
65 List<RegionData> GetHyperlinks(UUID scopeID);
65 } 66 }
66 67
67 [Flags] 68 [Flags]
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index 66c3f81..9656be1 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -310,23 +310,23 @@ namespace OpenSim.Data.MSSQL
310 310
311 public List<RegionData> GetDefaultRegions(UUID scopeID) 311 public List<RegionData> GetDefaultRegions(UUID scopeID)
312 { 312 {
313 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 1) <> 0"; 313 return Get((int)RegionFlags.DefaultRegion, scopeID);
314 if (scopeID != UUID.Zero)
315 sql += " AND ScopeID = @scopeID";
316
317 using (SqlConnection conn = new SqlConnection(m_ConnectionString))
318 using (SqlCommand cmd = new SqlCommand(sql, conn))
319 {
320 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
321 conn.Open();
322 return RunCommand(cmd);
323 }
324
325 } 314 }
326 315
327 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 316 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
328 { 317 {
329 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 2) <> 0"; 318 // TODO: distance-sort results
319 return Get((int)RegionFlags.FallbackRegion, scopeID);
320 }
321
322 public List<RegionData> GetHyperlinks(UUID scopeID)
323 {
324 return Get((int)RegionFlags.Hyperlink, scopeID);
325 }
326
327 private List<RegionData> Get(int regionFlags, UUID scopeID)
328 {
329 string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
330 if (scopeID != UUID.Zero) 330 if (scopeID != UUID.Zero)
331 sql += " AND ScopeID = @scopeID"; 331 sql += " AND ScopeID = @scopeID";
332 332
@@ -335,7 +335,6 @@ namespace OpenSim.Data.MSSQL
335 { 335 {
336 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID)); 336 cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
337 conn.Open(); 337 conn.Open();
338 // TODO: distance-sort results
339 return RunCommand(cmd); 338 return RunCommand(cmd);
340 } 339 }
341 } 340 }
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index c7bddac..aec37e2 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -281,22 +281,26 @@ namespace OpenSim.Data.MySQL
281 281
282 return false; 282 return false;
283 } 283 }
284
284 public List<RegionData> GetDefaultRegions(UUID scopeID) 285 public List<RegionData> GetDefaultRegions(UUID scopeID)
285 { 286 {
286 string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0"; 287 return Get((int)RegionFlags.DefaultRegion, scopeID);
287 if (scopeID != UUID.Zero) 288 }
288 command += " and ScopeID = ?scopeID";
289
290 MySqlCommand cmd = new MySqlCommand(command);
291 289
292 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 290 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
291 {
292 // TODO: distance-sort results
293 return Get((int)RegionFlags.FallbackRegion, scopeID);
294 }
293 295
294 return RunCommand(cmd); 296 public List<RegionData> GetHyperlinks(UUID scopeID)
297 {
298 return Get((int)RegionFlags.Hyperlink, scopeID);
295 } 299 }
296 300
297 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 301 private List<RegionData> Get(int regionFlags, UUID scopeID)
298 { 302 {
299 string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0"; 303 string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
300 if (scopeID != UUID.Zero) 304 if (scopeID != UUID.Zero)
301 command += " and ScopeID = ?scopeID"; 305 command += " and ScopeID = ?scopeID";
302 306
@@ -304,7 +308,6 @@ namespace OpenSim.Data.MySQL
304 308
305 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); 309 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
306 310
307 // TODO: distance-sort results
308 return RunCommand(cmd); 311 return RunCommand(cmd);
309 } 312 }
310 } 313 }
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index d596698..f276d10 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -164,30 +164,29 @@ namespace OpenSim.Data.Null
164 164
165 public List<RegionData> GetDefaultRegions(UUID scopeID) 165 public List<RegionData> GetDefaultRegions(UUID scopeID)
166 { 166 {
167 if (Instance != this) 167 return Get((int)RegionFlags.DefaultRegion, scopeID);
168 return Instance.GetDefaultRegions(scopeID); 168 }
169
170 List<RegionData> ret = new List<RegionData>();
171 169
172 foreach (RegionData r in m_regionData.Values) 170 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
173 { 171 {
174 if ((Convert.ToInt32(r.Data["flags"]) & 1) != 0) 172 return Get((int)RegionFlags.FallbackRegion, scopeID);
175 ret.Add(r); 173 }
176 }
177 174
178 return ret; 175 public List<RegionData> GetHyperlinks(UUID scopeID)
176 {
177 return Get((int)RegionFlags.Hyperlink, scopeID);
179 } 178 }
180 179
181 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) 180 private List<RegionData> Get(int regionFlags, UUID scopeID)
182 { 181 {
183 if (Instance != this) 182 if (Instance != this)
184 return Instance.GetFallbackRegions(scopeID, x, y); 183 return Instance.Get(regionFlags, scopeID);
185 184
186 List<RegionData> ret = new List<RegionData>(); 185 List<RegionData> ret = new List<RegionData>();
187 186
188 foreach (RegionData r in m_regionData.Values) 187 foreach (RegionData r in m_regionData.Values)
189 { 188 {
190 if ((Convert.ToInt32(r.Data["flags"]) & 2) != 0) 189 if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
191 ret.Add(r); 190 ret.Add(r);
192 } 191 }
193 192
diff --git a/OpenSim/Data/Resources/OpenSim.Data.addin.xml b/OpenSim/Data/Resources/OpenSim.Data.addin.xml
index 65774ff..10c9c3c 100644
--- a/OpenSim/Data/Resources/OpenSim.Data.addin.xml
+++ b/OpenSim/Data/Resources/OpenSim.Data.addin.xml
@@ -3,19 +3,10 @@
3 <Import assembly="OpenSim.Data.dll" /> 3 <Import assembly="OpenSim.Data.dll" />
4 <Import assembly="OpenSim.Framework.dll" /> 4 <Import assembly="OpenSim.Framework.dll" />
5 </Runtime> 5 </Runtime>
6 <ExtensionPoint path = "/OpenSim/GridData">
7 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin" />
8 </ExtensionPoint>
9 <ExtensionPoint path = "/OpenSim/LogData">
10 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin" />
11 </ExtensionPoint>
12 <ExtensionPoint path = "/OpenSim/AssetData"> 6 <ExtensionPoint path = "/OpenSim/AssetData">
13 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" /> 7 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" />
14 </ExtensionPoint> 8 </ExtensionPoint>
15 <ExtensionPoint path = "/OpenSim/InventoryData"> 9 <ExtensionPoint path = "/OpenSim/InventoryData">
16 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" /> 10 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" />
17 </ExtensionPoint> 11 </ExtensionPoint>
18 <ExtensionPoint path = "/OpenSim/UserData">
19 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin" />
20 </ExtensionPoint>
21</Addin> 12</Addin>
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index 9dd4a2e..fcf041e 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLite
328 328
329 public EstateSettings LoadEstateSettings(int estateID) 329 public EstateSettings LoadEstateSettings(int estateID)
330 { 330 {
331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; 331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
332 332
333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
334 334
@@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLite
342 { 342 {
343 List<int> result = new List<int>(); 343 List<int> result = new List<int>();
344 344
345 string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; 345 string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
346 346
347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
348 348
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
index e135eaa..bf8ee14 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Data.SQLiteLegacy
328 328
329 public EstateSettings LoadEstateSettings(int estateID) 329 public EstateSettings LoadEstateSettings(int estateID)
330 { 330 {
331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID"; 331 string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
332 332
333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 333 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
334 334
@@ -342,7 +342,7 @@ namespace OpenSim.Data.SQLiteLegacy
342 { 342 {
343 List<int> result = new List<int>(); 343 List<int> result = new List<int>();
344 344
345 string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName"; 345 string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
346 346
347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); 347 SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
348 348
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 1f654d3..eeffdda 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -781,7 +781,7 @@ namespace OpenSim.Data.Tests
781 // Ownership changes when you drop an object into an object 781 // Ownership changes when you drop an object into an object
782 // owned by someone else 782 // owned by someone else
783 Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))"); 783 Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))");
784 Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))"); 784// Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 16), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))");
785 Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); 785 Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))");
786 Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); 786 Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))");
787 } 787 }
diff --git a/OpenSim/Framework/ACL.cs b/OpenSim/Framework/ACL.cs
deleted file mode 100644
index f76e8b7..0000000
--- a/OpenSim/Framework/ACL.cs
+++ /dev/null
@@ -1,252 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30
31namespace OpenSim.Framework
32{
33 // ACL Class
34 // Modelled after the structure of the Zend ACL Framework Library
35 // with one key difference - the tree will search for all matching
36 // permissions rather than just the first. Deny permissions will
37 // override all others.
38
39 #region ACL Core Class
40
41 /// <summary>
42 /// Access Control List Engine
43 /// </summary>
44 public class ACL
45 {
46 private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>();
47 private Dictionary<string, Role> Roles = new Dictionary<string, Role>();
48
49 /// <summary>
50 /// Adds a new role
51 /// </summary>
52 /// <param name="role"></param>
53 /// <returns></returns>
54 public ACL AddRole(Role role)
55 {
56 if (Roles.ContainsKey(role.Name))
57 throw new AlreadyContainsRoleException(role);
58
59 Roles.Add(role.Name, role);
60
61 return this;
62 }
63
64 /// <summary>
65 /// Adds a new resource
66 /// </summary>
67 /// <param name="resource"></param>
68 /// <returns></returns>
69 public ACL AddResource(Resource resource)
70 {
71 Resources.Add(resource.Name, resource);
72
73 return this;
74 }
75
76 /// <summary>
77 /// Permision for user/roll on a resource
78 /// </summary>
79 /// <param name="role"></param>
80 /// <param name="resource"></param>
81 /// <returns></returns>
82 public Permission HasPermission(string role, string resource)
83 {
84 if (!Roles.ContainsKey(role))
85 throw new KeyNotFoundException();
86
87 if (!Resources.ContainsKey(resource))
88 throw new KeyNotFoundException();
89
90 return Roles[role].RequestPermission(resource);
91 }
92
93 public ACL GrantPermission(string role, string resource)
94 {
95 if (!Roles.ContainsKey(role))
96 throw new KeyNotFoundException();
97
98 if (!Resources.ContainsKey(resource))
99 throw new KeyNotFoundException();
100
101 Roles[role].GivePermission(resource, Permission.Allow);
102
103 return this;
104 }
105
106 public ACL DenyPermission(string role, string resource)
107 {
108 if (!Roles.ContainsKey(role))
109 throw new KeyNotFoundException();
110
111 if (!Resources.ContainsKey(resource))
112 throw new KeyNotFoundException();
113
114 Roles[role].GivePermission(resource, Permission.Deny);
115
116 return this;
117 }
118
119 public ACL ResetPermission(string role, string resource)
120 {
121 if (!Roles.ContainsKey(role))
122 throw new KeyNotFoundException();
123
124 if (!Resources.ContainsKey(resource))
125 throw new KeyNotFoundException();
126
127 Roles[role].GivePermission(resource, Permission.None);
128
129 return this;
130 }
131 }
132
133 #endregion
134
135 #region Exceptions
136
137 /// <summary>
138 /// Thrown when an ACL attempts to add a duplicate role.
139 /// </summary>
140 public class AlreadyContainsRoleException : Exception
141 {
142 protected Role m_role;
143
144 public AlreadyContainsRoleException(Role role)
145 {
146 m_role = role;
147 }
148
149 public Role ErrorRole
150 {
151 get { return m_role; }
152 }
153
154 public override string ToString()
155 {
156 return "This ACL already contains a role called '" + m_role.Name + "'.";
157 }
158 }
159
160 #endregion
161
162 #region Roles and Resources
163
164 /// <summary>
165 /// Does this Role have permission to access a specified Resource?
166 /// </summary>
167 public enum Permission
168 {
169 Deny,
170 None,
171 Allow
172 } ;
173
174 /// <summary>
175 /// A role class, for use with Users or Groups
176 /// </summary>
177 public class Role
178 {
179 private string m_name;
180 private Role[] m_parents;
181 private Dictionary<string, Permission> m_resources = new Dictionary<string, Permission>();
182
183 public Role(string name)
184 {
185 m_name = name;
186 m_parents = null;
187 }
188
189 public Role(string name, Role[] parents)
190 {
191 m_name = name;
192 m_parents = parents;
193 }
194
195 public string Name
196 {
197 get { return m_name; }
198 }
199
200 public Permission RequestPermission(string resource)
201 {
202 return RequestPermission(resource, Permission.None);
203 }
204
205 public Permission RequestPermission(string resource, Permission current)
206 {
207 // Deny permissions always override any others
208 if (current == Permission.Deny)
209 return current;
210
211 Permission temp = Permission.None;
212
213 // Pickup non-None permissions
214 if (m_resources.ContainsKey(resource) && m_resources[resource] != Permission.None)
215 temp = m_resources[resource];
216
217 if (m_parents != null)
218 {
219 foreach (Role parent in m_parents)
220 {
221 temp = parent.RequestPermission(resource, temp);
222 }
223 }
224
225 return temp;
226 }
227
228 public void GivePermission(string resource, Permission perm)
229 {
230 m_resources[resource] = perm;
231 }
232 }
233
234 public class Resource
235 {
236 private string m_name;
237
238 public Resource(string name)
239 {
240 m_name = name;
241 }
242
243 public string Name
244 {
245 get { return m_name; }
246 }
247 }
248
249 #endregion
250
251
252} \ No newline at end of file
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index 62a1e17..da953bb 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities
814 814
815 if (mm != null) 815 if (mm != null)
816 { 816 {
817 if (!mm.UploadCovered(client)) 817 if (!mm.UploadCovered(client, mm.UploadCharge))
818 { 818 {
819 if (client != null) 819 if (client != null)
820 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 820 client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index a1ac84c..89ee39c 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -265,6 +265,46 @@ namespace OpenSim.Framework
265 } 265 }
266 } 266 }
267 267
268 public class ControllerData
269 {
270 public UUID ItemID;
271 public uint IgnoreControls;
272 public uint EventControls;
273
274 public ControllerData(UUID item, uint ignore, uint ev)
275 {
276 ItemID = item;
277 IgnoreControls = ignore;
278 EventControls = ev;
279 }
280
281 public ControllerData(OSDMap args)
282 {
283 UnpackUpdateMessage(args);
284 }
285
286 public OSDMap PackUpdateMessage()
287 {
288 OSDMap controldata = new OSDMap();
289 controldata["item"] = OSD.FromUUID(ItemID);
290 controldata["ignore"] = OSD.FromInteger(IgnoreControls);
291 controldata["event"] = OSD.FromInteger(EventControls);
292
293 return controldata;
294 }
295
296
297 public void UnpackUpdateMessage(OSDMap args)
298 {
299 if (args["item"] != null)
300 ItemID = args["item"].AsUUID();
301 if (args["ignore"] != null)
302 IgnoreControls = (uint)args["ignore"].AsInteger();
303 if (args["event"] != null)
304 EventControls = (uint)args["event"].AsInteger();
305 }
306 }
307
268 public class AgentData : IAgentData 308 public class AgentData : IAgentData
269 { 309 {
270 private UUID m_id; 310 private UUID m_id;
@@ -313,6 +353,9 @@ namespace OpenSim.Framework
313 public UUID[] Wearables; 353 public UUID[] Wearables;
314 public AttachmentData[] Attachments; 354 public AttachmentData[] Attachments;
315 355
356 // Scripted
357 public ControllerData[] Controllers;
358
316 public string CallbackURI; 359 public string CallbackURI;
317 360
318 public virtual OSDMap Pack() 361 public virtual OSDMap Pack()
@@ -403,6 +446,14 @@ namespace OpenSim.Framework
403 args["attachments"] = attachs; 446 args["attachments"] = attachs;
404 } 447 }
405 448
449 if ((Controllers != null) && (Controllers.Length > 0))
450 {
451 OSDArray controls = new OSDArray(Controllers.Length);
452 foreach (ControllerData ctl in Controllers)
453 controls.Add(ctl.PackUpdateMessage());
454 args["controllers"] = controls;
455 }
456
406 457
407 if ((CallbackURI != null) && (!CallbackURI.Equals(""))) 458 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
408 args["callback_uri"] = OSD.FromString(CallbackURI); 459 args["callback_uri"] = OSD.FromString(CallbackURI);
@@ -559,6 +610,20 @@ namespace OpenSim.Framework
559 } 610 }
560 } 611 }
561 612
613 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
614 {
615 OSDArray controls = (OSDArray)(args["controllers"]);
616 Controllers = new ControllerData[controls.Count];
617 int i = 0;
618 foreach (OSD o in controls)
619 {
620 if (o.Type == OSDType.Map)
621 {
622 Controllers[i++] = new ControllerData((OSDMap)o);
623 }
624 }
625 }
626
562 if (args["callback_uri"] != null) 627 if (args["callback_uri"] != null)
563 CallbackURI = args["callback_uri"].AsString(); 628 CallbackURI = args["callback_uri"].AsString();
564 } 629 }
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index b70d1db..aab920b 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Framework.Console
118 // (Done with no echo and suitable for passwords) 118 // (Done with no echo and suitable for passwords)
119 public string PasswdPrompt(string p) 119 public string PasswdPrompt(string p)
120 { 120 {
121 return ReadLine(p, false, false); 121 return ReadLine(String.Format("{0}: ", p), false, false);
122 } 122 }
123 123
124 public virtual string ReadLine(string p, bool isCommand, bool e) 124 public virtual string ReadLine(string p, bool isCommand, bool e)
diff --git a/OpenSim/Framework/FriendRegionInfo.cs b/OpenSim/Framework/FriendRegionInfo.cs
deleted file mode 100644
index 68b5f3d..0000000
--- a/OpenSim/Framework/FriendRegionInfo.cs
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public class FriendRegionInfo
33 {
34 public bool isOnline;
35 public ulong regionHandle;
36 public UUID regionID;
37 }
38}
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs
deleted file mode 100644
index 3a43a14..0000000
--- a/OpenSim/Framework/GridConfig.cs
+++ /dev/null
@@ -1,162 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework
31{
32 public class GridConfig:ConfigBase
33 {
34 public string AllowForcefulBanlines = "TRUE";
35 public bool AllowRegionRegistration = true;
36 public string AssetRecvKey = String.Empty;
37 public string AssetSendKey = String.Empty;
38
39 public string DatabaseProvider = String.Empty;
40 public string DatabaseConnect = String.Empty;
41 public string DefaultAssetServer = String.Empty;
42 public string DefaultUserServer = String.Empty;
43 public uint HttpPort = ConfigSettings.DefaultGridServerHttpPort;
44 public string SimRecvKey = String.Empty;
45 public string SimSendKey = String.Empty;
46 public string UserRecvKey = String.Empty;
47 public string UserSendKey = String.Empty;
48 public string ConsoleUser = String.Empty;
49 public string ConsolePass = String.Empty;
50
51 public GridConfig(string description, string filename)
52 {
53 m_configMember =
54 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
55 m_configMember.performConfigurationRetrieve();
56 }
57
58 public void loadConfigurationOptions()
59 {
60 m_configMember.addConfigurationOption("default_asset_server",
61 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
62 "Default Asset Server URI",
63 "http://127.0.0.1:" + ConfigSettings.DefaultAssetServerHttpPort.ToString() + "/",
64 false);
65 m_configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
66 "Key to send to asset server", "null", false);
67 m_configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
68 "Key to expect from asset server", "null", false);
69
70 m_configMember.addConfigurationOption("default_user_server",
71 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
72 "Default User Server URI",
73 "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString() + "/", false);
74 m_configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
75 "Key to send to user server", "null", false);
76 m_configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
77 "Key to expect from user server", "null", false);
78
79 m_configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
80 "Key to send to a simulator", "null", false);
81 m_configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
82 "Key to expect from a simulator", "null", false);
83 m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
84 "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
85 m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
86 "Database connect string", "", false);
87
88 m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
89 "Http Listener port", ConfigSettings.DefaultGridServerHttpPort.ToString(), false);
90
91 m_configMember.addConfigurationOption("allow_forceful_banlines",
92 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
93 "Allow Forceful Banlines", "TRUE", true);
94
95 m_configMember.addConfigurationOption("allow_region_registration",
96 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
97 "Allow regions to register immediately upon grid server startup? true/false",
98 "True",
99 false);
100 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
101 "Remote console access user name [Default: disabled]", "", false);
102
103 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
104 "Remote console access password [Default: disabled]", "", false);
105
106 }
107
108 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
109 {
110 switch (configuration_key)
111 {
112 case "default_asset_server":
113 DefaultAssetServer = (string) configuration_result;
114 break;
115 case "asset_send_key":
116 AssetSendKey = (string) configuration_result;
117 break;
118 case "asset_recv_key":
119 AssetRecvKey = (string) configuration_result;
120 break;
121 case "default_user_server":
122 DefaultUserServer = (string) configuration_result;
123 break;
124 case "user_send_key":
125 UserSendKey = (string) configuration_result;
126 break;
127 case "user_recv_key":
128 UserRecvKey = (string) configuration_result;
129 break;
130 case "sim_send_key":
131 SimSendKey = (string) configuration_result;
132 break;
133 case "sim_recv_key":
134 SimRecvKey = (string) configuration_result;
135 break;
136 case "database_provider":
137 DatabaseProvider = (string) configuration_result;
138 break;
139 case "database_connect":
140 DatabaseConnect = (string) configuration_result;
141 break;
142 case "http_port":
143 HttpPort = (uint) configuration_result;
144 break;
145 case "allow_forceful_banlines":
146 AllowForcefulBanlines = (string) configuration_result;
147 break;
148 case "allow_region_registration":
149 AllowRegionRegistration = (bool)configuration_result;
150 break;
151 case "console_user":
152 ConsoleUser = (string)configuration_result;
153 break;
154 case "console_pass":
155 ConsolePass = (string)configuration_result;
156 break;
157 }
158
159 return true;
160 }
161 }
162}
diff --git a/OpenSim/Framework/HGNetworkServersInfo.cs b/OpenSim/Framework/HGNetworkServersInfo.cs
deleted file mode 100644
index 0865576..0000000
--- a/OpenSim/Framework/HGNetworkServersInfo.cs
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Net;
29
30namespace OpenSim.Framework
31{
32 public class HGNetworkServersInfo
33 {
34
35 public readonly string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI;
36
37 private static HGNetworkServersInfo m_singleton;
38 public static HGNetworkServersInfo Singleton
39 {
40 get { return m_singleton; }
41 }
42
43 public static void Init(string assetserver, string inventoryserver, string userserver)
44 {
45 m_singleton = new HGNetworkServersInfo(assetserver, inventoryserver, userserver);
46
47 }
48
49 private HGNetworkServersInfo(string a, string i, string u)
50 {
51 LocalAssetServerURI = ServerURI(a);
52 LocalInventoryServerURI = ServerURI(i);
53 LocalUserServerURI = ServerURI(u);
54 }
55
56 public bool IsLocalUser(string userserver)
57 {
58 string userServerURI = ServerURI(userserver);
59 bool ret = (((userServerURI == null) || (userServerURI == "") || (userServerURI == LocalUserServerURI)));
60 //m_log.Debug("-------------> HGNetworkServersInfo.IsLocalUser? " + ret + "(userServer=" + userServerURI + "; localuserserver=" + LocalUserServerURI + ")");
61 return ret;
62 }
63
64 public bool IsLocalUser(UserProfileData userData)
65 {
66 if (userData != null)
67 {
68 if (userData is ForeignUserProfileData)
69 return IsLocalUser(((ForeignUserProfileData)userData).UserServerURI);
70 else
71 return true;
72 }
73 else
74 // Something fishy; ignore it
75 return true;
76 }
77
78 public static string ServerURI(string uri)
79 {
80 // Get rid of eventual slashes at the end
81 try
82 {
83 if (uri.EndsWith("/"))
84 uri = uri.Substring(0, uri.Length - 1);
85 }
86 catch { }
87
88 IPAddress ipaddr1 = null;
89 string port1 = "";
90 try
91 {
92 ipaddr1 = Util.GetHostFromURL(uri);
93 }
94 catch { }
95
96 try
97 {
98 port1 = uri.Split(new char[] { ':' })[2];
99 }
100 catch { }
101
102 // We tried our best to convert the domain names to IP addresses
103 return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
104 }
105
106 }
107}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 556a532..db74548 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Framework
57 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects); 57 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
58 58
59 public delegate void ObjectAttach( 59 public delegate void ObjectAttach(
60 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent); 60 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
61 61
62 public delegate void ModifyTerrain(UUID user, 62 public delegate void ModifyTerrain(UUID user,
63 float height, float seconds, byte size, byte action, float north, float west, float south, float east, 63 float height, float seconds, byte size, byte action, float north, float west, float south, float east,
@@ -1017,7 +1017,6 @@ namespace OpenSim.Framework
1017 1017
1018 void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations); 1018 void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
1019 1019
1020 void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID);
1021 void SetChildAgentThrottle(byte[] throttle); 1020 void SetChildAgentThrottle(byte[] throttle);
1022 1021
1023 void SendAvatarDataImmediate(ISceneEntity avatar); 1022 void SendAvatarDataImmediate(ISceneEntity avatar);
diff --git a/OpenSim/Framework/IClientFileTransfer.cs b/OpenSim/Framework/IClientFileTransfer.cs
deleted file mode 100644
index f947b17..0000000
--- a/OpenSim/Framework/IClientFileTransfer.cs
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public delegate void UploadComplete(string filename, UUID fileID, ulong transferID, byte[] fileData, IClientAPI remoteClient);
33 public delegate void UploadAborted(string filename, UUID fileID, ulong transferID, IClientAPI remoteClient);
34
35 public interface IClientFileTransfer
36 {
37 bool RequestUpload(string clientFileName, UploadComplete uploadCompleteCallback, UploadAborted abortCallback);
38 bool RequestUpload(UUID fileID, UploadComplete uploadCompleteCallback, UploadAborted abortCallback);
39 }
40}
diff --git a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs b/OpenSim/Framework/ILoginServiceToRegionsConnector.cs
deleted file mode 100644
index 5a155c1..0000000
--- a/OpenSim/Framework/ILoginServiceToRegionsConnector.cs
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30
31namespace OpenSim.Framework
32{
33 public interface ILoginServiceToRegionsConnector
34 {
35 void LogOffUserFromGrid(ulong regionHandle, UUID AvatarID, UUID RegionSecret, string message);
36 bool NewUserConnection(ulong regionHandle, AgentCircuitData agent, out string reason);
37 RegionInfo RequestClosestRegion(string region);
38 RegionInfo RequestNeighbourInfo(UUID regionID);
39 RegionInfo RequestNeighbourInfo(ulong regionhandle);
40 }
41}
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs
index 3480960..3d4873d 100644
--- a/OpenSim/Framework/IMoneyModule.cs
+++ b/OpenSim/Framework/IMoneyModule.cs
@@ -35,35 +35,15 @@ namespace OpenSim.Framework
35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, 35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
36 int amount); 36 int amount);
37 37
38 int GetBalance(IClientAPI client); 38 int GetBalance(UUID agentID);
39 void ApplyUploadCharge(UUID agentID); 39 bool UploadCovered(IClientAPI client, int amount);
40 bool UploadCovered(IClientAPI client);
41 void ApplyGroupCreationCharge(UUID agentID);
42 bool GroupCreationCovered(IClientAPI client);
43 bool AmountCovered(IClientAPI client, int amount); 40 bool AmountCovered(IClientAPI client, int amount);
44 void ApplyCharge(UUID agentID, int amount, string text); 41 void ApplyCharge(UUID agentID, int amount, string text);
42 void ApplyUploadCharge(UUID agentID, int amount, string text);
45 43
46 EconomyData GetEconomyData(); 44 int UploadCharge { get; }
45 int GroupCreationCharge { get; }
47 46
48 event ObjectPaid OnObjectPaid; 47 event ObjectPaid OnObjectPaid;
49 } 48 }
50
51 public struct EconomyData
52 {
53 public int ObjectCapacity;
54 public int ObjectCount;
55 public int PriceEnergyUnit;
56 public int PriceGroupCreate;
57 public int PriceObjectClaim;
58 public float PriceObjectRent;
59 public float PriceObjectScaleFactor;
60 public int PriceParcelClaim;
61 public float PriceParcelClaimFactor;
62 public int PriceParcelRent;
63 public int PricePublicObjectDecay;
64 public int PricePublicObjectDelete;
65 public int PriceRentLight;
66 public int PriceUpload;
67 public int TeleportMinPrice;
68 }
69} 49}
diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs
deleted file mode 100644
index 884c0ea..0000000
--- a/OpenSim/Framework/MessageServerConfig.cs
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework
31{
32 /// <summary>
33 /// Message Server Config - Configuration of the Message Server
34 /// </summary>
35 public class MessageServerConfig:ConfigBase
36 {
37 public string DatabaseProvider = String.Empty;
38 public string DatabaseConnect = String.Empty;
39 public string GridCommsProvider = String.Empty;
40 public string GridRecvKey = String.Empty;
41 public string GridSendKey = String.Empty;
42 public string GridServerURL = String.Empty;
43 public uint HttpPort = ConfigSettings.DefaultMessageServerHttpPort;
44 public bool HttpSSL = ConfigSettings.DefaultMessageServerHttpSSL;
45 public string MessageServerIP = String.Empty;
46 public string UserRecvKey = String.Empty;
47 public string UserSendKey = String.Empty;
48 public string UserServerURL = String.Empty;
49 public string ConsoleUser = String.Empty;
50 public string ConsolePass = String.Empty;
51
52 public MessageServerConfig(string description, string filename)
53 {
54 m_configMember =
55 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
56 m_configMember.performConfigurationRetrieve();
57 }
58
59 public void loadConfigurationOptions()
60 {
61 m_configMember.addConfigurationOption("default_user_server",
62 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
63 "Default User Server URI",
64 "http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort.ToString() + "/", false);
65 m_configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
66 "Key to send to user server", "null", false);
67 m_configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
68 "Key to expect from user server", "null", false);
69 m_configMember.addConfigurationOption("default_grid_server",
70 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
71 "Default Grid Server URI",
72 "http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort.ToString() + "/", false);
73 m_configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
74 "Key to send to grid server", "null", false);
75 m_configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
76 "Key to expect from grid server", "null", false);
77
78 m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
79 "Connection String for Database", "", false);
80
81 m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
82 "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
83
84 m_configMember.addConfigurationOption("region_comms_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
85 "DLL for comms provider", "OpenSim.Region.Communications.OGS1.dll", false);
86
87 m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
88 "Http Listener port", ConfigSettings.DefaultMessageServerHttpPort.ToString(), false);
89 m_configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
90 "Use SSL? true/false", ConfigSettings.DefaultMessageServerHttpSSL.ToString(), false);
91 m_configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
92 "My Published IP Address", "127.0.0.1", false);
93 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
94 "Remote console access user name [Default: disabled]", "", false);
95
96 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
97 "Remote console access password [Default: disabled]", "", false);
98
99 }
100
101 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
102 {
103 switch (configuration_key)
104 {
105 case "default_user_server":
106 UserServerURL = (string) configuration_result;
107 break;
108 case "user_send_key":
109 UserSendKey = (string) configuration_result;
110 break;
111 case "user_recv_key":
112 UserRecvKey = (string) configuration_result;
113 break;
114 case "default_grid_server":
115 GridServerURL = (string) configuration_result;
116 break;
117 case "grid_send_key":
118 GridSendKey = (string) configuration_result;
119 break;
120 case "grid_recv_key":
121 GridRecvKey = (string) configuration_result;
122 break;
123 case "database_provider":
124 DatabaseProvider = (string) configuration_result;
125 break;
126 case "database_connect":
127 DatabaseConnect = (string)configuration_result;
128 break;
129 case "http_port":
130 HttpPort = (uint) configuration_result;
131 break;
132 case "http_ssl":
133 HttpSSL = (bool) configuration_result;
134 break;
135 case "region_comms_provider":
136 GridCommsProvider = (string) configuration_result;
137 break;
138 case "published_ip":
139 MessageServerIP = (string) configuration_result;
140 break;
141 case "console_user":
142 ConsoleUser = (string)configuration_result;
143 break;
144 case "console_pass":
145 ConsolePass = (string)configuration_result;
146 break;
147 }
148
149 return true;
150 }
151 }
152}
diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs
index 5fe343d..831ff70 100644
--- a/OpenSim/Framework/NetworkUtil.cs
+++ b/OpenSim/Framework/NetworkUtil.cs
@@ -31,6 +31,7 @@ using System.Net.Sockets;
31using System.Net; 31using System.Net;
32using System.Net.NetworkInformation; 32using System.Net.NetworkInformation;
33using System.Reflection; 33using System.Reflection;
34using System.Text;
34using log4net; 35using log4net;
35 36
36namespace OpenSim.Framework 37namespace OpenSim.Framework
@@ -180,10 +181,18 @@ namespace OpenSim.Framework
180 throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client"); 181 throw new ArgumentException("[NetworkUtil] Unable to resolve defaultHostname to an IPv4 address for an IPv4 client");
181 } 182 }
182 183
184 static IPAddress externalIPAddress;
185
183 static NetworkUtil() 186 static NetworkUtil()
184 { 187 {
185 try 188 try
186 { 189 {
190 externalIPAddress = GetExternalIP();
191 }
192 catch { /* ignore */ }
193
194 try
195 {
187 foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) 196 foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
188 { 197 {
189 foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses) 198 foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses)
@@ -244,5 +253,80 @@ namespace OpenSim.Framework
244 } 253 }
245 return defaultHostname; 254 return defaultHostname;
246 } 255 }
256
257 public static IPAddress GetExternalIPOf(IPAddress user)
258 {
259 if (externalIPAddress == null)
260 return user;
261
262 if (user.ToString() == "127.0.0.1")
263 {
264 m_log.Info("[NetworkUtil] 127.0.0.1 user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
265 return externalIPAddress;
266 }
267 // Check if we're accessing localhost.
268 foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName()))
269 {
270 if (host.Equals(user) && host.AddressFamily == AddressFamily.InterNetwork)
271 {
272 m_log.Info("[NetworkUtil] Localhost user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
273 return externalIPAddress;
274 }
275 }
276
277 // Check for same LAN segment
278 foreach (KeyValuePair<IPAddress, IPAddress> subnet in m_subnets)
279 {
280 byte[] subnetBytes = subnet.Value.GetAddressBytes();
281 byte[] localBytes = subnet.Key.GetAddressBytes();
282 byte[] destBytes = user.GetAddressBytes();
283
284 if (subnetBytes.Length != destBytes.Length || subnetBytes.Length != localBytes.Length)
285 return user;
286
287 bool valid = true;
288
289 for (int i = 0; i < subnetBytes.Length; i++)
290 {
291 if ((localBytes[i] & subnetBytes[i]) != (destBytes[i] & subnetBytes[i]))
292 {
293 valid = false;
294 break;
295 }
296 }
297
298 if (subnet.Key.AddressFamily != AddressFamily.InterNetwork)
299 valid = false;
300
301 if (valid)
302 {
303 m_log.Info("[NetworkUtil] Local LAN user detected, sending '" + externalIPAddress + "' instead of '" + user + "'");
304 return externalIPAddress;
305 }
306 }
307
308 // Otherwise, return user address
309 return user;
310 }
311
312 private static IPAddress GetExternalIP()
313 {
314 string whatIsMyIp = "http://www.whatismyip.com/automation/n09230945.asp";
315 WebClient wc = new WebClient();
316 UTF8Encoding utf8 = new UTF8Encoding();
317 string requestHtml = "";
318 try
319 {
320 requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp));
321 }
322 catch (WebException we)
323 {
324 m_log.Info("[NetworkUtil]: Exception in GetExternalIP: " + we.ToString());
325 return null;
326 }
327
328 IPAddress externalIp = IPAddress.Parse(requestHtml);
329 return externalIp;
330 }
247 } 331 }
248} 332}
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index 1cc19c5..b91496b 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -73,7 +73,18 @@ namespace OpenSim.Framework.Servers.HttpServer
73 { 73 {
74 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) 74 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
75 { 75 {
76 StreamReader str = new StreamReader(req.Request.Body); 76 StreamReader str;
77 try
78 {
79 str = new StreamReader(req.Request.Body);
80 }
81 catch (System.ArgumentException)
82 {
83 // Stream was not readable means a child agent
84 // was closed due to logout, leaving the
85 // Event Queue request orphaned.
86 continue;
87 }
77 88
78 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); 89 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
79 m_server.DoHTTPGruntWork(responsedata, 90 m_server.DoHTTPGruntWork(responsedata,
@@ -106,4 +117,4 @@ namespace OpenSim.Framework.Servers.HttpServer
106 m_request.Enqueue(pPollServiceHttpRequest); 117 m_request.Enqueue(pPollServiceHttpRequest);
107 } 118 }
108 } 119 }
109} \ No newline at end of file 120}
diff --git a/OpenSim/Framework/Tests/ACLTest.cs b/OpenSim/Framework/Tests/ACLTest.cs
deleted file mode 100644
index 06e860e..0000000
--- a/OpenSim/Framework/Tests/ACLTest.cs
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using NUnit.Framework;
30using System.Collections.Generic;
31
32
33namespace OpenSim.Framework.Tests
34{
35 [TestFixture]
36 public class ACLTest
37 {
38 #region Tests
39
40 /// <summary>
41 /// ACL Test class
42 /// </summary>
43 [Test]
44 public void ACLTest01()
45 {
46 ACL acl = new ACL();
47
48 Role Guests = new Role("Guests");
49 acl.AddRole(Guests);
50
51 Role[] parents = new Role[1];
52 parents[0] = Guests;
53
54 Role JoeGuest = new Role("JoeGuest", parents);
55 acl.AddRole(JoeGuest);
56
57 Resource CanBuild = new Resource("CanBuild");
58 acl.AddResource(CanBuild);
59
60
61 acl.GrantPermission("Guests", "CanBuild");
62
63 Permission perm = acl.HasPermission("JoeGuest", "CanBuild");
64 Assert.That(perm == Permission.Allow, "JoeGuest should have permission to build");
65 perm = Permission.None;
66 try
67 {
68 perm = acl.HasPermission("unknownGuest", "CanBuild");
69
70 }
71 catch (KeyNotFoundException)
72 {
73
74
75 }
76 catch (Exception)
77 {
78 Assert.That(false,"Exception thrown should have been KeyNotFoundException");
79 }
80 Assert.That(perm == Permission.None,"Permission None should be set because exception should have been thrown");
81
82 }
83
84 [Test]
85 public void KnownButPermissionDenyAndPermissionNoneUserTest()
86 {
87 ACL acl = new ACL();
88
89 Role Guests = new Role("Guests");
90 acl.AddRole(Guests);
91 Role Administrators = new Role("Administrators");
92 acl.AddRole(Administrators);
93 Role[] Guestparents = new Role[1];
94 Role[] Adminparents = new Role[1];
95
96 Guestparents[0] = Guests;
97 Adminparents[0] = Administrators;
98
99 Role JoeGuest = new Role("JoeGuest", Guestparents);
100 acl.AddRole(JoeGuest);
101
102 Resource CanBuild = new Resource("CanBuild");
103 acl.AddResource(CanBuild);
104
105 Resource CanScript = new Resource("CanScript");
106 acl.AddResource(CanScript);
107
108 Resource CanRestart = new Resource("CanRestart");
109 acl.AddResource(CanRestart);
110
111 acl.GrantPermission("Guests", "CanBuild");
112 acl.DenyPermission("Guests", "CanRestart");
113
114 acl.GrantPermission("Administrators", "CanScript");
115
116 acl.GrantPermission("Administrators", "CanRestart");
117 Permission setPermission = acl.HasPermission("JoeGuest", "CanRestart");
118 Assert.That(setPermission == Permission.Deny, "Guests Should not be able to restart");
119 Assert.That(acl.HasPermission("JoeGuest", "CanScript") == Permission.None,
120 "No Explicit Permissions set so should be Permission.None");
121 }
122
123 #endregion
124 }
125}
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs
deleted file mode 100644
index 0fa82cf..0000000
--- a/OpenSim/Framework/UserConfig.cs
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30
31namespace OpenSim.Framework
32{
33 /// <summary>
34 /// UserConfig -- For User Server Configuration
35 /// </summary>
36 public class UserConfig:ConfigBase
37 {
38 public string DatabaseProvider = String.Empty;
39 public string DatabaseConnect = String.Empty;
40 public string DefaultStartupMsg = String.Empty;
41 public uint DefaultX = 1000;
42 public uint DefaultY = 1000;
43 public string GridRecvKey = String.Empty;
44 public string GridSendKey = String.Empty;
45 public uint HttpPort = ConfigSettings.DefaultUserServerHttpPort;
46 public bool HttpSSL = ConfigSettings.DefaultUserServerHttpSSL;
47 public uint DefaultUserLevel = 0;
48 public string LibraryXmlfile = "";
49 public string ConsoleUser = String.Empty;
50 public string ConsolePass = String.Empty;
51
52 private Uri m_inventoryUrl;
53
54 public Uri InventoryUrl
55 {
56 get
57 {
58 return m_inventoryUrl;
59 }
60 set
61 {
62 m_inventoryUrl = value;
63 }
64 }
65
66 private Uri m_authUrl;
67 public Uri AuthUrl
68 {
69 get
70 {
71 return m_authUrl;
72 }
73 set
74 {
75 m_authUrl = value;
76 }
77 }
78
79 private Uri m_gridServerURL;
80
81 public Uri GridServerURL
82 {
83 get
84 {
85 return m_gridServerURL;
86 }
87 set
88 {
89 m_gridServerURL = value;
90 }
91 }
92
93 public bool EnableLLSDLogin = true;
94
95 public bool EnableHGLogin = true;
96
97 public UserConfig()
98 {
99 // weird, but UserManagerBase needs this.
100 }
101 public UserConfig(string description, string filename)
102 {
103 m_configMember =
104 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
105 m_configMember.performConfigurationRetrieve();
106 }
107
108 public void loadConfigurationOptions()
109 {
110 m_configMember.addConfigurationOption("default_startup_message",
111 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
112 "Default Startup Message", "Welcome to OGS", false);
113
114 m_configMember.addConfigurationOption("default_grid_server",
115 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
116 "Default Grid Server URI",
117 "http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort + "/", false);
118 m_configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
119 "Key to send to grid server", "null", false);
120 m_configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
121 "Key to expect from grid server", "null", false);
122
123 m_configMember.addConfigurationOption("default_inventory_server",
124 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
125 "Default Inventory Server URI",
126 "http://127.0.0.1:" + ConfigSettings.DefaultInventoryServerHttpPort + "/",
127 false);
128 m_configMember.addConfigurationOption("default_authentication_server",
129 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
130 "User Server (this) External URI for authentication keys",
131 "http://localhost:" + ConfigSettings.DefaultUserServerHttpPort + "/",
132 false);
133 m_configMember.addConfigurationOption("library_location",
134 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
135 "Path to library control file",
136 string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar), false);
137
138 m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
139 "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
140 m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
141 "Connection String for Database", "", false);
142
143 m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
144 "Http Listener port", ConfigSettings.DefaultUserServerHttpPort.ToString(), false);
145 m_configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
146 "Use SSL? true/false", ConfigSettings.DefaultUserServerHttpSSL.ToString(), false);
147 m_configMember.addConfigurationOption("default_X", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
148 "Known good region X", "1000", false);
149 m_configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
150 "Known good region Y", "1000", false);
151 m_configMember.addConfigurationOption("enable_llsd_login", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
152 "Enable LLSD login support [Currently used by libsl based clients/bots]? true/false", true.ToString(), false);
153
154 m_configMember.addConfigurationOption("enable_hg_login", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
155 "Enable Hypergrid login support [Currently used by GridSurfer-proxied clients]? true/false", true.ToString(), false);
156
157 m_configMember.addConfigurationOption("default_loginLevel", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
158 "Minimum Level a user should have to login [0 default]", "0", false);
159
160 m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
161 "Remote console access user name [Default: disabled]", "", false);
162
163 m_configMember.addConfigurationOption("console_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
164 "Remote console access password [Default: disabled]", "", false);
165
166 }
167
168 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
169 {
170 switch (configuration_key)
171 {
172 case "default_startup_message":
173 DefaultStartupMsg = (string) configuration_result;
174 break;
175 case "default_grid_server":
176 GridServerURL = new Uri((string) configuration_result);
177 break;
178 case "grid_send_key":
179 GridSendKey = (string) configuration_result;
180 break;
181 case "grid_recv_key":
182 GridRecvKey = (string) configuration_result;
183 break;
184 case "default_inventory_server":
185 InventoryUrl = new Uri((string) configuration_result);
186 break;
187 case "default_authentication_server":
188 AuthUrl = new Uri((string)configuration_result);
189 break;
190 case "database_provider":
191 DatabaseProvider = (string) configuration_result;
192 break;
193 case "database_connect":
194 DatabaseConnect = (string) configuration_result;
195 break;
196 case "http_port":
197 HttpPort = (uint) configuration_result;
198 break;
199 case "http_ssl":
200 HttpSSL = (bool) configuration_result;
201 break;
202 case "default_X":
203 DefaultX = (uint) configuration_result;
204 break;
205 case "default_Y":
206 DefaultY = (uint) configuration_result;
207 break;
208 case "enable_llsd_login":
209 EnableLLSDLogin = (bool)configuration_result;
210 break;
211 case "enable_hg_login":
212 EnableHGLogin = (bool)configuration_result;
213 break;
214 case "default_loginLevel":
215 DefaultUserLevel = (uint)configuration_result;
216 break;
217 case "library_location":
218 LibraryXmlfile = (string)configuration_result;
219 break;
220 case "console_user":
221 ConsoleUser = (string)configuration_result;
222 break;
223 case "console_pass":
224 ConsolePass = (string)configuration_result;
225 break;
226 }
227
228 return true;
229 }
230 }
231}
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index e20866e..d16f9bf 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -139,8 +139,9 @@ namespace OpenSim.Framework
139 request.ContentLength = requestData.Length; 139 request.ContentLength = requestData.Length;
140 request.ContentType = "application/x-www-form-urlencoded"; 140 request.ContentType = "application/x-www-form-urlencoded";
141 141
142 using (Stream requestStream = request.GetRequestStream()) 142 Stream requestStream = request.GetRequestStream();
143 requestStream.Write(requestData, 0, requestData.Length); 143 requestStream.Write(requestData, 0, requestData.Length);
144 requestStream.Close();
144 145
145 using (WebResponse response = request.GetResponse()) 146 using (WebResponse response = request.GetResponse())
146 { 147 {
@@ -169,7 +170,7 @@ namespace OpenSim.Framework
169 } 170 }
170 catch (Exception ex) 171 catch (Exception ex)
171 { 172 {
172 m_log.Warn("POST to URL " + url + " failed: " + ex.Message); 173 m_log.Warn("POST to URL " + url + " failed: " + ex);
173 errorMessage = ex.Message; 174 errorMessage = ex.Message;
174 } 175 }
175 176
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index cac5fa9..09f7bea 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -308,21 +308,6 @@ namespace OpenSim
308 } 308 }
309 309
310 { 310 {
311 IConfig config = defaultConfig.Configs["StandAlone"];
312
313 if (null == config)
314 config = defaultConfig.AddConfig("StandAlone");
315
316 config.Set("accounts_authenticate", true);
317 config.Set("welcome_message", "Welcome to OpenSimulator");
318 config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
319 config.Set("inventory_source", "");
320 config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
321 config.Set("user_source", "");
322 config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar));
323 }
324
325 {
326 IConfig config = defaultConfig.Configs["Network"]; 311 IConfig config = defaultConfig.Configs["Network"];
327 312
328 if (null == config) 313 if (null == config)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 9869a99..e9e2dca 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
55 public IJ2KDecoder J2KDecoder; 55 public IJ2KDecoder J2KDecoder;
56 public IAssetService AssetService; 56 public IAssetService AssetService;
57 public UUID AgentID; 57 public UUID AgentID;
58 public IHyperAssetService HyperAssets; 58 public IInventoryAccessModule InventoryAccessModule;
59 public OpenJPEG.J2KLayerInfo[] Layers; 59 public OpenJPEG.J2KLayerInfo[] Layers;
60 public bool IsDecoded; 60 public bool IsDecoded;
61 public bool HasAsset; 61 public bool HasAsset;
@@ -375,14 +375,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
375 UUID assetID = UUID.Zero; 375 UUID assetID = UUID.Zero;
376 if (asset != null) 376 if (asset != null)
377 assetID = asset.FullID; 377 assetID = asset.FullID;
378 else if ((HyperAssets != null) && (sender != HyperAssets)) 378 else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
379 { 379 {
380 // Try the user's inventory, but only if it's different from the regions' 380 // Unfortunately we need this here, there's no other way.
381 string userAssets = HyperAssets.GetUserAssetServer(AgentID); 381 // This is due to the fact that textures opened directly from the agent's inventory
382 if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer())) 382 // don't have any distinguishing feature. As such, in order to serve those when the
383 // foreign user is visiting, we need to try again after the first fail to the local
384 // asset service.
385 string assetServerURL = string.Empty;
386 if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
383 { 387 {
384 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id); 388 m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
385 AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived); 389 AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived);
386 return; 390 return;
387 } 391 }
388 } 392 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index d2824bd..0aec01a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -357,7 +357,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
357 protected uint m_agentFOVCounter; 357 protected uint m_agentFOVCounter;
358 358
359 protected IAssetService m_assetService; 359 protected IAssetService m_assetService;
360 private IHyperAssetService m_hyperAssets;
361 private const bool m_checkPackets = true; 360 private const bool m_checkPackets = true;
362 361
363 private Timer m_propertiesPacketTimer; 362 private Timer m_propertiesPacketTimer;
@@ -432,7 +431,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
432// m_attachmentsSent = new HashSet<uint>(); 431// m_attachmentsSent = new HashSet<uint>();
433 432
434 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 433 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
435 m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
436 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); 434 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
437 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); 435 m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
438 m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion()); 436 m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion());
@@ -3680,30 +3678,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3680 3678
3681 #endregion Primitive Packet/Data Sending Methods 3679 #endregion Primitive Packet/Data Sending Methods
3682 3680
3683 /// <summary>
3684 ///
3685 /// </summary>
3686 /// <param name="localID"></param>
3687 /// <param name="rotation"></param>
3688 /// <param name="attachPoint"></param>
3689 public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
3690 {
3691 if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD
3692 return;
3693
3694 ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
3695 // TODO: don't create new blocks if recycling an old packet
3696 attach.AgentData.AgentID = AgentId;
3697 attach.AgentData.SessionID = m_sessionId;
3698 attach.AgentData.AttachmentPoint = attachPoint;
3699 attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
3700 attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
3701 attach.ObjectData[0].ObjectLocalID = localID;
3702 attach.ObjectData[0].Rotation = rotation;
3703 attach.Header.Zerocoded = true;
3704 OutPacket(attach, ThrottleOutPacketType.Task);
3705 }
3706
3707 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) 3681 void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories)
3708 { 3682 {
3709 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) 3683 if ((categories & ThrottleOutPacketTypeFlags.Task) != 0)
@@ -5733,7 +5707,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5733 { 5707 {
5734 if (att.ObjectData.Length > 0) 5708 if (att.ObjectData.Length > 0)
5735 { 5709 {
5736 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation, false); 5710 handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, false);
5737 } 5711 }
5738 } 5712 }
5739 } 5713 }
@@ -7196,59 +7170,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7196 } 7170 }
7197 else // Agent 7171 else // Agent
7198 { 7172 {
7199 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); 7173 IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
7200 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId); 7174 if (invAccess != null)
7201 assetRequestItem = invService.GetItem(assetRequestItem);
7202 if (assetRequestItem == null)
7203 { 7175 {
7204 ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>(); 7176 if (!invAccess.GetAgentInventoryItem(this, itemID, requestID))
7205 if (lib != null) 7177 return false;
7206 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
7207 if (assetRequestItem == null)
7208 return true;
7209 }
7210 7178
7211 // At this point, we need to apply perms
7212 // only to notecards and scripts. All
7213 // other asset types are always available
7214 //
7215 if (assetRequestItem.AssetType == (int)AssetType.LSLText)
7216 {
7217 if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
7218 {
7219 SendAgentAlertMessage("Insufficient permissions to view script", false);
7220 return true;
7221 }
7222 }
7223 else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
7224 {
7225 if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
7226 {
7227 SendAgentAlertMessage("Insufficient permissions to view notecard", false);
7228 return true;
7229 }
7230 } 7179 }
7180 else
7181 return false;
7231 7182
7232 if (assetRequestItem.AssetID != requestID)
7233 {
7234 m_log.WarnFormat(
7235 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
7236 Name, requestID, itemID, assetRequestItem.AssetID);
7237 return true;
7238 }
7239 } 7183 }
7240 } 7184 }
7241 } 7185 }
7242 7186
7243 //m_assetCache.AddAssetRequest(this, transfer);
7244
7245 MakeAssetRequest(transfer, taskID); 7187 MakeAssetRequest(transfer, taskID);
7246 7188
7247 /* RequestAsset = OnRequestAsset;
7248 if (RequestAsset != null)
7249 {
7250 RequestAsset(this, transfer);
7251 }*/
7252 return true; 7189 return true;
7253 } 7190 }
7254 7191
@@ -11459,15 +11396,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11459 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 11396 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11460 { 11397 {
11461 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11398 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11462 //m_log.Debug("[XXX] inventory asset request " + requestID);
11463 //if (taskID == UUID.Zero) // Agent
11464 // if (m_scene is HGScene)
11465 // {
11466 // m_log.Debug("[XXX] hg asset request " + requestID);
11467 // // We may need to fetch the asset from the user's asset server into the local asset server
11468 // HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
11469 // mapper.Get(requestID, AgentId);
11470 // }
11471 } 11399 }
11472 11400
11473// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 11401// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
@@ -11483,49 +11411,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11483 /// <param name="asset"></param> 11411 /// <param name="asset"></param>
11484 protected void AssetReceived(string id, Object sender, AssetBase asset) 11412 protected void AssetReceived(string id, Object sender, AssetBase asset)
11485 { 11413 {
11414 if (asset == null)
11415 return;
11416
11486 TransferRequestPacket transferRequest = (TransferRequestPacket)sender; 11417 TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
11487 11418
11488 UUID requestID = UUID.Zero; 11419 UUID requestID = UUID.Zero;
11489 byte source = (byte)SourceType.Asset; 11420 byte source = (byte)SourceType.Asset;
11490 11421
11491 if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) 11422 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11492 || (transferRequest.TransferInfo.SourceType == 2222))
11493 { 11423 {
11494 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 11424 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
11495 } 11425 }
11496 else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 11426 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11497 || (transferRequest.TransferInfo.SourceType == 3333))
11498 { 11427 {
11499 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11428 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11500 source = (byte)SourceType.SimInventoryItem; 11429 source = (byte)SourceType.SimInventoryItem;
11501 //m_log.Debug("asset request " + requestID); 11430 //m_log.Debug("asset request " + requestID);
11502 } 11431 }
11503 11432
11504 if (null == asset)
11505 {
11506 if ((m_hyperAssets != null) && (transferRequest.TransferInfo.SourceType < 2000))
11507 {
11508 // Try the user's inventory, but only if it's different from the regions'
11509 string userAssets = m_hyperAssets.GetUserAssetServer(AgentId);
11510 if ((userAssets != string.Empty) && (userAssets != m_hyperAssets.GetSimAssetServer()))
11511 {
11512 m_log.DebugFormat("[CLIENT]: asset {0} not found in local asset storage. Trying user's storage.", id);
11513 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11514 transferRequest.TransferInfo.SourceType = 2222; // marker
11515 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11516 transferRequest.TransferInfo.SourceType = 3333; // marker
11517
11518 m_assetService.Get(userAssets + "/" + id, transferRequest, AssetReceived);
11519 return;
11520 }
11521 }
11522
11523 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
11524
11525 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right.
11526 return;
11527 }
11528
11529 // Scripts cannot be retrieved by direct request 11433 // Scripts cannot be retrieved by direct request
11530 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10) 11434 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset && asset.Type == 10)
11531 return; 11435 return;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs
deleted file mode 100644
index 10e5a95..0000000
--- a/OpenSim/Region/ClientStack/LindenUDP/LLFileTransfer.cs
+++ /dev/null
@@ -1,367 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.ClientStack.LindenUDP
34{
35 /// <summary>
36 /// A work in progress, to contain the SL specific file transfer code that is currently in various region modules
37 /// This file currently contains multiple classes that need to be split out into their own files.
38 /// </summary>
39 public class LLFileTransfer : IClientFileTransfer
40 {
41 protected IClientAPI m_clientAPI;
42
43 /// Dictionary of handlers for uploading files from client
44 /// TODO: Need to add cleanup code to remove handlers that have completed their upload
45 protected Dictionary<ulong, XferUploadHandler> m_uploadHandlers;
46 protected object m_uploadHandlersLock = new object();
47
48
49 /// <summary>
50 /// Dictionary of files ready to be sent to clients
51 /// </summary>
52 protected static Dictionary<string, byte[]> m_files;
53
54 /// <summary>
55 /// Dictionary of Download Transfers in progess
56 /// </summary>
57 protected Dictionary<ulong, XferDownloadHandler> m_downloadHandlers = new Dictionary<ulong, XferDownloadHandler>();
58
59
60 public LLFileTransfer(IClientAPI clientAPI)
61 {
62 m_uploadHandlers = new Dictionary<ulong, XferUploadHandler>();
63 m_clientAPI = clientAPI;
64
65 m_clientAPI.OnXferReceive += XferReceive;
66 m_clientAPI.OnAbortXfer += AbortXferUploadHandler;
67 }
68
69 public void Close()
70 {
71 if (m_clientAPI != null)
72 {
73 m_clientAPI.OnXferReceive -= XferReceive;
74 m_clientAPI.OnAbortXfer -= AbortXferUploadHandler;
75 m_clientAPI = null;
76 }
77 }
78
79 #region Upload Handling
80
81 public bool RequestUpload(string clientFileName, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
82 {
83 if ((String.IsNullOrEmpty(clientFileName)) || (uploadCompleteCallback == null))
84 {
85 return false;
86 }
87
88 XferUploadHandler uploader = new XferUploadHandler(m_clientAPI, clientFileName);
89
90 return StartUpload(uploader, uploadCompleteCallback, abortCallback);
91 }
92
93 public bool RequestUpload(UUID fileID, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
94 {
95 if ((fileID == UUID.Zero) || (uploadCompleteCallback == null))
96 {
97 return false;
98 }
99
100 XferUploadHandler uploader = new XferUploadHandler(m_clientAPI, fileID);
101
102 return StartUpload(uploader, uploadCompleteCallback, abortCallback);
103 }
104
105 private bool StartUpload(XferUploadHandler uploader, UploadComplete uploadCompleteCallback, UploadAborted abortCallback)
106 {
107 uploader.UploadDone += uploadCompleteCallback;
108 uploader.UploadDone += RemoveXferUploadHandler;
109
110 if (abortCallback != null)
111 {
112 uploader.UploadAborted += abortCallback;
113 }
114
115 lock (m_uploadHandlersLock)
116 {
117 if (!m_uploadHandlers.ContainsKey(uploader.XferID))
118 {
119 m_uploadHandlers.Add(uploader.XferID, uploader);
120 uploader.RequestStartXfer(m_clientAPI);
121 return true;
122 }
123 else
124 {
125 // something went wrong with the xferID allocation
126 uploader.UploadDone -= uploadCompleteCallback;
127 uploader.UploadDone -= RemoveXferUploadHandler;
128 if (abortCallback != null)
129 {
130 uploader.UploadAborted -= abortCallback;
131 }
132 return false;
133 }
134 }
135 }
136
137 protected void AbortXferUploadHandler(IClientAPI remoteClient, ulong xferID)
138 {
139 lock (m_uploadHandlersLock)
140 {
141 if (m_uploadHandlers.ContainsKey(xferID))
142 {
143 m_uploadHandlers[xferID].AbortUpload(remoteClient);
144 m_uploadHandlers.Remove(xferID);
145 }
146 }
147 }
148
149 protected void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
150 {
151 lock (m_uploadHandlersLock)
152 {
153 if (m_uploadHandlers.ContainsKey(xferID))
154 {
155 m_uploadHandlers[xferID].XferReceive(remoteClient, xferID, packetID, data);
156 }
157 }
158 }
159
160 protected void RemoveXferUploadHandler(string filename, UUID fileID, ulong transferID, byte[] fileData, IClientAPI remoteClient)
161 {
162
163 }
164 #endregion
165
166 }
167
168 public class XferUploadHandler
169 {
170 private AssetBase m_asset;
171
172 public event UploadComplete UploadDone;
173 public event UploadAborted UploadAborted;
174
175 private sbyte type = 0;
176
177 public ulong mXferID;
178 private UploadComplete handlerUploadDone;
179 private UploadAborted handlerAbort;
180
181 private bool m_complete = false;
182
183 public bool UploadComplete
184 {
185 get { return m_complete; }
186 }
187
188 public XferUploadHandler(IClientAPI pRemoteClient, string pClientFilename)
189 {
190 Initialise(UUID.Zero, pClientFilename);
191 }
192
193 public XferUploadHandler(IClientAPI pRemoteClient, UUID fileID)
194 {
195 Initialise(fileID, String.Empty);
196 }
197
198 private void Initialise(UUID fileID, string fileName)
199 {
200 m_asset = new AssetBase(fileID, fileName, type, UUID.Zero.ToString());
201 m_asset.Data = new byte[0];
202 m_asset.Description = "empty";
203 m_asset.Local = true;
204 m_asset.Temporary = true;
205 mXferID = Util.GetNextXferID();
206 }
207
208 public ulong XferID
209 {
210 get { return mXferID; }
211 }
212
213 public void RequestStartXfer(IClientAPI pRemoteClient)
214 {
215 m_asset.Metadata.CreatorID = pRemoteClient.AgentId.ToString();
216
217 if (!String.IsNullOrEmpty(m_asset.Name))
218 {
219 pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name));
220 }
221 else
222 {
223 pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, new byte[0]);
224 }
225 }
226
227 /// <summary>
228 /// Process transfer data received from the client.
229 /// </summary>
230 /// <param name="xferID"></param>
231 /// <param name="packetID"></param>
232 /// <param name="data"></param>
233 public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
234 {
235 if (mXferID == xferID)
236 {
237 if (m_asset.Data.Length > 1)
238 {
239 byte[] destinationArray = new byte[m_asset.Data.Length + data.Length];
240 Array.Copy(m_asset.Data, 0, destinationArray, 0, m_asset.Data.Length);
241 Array.Copy(data, 0, destinationArray, m_asset.Data.Length, data.Length);
242 m_asset.Data = destinationArray;
243 }
244 else
245 {
246 byte[] buffer2 = new byte[data.Length - 4];
247 Array.Copy(data, 4, buffer2, 0, data.Length - 4);
248 m_asset.Data = buffer2;
249 }
250
251 remoteClient.SendConfirmXfer(xferID, packetID);
252
253 if ((packetID & 0x80000000) != 0)
254 {
255 SendCompleteMessage(remoteClient);
256
257 }
258 }
259 }
260
261 protected void SendCompleteMessage(IClientAPI remoteClient)
262 {
263 m_complete = true;
264 handlerUploadDone = UploadDone;
265 if (handlerUploadDone != null)
266 {
267 handlerUploadDone(m_asset.Name, m_asset.FullID, mXferID, m_asset.Data, remoteClient);
268 }
269 }
270
271 public void AbortUpload(IClientAPI remoteClient)
272 {
273 handlerAbort = UploadAborted;
274 if (handlerAbort != null)
275 {
276 handlerAbort(m_asset.Name, m_asset.FullID, mXferID, remoteClient);
277 }
278 }
279 }
280
281 public class XferDownloadHandler
282 {
283 public IClientAPI Client;
284 private bool complete;
285 public byte[] Data = new byte[0];
286 public int DataPointer = 0;
287 public string FileName = String.Empty;
288 public uint Packet = 0;
289 public uint Serial = 1;
290 public ulong XferID = 0;
291
292 public XferDownloadHandler(string fileName, byte[] data, ulong xferID, IClientAPI client)
293 {
294 FileName = fileName;
295 Data = data;
296 XferID = xferID;
297 Client = client;
298 }
299
300 public XferDownloadHandler()
301 {
302 }
303
304 /// <summary>
305 /// Start a transfer
306 /// </summary>
307 /// <returns>True if the transfer is complete, false if not</returns>
308 public bool StartSend()
309 {
310 if (Data.Length < 1000)
311 {
312 // for now (testing) we only support files under 1000 bytes
313 byte[] transferData = new byte[Data.Length + 4];
314 Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
315 Array.Copy(Data, 0, transferData, 4, Data.Length);
316 Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
317
318 complete = true;
319 }
320 else
321 {
322 byte[] transferData = new byte[1000 + 4];
323 Array.Copy(Utils.IntToBytes(Data.Length), 0, transferData, 0, 4);
324 Array.Copy(Data, 0, transferData, 4, 1000);
325 Client.SendXferPacket(XferID, 0, transferData);
326 Packet++;
327 DataPointer = 1000;
328 }
329
330 return complete;
331 }
332
333 /// <summary>
334 /// Respond to an ack packet from the client
335 /// </summary>
336 /// <param name="packet"></param>
337 /// <returns>True if the transfer is complete, false otherwise</returns>
338 public bool AckPacket(uint packet)
339 {
340 if (!complete)
341 {
342 if ((Data.Length - DataPointer) > 1000)
343 {
344 byte[] transferData = new byte[1000];
345 Array.Copy(Data, DataPointer, transferData, 0, 1000);
346 Client.SendXferPacket(XferID, Packet, transferData);
347 Packet++;
348 DataPointer += 1000;
349 }
350 else
351 {
352 byte[] transferData = new byte[Data.Length - DataPointer];
353 Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
354 uint endPacket = Packet |= (uint)0x80000000;
355 Client.SendXferPacket(XferID, endPacket, transferData);
356 Packet++;
357 DataPointer += (Data.Length - DataPointer);
358
359 complete = true;
360 }
361 }
362
363 return complete;
364 }
365 }
366
367}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 938cf50..9e0db12 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -58,8 +58,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
58 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); 58 private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
59 private object m_syncRoot = new object(); 59 private object m_syncRoot = new object();
60 60
61 private IHyperAssetService m_hyperAssets;
62
63 public LLClientView Client { get { return m_client; } } 61 public LLClientView Client { get { return m_client; } }
64 public AssetBase MissingImage { get { return m_missingImage; } } 62 public AssetBase MissingImage { get { return m_missingImage; } }
65 63
@@ -75,7 +73,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
75 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client"); 73 m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
76 74
77 m_j2kDecodeModule = pJ2kDecodeModule; 75 m_j2kDecodeModule = pJ2kDecodeModule;
78 m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
79 } 76 }
80 77
81 /// <summary> 78 /// <summary>
@@ -149,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
149 imgrequest.J2KDecoder = m_j2kDecodeModule; 146 imgrequest.J2KDecoder = m_j2kDecodeModule;
150 imgrequest.AssetService = m_assetCache; 147 imgrequest.AssetService = m_assetCache;
151 imgrequest.AgentID = m_client.AgentId; 148 imgrequest.AgentID = m_client.AgentId;
152 imgrequest.HyperAssets = m_hyperAssets; 149 imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
153 imgrequest.DiscardLevel = newRequest.DiscardLevel; 150 imgrequest.DiscardLevel = newRequest.DiscardLevel;
154 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); 151 imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
155 imgrequest.Priority = newRequest.Priority; 152 imgrequest.Priority = newRequest.Priority;
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index d30e954..3d6e7f3 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -182,7 +182,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
182 182
183 if (part.Inventory.UpdateInventoryItem(item)) 183 if (part.Inventory.UpdateInventoryItem(item))
184 { 184 {
185 remoteClient.SendAgentAlertMessage("Notecard saved", false); 185 if ((InventoryType)item.InvType == InventoryType.Notecard)
186 remoteClient.SendAgentAlertMessage("Notecard saved", false);
187 else if ((InventoryType)item.InvType == InventoryType.LSL)
188 remoteClient.SendAgentAlertMessage("Script saved", false);
189 else
190 remoteClient.SendAgentAlertMessage("Item saved", false);
191
186 part.GetProperties(remoteClient); 192 part.GetProperties(remoteClient);
187 } 193 }
188 } 194 }
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 7e08ecf..ae31050 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
243 243
244 if (mm != null) 244 if (mm != null)
245 { 245 {
246 if (!mm.UploadCovered(remoteClient)) 246 if (!mm.UploadCovered(remoteClient, mm.UploadCharge))
247 { 247 {
248 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 248 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
249 return; 249 return;
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index 75efb79..8aa87fd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
190 end = Utils.Clamp(end, 1, texture.Data.Length); 190 end = Utils.Clamp(end, 1, texture.Data.Length);
191 start = Utils.Clamp(start, 0, end - 1); 191 start = Utils.Clamp(start, 0, end - 1);
192 192
193 m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); 193 //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
194 194
195 if (end - start < texture.Data.Length) 195 if (end - start < texture.Data.Length)
196 response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent; 196 response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index a7b4c66..d895bb1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenMetaverse.Packets; 35using OpenMetaverse.Packets;
@@ -39,37 +40,65 @@ using OpenSim.Region.Framework.Scenes;
39 40
40namespace OpenSim.Region.CoreModules.Avatar.Attachments 41namespace OpenSim.Region.CoreModules.Avatar.Attachments
41{ 42{
42 public class AttachmentsModule : IAttachmentsModule, IRegionModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AttachmentsModule")]
44 public class AttachmentsModule : IAttachmentsModule, INonSharedRegionModule
43 { 45 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 47
46 protected Scene m_scene = null; 48 protected Scene m_scene = null;
49
50 public string Name { get { return "Attachments Module"; } }
51 public Type ReplaceableInterface { get { return null; } }
47 52
48 public void Initialise(Scene scene, IConfigSource source) 53 public void Initialise(IConfigSource source) {}
54
55 public void AddRegion(Scene scene)
49 { 56 {
50 scene.RegisterModuleInterface<IAttachmentsModule>(this);
51 m_scene = scene; 57 m_scene = scene;
58 m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
59 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
60 // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
52 } 61 }
53 62
54 public void PostInitialise() 63 public void RemoveRegion(Scene scene)
55 { 64 {
65 m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
66 m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
56 } 67 }
57 68
58 public void Close() 69 public void RegionLoaded(Scene scene) {}
70
71 public void Close()
59 { 72 {
73 RemoveRegion(m_scene);
60 } 74 }
61 75
62 public string Name 76 public void SubscribeToClientEvents(IClientAPI client)
63 { 77 {
64 get { return "Attachments Module"; } 78 client.OnRezSingleAttachmentFromInv += RezSingleAttachmentFromInventory;
79 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
80 client.OnObjectAttach += AttachObject;
81 client.OnObjectDetach += DetachObject;
82 client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
65 } 83 }
66 84
67 public bool IsSharedModule 85 public void UnsubscribeFromClientEvents(IClientAPI client)
68 { 86 {
69 get { return false; } 87 client.OnRezSingleAttachmentFromInv -= RezSingleAttachmentFromInventory;
88 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
89 client.OnObjectAttach -= AttachObject;
90 client.OnObjectDetach -= DetachObject;
91 client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
70 } 92 }
71 93
72 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) 94 /// <summary>
95 /// Called by client
96 /// </summary>
97 /// <param name="remoteClient"></param>
98 /// <param name="objectLocalID"></param>
99 /// <param name="AttachmentPt"></param>
100 /// <param name="silent"></param>
101 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
73 { 102 {
74 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); 103 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
75 104
@@ -84,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
84 return; 113 return;
85 114
86 // Calls attach with a Zero position 115 // Calls attach with a Zero position
87 if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) 116 if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false))
88 { 117 {
89 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); 118 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
90 119
@@ -106,72 +135,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
106 } 135 }
107 } 136 }
108 137
109 public bool AttachObject( 138 public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
110 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
111 { 139 {
112 SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); 140 Vector3 attachPos = group.AbsolutePosition;
113 if (group != null) 141
142 if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
114 { 143 {
115 if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) 144 // If the attachment point isn't the same as the one previously used
145 // set it's offset position = 0 so that it appears on the attachment point
146 // and not in a weird location somewhere unknown.
147 if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
116 { 148 {
117 // If the attachment point isn't the same as the one previously used 149 attachPos = Vector3.Zero;
118 // set it's offset position = 0 so that it appears on the attachment point 150 }
119 // and not in a weird location somewhere unknown.
120 if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
121 {
122 attachPos = Vector3.Zero;
123 }
124
125 // AttachmentPt 0 means the client chose to 'wear' the attachment.
126 if (AttachmentPt == 0)
127 {
128 // Check object for stored attachment point
129 AttachmentPt = (uint)group.GetAttachmentPoint();
130 }
131 151
132 // if we still didn't find a suitable attachment point....... 152 // AttachmentPt 0 means the client chose to 'wear' the attachment.
133 if (AttachmentPt == 0) 153 if (AttachmentPt == 0)
134 { 154 {
135 // Stick it on left hand with Zero Offset from the attachment point. 155 // Check object for stored attachment point
136 AttachmentPt = (uint)AttachmentPoint.LeftHand; 156 AttachmentPt = (uint)group.GetAttachmentPoint();
137 attachPos = Vector3.Zero; 157 }
138 }
139 158
140 group.SetAttachmentPoint((byte)AttachmentPt); 159 // if we still didn't find a suitable attachment point.......
141 group.AbsolutePosition = attachPos; 160 if (AttachmentPt == 0)
161 {
162 // Stick it on left hand with Zero Offset from the attachment point.
163 AttachmentPt = (uint)AttachmentPoint.LeftHand;
164 attachPos = Vector3.Zero;
165 }
142 166
143 // Saves and gets itemID 167 group.SetAttachmentPoint((byte)AttachmentPt);
144 UUID itemId; 168 group.AbsolutePosition = attachPos;
145 169
146 if (group.GetFromItemID() == UUID.Zero) 170 // Remove any previous attachments
147 { 171 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
148 m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); 172 UUID itemID = UUID.Zero;
149 } 173 if (sp != null)
150 else 174 {
175 foreach(SceneObjectGroup grp in sp.Attachments)
151 { 176 {
152 itemId = group.GetFromItemID(); 177 if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
178 {
179 itemID = grp.GetFromItemID();
180 break;
181 }
153 } 182 }
183 if (itemID != UUID.Zero)
184 DetachSingleAttachmentToInv(itemID, remoteClient);
185 }
154 186
155 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); 187 if (group.GetFromItemID() == UUID.Zero)
156 188 {
157 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); 189 m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
158
159 // In case it is later dropped again, don't let
160 // it get cleaned up
161 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
162 group.HasGroupChanged = false;
163 } 190 }
164 else 191 else
165 { 192 {
166 remoteClient.SendAgentAlertMessage( 193 itemID = group.GetFromItemID();
167 "You don't have sufficient permissions to attach this object", false);
168
169 return false;
170 } 194 }
195
196 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
197
198 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
199
200 // In case it is later dropped again, don't let
201 // it get cleaned up
202 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
203 group.HasGroupChanged = false;
171 } 204 }
172 else 205 else
173 { 206 {
174 m_log.DebugFormat("[ATTACHMENTS MODULE]: AttachObject found no such scene object {0}", objectLocalID); 207 remoteClient.SendAgentAlertMessage(
208 "You don't have sufficient permissions to attach this object", false);
209
175 return false; 210 return false;
176 } 211 }
177 212
@@ -237,8 +272,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
237 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) 272 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
238 tainted = true; 273 tainted = true;
239 274
240 AttachObject( 275 AttachObject(remoteClient, objatt, AttachmentPt, false);
241 remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
242 //objatt.ScheduleGroupForFullUpdate(); 276 //objatt.ScheduleGroupForFullUpdate();
243 277
244 if (tainted) 278 if (tainted)
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index b5c3176..2105f3c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -81,14 +81,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
81 { 81 {
82 ScenePresence sp = m_scene.GetScenePresence(agentID); 82 ScenePresence sp = m_scene.GetScenePresence(agentID);
83 83
84 if (sp != null && !sp.IsChildAgent) 84 if (sp != null)
85 sp.ControllingClient.SendAgentAlertMessage(message, modal); 85 sp.ControllingClient.SendAgentAlertMessage(message, modal);
86 } 86 }
87 87
88 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 88 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
89 { 89 {
90 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); 90 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
91 if (presence != null && !presence.IsChildAgent) 91 if (presence != null)
92 presence.ControllingClient.SendAgentAlertMessage(message, modal); 92 presence.ControllingClient.SendAgentAlertMessage(message, modal);
93 } 93 }
94 94
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
119 } 119 }
120 120
121 ScenePresence sp = m_scene.GetScenePresence(avatarID); 121 ScenePresence sp = m_scene.GetScenePresence(avatarID);
122 if (sp != null && !sp.IsChildAgent) 122 if (sp != null)
123 sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); 123 sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels);
124 } 124 }
125 125
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
128 { 128 {
129 ScenePresence sp = m_scene.GetScenePresence(avatarID); 129 ScenePresence sp = m_scene.GetScenePresence(avatarID);
130 130
131 if (sp != null && !sp.IsChildAgent) 131 if (sp != null)
132 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); 132 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url);
133 } 133 }
134 134
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
149 149
150 ScenePresence sp = m_scene.GetScenePresence(avatarid); 150 ScenePresence sp = m_scene.GetScenePresence(avatarid);
151 151
152 if (sp != null && !sp.IsChildAgent) 152 if (sp != null)
153 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); 153 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid);
154 } 154 }
155 155
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 50171a3..4b30b0d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
47 m_scene = scene; 47 m_scene = scene;
48 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); 48 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
49 m_scene.RegisterModuleInterface<IGodsModule>(this); 49 m_scene.RegisterModuleInterface<IGodsModule>(this);
50 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
50 } 51 }
51 52
52 public void PostInitialise() {} 53 public void PostInitialise() {}
@@ -54,6 +55,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
54 public string Name { get { return "Gods Module"; } } 55 public string Name { get { return "Gods Module"; } }
55 public bool IsSharedModule { get { return false; } } 56 public bool IsSharedModule { get { return false; } }
56 57
58 public void SubscribeToClientEvents(IClientAPI client)
59 {
60 client.OnGodKickUser += KickUser;
61 client.OnRequestGodlikePowers += RequestGodlikePowers;
62 }
63
64 public void UnsubscribeFromClientEvents(IClientAPI client)
65 {
66 client.OnGodKickUser -= KickUser;
67 client.OnRequestGodlikePowers -= RequestGodlikePowers;
68 }
69
57 public void RequestGodlikePowers( 70 public void RequestGodlikePowers(
58 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) 71 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
59 { 72 {
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index ab141eb..a3c40e0 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -162,7 +162,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
162 delegate(bool success) 162 delegate(bool success)
163 { 163 {
164 if (dialog == (uint)InstantMessageDialog.StartTyping || 164 if (dialog == (uint)InstantMessageDialog.StartTyping ||
165 dialog == (uint)InstantMessageDialog.StopTyping) 165 dialog == (uint)InstantMessageDialog.StopTyping ||
166 dialog == (uint)InstantMessageDialog.MessageFromObject)
166 { 167 {
167 return; 168 return;
168 } 169 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 83209fc..d025f0c 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -185,13 +185,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
185 { 185 {
186 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; 186 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
187 187
188 // If this event has handlers, then the IM will be considered 188 // If this event has handlers, then an IM from an agent will be
189 // delivered. This will suppress the error message. 189 // considered delivered. This will suppress the error message.
190 // 190 //
191 if (handlerUndeliveredMessage != null) 191 if (handlerUndeliveredMessage != null)
192 { 192 {
193 handlerUndeliveredMessage(im); 193 handlerUndeliveredMessage(im);
194 result(true); 194 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
195 result(true);
196 else
197 result(false);
195 return; 198 return;
196 } 199 }
197 200
@@ -504,14 +507,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
504 // 507 //
505 if (upd.RegionID == prevRegionID) 508 if (upd.RegionID == prevRegionID)
506 { 509 {
507 m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); 510 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
508 HandleUndeliveredMessage(im, result); 511 HandleUndeliveredMessage(im, result);
509 return; 512 return;
510 } 513 }
511 } 514 }
512 else 515 else
513 { 516 {
514 m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); 517 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
515 HandleUndeliveredMessage(im, result); 518 HandleUndeliveredMessage(im, result);
516 return; 519 return;
517 } 520 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index f130b3e..7683288 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -100,37 +100,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
100 /// </returns> 100 /// </returns>
101 public HashSet<InventoryNodeBase> Execute() 101 public HashSet<InventoryNodeBase> Execute()
102 { 102 {
103 string filePath = "ERROR";
104 int successfulAssetRestores = 0;
105 int failedAssetRestores = 0;
106 int successfulItemRestores = 0;
107
108 HashSet<InventoryNodeBase> loadedNodes = new HashSet<InventoryNodeBase>();
109
110 List<InventoryFolderBase> folderCandidates
111 = InventoryArchiveUtils.FindFolderByPath(
112 m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
113
114 if (folderCandidates.Count == 0)
115 {
116 // Possibly provide an option later on to automatically create this folder if it does not exist
117 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
118
119 return loadedNodes;
120 }
121
122 InventoryFolderBase rootDestinationFolder = folderCandidates[0];
123 archive = new TarArchiveReader(m_loadStream);
124
125 // In order to load identically named folders, we need to keep track of the folders that we have already
126 // resolved
127 Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
128
129 byte[] data;
130 TarArchiveReader.TarEntryType entryType;
131
132 try 103 try
133 { 104 {
105 string filePath = "ERROR";
106 int successfulAssetRestores = 0;
107 int failedAssetRestores = 0;
108 int successfulItemRestores = 0;
109
110 HashSet<InventoryNodeBase> loadedNodes = new HashSet<InventoryNodeBase>();
111
112 List<InventoryFolderBase> folderCandidates
113 = InventoryArchiveUtils.FindFolderByPath(
114 m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
115
116 if (folderCandidates.Count == 0)
117 {
118 // Possibly provide an option later on to automatically create this folder if it does not exist
119 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
120
121 return loadedNodes;
122 }
123
124 InventoryFolderBase rootDestinationFolder = folderCandidates[0];
125 archive = new TarArchiveReader(m_loadStream);
126
127 // In order to load identically named folders, we need to keep track of the folders that we have already
128 // resolved
129 Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
130
131 byte[] data;
132 TarArchiveReader.TarEntryType entryType;
133
134 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 134 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
135 { 135 {
136 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 136 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
@@ -173,18 +173,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
173 } 173 }
174 } 174 }
175 } 175 }
176
177 archive.Close();
178
179 m_log.DebugFormat(
180 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
181 successfulAssetRestores, failedAssetRestores);
182 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
183
184 return loadedNodes;
176 } 185 }
177 finally 186 finally
178 { 187 {
179 archive.Close(); 188 m_loadStream.Close();
180 } 189 }
181
182 m_log.DebugFormat(
183 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
184 successfulAssetRestores, failedAssetRestores);
185 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
186
187 return loadedNodes;
188 } 190 }
189 191
190 public void Close() 192 public void Close()
@@ -220,9 +222,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
220 InventoryFolderBase destFolder 222 InventoryFolderBase destFolder
221 = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders); 223 = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
222 224
223 m_log.DebugFormat( 225// m_log.DebugFormat(
224 "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]", 226// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
225 iarPath, iarPathExisting); 227// iarPath, iarPathExisting);
226 228
227 string iarPathToCreate = iarPath.Substring(iarPathExisting.Length); 229 string iarPathToCreate = iarPath.Substring(iarPathExisting.Length);
228 CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes); 230 CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes);
@@ -255,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
255 ref string archivePath, 257 ref string archivePath,
256 Dictionary <string, InventoryFolderBase> resolvedFolders) 258 Dictionary <string, InventoryFolderBase> resolvedFolders)
257 { 259 {
258 string originalArchivePath = archivePath; 260// string originalArchivePath = archivePath;
259 261
260 while (archivePath.Length > 0) 262 while (archivePath.Length > 0)
261 { 263 {
@@ -263,8 +265,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
263 265
264 if (resolvedFolders.ContainsKey(archivePath)) 266 if (resolvedFolders.ContainsKey(archivePath))
265 { 267 {
266 m_log.DebugFormat( 268// m_log.DebugFormat(
267 "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath); 269// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
268 return resolvedFolders[archivePath]; 270 return resolvedFolders[archivePath];
269 } 271 }
270 else 272 else
@@ -296,9 +298,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
296 } 298 }
297 else 299 else
298 { 300 {
299 m_log.DebugFormat( 301// m_log.DebugFormat(
300 "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}", 302// "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
301 originalArchivePath); 303// originalArchivePath);
302 archivePath = string.Empty; 304 archivePath = string.Empty;
303 return rootDestFolder; 305 return rootDestFolder;
304 } 306 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index ca33968..84afb40 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -206,11 +206,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
206 206
207 if (components.Length == 1) 207 if (components.Length == 1)
208 { 208 {
209// m_log.DebugFormat("FOUND SINGLE COMPONENT [{0}]", components[0]); 209// m_log.DebugFormat(
210// "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}",
211// components[0], startFolder.Name, startFolder.ID);
210 212
211 List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID); 213 List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
214
215// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count);
216
212 foreach (InventoryItemBase item in items) 217 foreach (InventoryItemBase item in items)
213 { 218 {
219// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID);
220
214 if (item.Name == components[0]) 221 if (item.Name == components[0])
215 return item; 222 return item;
216 } 223 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 2c2724e..25a78ff 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -119,22 +119,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) 119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
120 { 120 {
121 Exception reportedException = null; 121 Exception reportedException = null;
122 bool succeeded = true; 122 bool succeeded = true;
123 123
124 try 124 try
125 { 125 {
126 // We're almost done. Just need to write out the control file now 126 // We're almost done. Just need to write out the control file now
127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); 127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); 128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
129
130 m_archiveWriter.Close(); 129 m_archiveWriter.Close();
131 } 130 }
132 catch (Exception e) 131 catch (Exception e)
133 { 132 {
134 m_saveStream.Close();
135 reportedException = e; 133 reportedException = e;
136 succeeded = false; 134 succeeded = false;
137 } 135 }
136 finally
137 {
138 m_saveStream.Close();
139 }
138 140
139 m_module.TriggerInventoryArchiveSaved( 141 m_module.TriggerInventoryArchiveSaved(
140 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 142 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@@ -213,70 +215,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
213 /// </summary> 215 /// </summary>
214 public void Execute() 216 public void Execute()
215 { 217 {
216 InventoryFolderBase inventoryFolder = null; 218 try
217 InventoryItemBase inventoryItem = null;
218 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
219
220 bool foundStar = false;
221
222 // Eliminate double slashes and any leading / on the path.
223 string[] components
224 = m_invPath.Split(
225 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
226
227 int maxComponentIndex = components.Length - 1;
228
229 // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
230 // folder itself. This may get more sophisicated later on
231 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
232 {
233 foundStar = true;
234 maxComponentIndex--;
235 }
236
237 m_invPath = String.Empty;
238 for (int i = 0; i <= maxComponentIndex; i++)
239 {
240 m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
241 }
242
243 // Annoyingly Split actually returns the original string if the input string consists only of delimiters
244 // Therefore if we still start with a / after the split, then we need the root folder
245 if (m_invPath.Length == 0)
246 {
247 inventoryFolder = rootFolder;
248 }
249 else
250 {
251 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
252 List<InventoryFolderBase> candidateFolders
253 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
254 if (candidateFolders.Count > 0)
255 inventoryFolder = candidateFolders[0];
256 }
257
258 // The path may point to an item instead
259 if (inventoryFolder == null)
260 {
261 inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
262 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
263 }
264
265 if (null == inventoryFolder && null == inventoryItem)
266 { 219 {
267 // We couldn't find the path indicated 220 InventoryFolderBase inventoryFolder = null;
268 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 221 InventoryItemBase inventoryItem = null;
269 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); 222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
270 m_module.TriggerInventoryArchiveSaved( 223
271 m_id, false, m_userInfo, m_invPath, m_saveStream, 224 bool foundStar = false;
272 new Exception(errorMessage)); 225
273 return; 226 // Eliminate double slashes and any leading / on the path.
274 } 227 string[] components
228 = m_invPath.Split(
229 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
230
231 int maxComponentIndex = components.Length - 1;
232
233 // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
234 // folder itself. This may get more sophisicated later on
235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
236 {
237 foundStar = true;
238 maxComponentIndex--;
239 }
240
241 m_invPath = String.Empty;
242 for (int i = 0; i <= maxComponentIndex; i++)
243 {
244 m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
245 }
246
247 // Annoyingly Split actually returns the original string if the input string consists only of delimiters
248 // Therefore if we still start with a / after the split, then we need the root folder
249 if (m_invPath.Length == 0)
250 {
251 inventoryFolder = rootFolder;
252 }
253 else
254 {
255 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
256 List<InventoryFolderBase> candidateFolders
257 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
258 if (candidateFolders.Count > 0)
259 inventoryFolder = candidateFolders[0];
260 }
261
262 // The path may point to an item instead
263 if (inventoryFolder == null)
264 {
265 inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
266 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
267 }
268
269 if (null == inventoryFolder && null == inventoryItem)
270 {
271 // We couldn't find the path indicated
272 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
273 Exception e = new InventoryArchiverException(errorMessage);
274 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
275 throw e;
276 }
275 277
276 m_archiveWriter = new TarArchiveWriter(m_saveStream); 278 m_archiveWriter = new TarArchiveWriter(m_saveStream);
277 279
278 try
279 {
280 if (inventoryFolder != null) 280 if (inventoryFolder != null)
281 { 281 {
282 m_log.DebugFormat( 282 m_log.DebugFormat(
@@ -297,16 +297,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
297 297
298 // Don't put all this profile information into the archive right now. 298 // Don't put all this profile information into the archive right now.
299 //SaveUsers(); 299 //SaveUsers();
300
301 new AssetsRequest(
302 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
300 } 303 }
301 catch (Exception) 304 catch (Exception)
302 { 305 {
303 m_archiveWriter.Close(); 306 m_saveStream.Close();
304 throw; 307 throw;
305 } 308 }
306
307 new AssetsRequest(
308 new AssetsArchiver(m_archiveWriter), m_assetUuids,
309 m_scene.AssetService, ReceivedAllAssets).Execute();
310 } 309 }
311 310
312 /// <summary> 311 /// <summary>
diff --git a/OpenSim/Framework/ConfigBase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
index 40ec32f..e07e2ca 100644
--- a/OpenSim/Framework/ConfigBase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
@@ -26,13 +26,15 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
30using System.Text;
31 29
32namespace OpenSim.Framework 30namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
33{ 31{
34 public abstract class ConfigBase 32 /// <summary>
35 { 33 /// Signals an inventory archiving problem
36 protected ConfigurationMember m_configMember; 34 /// </summary>
35 public class InventoryArchiverException : Exception
36 {
37 public InventoryArchiverException(string message) : base(message) {}
38 public InventoryArchiverException(string message, Exception e) : base(message, e) {}
37 } 39 }
38} 40} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 668c344..f03f2a1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -324,34 +324,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
324 /// <param name="cmdparams"></param> 324 /// <param name="cmdparams"></param>
325 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) 325 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
326 { 326 {
327 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 327 try
328 328 {
329 Dictionary<string, object> options = new Dictionary<string, object>(); 329 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
330 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 330
331 331 Dictionary<string, object> options = new Dictionary<string, object>();
332 List<string> mainParams = optionSet.Parse(cmdparams); 332 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
333 333
334 if (mainParams.Count < 6) 334 List<string> mainParams = optionSet.Parse(cmdparams);
335 { 335
336 m_log.Error( 336 if (mainParams.Count < 6)
337 "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]"); 337 {
338 return; 338 m_log.Error(
339 } 339 "[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
340 340 return;
341 string firstName = mainParams[2]; 341 }
342 string lastName = mainParams[3]; 342
343 string invPath = mainParams[4]; 343 string firstName = mainParams[2];
344 string pass = mainParams[5]; 344 string lastName = mainParams[3];
345 string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); 345 string invPath = mainParams[4];
346 346 string pass = mainParams[5];
347 m_log.InfoFormat( 347 string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
348 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 348
349 loadPath, invPath, firstName, lastName);
350
351 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
352 m_log.InfoFormat( 349 m_log.InfoFormat(
353 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 350 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
354 loadPath, firstName, lastName); 351 loadPath, invPath, firstName, lastName);
352
353 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
354 m_log.InfoFormat(
355 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
356 loadPath, firstName, lastName);
357 }
358 catch (InventoryArchiverException e)
359 {
360 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
361 }
355 } 362 }
356 363
357 /// <summary> 364 /// <summary>
@@ -360,30 +367,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
360 /// <param name="cmdparams"></param> 367 /// <param name="cmdparams"></param>
361 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 368 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
362 { 369 {
363 if (cmdparams.Length < 6) 370 Guid id = Guid.NewGuid();
371
372 try
364 { 373 {
365 m_log.Error( 374 if (cmdparams.Length < 6)
366 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); 375 {
367 return; 376 m_log.Error(
377 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
378 return;
379 }
380
381 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
382
383 string firstName = cmdparams[2];
384 string lastName = cmdparams[3];
385 string invPath = cmdparams[4];
386 string pass = cmdparams[5];
387 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
388
389 m_log.InfoFormat(
390 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
391 savePath, invPath, firstName, lastName);
392
393 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
368 } 394 }
369 395 catch (InventoryArchiverException e)
370 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 396 {
371 397 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
372 string firstName = cmdparams[2]; 398 }
373 string lastName = cmdparams[3]; 399
374 string invPath = cmdparams[4];
375 string pass = cmdparams[5];
376 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
377
378 m_log.InfoFormat(
379 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
380 savePath, invPath, firstName, lastName);
381
382 Guid id = Guid.NewGuid();
383 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
384
385 lock (m_pendingConsoleSaves) 400 lock (m_pendingConsoleSaves)
386 m_pendingConsoleSaves.Add(id); 401 m_pendingConsoleSaves.Add(id);
387 } 402 }
388 403
389 private void SaveInvConsoleCommandCompleted( 404 private void SaveInvConsoleCommandCompleted(
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 5fad0a9..2d80382 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -63,13 +63,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
63 } 63 }
64 64
65 /// <summary> 65 /// <summary>
66 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). 66 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
67 /// (subject to change since there is no fixed format yet).
67 /// </summary> 68 /// </summary>
68 // Commenting for now! The mock inventory service needs more beef, at least for
69 // GetFolderForType
70 // REFACTORING PROBLEM. This needs to be rewritten.
71 [Test] 69 [Test]
72 public void TestSaveIarV0_1() 70 public void TestSavePathToIarV0_1()
73 { 71 {
74 TestHelper.InMethod(); 72 TestHelper.InMethod();
75// log4net.Config.XmlConfigurator.Configure(); 73// log4net.Config.XmlConfigurator.Configure();
@@ -182,6 +180,123 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
182 } 180 }
183 181
184 /// <summary> 182 /// <summary>
183 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
184 /// (subject to change since there is no fixed format yet).
185 /// </summary>
186 [Test]
187 public void TestSaveItemToIarV0_1()
188 {
189 TestHelper.InMethod();
190// log4net.Config.XmlConfigurator.Configure();
191
192 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
193
194 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
195 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
196
197 // Create user
198 string userFirstName = "Jock";
199 string userLastName = "Stirrup";
200 string userPassword = "troll";
201 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
202 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
203
204 // Create asset
205 SceneObjectGroup object1;
206 SceneObjectPart part1;
207 {
208 string partName = "My Little Dog Object";
209 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
210 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
211 Vector3 groupPosition = new Vector3(10, 20, 30);
212 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
213 Vector3 offsetPosition = new Vector3(5, 10, 15);
214
215 part1
216 = new SceneObjectPart(
217 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
218 part1.Name = partName;
219
220 object1 = new SceneObjectGroup(part1);
221 scene.AddNewSceneObject(object1, false);
222 }
223
224 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
225 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
226 scene.AssetService.Store(asset1);
227
228 // Create item
229 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
230 string item1Name = "My Little Dog";
231 InventoryItemBase item1 = new InventoryItemBase();
232 item1.Name = item1Name;
233 item1.AssetID = asset1.FullID;
234 item1.ID = item1Id;
235 InventoryFolderBase objsFolder
236 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
237 item1.Folder = objsFolder.ID;
238 scene.AddInventoryItem(userId, item1);
239
240 MemoryStream archiveWriteStream = new MemoryStream();
241 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
242
243 mre.Reset();
244 archiverModule.ArchiveInventory(
245 Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
246 mre.WaitOne(60000, false);
247
248 byte[] archive = archiveWriteStream.ToArray();
249 MemoryStream archiveReadStream = new MemoryStream(archive);
250 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
251
252 //bool gotControlFile = false;
253 bool gotObject1File = false;
254 //bool gotObject2File = false;
255 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
256 string expectedObject1FilePath = string.Format(
257 "{0}{1}",
258 ArchiveConstants.INVENTORY_PATH,
259 expectedObject1FileName);
260
261 string filePath;
262 TarArchiveReader.TarEntryType tarEntryType;
263
264// Console.WriteLine("Reading archive");
265
266 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
267 {
268 Console.WriteLine("Got {0}", filePath);
269
270// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
271// {
272// gotControlFile = true;
273// }
274
275 if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
276 {
277// string fileName = filePath.Remove(0, "Objects/".Length);
278//
279// if (fileName.StartsWith(part1.Name))
280// {
281 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
282 gotObject1File = true;
283// }
284// else if (fileName.StartsWith(part2.Name))
285// {
286// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
287// gotObject2File = true;
288// }
289 }
290 }
291
292// Assert.That(gotControlFile, Is.True, "No control file in archive");
293 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
294// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
295
296 // TODO: Test presence of more files and contents of files.
297 }
298
299 /// <summary>
185 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 300 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
186 /// an account exists with the creator name. 301 /// an account exists with the creator name.
187 /// </summary> 302 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index c1e92f5..b13b9d8 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); 158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); 159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
160 if (ids.ContainsKey(assetID))
161 ids.Remove(assetID);
160 foreach (UUID uuid in ids.Keys) 162 foreach (UUID uuid in ids.Keys)
161 FetchAsset(userAssetURL, uuid); 163 FetchAsset(userAssetURL, uuid);
162 164
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index b0555da..8ccc941 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
131 return ret; 131 return ret;
132 } 132 }
133 133
134 // DO NOT OVERRIDE THIS METHOD 134 // DO NOT OVERRIDE THE BASE METHOD
135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
136 SceneObjectGroup objectGroup, IClientAPI remoteClient) 136 SceneObjectGroup objectGroup, IClientAPI remoteClient)
137 { 137 {
@@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
139 139
140 if (!assetID.Equals(UUID.Zero)) 140 if (!assetID.Equals(UUID.Zero))
141 { 141 {
142 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); 142 if (remoteClient != null)
143 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
143 } 144 }
144 else 145 else
145 m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); 146 m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
@@ -192,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
192 m_assMapper.Post(item.AssetID, receiver, userAssetServer); 193 m_assMapper.Post(item.AssetID, receiver, userAssetServer);
193 } 194 }
194 195
195 #endregion 196 public override bool IsForeignUser(UUID userID, out string assetServerURL)
196
197 public bool IsForeignUser(UUID userID, out string assetServerURL)
198 { 197 {
199 assetServerURL = string.Empty; 198 assetServerURL = string.Empty;
200 UserAccount account = null; 199 UserAccount account = null;
@@ -217,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
217 216
218 return false; 217 return false;
219 } 218 }
219
220 #endregion
221
222 protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
223 {
224 InventoryItemBase item = base.GetItem(agentID, itemID);
225
226 string userAssetServer = string.Empty;
227 if (IsForeignUser(agentID, out userAssetServer))
228 m_assMapper.Get(item.AssetID, agentID, userAssetServer);
229
230 return item;
231 }
220 } 232 }
221} 233}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 12b6aa0..1a7da61 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -322,6 +322,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
322 } 322 }
323 } 323 }
324 324
325 // Override and put into where it came from, if it came
326 // from anywhere in inventory
327 //
328 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
329 {
330 if (objectGroup.RootPart.FromFolderID != UUID.Zero)
331 {
332 InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID);
333 folder = m_Scene.InventoryService.GetFolder(f);
334 }
335 }
336
325 if (folder == null) // None of the above 337 if (folder == null) // None of the above
326 { 338 {
327 folder = new InventoryFolderBase(folderID); 339 folder = new InventoryFolderBase(folderID);
@@ -369,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
369 if ((nextPerms & (uint)PermissionMask.Modify) == 0) 381 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
370 perms &= ~(uint)PermissionMask.Modify; 382 perms &= ~(uint)PermissionMask.Modify;
371 383
384 // Make sure all bits but the ones we want are clear
385 // on take.
386 // This will be applied to the current perms, so
387 // it will do what we want.
388 objectGroup.RootPart.NextOwnerMask &=
389 ((uint)PermissionMask.Copy |
390 (uint)PermissionMask.Transfer |
391 (uint)PermissionMask.Modify);
392 objectGroup.RootPart.NextOwnerMask |=
393 (uint)PermissionMask.Move;
394
372 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; 395 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
373 item.CurrentPermissions = item.BasePermissions; 396 item.CurrentPermissions = item.BasePermissions;
374 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 397 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
375 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; 398 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
376 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; 399 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
377 item.CurrentPermissions |= 8; // Slam! 400
401 // Magic number badness. Maybe this deserves an enum.
402 // bit 4 (16) is the "Slam" bit, it means treat as passed
403 // and apply next owner perms on rez
404 item.CurrentPermissions |= 16; // Slam!
378 } 405 }
379 else 406 else
380 { 407 {
@@ -384,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
384 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 411 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
385 item.GroupPermissions = objectGroup.RootPart.GroupMask; 412 item.GroupPermissions = objectGroup.RootPart.GroupMask;
386 413
387 item.CurrentPermissions |= 8; // Slam! 414 item.CurrentPermissions &=
415 ((uint)PermissionMask.Copy |
416 (uint)PermissionMask.Transfer |
417 (uint)PermissionMask.Modify |
418 (uint)PermissionMask.Move |
419 7); // Preserve folded permissions
388 } 420 }
389 421
390 // TODO: add the new fields (Flags, Sale info, etc) 422 // TODO: add the new fields (Flags, Sale info, etc)
@@ -485,6 +517,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
485 SceneObjectGroup group 517 SceneObjectGroup group
486 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); 518 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
487 519
520 group.RootPart.FromFolderID = item.Folder;
521
522 // If it's rezzed in world, select it. Much easier to
523 // find small items.
524 //
525 if (!attachment)
526 group.RootPart.CreateSelected = true;
527
488 if (!m_Scene.Permissions.CanRezObject( 528 if (!m_Scene.Permissions.CanRezObject(
489 group.Children.Count, remoteClient.AgentId, pos) 529 group.Children.Count, remoteClient.AgentId, pos)
490 && !attachment) 530 && !attachment)
@@ -557,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
557 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 597 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
558 598
559 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 599 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
560 if (rootPart.OwnerID != item.Owner) 600 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
561 { 601 {
562 //Need to kill the for sale here 602 //Need to kill the for sale here
563 rootPart.ObjectSaleType = 0; 603 rootPart.ObjectSaleType = 0;
@@ -565,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
565 605
566 if (m_Scene.Permissions.PropagatePermissions()) 606 if (m_Scene.Permissions.PropagatePermissions())
567 { 607 {
568 if ((item.CurrentPermissions & 8) != 0) 608 foreach (SceneObjectPart part in partList)
569 { 609 {
570 foreach (SceneObjectPart part in partList) 610 part.EveryoneMask = item.EveryOnePermissions;
571 { 611 part.NextOwnerMask = item.NextPermissions;
572 part.EveryoneMask = item.EveryOnePermissions; 612 part.GroupMask = 0; // DO NOT propagate here
573 part.NextOwnerMask = item.NextPermissions;
574 part.GroupMask = 0; // DO NOT propagate here
575 }
576 } 613 }
577 614
578 group.ApplyNextOwnerPermissions(); 615 group.ApplyNextOwnerPermissions();
@@ -581,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
581 618
582 foreach (SceneObjectPart part in partList) 619 foreach (SceneObjectPart part in partList)
583 { 620 {
584 if (part.OwnerID != item.Owner) 621 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
585 { 622 {
586 part.LastOwnerID = part.OwnerID; 623 part.LastOwnerID = part.OwnerID;
587 part.OwnerID = item.Owner; 624 part.OwnerID = item.Owner;
588 part.Inventory.ChangeInventoryOwner(item.Owner); 625 part.Inventory.ChangeInventoryOwner(item.Owner);
589 }
590 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
591 {
592 part.EveryoneMask = item.EveryOnePermissions;
593 part.NextOwnerMask = item.NextPermissions;
594
595 part.GroupMask = 0; // DO NOT propagate here 626 part.GroupMask = 0; // DO NOT propagate here
596 } 627 }
628 part.EveryoneMask = item.EveryOnePermissions;
629 part.NextOwnerMask = item.NextPermissions;
597 } 630 }
598 631
599 rootPart.TrimPermissions(); 632 rootPart.TrimPermissions();
@@ -639,6 +672,57 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
639 { 672 {
640 } 673 }
641 674
675 public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
676 {
677 InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
678 if (assetRequestItem == null)
679 {
680 ILibraryService lib = m_Scene.RequestModuleInterface<ILibraryService>();
681 if (lib != null)
682 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
683 if (assetRequestItem == null)
684 return false;
685 }
686
687 // At this point, we need to apply perms
688 // only to notecards and scripts. All
689 // other asset types are always available
690 //
691 if (assetRequestItem.AssetType == (int)AssetType.LSLText)
692 {
693 if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId))
694 {
695 remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false);
696 return false;
697 }
698 }
699 else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
700 {
701 if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId))
702 {
703 remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false);
704 return false;
705 }
706 }
707
708 if (assetRequestItem.AssetID != requestID)
709 {
710 m_log.WarnFormat(
711 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
712 Name, requestID, itemID, assetRequestItem.AssetID);
713 return false;
714 }
715
716 return true;
717 }
718
719
720 public virtual bool IsForeignUser(UUID userID, out string assetServerURL)
721 {
722 assetServerURL = string.Empty;
723 return false;
724 }
725
642 #endregion 726 #endregion
643 727
644 #region Misc 728 #region Misc
@@ -661,6 +745,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
661 return asset; 745 return asset;
662 } 746 }
663 747
748 protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
749 {
750 IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
751 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
752 assetRequestItem = invService.GetItem(assetRequestItem);
753 return assetRequestItem;
754 }
755
664 #endregion 756 #endregion
665 } 757 }
666} 758}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index ebd6bbd..034e692 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
42{ 42{
43 public class HGAssetBroker : 43 public class HGAssetBroker :
44 ISharedRegionModule, IAssetService, IHyperAssetService 44 ISharedRegionModule, IAssetService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
150 m_aScene = scene; 150 m_aScene = scene;
151 151
152 scene.RegisterModuleInterface<IAssetService>(this); 152 scene.RegisterModuleInterface<IAssetService>(this);
153 scene.RegisterModuleInterface<IHyperAssetService>(this);
154 } 153 }
155 154
156 public void RemoveRegion(Scene scene) 155 public void RemoveRegion(Scene scene)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index e09db15..97161fc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
202 } 202 }
203 } 203 }
204 } 204 }
205
206 // else put a null; it means that the methods should forward to local grid's inventory
207 m_InventoryURLs.Add(userID, null);
208 } 205 }
209 206
210 private void DropInventoryServiceURL(UUID userID) 207 private void DropInventoryServiceURL(UUID userID)
@@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
223 if (m_InventoryURLs.ContainsKey(userID)) 220 if (m_InventoryURLs.ContainsKey(userID))
224 return m_InventoryURLs[userID]; 221 return m_InventoryURLs[userID];
225 222
226 else 223 CacheInventoryServiceURL(userID);
227 CacheInventoryServiceURL(userID);
228 224
229 return m_InventoryURLs[userID]; 225 if (m_InventoryURLs.ContainsKey(userID))
226 return m_InventoryURLs[userID];
227
228 return null; //it means that the methods should forward to local grid's inventory
229
230 } 230 }
231 #endregion 231 #endregion
232 232
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
253 253
254 public InventoryFolderBase GetRootFolder(UUID userID) 254 public InventoryFolderBase GetRootFolder(UUID userID)
255 { 255 {
256 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); 256 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
257 257
258 string invURL = GetInventoryServiceURL(userID); 258 string invURL = GetInventoryServiceURL(userID);
259 259
@@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
267 267
268 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 268 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
269 { 269 {
270 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); 270 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
271 271
272 string invURL = GetInventoryServiceURL(userID); 272 string invURL = GetInventoryServiceURL(userID);
273 273
@@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
281 281
282 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 282 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
283 { 283 {
284 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID); 284 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
285 285
286 string invURL = GetInventoryServiceURL(userID); 286 string invURL = GetInventoryServiceURL(userID);
287 287
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
296 296
297 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 297 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
298 { 298 {
299 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID); 299 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
300 300
301 string invURL = GetInventoryServiceURL(userID); 301 string invURL = GetInventoryServiceURL(userID);
302 302
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
314 if (folder == null) 314 if (folder == null)
315 return false; 315 return false;
316 316
317 m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID); 317 //m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
318 318
319 string invURL = GetInventoryServiceURL(folder.Owner); 319 string invURL = GetInventoryServiceURL(folder.Owner);
320 320
@@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
331 if (folder == null) 331 if (folder == null)
332 return false; 332 return false;
333 333
334 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID); 334 //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
335 335
336 string invURL = GetInventoryServiceURL(folder.Owner); 336 string invURL = GetInventoryServiceURL(folder.Owner);
337 337
@@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
350 if (folderIDs.Count == 0) 350 if (folderIDs.Count == 0)
351 return false; 351 return false;
352 352
353 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID); 353 //m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
354 354
355 string invURL = GetInventoryServiceURL(ownerID); 355 string invURL = GetInventoryServiceURL(ownerID);
356 356
@@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
367 if (folder == null) 367 if (folder == null)
368 return false; 368 return false;
369 369
370 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner); 370 //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
371 371
372 string invURL = GetInventoryServiceURL(folder.Owner); 372 string invURL = GetInventoryServiceURL(folder.Owner);
373 373
@@ -384,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
384 if (folder == null) 384 if (folder == null)
385 return false; 385 return false;
386 386
387 m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner); 387 //m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
388 388
389 string invURL = GetInventoryServiceURL(folder.Owner); 389 string invURL = GetInventoryServiceURL(folder.Owner);
390 390
@@ -401,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
401 if (item == null) 401 if (item == null)
402 return false; 402 return false;
403 403
404 m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID); 404 //m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
405 405
406 string invURL = GetInventoryServiceURL(item.Owner); 406 string invURL = GetInventoryServiceURL(item.Owner);
407 407
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
418 if (item == null) 418 if (item == null)
419 return false; 419 return false;
420 420
421 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID); 421 //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
422 422
423 string invURL = GetInventoryServiceURL(item.Owner); 423 string invURL = GetInventoryServiceURL(item.Owner);
424 424
@@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
437 if (items.Count == 0) 437 if (items.Count == 0)
438 return true; 438 return true;
439 439
440 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID); 440 //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
441 441
442 string invURL = GetInventoryServiceURL(ownerID); 442 string invURL = GetInventoryServiceURL(ownerID);
443 443
@@ -451,15 +451,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
451 451
452 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) 452 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
453 { 453 {
454 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); 454 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
455 455
456 if (itemIDs == null) 456 if (itemIDs == null)
457 return false; 457 return false;
458 if (itemIDs.Count == 0) 458 if (itemIDs.Count == 0)
459 return true; 459 return true;
460 460
461 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
462
463 string invURL = GetInventoryServiceURL(ownerID); 461 string invURL = GetInventoryServiceURL(ownerID);
464 462
465 if (invURL == null) // not there, forward to local inventory connector to resolve 463 if (invURL == null) // not there, forward to local inventory connector to resolve
@@ -474,7 +472,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
474 { 472 {
475 if (item == null) 473 if (item == null)
476 return null; 474 return null;
477 m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); 475 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
478 476
479 string invURL = GetInventoryServiceURL(item.Owner); 477 string invURL = GetInventoryServiceURL(item.Owner);
480 478
@@ -491,7 +489,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
491 if (folder == null) 489 if (folder == null)
492 return null; 490 return null;
493 491
494 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); 492 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
495 493
496 string invURL = GetInventoryServiceURL(folder.Owner); 494 string invURL = GetInventoryServiceURL(folder.Owner);
497 495
@@ -515,7 +513,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
515 513
516 public int GetAssetPermissions(UUID userID, UUID assetID) 514 public int GetAssetPermissions(UUID userID, UUID assetID)
517 { 515 {
518 m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID); 516 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
519 517
520 string invURL = GetInventoryServiceURL(userID); 518 string invURL = GetInventoryServiceURL(userID);
521 519
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 3945142..6864629 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
146 else 146 else
147 { 147 {
148 // Normal Calculations 148 // Normal Calculations
149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.objectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
150 } 150 }
151 } 151 }
152 public int GetSimulatorMaxPrimCount(ILandObject thisObject) 152 public int GetSimulatorMaxPrimCount(ILandObject thisObject)
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Land
158 else 158 else
159 { 159 {
160 //Normal Calculations 160 //Normal Calculations
161 return m_scene.objectCapacity; 161 return m_scene.RegionInfo.ObjectCapacity;
162 } 162 }
163 } 163 }
164 #endregion 164 #endregion
@@ -283,6 +283,9 @@ namespace OpenSim.Region.CoreModules.World.Land
283 283
284 public bool IsBannedFromLand(UUID avatar) 284 public bool IsBannedFromLand(UUID avatar)
285 { 285 {
286 if (m_scene.Permissions.IsAdministrator(avatar))
287 return false;
288
286 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 289 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
287 { 290 {
288 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 291 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
@@ -301,6 +304,9 @@ namespace OpenSim.Region.CoreModules.World.Land
301 304
302 public bool IsRestrictedFromLand(UUID avatar) 305 public bool IsRestrictedFromLand(UUID avatar)
303 { 306 {
307 if (m_scene.Permissions.IsAdministrator(avatar))
308 return false;
309
304 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 310 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
305 { 311 {
306 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 312 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 69b247c..1d70546 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -209,6 +209,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
209 m_scene.Permissions.OnDeedParcel += CanDeedParcel; 209 m_scene.Permissions.OnDeedParcel += CanDeedParcel;
210 m_scene.Permissions.OnDeedObject += CanDeedObject; 210 m_scene.Permissions.OnDeedObject += CanDeedObject;
211 m_scene.Permissions.OnIsGod += IsGod; 211 m_scene.Permissions.OnIsGod += IsGod;
212 m_scene.Permissions.OnIsAdministrator += IsAdministrator;
212 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 213 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
213 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 214 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
214 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 215 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
diff --git a/OpenSim/Region/CoreModules/World/Terrain/DefaultEffects/ChannelDigger.cs b/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs
index e23be59..36917e9 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/DefaultEffects/ChannelDigger.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs
@@ -30,7 +30,7 @@ using OpenSim.Region.CoreModules.World.Terrain;
30using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes; 30using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes;
31using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
32 32
33namespace OpenSim.Region.Modules.Terrain.Extensions.DefaultEffects.Effects 33namespace OpenSim.Region.CoreModules.World.Terrain.Effects
34{ 34{
35 public class ChannelDigger : ITerrainEffect 35 public class ChannelDigger : ITerrainEffect
36 { 36 {
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 1e7ea7b..2c5e444 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
68 #endregion 68 #endregion
69 69
70 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 70 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
71 71
72 private readonly Commander m_commander = new Commander("terrain"); 72 private readonly Commander m_commander = new Commander("terrain");
73 73
74 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects = 74 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects =
@@ -381,8 +381,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
381 private void LoadPlugins() 381 private void LoadPlugins()
382 { 382 {
383 m_plugineffects = new Dictionary<string, ITerrainEffect>(); 383 m_plugineffects = new Dictionary<string, ITerrainEffect>();
384 string plugineffectsPath = "Terrain";
385
384 // Load the files in the Terrain/ dir 386 // Load the files in the Terrain/ dir
385 string[] files = Directory.GetFiles("Terrain"); 387 if (!Directory.Exists(plugineffectsPath))
388 return;
389
390 string[] files = Directory.GetFiles(plugineffectsPath);
386 foreach (string file in files) 391 foreach (string file in files)
387 { 392 {
388 m_log.Info("Loading effects in " + file); 393 m_log.Info("Loading effects in " + file);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 0e849e5..9d9967a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -805,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
805 imgstream = new MemoryStream(); 805 imgstream = new MemoryStream();
806 806
807 // non-async because we know we have the asset immediately. 807 // non-async because we know we have the asset immediately.
808 AssetBase mapasset = m_scene.AssetService.Get(m_scene.RegionInfo.lastMapUUID.ToString()); 808 AssetBase mapasset = m_scene.AssetService.Get(m_scene.RegionInfo.RegionSettings.TerrainImageID.ToString());
809 809
810 // Decode image to System.Drawing.Image 810 // Decode image to System.Drawing.Image
811 if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image)) 811 if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image))
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index 6e69902..00f6918 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
73 client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, 73 client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos,
74 IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; }; 74 IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; };
75 client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, 75 client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt,
76 Quaternion rot, bool silent) { this.Stale = true; }; 76 bool silent) { this.Stale = true; };
77 client.OnObjectDuplicate += delegate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID, 77 client.OnObjectDuplicate += delegate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID,
78 UUID GroupID) { this.Stale = true; }; 78 UUID GroupID) { this.Stale = true; };
79 client.OnObjectDuplicateOnRay += delegate(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, 79 client.OnObjectDuplicateOnRay += delegate(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
index 976c2c1..70cb205 100644
--- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs
+++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
@@ -258,21 +258,16 @@ namespace OpenSim.Region.DataSnapshot
258 258
259 private String GetRegionCategory(Scene scene) 259 private String GetRegionCategory(Scene scene)
260 { 260 {
261 //Boolean choice between: 261 if (scene.RegionInfo.RegionSettings.Maturity == 0)
262 // "PG" - Mormontown 262 return "PG";
263 // "Mature" - Sodom and Gomorrah 263
264 if (scene.RegionInfo.RegionSettings.Maturity == 1) 264 if (scene.RegionInfo.RegionSettings.Maturity == 1)
265 {
266 return "Mature"; 265 return "Mature";
267 } 266
268 else if (scene.RegionInfo.RegionSettings.Maturity == 0) 267 if (scene.RegionInfo.RegionSettings.Maturity == 2)
269 { 268 return "Adult";
270 return "PG"; 269
271 } 270 return "Unknown";
272 else
273 {
274 return "Unknown";
275 }
276 } 271 }
277 272
278 private XmlNode GetGridSnapshotData(XmlDocument factory) 273 private XmlNode GetGridSnapshotData(XmlDocument factory)
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index af9df45..f6e6163 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -536,10 +536,6 @@ namespace OpenSim.Region.Examples.SimpleModule
536 { 536 {
537 } 537 }
538 538
539 public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
540 {
541 }
542
543 public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) 539 public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
544 { 540 {
545 } 541 }
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index f8af367..2af2548 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Interfaces
44 /// <param name="rot"></param> 44 /// <param name="rot"></param>
45 /// <param name="silent"></param> 45 /// <param name="silent"></param>
46 void AttachObject( 46 void AttachObject(
47 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent); 47 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
48 48
49 /// <summary> 49 /// <summary>
50 /// Attach an object to an avatar. 50 /// Attach an object to an avatar.
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces
57 /// <param name="silent"></param> 57 /// <param name="silent"></param>
58 /// <returns>true if the object was successfully attached, false otherwise</returns> 58 /// <returns>true if the object was successfully attached, false otherwise</returns>
59 bool AttachObject( 59 bool AttachObject(
60 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent); 60 IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent);
61 61
62 /// <summary> 62 /// <summary>
63 /// Rez an attachment from user inventory and change inventory status to match. 63 /// Rez an attachment from user inventory and change inventory status to match.
diff --git a/OpenSim/Region/Framework/Interfaces/IHyperService.cs b/OpenSim/Region/Framework/Interfaces/IHyperService.cs
deleted file mode 100644
index 51ea28a..0000000
--- a/OpenSim/Region/Framework/Interfaces/IHyperService.cs
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using OpenMetaverse;
29
30namespace OpenSim.Region.Framework.Interfaces
31{
32 public interface IHyperAssetService
33 {
34 string GetUserAssetServer(UUID userID);
35 string GetSimAssetServer();
36 }
37}
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
index 97f4188..05fc2ad 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
@@ -43,5 +43,9 @@ namespace OpenSim.Region.Framework.Interfaces
43 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 43 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
44 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); 44 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment);
45 void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); 45 void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver);
46 bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID);
47
48 // Must be here because of textures in user's inventory
49 bool IsForeignUser(UUID userID, out string assetServerURL);
46 } 50 }
47} 51}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index ef125cd..9db2e41 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes
179 public event ScriptChangedEvent OnScriptChangedEvent; 179 public event ScriptChangedEvent OnScriptChangedEvent;
180 public delegate void ScriptChangedEvent(uint localID, uint change); 180 public delegate void ScriptChangedEvent(uint localID, uint change);
181 181
182 public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed); 182 public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
183 public event ScriptControlEvent OnScriptControlEvent; 183 public event ScriptControlEvent OnScriptControlEvent;
184 184
185 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); 185 public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
@@ -1595,7 +1595,7 @@ namespace OpenSim.Region.Framework.Scenes
1595 } 1595 }
1596 } 1596 }
1597 1597
1598 internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) 1598 internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed)
1599 { 1599 {
1600 ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; 1600 ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent;
1601 if (handlerScriptControlEvent != null) 1601 if (handlerScriptControlEvent != null)
@@ -1604,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes
1604 { 1604 {
1605 try 1605 try
1606 { 1606 {
1607 d(p, scriptUUID, avatarID, held, _changed); 1607 d(scriptUUID, avatarID, held, _changed);
1608 } 1608 }
1609 catch (Exception e) 1609 catch (Exception e)
1610 { 1610 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index f9da341..01edf51 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes
73 IMoneyModule money=RequestModuleInterface<IMoneyModule>(); 73 IMoneyModule money=RequestModuleInterface<IMoneyModule>();
74 if (money != null) 74 if (money != null)
75 { 75 {
76 money.ApplyUploadCharge(agentID); 76 money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
77 } 77 }
78 78
79 AddInventoryItem(agentID, item); 79 AddInventoryItem(agentID, item);
@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes
265 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, 265 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
266 UUID itemID, InventoryItemBase itemUpd) 266 UUID itemID, InventoryItemBase itemUpd)
267 { 267 {
268 // This one will let people set next perms on items in agent
269 // inventory. Rut-Roh. Whatever. Make this secure. Yeah.
270 //
271 // Passing something to another avatar or a an object will already
268 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 272 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
269 item = InventoryService.GetItem(item); 273 item = InventoryService.GetItem(item);
270 274
@@ -274,11 +278,9 @@ namespace OpenSim.Region.Framework.Scenes
274 { 278 {
275 item.Name = itemUpd.Name; 279 item.Name = itemUpd.Name;
276 item.Description = itemUpd.Description; 280 item.Description = itemUpd.Description;
277 item.NextPermissions = itemUpd.NextPermissions; 281 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
278 item.CurrentPermissions |= 8; // Slam! 282 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
279 item.EveryOnePermissions = itemUpd.EveryOnePermissions; 283 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
280 item.GroupPermissions = itemUpd.GroupPermissions;
281
282 item.GroupID = itemUpd.GroupID; 284 item.GroupID = itemUpd.GroupID;
283 item.GroupOwned = itemUpd.GroupOwned; 285 item.GroupOwned = itemUpd.GroupOwned;
284 item.CreationDate = itemUpd.CreationDate; 286 item.CreationDate = itemUpd.CreationDate;
@@ -384,28 +386,103 @@ namespace OpenSim.Region.Framework.Scenes
384 386
385 if (Permissions.PropagatePermissions() && recipient != senderId) 387 if (Permissions.PropagatePermissions() && recipient != senderId)
386 { 388 {
387 // First, make sore base is limited to the next perms 389 // Trying to do this right this time. This is evil. If
388 itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); 390 // you believe in Good, go elsewhere. Vampires and other
389 // By default, current equals base 391 // evil creatores only beyond this point. You have been
390 itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions; 392 // warned.
391 393
392 // If this is an object, replace current perms 394 // We're going to mask a lot of things by the next perms
393 // with folded perms 395 // Tweak the next perms to be nicer to our data
396 //
397 // In this mask, all the bits we do NOT want to mess
398 // with are set. These are:
399 //
400 // Transfer
401 // Copy
402 // Modufy
403 uint permsMask = ~ ((uint)PermissionMask.Copy |
404 (uint)PermissionMask.Transfer |
405 (uint)PermissionMask.Modify);
406
407 // Now, reduce the next perms to the mask bits
408 // relevant to the operation
409 uint nextPerms = permsMask | (item.NextPermissions &
410 ((uint)PermissionMask.Copy |
411 (uint)PermissionMask.Transfer |
412 (uint)PermissionMask.Modify));
413
414 // nextPerms now has all bits set, except for the actual
415 // next permission bits.
416
417 // This checks for no mod, no copy, no trans.
418 // This indicates an error or messed up item. Do it like
419 // SL and assume trans
420 if (nextPerms == permsMask)
421 nextPerms |= (uint)PermissionMask.Transfer;
422
423 // Inventory owner perms are the logical AND of the
424 // folded perms and the root prim perms, however, if
425 // the root prim is mod, the inventory perms will be
426 // mod. This happens on "take" and is of little concern
427 // here, save for preventing escalation
428
429 // This hack ensures that items previously permalocked
430 // get unlocked when they're passed or rezzed
431 uint basePerms = item.BasePermissions |
432 (uint)PermissionMask.Move;
433 uint ownerPerms = item.CurrentPermissions;
434
435 // If this is an object, root prim perms may be more
436 // permissive than folded perms. Use folded perms as
437 // a mask
394 if (item.InvType == (int)InventoryType.Object) 438 if (item.InvType == (int)InventoryType.Object)
395 { 439 {
396 itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); 440 // Create a safe mask for the current perms
397 itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13; 441 uint foldedPerms = (item.CurrentPermissions & 7) << 13;
442 foldedPerms |= permsMask;
443
444 bool isRootMod = (item.CurrentPermissions &
445 (uint)PermissionMask.Modify) != 0 ?
446 true : false;
447
448 // Mask the owner perms to the folded perms
449 ownerPerms &= foldedPerms;
450 basePerms &= foldedPerms;
451
452 // If the root was mod, let the mask reflect that
453 // We also need to adjust the base here, because
454 // we should be able to edit in-inventory perms
455 // for the root prim, if it's mod.
456 if (isRootMod)
457 {
458 ownerPerms |= (uint)PermissionMask.Modify;
459 basePerms |= (uint)PermissionMask.Modify;
460 }
398 } 461 }
399 462
400 // Ensure there is no escalation 463 // These will be applied to the root prim at next rez.
401 itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move); 464 // The slam bit (bit 3) and folded permission (bits 0-2)
465 // are preserved due to the above mangling
466 ownerPerms &= nextPerms;
402 467
403 // Need slam bit on xfer 468 // Mask the base permissions. This is a conservative
404 itemCopy.CurrentPermissions |= 8; 469 // approach altering only the three main perms
470 basePerms &= nextPerms;
471
472 // Assign to the actual item. Make sure the slam bit is
473 // set, if it wasn't set before.
474 itemCopy.BasePermissions = basePerms;
475 itemCopy.CurrentPermissions = ownerPerms | 16; // Slam
405 476
406 itemCopy.NextPermissions = item.NextPermissions; 477 itemCopy.NextPermissions = item.NextPermissions;
407 478
408 itemCopy.EveryOnePermissions = 0; 479 // This preserves "everyone can move"
480 itemCopy.EveryOnePermissions = item.EveryOnePermissions &
481 nextPerms;
482
483 // Intentionally killing "share with group" here, as
484 // the recipient will not have the group this is
485 // set to
409 itemCopy.GroupPermissions = 0; 486 itemCopy.GroupPermissions = 0;
410 } 487 }
411 else 488 else
@@ -839,6 +916,9 @@ namespace OpenSim.Region.Framework.Scenes
839 SceneObjectGroup group = part.ParentGroup; 916 SceneObjectGroup group = part.ParentGroup;
840 if (group != null) 917 if (group != null)
841 { 918 {
919 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
920 return;
921
842 TaskInventoryItem item = group.GetInventoryItem(localID, itemID); 922 TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
843 if (item == null) 923 if (item == null)
844 return; 924 return;
@@ -903,7 +983,7 @@ namespace OpenSim.Region.Framework.Scenes
903 else 983 else
904 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; 984 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
905 985
906 agentItem.CurrentPermissions |= 8; 986 agentItem.CurrentPermissions |= 16; // Slam
907 agentItem.NextPermissions = taskItem.NextPermissions; 987 agentItem.NextPermissions = taskItem.NextPermissions;
908 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 988 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
909 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 989 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
@@ -978,9 +1058,21 @@ namespace OpenSim.Region.Framework.Scenes
978 return; 1058 return;
979 } 1059 }
980 1060
981 // Only owner can copy 1061 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId);
982 if (remoteClient.AgentId != taskItem.OwnerID) 1062 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
983 return; 1063 {
1064 // If the item to be moved is no copy, we need to be able to
1065 // edit the prim.
1066 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
1067 return;
1068 }
1069 else
1070 {
1071 // If the item is copiable, then we just need to have perms
1072 // on it. The delete check is a pure rights check
1073 if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId))
1074 return;
1075 }
984 1076
985 MoveTaskInventoryItem(remoteClient, folderId, part, itemId); 1077 MoveTaskInventoryItem(remoteClient, folderId, part, itemId);
986 } 1078 }
@@ -1094,7 +1186,7 @@ namespace OpenSim.Region.Framework.Scenes
1094 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1186 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1095 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1187 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1096 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); 1188 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1097 destTaskItem.CurrentPermissions |= 8; // Slam! 1189 destTaskItem.CurrentPermissions |= 16; // Slam!
1098 } 1190 }
1099 } 1191 }
1100 1192
@@ -1263,10 +1355,48 @@ namespace OpenSim.Region.Framework.Scenes
1263 { 1355 {
1264 agentTransactions.HandleTaskItemUpdateFromTransaction( 1356 agentTransactions.HandleTaskItemUpdateFromTransaction(
1265 remoteClient, part, transactionID, currentItem); 1357 remoteClient, part, transactionID, currentItem);
1358
1359 if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
1360 remoteClient.SendAgentAlertMessage("Notecard saved", false);
1361 else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
1362 remoteClient.SendAgentAlertMessage("Script saved", false);
1363 else
1364 remoteClient.SendAgentAlertMessage("Item saved", false);
1365 }
1366
1367 // Base ALWAYS has move
1368 currentItem.BasePermissions |= (uint)PermissionMask.Move;
1369
1370 // Check if we're allowed to mess with permissions
1371 if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
1372 {
1373 if (remoteClient.AgentId != part.OwnerID) // Not owner
1374 {
1375 // Friends and group members can't change any perms
1376 itemInfo.BasePermissions = currentItem.BasePermissions;
1377 itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
1378 itemInfo.GroupPermissions = currentItem.GroupPermissions;
1379 itemInfo.NextPermissions = currentItem.NextPermissions;
1380 itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
1381 }
1382 else
1383 {
1384 // Owner can't change base, and can change other
1385 // only up to base
1386 itemInfo.BasePermissions = currentItem.BasePermissions;
1387 itemInfo.EveryonePermissions &= currentItem.BasePermissions;
1388 itemInfo.GroupPermissions &= currentItem.BasePermissions;
1389 itemInfo.CurrentPermissions &= currentItem.BasePermissions;
1390 itemInfo.NextPermissions &= currentItem.BasePermissions;
1391 }
1392
1266 } 1393 }
1394
1395 // Next ALWAYS has move
1396 itemInfo.NextPermissions |= (uint)PermissionMask.Move;
1397
1267 if (part.Inventory.UpdateInventoryItem(itemInfo)) 1398 if (part.Inventory.UpdateInventoryItem(itemInfo))
1268 { 1399 {
1269 remoteClient.SendAgentAlertMessage("Notecard saved", false);
1270 part.GetProperties(remoteClient); 1400 part.GetProperties(remoteClient);
1271 } 1401 }
1272 } 1402 }
@@ -1478,7 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes
1478 srcTaskItem.NextPermissions; 1608 srcTaskItem.NextPermissions;
1479 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1609 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1480 srcTaskItem.NextPermissions; 1610 srcTaskItem.NextPermissions;
1481 destTaskItem.CurrentPermissions |= 8; // Slam! 1611 destTaskItem.CurrentPermissions |= 16; // Slam!
1482 } 1612 }
1483 } 1613 }
1484 1614
@@ -1597,7 +1727,7 @@ namespace OpenSim.Region.Framework.Scenes
1597 } 1727 }
1598 1728
1599 // Handle god perms 1729 // Handle god perms
1600 if (Permissions.IsGod(remoteClient.AgentId)) 1730 if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId))
1601 { 1731 {
1602 permissionToTake = true; 1732 permissionToTake = true;
1603 permissionToTakeCopy = true; 1733 permissionToTakeCopy = true;
@@ -1608,7 +1738,7 @@ namespace OpenSim.Region.Framework.Scenes
1608 if (action == DeRezAction.SaveToExistingUserInventoryItem) 1738 if (action == DeRezAction.SaveToExistingUserInventoryItem)
1609 permissionToDelete = false; 1739 permissionToDelete = false;
1610 1740
1611 // if we want to take a copy,, we also don't want to delete 1741 // if we want to take a copy, we also don't want to delete
1612 // Note: after this point, the permissionToTakeCopy flag 1742 // Note: after this point, the permissionToTakeCopy flag
1613 // becomes irrelevant. It already includes the permissionToTake 1743 // becomes irrelevant. It already includes the permissionToTake
1614 // permission and after excluding no copy items here, we can 1744 // permission and after excluding no copy items here, we can
@@ -1619,6 +1749,7 @@ namespace OpenSim.Region.Framework.Scenes
1619 if (!permissionToTakeCopy) 1749 if (!permissionToTakeCopy)
1620 return; 1750 return;
1621 1751
1752 permissionToTake = true;
1622 // Don't delete 1753 // Don't delete
1623 permissionToDelete = false; 1754 permissionToDelete = false;
1624 } 1755 }
@@ -1863,17 +1994,14 @@ namespace OpenSim.Region.Framework.Scenes
1863 1994
1864 group.SetGroup(sourcePart.GroupID, null); 1995 group.SetGroup(sourcePart.GroupID, null);
1865 1996
1866 if (rootPart.OwnerID != item.OwnerID) 1997 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1867 { 1998 {
1868 if (Permissions.PropagatePermissions()) 1999 if (Permissions.PropagatePermissions())
1869 { 2000 {
1870 if ((item.CurrentPermissions & 8) != 0) 2001 foreach (SceneObjectPart part in partList)
1871 { 2002 {
1872 foreach (SceneObjectPart part in partList) 2003 part.EveryoneMask = item.EveryonePermissions;
1873 { 2004 part.NextOwnerMask = item.NextPermissions;
1874 part.EveryoneMask = item.EveryonePermissions;
1875 part.NextOwnerMask = item.NextPermissions;
1876 }
1877 } 2005 }
1878 group.ApplyNextOwnerPermissions(); 2006 group.ApplyNextOwnerPermissions();
1879 } 2007 }
@@ -1881,17 +2009,14 @@ namespace OpenSim.Region.Framework.Scenes
1881 2009
1882 foreach (SceneObjectPart part in partList) 2010 foreach (SceneObjectPart part in partList)
1883 { 2011 {
1884 if (part.OwnerID != item.OwnerID) 2012 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
1885 { 2013 {
1886 part.LastOwnerID = part.OwnerID; 2014 part.LastOwnerID = part.OwnerID;
1887 part.OwnerID = item.OwnerID; 2015 part.OwnerID = item.OwnerID;
1888 part.Inventory.ChangeInventoryOwner(item.OwnerID); 2016 part.Inventory.ChangeInventoryOwner(item.OwnerID);
1889 } 2017 }
1890 else if ((item.CurrentPermissions & 8) != 0) // Slam! 2018 part.EveryoneMask = item.EveryonePermissions;
1891 { 2019 part.NextOwnerMask = item.NextPermissions;
1892 part.EveryoneMask = item.EveryonePermissions;
1893 part.NextOwnerMask = item.NextPermissions;
1894 }
1895 } 2020 }
1896 2021
1897 rootPart.TrimPermissions(); 2022 rootPart.TrimPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 7dab04f..a523351 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -64,6 +64,7 @@ namespace OpenSim.Region.Framework.Scenes
64 public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); 64 public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
65 public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); 65 public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
66 public delegate bool IsGodHandler(UUID user, Scene requestFromScene); 66 public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
67 public delegate bool IsAdministratorHandler(UUID user);
67 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); 68 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
68 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); 69 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
69 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); 70 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
@@ -122,6 +123,7 @@ namespace OpenSim.Region.Framework.Scenes
122 public event RunConsoleCommandHandler OnRunConsoleCommand; 123 public event RunConsoleCommandHandler OnRunConsoleCommand;
123 public event IssueEstateCommandHandler OnIssueEstateCommand; 124 public event IssueEstateCommandHandler OnIssueEstateCommand;
124 public event IsGodHandler OnIsGod; 125 public event IsGodHandler OnIsGod;
126 public event IsAdministratorHandler OnIsAdministrator;
125 public event EditParcelHandler OnEditParcel; 127 public event EditParcelHandler OnEditParcel;
126 public event SellParcelHandler OnSellParcel; 128 public event SellParcelHandler OnSellParcel;
127 public event AbandonParcelHandler OnAbandonParcel; 129 public event AbandonParcelHandler OnAbandonParcel;
@@ -652,6 +654,21 @@ namespace OpenSim.Region.Framework.Scenes
652 } 654 }
653 return true; 655 return true;
654 } 656 }
657
658 public bool IsAdministrator(UUID user)
659 {
660 IsAdministratorHandler handler = OnIsAdministrator;
661 if (handler != null)
662 {
663 Delegate[] list = handler.GetInvocationList();
664 foreach (IsAdministratorHandler h in list)
665 {
666 if (h(user) == false)
667 return false;
668 }
669 }
670 return true;
671 }
655 #endregion 672 #endregion
656 673
657 #region EDIT PARCEL 674 #region EDIT PARCEL
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e2ab643..93f684c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -136,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes
136 136
137 protected SceneCommunicationService m_sceneGridService; 137 protected SceneCommunicationService m_sceneGridService;
138 public bool LoginsDisabled = true; 138 public bool LoginsDisabled = true;
139 public bool LoadingPrims = false;
139 140
140 public new float TimeDilation 141 public new float TimeDilation
141 { 142 {
@@ -478,8 +479,6 @@ namespace OpenSim.Region.Framework.Scenes
478 set { m_sceneGraph.RestorePresences = value; } 479 set { m_sceneGraph.RestorePresences = value; }
479 } 480 }
480 481
481 public int objectCapacity = 45000;
482
483 #endregion 482 #endregion
484 483
485 #region BinaryStats 484 #region BinaryStats
@@ -687,7 +686,7 @@ namespace OpenSim.Region.Framework.Scenes
687 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 686 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
688 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 687 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
689 688
690 StatsReporter.SetObjectCapacity(objectCapacity); 689 StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity);
691 690
692 // Old 691 // Old
693 /* 692 /*
@@ -1879,6 +1878,7 @@ namespace OpenSim.Region.Framework.Scenes
1879 /// </summary> 1878 /// </summary>
1880 public virtual void LoadPrimsFromStorage(UUID regionID) 1879 public virtual void LoadPrimsFromStorage(UUID regionID)
1881 { 1880 {
1881 LoadingPrims = true;
1882 m_log.Info("[SCENE]: Loading objects from datastore"); 1882 m_log.Info("[SCENE]: Loading objects from datastore");
1883 1883
1884 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); 1884 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID);
@@ -1902,6 +1902,7 @@ namespace OpenSim.Region.Framework.Scenes
1902 } 1902 }
1903 1903
1904 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 1904 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
1905 LoadingPrims = false;
1905 } 1906 }
1906 1907
1907 1908
@@ -2573,8 +2574,7 @@ namespace OpenSim.Region.Framework.Scenes
2573 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2574 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2574 2575
2575 if (AttachmentsModule != null) 2576 if (AttachmentsModule != null)
2576 AttachmentsModule.AttachObject( 2577 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false);
2577 sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
2578 2578
2579 } 2579 }
2580 else 2580 else
@@ -2725,7 +2725,9 @@ namespace OpenSim.Region.Framework.Scenes
2725 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>(); 2725 IUserAgentVerificationModule userVerification = RequestModuleInterface<IUserAgentVerificationModule>();
2726 if (userVerification != null && ep != null) 2726 if (userVerification != null && ep != null)
2727 { 2727 {
2728 if (!userVerification.VerifyClient(aCircuit, ep.Address.ToString())) 2728 System.Net.IPAddress addr = NetworkUtil.GetExternalIPOf(ep.Address);
2729
2730 if (!userVerification.VerifyClient(aCircuit, /*ep.Address.ToString() */ addr.ToString()))
2729 { 2731 {
2730 // uh-oh, this is fishy 2732 // uh-oh, this is fishy
2731 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2733 m_log.DebugFormat("[Scene]: User Client Verification for {0} {1} in {2} returned false", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
@@ -2783,17 +2785,11 @@ namespace OpenSim.Region.Framework.Scenes
2783 SubscribeToClientPrimEvents(client); 2785 SubscribeToClientPrimEvents(client);
2784 SubscribeToClientPrimRezEvents(client); 2786 SubscribeToClientPrimRezEvents(client);
2785 SubscribeToClientInventoryEvents(client); 2787 SubscribeToClientInventoryEvents(client);
2786 SubscribeToClientAttachmentEvents(client);
2787 SubscribeToClientTeleportEvents(client); 2788 SubscribeToClientTeleportEvents(client);
2788 SubscribeToClientScriptEvents(client); 2789 SubscribeToClientScriptEvents(client);
2789 SubscribeToClientParcelEvents(client); 2790 SubscribeToClientParcelEvents(client);
2790 SubscribeToClientGridEvents(client); 2791 SubscribeToClientGridEvents(client);
2791 SubscribeToClientGodEvents(client);
2792
2793 SubscribeToClientNetworkEvents(client); 2792 SubscribeToClientNetworkEvents(client);
2794
2795
2796 // EventManager.TriggerOnNewClient(client);
2797 } 2793 }
2798 2794
2799 public virtual void SubscribeToClientTerrainEvents(IClientAPI client) 2795 public virtual void SubscribeToClientTerrainEvents(IClientAPI client)
@@ -2803,8 +2799,7 @@ namespace OpenSim.Region.Framework.Scenes
2803 } 2799 }
2804 2800
2805 public virtual void SubscribeToClientPrimEvents(IClientAPI client) 2801 public virtual void SubscribeToClientPrimEvents(IClientAPI client)
2806 { 2802 {
2807
2808 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; 2803 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
2809 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; 2804 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
2810 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; 2805 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@@ -2874,18 +2869,6 @@ namespace OpenSim.Region.Framework.Scenes
2874 client.OnMoveTaskItem += ClientMoveTaskInventoryItem; 2869 client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
2875 } 2870 }
2876 2871
2877 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
2878 {
2879 if (AttachmentsModule != null)
2880 {
2881 client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
2882 client.OnRezMultipleAttachmentsFromInv += AttachmentsModule.RezMultipleAttachmentsFromInventory;
2883 client.OnObjectAttach += AttachmentsModule.AttachObject;
2884 client.OnObjectDetach += AttachmentsModule.DetachObject;
2885 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
2886 }
2887 }
2888
2889 public virtual void SubscribeToClientTeleportEvents(IClientAPI client) 2872 public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
2890 { 2873 {
2891 client.OnTeleportLocationRequest += RequestTeleportLocation; 2874 client.OnTeleportLocationRequest += RequestTeleportLocation;
@@ -2915,44 +2898,29 @@ namespace OpenSim.Region.Framework.Scenes
2915 client.OnSetStartLocationRequest += SetHomeRezPoint; 2898 client.OnSetStartLocationRequest += SetHomeRezPoint;
2916 client.OnRegionHandleRequest += RegionHandleRequest; 2899 client.OnRegionHandleRequest += RegionHandleRequest;
2917 } 2900 }
2918 2901
2919 public virtual void SubscribeToClientGodEvents(IClientAPI client)
2920 {
2921 IGodsModule godsModule = RequestModuleInterface<IGodsModule>();
2922 client.OnGodKickUser += godsModule.KickUser;
2923 client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers;
2924 }
2925
2926 public virtual void SubscribeToClientNetworkEvents(IClientAPI client) 2902 public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
2927 { 2903 {
2928 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; 2904 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
2929 client.OnViewerEffect += ProcessViewerEffect; 2905 client.OnViewerEffect += ProcessViewerEffect;
2930 } 2906 }
2931 2907
2932 protected virtual void UnsubscribeToClientEvents(IClientAPI client)
2933 {
2934 }
2935
2936 /// <summary> 2908 /// <summary>
2937 /// Register for events from the client 2909 /// Unsubscribe the client from events.
2938 /// </summary> 2910 /// </summary>
2939 /// <param name="client">The IClientAPI of the connected client</param> 2911 /// FIXME: Not called anywhere!
2912 /// <param name="client">The IClientAPI of the client</param>
2940 public virtual void UnSubscribeToClientEvents(IClientAPI client) 2913 public virtual void UnSubscribeToClientEvents(IClientAPI client)
2941 { 2914 {
2942 UnSubscribeToClientTerrainEvents(client); 2915 UnSubscribeToClientTerrainEvents(client);
2943 UnSubscribeToClientPrimEvents(client); 2916 UnSubscribeToClientPrimEvents(client);
2944 UnSubscribeToClientPrimRezEvents(client); 2917 UnSubscribeToClientPrimRezEvents(client);
2945 UnSubscribeToClientInventoryEvents(client); 2918 UnSubscribeToClientInventoryEvents(client);
2946 UnSubscribeToClientAttachmentEvents(client);
2947 UnSubscribeToClientTeleportEvents(client); 2919 UnSubscribeToClientTeleportEvents(client);
2948 UnSubscribeToClientScriptEvents(client); 2920 UnSubscribeToClientScriptEvents(client);
2949 UnSubscribeToClientParcelEvents(client); 2921 UnSubscribeToClientParcelEvents(client);
2950 UnSubscribeToClientGridEvents(client); 2922 UnSubscribeToClientGridEvents(client);
2951 UnSubscribeToClientGodEvents(client);
2952
2953 UnSubscribeToClientNetworkEvents(client); 2923 UnSubscribeToClientNetworkEvents(client);
2954
2955 // EventManager.TriggerOnNewClient(client);
2956 } 2924 }
2957 2925
2958 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) 2926 public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client)
@@ -3029,18 +2997,6 @@ namespace OpenSim.Region.Framework.Scenes
3029 client.OnMoveTaskItem -= ClientMoveTaskInventoryItem; 2997 client.OnMoveTaskItem -= ClientMoveTaskInventoryItem;
3030 } 2998 }
3031 2999
3032 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
3033 {
3034 if (AttachmentsModule != null)
3035 {
3036 client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
3037 client.OnRezMultipleAttachmentsFromInv -= AttachmentsModule.RezMultipleAttachmentsFromInventory;
3038 client.OnObjectAttach -= AttachmentsModule.AttachObject;
3039 client.OnObjectDetach -= AttachmentsModule.DetachObject;
3040 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
3041 }
3042 }
3043
3044 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) 3000 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
3045 { 3001 {
3046 client.OnTeleportLocationRequest -= RequestTeleportLocation; 3002 client.OnTeleportLocationRequest -= RequestTeleportLocation;
@@ -3072,13 +3028,6 @@ namespace OpenSim.Region.Framework.Scenes
3072 client.OnRegionHandleRequest -= RegionHandleRequest; 3028 client.OnRegionHandleRequest -= RegionHandleRequest;
3073 } 3029 }
3074 3030
3075 public virtual void UnSubscribeToClientGodEvents(IClientAPI client)
3076 {
3077 IGodsModule godsModule = RequestModuleInterface<IGodsModule>();
3078 client.OnGodKickUser -= godsModule.KickUser;
3079 client.OnRequestGodlikePowers -= godsModule.RequestGodlikePowers;
3080 }
3081
3082 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client) 3031 public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client)
3083 { 3032 {
3084 client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats; 3033 client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats;
@@ -4119,20 +4068,6 @@ namespace OpenSim.Region.Framework.Scenes
4119 4068
4120 #region Other Methods 4069 #region Other Methods
4121 4070
4122 public void SetObjectCapacity(int objects)
4123 {
4124 // Region specific config overrides global
4125 //
4126 if (RegionInfo.ObjectCapacity != 0)
4127 objects = RegionInfo.ObjectCapacity;
4128
4129 if (StatsReporter != null)
4130 {
4131 StatsReporter.SetObjectCapacity(objects);
4132 }
4133 objectCapacity = objects;
4134 }
4135
4136 #endregion 4071 #endregion
4137 4072
4138 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) 4073 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@@ -4731,7 +4666,7 @@ namespace OpenSim.Region.Framework.Scenes
4731 part.NextOwnerMask; 4666 part.NextOwnerMask;
4732 item.GroupPermissions = part.GroupMask & 4667 item.GroupPermissions = part.GroupMask &
4733 part.NextOwnerMask; 4668 part.NextOwnerMask;
4734 item.CurrentPermissions |= 8; // Slam! 4669 item.CurrentPermissions |= 16; // Slam!
4735 item.CreationDate = Util.UnixTimeSinceEpoch(); 4670 item.CreationDate = Util.UnixTimeSinceEpoch();
4736 4671
4737 if (InventoryService.AddItem(item)) 4672 if (InventoryService.AddItem(item))
@@ -5306,4 +5241,4 @@ namespace OpenSim.Region.Framework.Scenes
5306 return offsets.ToArray(); 5241 return offsets.ToArray();
5307 } 5242 }
5308 } 5243 }
5309} 5244} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 40332a6..f47450f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -78,8 +78,6 @@ namespace OpenSim.Region.Framework.Scenes
78// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>(); 78// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
79 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); 79 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
80 80
81 protected internal BasicQuadTreeNode QuadTree;
82
83 protected RegionInfo m_regInfo; 81 protected RegionInfo m_regInfo;
84 protected Scene m_parentScene; 82 protected Scene m_parentScene;
85 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); 83 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>();
@@ -107,9 +105,6 @@ namespace OpenSim.Region.Framework.Scenes
107 { 105 {
108 m_parentScene = parent; 106 m_parentScene = parent;
109 m_regInfo = regInfo; 107 m_regInfo = regInfo;
110 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize);
111 QuadTree.Subdivide();
112 QuadTree.Subdivide();
113 } 108 }
114 109
115 public PhysicsScene PhysicsScene 110 public PhysicsScene PhysicsScene
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index f7e46af..9a01a28 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -172,13 +172,14 @@ namespace OpenSim.Region.Framework.Scenes
172 taskItem.GroupPermissions = item.GroupPermissions & 172 taskItem.GroupPermissions = item.GroupPermissions &
173 item.NextPermissions; 173 item.NextPermissions;
174 taskItem.NextPermissions = item.NextPermissions; 174 taskItem.NextPermissions = item.NextPermissions;
175 taskItem.CurrentPermissions |= 8; 175 // We're adding this to a prim we don't own. Force
176 // owner change
177 taskItem.CurrentPermissions |= 16; // Slam
176 } 178 }
177 else 179 else
178 { 180 {
179 taskItem.BasePermissions = item.BasePermissions; 181 taskItem.BasePermissions = item.BasePermissions;
180 taskItem.CurrentPermissions = item.CurrentPermissions; 182 taskItem.CurrentPermissions = item.CurrentPermissions;
181 taskItem.CurrentPermissions |= 8;
182 taskItem.EveryonePermissions = item.EveryOnePermissions; 183 taskItem.EveryonePermissions = item.EveryOnePermissions;
183 taskItem.GroupPermissions = item.GroupPermissions; 184 taskItem.GroupPermissions = item.GroupPermissions;
184 taskItem.NextPermissions = item.NextPermissions; 185 taskItem.NextPermissions = item.NextPermissions;
@@ -281,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes
281 PermissionMask.Move | 282 PermissionMask.Move |
282 PermissionMask.Transfer) | 7; 283 PermissionMask.Transfer) | 7;
283 284
284 uint ownerMask = 0x7ffffff; 285 uint ownerMask = 0x7fffffff;
285 foreach (SceneObjectPart part in m_parts.Values) 286 foreach (SceneObjectPart part in m_parts.Values)
286 { 287 {
287 ownerMask &= part.OwnerMask; 288 ownerMask &= part.OwnerMask;
@@ -295,12 +296,16 @@ namespace OpenSim.Region.Framework.Scenes
295 if ((ownerMask & (uint)PermissionMask.Transfer) == 0) 296 if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
296 perms &= ~(uint)PermissionMask.Transfer; 297 perms &= ~(uint)PermissionMask.Transfer;
297 298
298 if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0) 299 // If root prim permissions are applied here, this would screw
299 perms &= ~((uint)PermissionMask.Modify >> 13); 300 // with in-inventory manipulation of the next owner perms
300 if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0) 301 // in a major way. So, let's move this to the give itself.
301 perms &= ~((uint)PermissionMask.Copy >> 13); 302 // Yes. I know. Evil.
302 if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) 303// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
303 perms &= ~((uint)PermissionMask.Transfer >> 13); 304// perms &= ~((uint)PermissionMask.Modify >> 13);
305// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
306// perms &= ~((uint)PermissionMask.Copy >> 13);
307// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
308// perms &= ~((uint)PermissionMask.Transfer >> 13);
304 309
305 return perms; 310 return perms;
306 } 311 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 1ca390a..17275d0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -294,7 +294,7 @@ namespace OpenSim.Region.Framework.Scenes
294 294
295 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) 295 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
296 || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) 296 || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
297 && !IsAttachmentCheckFull()) 297 && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims))
298 { 298 {
299 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 299 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
300 } 300 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 59fd805..e331bb0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -180,6 +180,9 @@ namespace OpenSim.Region.Framework.Scenes
180 public UUID FromItemID; 180 public UUID FromItemID;
181 181
182 [XmlIgnore] 182 [XmlIgnore]
183 public UUID FromFolderID;
184
185 [XmlIgnore]
183 public int STATUS_ROTATE_X; 186 public int STATUS_ROTATE_X;
184 187
185 [XmlIgnore] 188 [XmlIgnore]
@@ -4137,6 +4140,13 @@ namespace OpenSim.Region.Framework.Scenes
4137 case 16: 4140 case 16:
4138 _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) & 4141 _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) &
4139 baseMask; 4142 baseMask;
4143 // Prevent the client from creating no mod, no copy
4144 // objects
4145 if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0)
4146 _nextOwnerMask |= (uint)PermissionMask.Transfer;
4147
4148 _nextOwnerMask |= (uint)PermissionMask.Move;
4149
4140 break; 4150 break;
4141 } 4151 }
4142 SendFullUpdateToAllClients(); 4152 SendFullUpdateToAllClients();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3a8f168..4ae53a2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -118,20 +118,20 @@ namespace OpenSim.Region.Framework.Scenes
118 /// <param name="linkNum">Link number for the part</param> 118 /// <param name="linkNum">Link number for the part</param>
119 public void ResetInventoryIDs() 119 public void ResetInventoryIDs()
120 { 120 {
121 lock (Items) 121 lock (m_items)
122 { 122 {
123 if (0 == Items.Count) 123 if (0 == m_items.Count)
124 return; 124 return;
125 125
126 HasInventoryChanged = true; 126 HasInventoryChanged = true;
127 m_part.ParentGroup.HasGroupChanged = true; 127 m_part.ParentGroup.HasGroupChanged = true;
128 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 128 IList<TaskInventoryItem> items = GetInventoryItems();
129 Items.Clear(); 129 m_items.Clear();
130 130
131 foreach (TaskInventoryItem item in items) 131 foreach (TaskInventoryItem item in items)
132 { 132 {
133 item.ResetIDs(m_part.UUID); 133 item.ResetIDs(m_part.UUID);
134 Items.Add(item.ItemID, item); 134 m_items.Add(item.ItemID, item);
135 } 135 }
136 } 136 }
137 } 137 }
@@ -148,17 +148,17 @@ namespace OpenSim.Region.Framework.Scenes
148 { 148 {
149 return; 149 return;
150 } 150 }
151 }
151 152
152 HasInventoryChanged = true; 153 HasInventoryChanged = true;
153 m_part.ParentGroup.HasGroupChanged = true; 154 m_part.ParentGroup.HasGroupChanged = true;
154 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 155 List<TaskInventoryItem> items = GetInventoryItems();
155 foreach (TaskInventoryItem item in items) 156 foreach (TaskInventoryItem item in items)
157 {
158 if (ownerId != item.OwnerID)
156 { 159 {
157 if (ownerId != item.OwnerID) 160 item.LastOwnerID = item.OwnerID;
158 { 161 item.OwnerID = ownerId;
159 item.LastOwnerID = item.OwnerID;
160 item.OwnerID = ownerId;
161 }
162 } 162 }
163 } 163 }
164 } 164 }
@@ -175,17 +175,15 @@ namespace OpenSim.Region.Framework.Scenes
175 { 175 {
176 return; 176 return;
177 } 177 }
178 }
178 179
179 HasInventoryChanged = true; 180 HasInventoryChanged = true;
180 m_part.ParentGroup.HasGroupChanged = true; 181 m_part.ParentGroup.HasGroupChanged = true;
181 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 182 List<TaskInventoryItem> items = GetInventoryItems();
182 foreach (TaskInventoryItem item in items) 183 foreach (TaskInventoryItem item in items)
183 { 184 {
184 if (groupID != item.GroupID) 185 if (groupID != item.GroupID)
185 { 186 item.GroupID = groupID;
186 item.GroupID = groupID;
187 }
188 }
189 } 187 }
190 } 188 }
191 189
@@ -194,17 +192,9 @@ namespace OpenSim.Region.Framework.Scenes
194 /// </summary> 192 /// </summary>
195 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) 193 public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
196 { 194 {
197 lock (m_items) 195 List<TaskInventoryItem> scripts = GetInventoryScripts();
198 { 196 foreach (TaskInventoryItem item in scripts)
199 foreach (TaskInventoryItem item in Items.Values) 197 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
200 {
201 if ((int)InventoryType.LSL == item.InvType)
202 {
203 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
204 Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
205 }
206 }
207 }
208 } 198 }
209 199
210 public ArrayList GetScriptErrors(UUID itemID) 200 public ArrayList GetScriptErrors(UUID itemID)
@@ -237,16 +227,9 @@ namespace OpenSim.Region.Framework.Scenes
237 /// </param> 227 /// </param>
238 public void RemoveScriptInstances(bool sceneObjectBeingDeleted) 228 public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
239 { 229 {
240 lock (Items) 230 List<TaskInventoryItem> scripts = GetInventoryScripts();
241 { 231 foreach (TaskInventoryItem item in scripts)
242 foreach (TaskInventoryItem item in Items.Values) 232 RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
243 {
244 if ((int)InventoryType.LSL == item.InvType)
245 {
246 RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted);
247 }
248 }
249 }
250 } 233 }
251 234
252 /// <summary> 235 /// <summary>
@@ -259,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
259 // m_log.InfoFormat( 242 // m_log.InfoFormat(
260 // "[PRIM INVENTORY]: " + 243 // "[PRIM INVENTORY]: " +
261 // "Starting script {0}, {1} in prim {2}, {3}", 244 // "Starting script {0}, {1} in prim {2}, {3}",
262 // item.Name, item.ItemID, m_part.Name, m_part.UUID); 245 // item.Name, item.ItemID, Name, UUID);
263 246
264 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 247 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
265 return; 248 return;
@@ -295,20 +278,20 @@ namespace OpenSim.Region.Framework.Scenes
295 } 278 }
296 else 279 else
297 { 280 {
281 if (m_part.ParentGroup.m_savedScriptState != null)
282 RestoreSavedScriptState(item.OldItemID, item.ItemID);
283
298 lock (m_items) 284 lock (m_items)
299 { 285 {
300 if (m_part.ParentGroup.m_savedScriptState != null)
301 RestoreSavedScriptState(item.OldItemID, item.ItemID);
302
303 m_items[item.ItemID].PermsMask = 0; 286 m_items[item.ItemID].PermsMask = 0;
304 m_items[item.ItemID].PermsGranter = UUID.Zero; 287 m_items[item.ItemID].PermsGranter = UUID.Zero;
305
306 string script = Utils.BytesToString(asset.Data);
307 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
308 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
309 m_part.ParentGroup.AddActiveScriptCount(1);
310 m_part.ScheduleFullUpdate();
311 } 288 }
289
290 string script = Utils.BytesToString(asset.Data);
291 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
292 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
293 m_part.ParentGroup.AddActiveScriptCount(1);
294 m_part.ScheduleFullUpdate();
312 } 295 }
313 } 296 }
314 } 297 }
@@ -376,21 +359,15 @@ namespace OpenSim.Region.Framework.Scenes
376 /// </param> 359 /// </param>
377 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) 360 public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
378 { 361 {
379 lock (m_items) 362 TaskInventoryItem item = GetInventoryItem(itemId);
380 { 363 if (item != null)
381 if (m_items.ContainsKey(itemId)) 364 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
382 { 365 else
383 CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); 366 m_log.ErrorFormat(
384 } 367 "[PRIM INVENTORY]: " +
385 else 368 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
386 { 369 itemId, m_part.Name, m_part.UUID,
387 m_log.ErrorFormat( 370 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
388 "[PRIM INVENTORY]: " +
389 "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
390 itemId, m_part.Name, m_part.UUID,
391 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
392 }
393 }
394 } 371 }
395 372
396 /// <summary> 373 /// <summary>
@@ -431,16 +408,18 @@ namespace OpenSim.Region.Framework.Scenes
431 408
432 /// <summary> 409 /// <summary>
433 /// Check if the inventory holds an item with a given name. 410 /// Check if the inventory holds an item with a given name.
434 /// This method assumes that the task inventory is already locked.
435 /// </summary> 411 /// </summary>
436 /// <param name="name"></param> 412 /// <param name="name"></param>
437 /// <returns></returns> 413 /// <returns></returns>
438 private bool InventoryContainsName(string name) 414 private bool InventoryContainsName(string name)
439 { 415 {
440 foreach (TaskInventoryItem item in Items.Values) 416 lock (m_items)
441 { 417 {
442 if (item.Name == name) 418 foreach (TaskInventoryItem item in m_items.Values)
443 return true; 419 {
420 if (item.Name == name)
421 return true;
422 }
444 } 423 }
445 return false; 424 return false;
446 } 425 }
@@ -483,12 +462,7 @@ namespace OpenSim.Region.Framework.Scenes
483 /// <param name="item"></param> 462 /// <param name="item"></param>
484 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) 463 public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
485 { 464 {
486 List<TaskInventoryItem> il; 465 List<TaskInventoryItem> il = GetInventoryItems();
487
488 lock (m_items)
489 {
490 il = new List<TaskInventoryItem>(m_items.Values);
491 }
492 466
493 foreach (TaskInventoryItem i in il) 467 foreach (TaskInventoryItem i in il)
494 { 468 {
@@ -528,14 +502,12 @@ namespace OpenSim.Region.Framework.Scenes
528 item.GroupID = m_part.GroupID; 502 item.GroupID = m_part.GroupID;
529 503
530 lock (m_items) 504 lock (m_items)
531 {
532 m_items.Add(item.ItemID, item); 505 m_items.Add(item.ItemID, item);
533 506
534 if (allowedDrop) 507 if (allowedDrop)
535 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); 508 m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
536 else 509 else
537 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 510 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
538 }
539 511
540 m_inventorySerial++; 512 m_inventorySerial++;
541 //m_inventorySerial += 2; 513 //m_inventorySerial += 2;
@@ -559,9 +531,8 @@ namespace OpenSim.Region.Framework.Scenes
559 m_items.Add(item.ItemID, item); 531 m_items.Add(item.ItemID, item);
560// m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 532// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
561 } 533 }
534 m_inventorySerial++;
562 } 535 }
563
564 m_inventorySerial++;
565 } 536 }
566 537
567 /// <summary> 538 /// <summary>
@@ -616,45 +587,44 @@ namespace OpenSim.Region.Framework.Scenes
616 587
617 public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) 588 public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
618 { 589 {
619 lock(m_items) 590 TaskInventoryItem it = GetInventoryItem(item.ItemID);
591 if (it != null)
620 { 592 {
621 if (m_items.ContainsKey(item.ItemID)) 593 item.ParentID = m_part.UUID;
622 { 594 item.ParentPartID = m_part.UUID;
623 if (m_items.ContainsKey(item.ItemID)) 595 item.Flags = m_items[item.ItemID].Flags;
624 { 596
625 item.ParentID = m_part.UUID; 597 // If group permissions have been set on, check that the groupID is up to date in case it has
626 item.ParentPartID = m_part.UUID; 598 // changed since permissions were last set.
627 item.Flags = m_items[item.ItemID].Flags; 599 if (item.GroupPermissions != (uint)PermissionMask.None)
628 600 item.GroupID = m_part.GroupID;
629 // If group permissions have been set on, check that the groupID is up to date in case it has 601
630 // changed since permissions were last set. 602 if (item.AssetID == UUID.Zero)
631 if (item.GroupPermissions != (uint)PermissionMask.None) 603 item.AssetID = it.AssetID;
632 item.GroupID = m_part.GroupID;
633
634 if (item.AssetID == UUID.Zero)
635 {
636 item.AssetID = m_items[item.ItemID].AssetID;
637 }
638 m_items[item.ItemID] = item;
639 m_inventorySerial++;
640 if (fireScriptEvents)
641 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
642 HasInventoryChanged = true;
643 m_part.ParentGroup.HasGroupChanged = true;
644 return true;
645 }
646 else
647 {
648 m_log.ErrorFormat(
649 "[PRIM INVENTORY]: " +
650 "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
651 item.ItemID, m_part.Name, m_part.UUID,
652 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
653 }
654 604
605 lock (m_items)
606 {
607 m_items[item.ItemID] = item;
608 m_inventorySerial++;
655 } 609 }
656 return false; 610
611 if (fireScriptEvents)
612 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
613
614 HasInventoryChanged = true;
615 m_part.ParentGroup.HasGroupChanged = true;
616 return true;
657 } 617 }
618 else
619 {
620 m_log.ErrorFormat(
621 "[PRIM INVENTORY]: " +
622 "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
623 item.ItemID, m_part.Name, m_part.UUID,
624 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
625 }
626 return false;
627
658 } 628 }
659 629
660 /// <summary> 630 /// <summary>
@@ -665,52 +635,37 @@ namespace OpenSim.Region.Framework.Scenes
665 /// in this prim's inventory.</returns> 635 /// in this prim's inventory.</returns>
666 public int RemoveInventoryItem(UUID itemID) 636 public int RemoveInventoryItem(UUID itemID)
667 { 637 {
668 lock (m_items) 638 TaskInventoryItem item = GetInventoryItem(itemID);
639 if (item != null)
669 { 640 {
670 if (m_items.ContainsKey(itemID)) 641 int type = m_items[itemID].InvType;
642 if (type == 10) // Script
671 { 643 {
672 int type = m_items[itemID].InvType; 644 m_part.RemoveScriptEvents(itemID);
673 if (type == 10) // Script 645 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
674 { 646 }
675 m_part.RemoveScriptEvents(itemID); 647 m_items.Remove(itemID);
676 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); 648 m_inventorySerial++;
677 } 649 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
678 m_items.Remove(itemID);
679 m_inventorySerial++;
680 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
681
682 HasInventoryChanged = true;
683 m_part.ParentGroup.HasGroupChanged = true;
684 650
685 int scriptcount = 0; 651 HasInventoryChanged = true;
686 lock (m_items) 652 m_part.ParentGroup.HasGroupChanged = true;
687 {
688 foreach (TaskInventoryItem item in m_items.Values)
689 {
690 if (item.Type == 10)
691 {
692 scriptcount++;
693 }
694 }
695 }
696 653
697 if (scriptcount <= 0) 654 if (!ContainsScripts())
698 { 655 m_part.RemFlag(PrimFlags.Scripted);
699 m_part.RemFlag(PrimFlags.Scripted);
700 }
701 656
702 m_part.ScheduleFullUpdate(); 657 m_part.ScheduleFullUpdate();
703 658
704 return type; 659 return type;
705 } 660
706 else 661 }
707 { 662 else
708 m_log.ErrorFormat( 663 {
709 "[PRIM INVENTORY]: " + 664 m_log.ErrorFormat(
710 "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", 665 "[PRIM INVENTORY]: " +
711 itemID, m_part.Name, m_part.UUID, 666 "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
712 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); 667 itemID, m_part.Name, m_part.UUID,
713 } 668 m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
714 } 669 }
715 670
716 return -1; 671 return -1;
@@ -764,52 +719,50 @@ namespace OpenSim.Region.Framework.Scenes
764 // isn't available (such as drag from prim inventory to agent inventory) 719 // isn't available (such as drag from prim inventory to agent inventory)
765 InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); 720 InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
766 721
767 lock (m_items) 722 List<TaskInventoryItem> items = GetInventoryItems();
723 foreach (TaskInventoryItem item in items)
768 { 724 {
769 foreach (TaskInventoryItem item in m_items.Values) 725 UUID ownerID = item.OwnerID;
770 { 726 uint everyoneMask = 0;
771 UUID ownerID = item.OwnerID; 727 uint baseMask = item.BasePermissions;
772 uint everyoneMask = 0; 728 uint ownerMask = item.CurrentPermissions;
773 uint baseMask = item.BasePermissions; 729 uint groupMask = item.GroupPermissions;
774 uint ownerMask = item.CurrentPermissions;
775 uint groupMask = item.GroupPermissions;
776 730
777 invString.AddItemStart(); 731 invString.AddItemStart();
778 invString.AddNameValueLine("item_id", item.ItemID.ToString()); 732 invString.AddNameValueLine("item_id", item.ItemID.ToString());
779 invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); 733 invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
780 734
781 invString.AddPermissionsStart(); 735 invString.AddPermissionsStart();
782 736
783 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); 737 invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
784 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); 738 invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
785 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); 739 invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask));
786 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); 740 invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
787 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); 741 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
788 742
789 invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); 743 invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
790 invString.AddNameValueLine("owner_id", ownerID.ToString()); 744 invString.AddNameValueLine("owner_id", ownerID.ToString());
791 745
792 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); 746 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
793 747
794 invString.AddNameValueLine("group_id", item.GroupID.ToString()); 748 invString.AddNameValueLine("group_id", item.GroupID.ToString());
795 invString.AddSectionEnd(); 749 invString.AddSectionEnd();
796 750
797 invString.AddNameValueLine("asset_id", item.AssetID.ToString()); 751 invString.AddNameValueLine("asset_id", item.AssetID.ToString());
798 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); 752 invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
799 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); 753 invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
800 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); 754 invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
801 755
802 invString.AddSaleStart(); 756 invString.AddSaleStart();
803 invString.AddNameValueLine("sale_type", "not"); 757 invString.AddNameValueLine("sale_type", "not");
804 invString.AddNameValueLine("sale_price", "0"); 758 invString.AddNameValueLine("sale_price", "0");
805 invString.AddSectionEnd(); 759 invString.AddSectionEnd();
806 760
807 invString.AddNameValueLine("name", item.Name + "|"); 761 invString.AddNameValueLine("name", item.Name + "|");
808 invString.AddNameValueLine("desc", item.Description + "|"); 762 invString.AddNameValueLine("desc", item.Description + "|");
809 763
810 invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); 764 invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
811 invString.AddSectionEnd(); 765 invString.AddSectionEnd();
812 }
813 } 766 }
814 767
815 fileData = Utils.StringToBytes(invString.BuildString); 768 fileData = Utils.StringToBytes(invString.BuildString);
@@ -831,12 +784,10 @@ namespace OpenSim.Region.Framework.Scenes
831 { 784 {
832 if (HasInventoryChanged) 785 if (HasInventoryChanged)
833 { 786 {
834 lock (Items)
835 {
836 datastore.StorePrimInventory(m_part.UUID, Items.Values);
837 }
838
839 HasInventoryChanged = false; 787 HasInventoryChanged = false;
788 List<TaskInventoryItem> items = GetInventoryItems();
789 datastore.StorePrimInventory(m_part.UUID, items);
790
840 } 791 }
841 } 792 }
842 793
@@ -952,7 +903,6 @@ namespace OpenSim.Region.Framework.Scenes
952 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; 903 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
953 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) 904 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
954 item.CurrentPermissions &= ~(uint)PermissionMask.Modify; 905 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
955 item.CurrentPermissions |= 8;
956 } 906 }
957 item.CurrentPermissions &= item.NextPermissions; 907 item.CurrentPermissions &= item.NextPermissions;
958 item.BasePermissions &= item.NextPermissions; 908 item.BasePermissions &= item.NextPermissions;
@@ -1002,6 +952,30 @@ namespace OpenSim.Region.Framework.Scenes
1002 952
1003 return ret; 953 return ret;
1004 } 954 }
955
956 public List<TaskInventoryItem> GetInventoryItems()
957 {
958 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
959
960 lock (m_items)
961 ret = new List<TaskInventoryItem>(m_items.Values);
962
963 return ret;
964 }
965
966 public List<TaskInventoryItem> GetInventoryScripts()
967 {
968 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
969
970 lock (m_items)
971 {
972 foreach (TaskInventoryItem item in m_items.Values)
973 if (item.InvType == (int)InventoryType.LSL)
974 ret.Add(item);
975 }
976
977 return ret;
978 }
1005 979
1006 public Dictionary<UUID, string> GetScriptStates() 980 public Dictionary<UUID, string> GetScriptStates()
1007 { 981 {
@@ -1011,24 +985,20 @@ namespace OpenSim.Region.Framework.Scenes
1011 if (engines == null) // No engine at all 985 if (engines == null) // No engine at all
1012 return ret; 986 return ret;
1013 987
1014 lock (m_items) 988 List<TaskInventoryItem> scripts = GetInventoryScripts();
989
990 foreach (TaskInventoryItem item in scripts)
1015 { 991 {
1016 foreach (TaskInventoryItem item in m_items.Values) 992 foreach (IScriptModule e in engines)
1017 { 993 {
1018 if (item.InvType == (int)InventoryType.LSL) 994 if (e != null)
1019 { 995 {
1020 foreach (IScriptModule e in engines) 996 string n = e.GetXMLState(item.ItemID);
997 if (n != String.Empty)
1021 { 998 {
1022 if (e != null) 999 if (!ret.ContainsKey(item.ItemID))
1023 { 1000 ret[item.ItemID] = n;
1024 string n = e.GetXMLState(item.ItemID); 1001 break;
1025 if (n != String.Empty)
1026 {
1027 if (!ret.ContainsKey(item.ItemID))
1028 ret[item.ItemID] = n;
1029 break;
1030 }
1031 }
1032 } 1002 }
1033 } 1003 }
1034 } 1004 }
@@ -1043,25 +1013,22 @@ namespace OpenSim.Region.Framework.Scenes
1043 if (engines == null) 1013 if (engines == null)
1044 return; 1014 return;
1045 1015
1046 lock (m_items) 1016 List<TaskInventoryItem> scripts = GetInventoryScripts();
1017
1018 foreach (TaskInventoryItem item in scripts)
1047 { 1019 {
1048 foreach (TaskInventoryItem item in m_items.Values) 1020 foreach (IScriptModule engine in engines)
1049 { 1021 {
1050 if (item.InvType == (int)InventoryType.LSL) 1022 if (engine != null)
1051 { 1023 {
1052 foreach (IScriptModule engine in engines) 1024 if (item.OwnerChanged)
1053 { 1025 engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
1054 if (engine != null) 1026 item.OwnerChanged = false;
1055 { 1027 engine.ResumeScript(item.ItemID);
1056 if (item.OwnerChanged)
1057 engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER });
1058 item.OwnerChanged = false;
1059 engine.ResumeScript(item.ItemID);
1060 }
1061 }
1062 } 1028 }
1063 } 1029 }
1064 } 1030 }
1065 } 1031 }
1032
1066 } 1033 }
1067} 1034}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6c119c2..1e8ce22 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -60,7 +60,6 @@ namespace OpenSim.Region.Framework.Scenes
60 struct ScriptControllers 60 struct ScriptControllers
61 { 61 {
62 public UUID itemID; 62 public UUID itemID;
63 public uint objID;
64 public ScriptControlled ignoreControls; 63 public ScriptControlled ignoreControls;
65 public ScriptControlled eventControls; 64 public ScriptControlled eventControls;
66 } 65 }
@@ -3057,6 +3056,18 @@ namespace OpenSim.Region.Framework.Scenes
3057 cAgent.Attachments = attachs; 3056 cAgent.Attachments = attachs;
3058 } 3057 }
3059 3058
3059 lock (scriptedcontrols)
3060 {
3061 ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
3062 int i = 0;
3063
3064 foreach (ScriptControllers c in scriptedcontrols.Values)
3065 {
3066 controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls);
3067 }
3068 cAgent.Controllers = controls;
3069 }
3070
3060 // Animations 3071 // Animations
3061 try 3072 try
3062 { 3073 {
@@ -3137,6 +3148,27 @@ namespace OpenSim.Region.Framework.Scenes
3137 } 3148 }
3138 catch { } 3149 catch { }
3139 3150
3151 try
3152 {
3153 lock (scriptedcontrols)
3154 {
3155 if (cAgent.Controllers != null)
3156 {
3157 scriptedcontrols.Clear();
3158
3159 foreach (ControllerData c in cAgent.Controllers)
3160 {
3161 ScriptControllers sc = new ScriptControllers();
3162 sc.itemID = c.ItemID;
3163 sc.ignoreControls = (ScriptControlled)c.IgnoreControls;
3164 sc.eventControls = (ScriptControlled)c.EventControls;
3165
3166 scriptedcontrols[sc.itemID] = sc;
3167 }
3168 }
3169 }
3170 }
3171 catch { }
3140 // Animations 3172 // Animations
3141 try 3173 try
3142 { 3174 {
@@ -3468,7 +3500,6 @@ namespace OpenSim.Region.Framework.Scenes
3468 obj.eventControls = ScriptControlled.CONTROL_ZERO; 3500 obj.eventControls = ScriptControlled.CONTROL_ZERO;
3469 3501
3470 obj.itemID = Script_item_UUID; 3502 obj.itemID = Script_item_UUID;
3471 obj.objID = Obj_localID;
3472 if (pass_on == 0 && accept == 0) 3503 if (pass_on == 0 && accept == 0)
3473 { 3504 {
3474 IgnoredControls |= (ScriptControlled)controls; 3505 IgnoredControls |= (ScriptControlled)controls;
@@ -3611,7 +3642,7 @@ namespace OpenSim.Region.Framework.Scenes
3611 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) 3642 if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO)
3612 { 3643 {
3613 // only send if still pressed or just changed 3644 // only send if still pressed or just changed
3614 m_scene.EventManager.TriggerControlEvent(scriptControlData.objID, scriptUUID, UUID, (uint)localHeld, (uint)localChange); 3645 m_scene.EventManager.TriggerControlEvent(scriptUUID, UUID, (uint)localHeld, (uint)localChange);
3615 } 3646 }
3616 } 3647 }
3617 } 3648 }
diff --git a/OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs
deleted file mode 100644
index 38a9203..0000000
--- a/OpenSim/Region/Framework/Scenes/Types/BasicQuadTreeNode.cs
+++ /dev/null
@@ -1,269 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenSim.Region.Framework.Scenes;
31
32namespace OpenSim.Region.Framework.Scenes.Types
33{
34 public class BasicQuadTreeNode
35 {
36 private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
37 private BasicQuadTreeNode[] m_childNodes = null;
38 private BasicQuadTreeNode m_parent = null;
39
40 private short m_leftX;
41 private short m_leftY;
42 private short m_width;
43 private short m_height;
44 //private int m_quadNumber;
45 private string m_quadID;
46
47 public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width,
48 short height)
49 {
50 m_parent = parent;
51 m_quadID = quadID;
52 m_leftX = leftX;
53 m_leftY = leftY;
54 m_width = width;
55 m_height = height;
56 // m_log.Debug("creating quadtree node " + m_quadID);
57 }
58
59 public void AddObject(SceneObjectGroup obj)
60 {
61 if (m_childNodes == null)
62 {
63 if (!m_objects.Contains(obj))
64 {
65 m_objects.Add(obj);
66 }
67 }
68 else
69 {
70 if (obj.AbsolutePosition.X < (m_leftX + (m_width/2)))
71 {
72 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
73 {
74 m_childNodes[0].AddObject(obj);
75 }
76 else
77 {
78 m_childNodes[2].AddObject(obj);
79 }
80 }
81 else
82 {
83 if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2)))
84 {
85 m_childNodes[1].AddObject(obj);
86 }
87 else
88 {
89 m_childNodes[3].AddObject(obj);
90 }
91 }
92 }
93 }
94
95 public void Subdivide()
96 {
97 if (m_childNodes == null)
98 {
99 m_childNodes = new BasicQuadTreeNode[4];
100 m_childNodes[0] =
101 new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short) (m_width/2),
102 (short) (m_height/2));
103 m_childNodes[1] =
104 new BasicQuadTreeNode(this, m_quadID + "2/", (short) (m_leftX + (m_width/2)), m_leftY,
105 (short) (m_width/2), (short) (m_height/2));
106 m_childNodes[2] =
107 new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short) (m_leftY + (m_height/2)),
108 (short) (m_width/2), (short) (m_height/2));
109 m_childNodes[3] =
110 new BasicQuadTreeNode(this, m_quadID + "4/", (short) (m_leftX + (m_width/2)),
111 (short) (m_height + (m_height/2)), (short) (m_width/2), (short) (m_height/2));
112 }
113 else
114 {
115 for (int i = 0; i < m_childNodes.Length; i++)
116 {
117 m_childNodes[i].Subdivide();
118 }
119 }
120 }
121
122 public List<SceneObjectGroup> GetObjectsFrom(float x, float y)
123 {
124 if (m_childNodes == null)
125 {
126 return new List<SceneObjectGroup>(m_objects);
127 }
128 else
129 {
130 if (x < m_leftX + (m_width/2))
131 {
132 if (y < m_leftY + (m_height/2))
133 {
134 return m_childNodes[0].GetObjectsFrom(x, y);
135 }
136 else
137 {
138 return m_childNodes[2].GetObjectsFrom(x, y);
139 }
140 }
141 else
142 {
143 if (y < m_leftY + (m_height/2))
144 {
145 return m_childNodes[1].GetObjectsFrom(x, y);
146 }
147 else
148 {
149 return m_childNodes[3].GetObjectsFrom(x, y);
150 }
151 }
152 }
153 }
154
155 public List<SceneObjectGroup> GetObjectsFrom(string nodeName)
156 {
157 if (nodeName == m_quadID)
158 {
159 return new List<SceneObjectGroup>(m_objects);
160 }
161 else if (m_childNodes != null)
162 {
163 for (int i = 0; i < 4; i++)
164 {
165 List<SceneObjectGroup> retVal;
166 retVal = m_childNodes[i].GetObjectsFrom(nodeName);
167 if (retVal != null)
168 {
169 return retVal;
170 }
171 }
172 }
173 return null;
174 }
175
176 public string GetNodeID(float x, float y)
177 {
178 if (m_childNodes == null)
179 {
180 return m_quadID;
181 }
182 else
183 {
184 if (x < m_leftX + (m_width/2))
185 {
186 if (y < m_leftY + (m_height/2))
187 {
188 return m_childNodes[0].GetNodeID(x, y);
189 }
190 else
191 {
192 return m_childNodes[2].GetNodeID(x, y);
193 }
194 }
195 else
196 {
197 if (y < m_leftY + (m_height/2))
198 {
199 return m_childNodes[1].GetNodeID(x, y);
200 }
201 else
202 {
203 return m_childNodes[3].GetNodeID(x, y);
204 }
205 }
206 }
207 }
208
209 public void Update()
210 {
211 if (m_childNodes != null)
212 {
213 for (int i = 0; i < 4; i++)
214 {
215 m_childNodes[i].Update();
216 }
217 }
218 else
219 {
220 List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
221 foreach (SceneObjectGroup group in m_objects)
222 {
223 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
224 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
225 {
226 //still in bounds
227 }
228 else
229 {
230 outBounds.Add(group);
231 }
232 }
233
234 foreach (SceneObjectGroup removee in outBounds)
235 {
236 m_objects.Remove(removee);
237 if (m_parent != null)
238 {
239 m_parent.PassUp(removee);
240 }
241 }
242 outBounds.Clear();
243 }
244 }
245
246 public void PassUp(SceneObjectGroup group)
247 {
248 if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
249 ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
250 {
251 AddObject(group);
252 }
253 else
254 {
255 if (m_parent != null)
256 {
257 m_parent.PassUp(group);
258 }
259 }
260 }
261
262 public string[] GetNeighbours(string nodeName)
263 {
264 string[] retVal = new string[1];
265 retVal[0] = String.Empty;
266 return retVal;
267 }
268 }
269}
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 754b925..ee7aa2da 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1055,11 +1055,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1055 1055
1056 } 1056 }
1057 1057
1058 public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
1059 {
1060
1061 }
1062
1063 public void SendAvatarDataImmediate(ISceneEntity avatar) 1058 public void SendAvatarDataImmediate(ISceneEntity avatar)
1064 { 1059 {
1065 1060
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 56c0d98..3f15b69 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -722,11 +722,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
722 if (money != null) 722 if (money != null)
723 { 723 {
724 // do the transaction, that is if the agent has got sufficient funds 724 // do the transaction, that is if the agent has got sufficient funds
725 if (!money.GroupCreationCovered(remoteClient)) { 725 if (!money.AmountCovered(remoteClient, money.GroupCreationCharge)) {
726 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group."); 726 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group.");
727 return UUID.Zero; 727 return UUID.Zero;
728 } 728 }
729 money.ApplyGroupCreationCharge(GetRequestingAgentID(remoteClient)); 729 money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation");
730 } 730 }
731 UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); 731 UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));
732 732
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index b9a75cc..653f856 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -108,6 +108,16 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
108 108
109 public event ObjectPaid OnObjectPaid; 109 public event ObjectPaid OnObjectPaid;
110 110
111 public int UploadCharge
112 {
113 get { return 0; }
114 }
115
116 public int GroupCreationCharge
117 {
118 get { return 0; }
119 }
120
111 /// <summary> 121 /// <summary>
112 /// Startup 122 /// Startup
113 /// </summary> 123 /// </summary>
@@ -128,8 +138,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
128 public void AddRegion(Scene scene) 138 public void AddRegion(Scene scene)
129 { 139 {
130 // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter. 140 // Send ObjectCapacity to Scene.. Which sends it to the SimStatsReporter.
131 scene.SetObjectCapacity(ObjectCapacity);
132
133 if (m_enabled) 141 if (m_enabled)
134 { 142 {
135 scene.RegisterModuleInterface<IMoneyModule>(this); 143 scene.RegisterModuleInterface<IMoneyModule>(this);
@@ -188,15 +196,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
188 // Please do not refactor these to be just one method 196 // Please do not refactor these to be just one method
189 // Existing implementations need the distinction 197 // Existing implementations need the distinction
190 // 198 //
191 public void ApplyUploadCharge(UUID agentID) 199 public void ApplyCharge(UUID agentID, int amount, string text)
192 {
193 }
194
195 public void ApplyGroupCreationCharge(UUID agentID)
196 { 200 {
197 } 201 }
198 202 public void ApplyUploadCharge(UUID agentID, int amount, string text)
199 public void ApplyCharge(UUID agentID, int amount, string text)
200 { 203 {
201 } 204 }
202 205
@@ -247,7 +250,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
247 250
248 if (config == "Economy" && startupConfig != null) 251 if (config == "Economy" && startupConfig != null)
249 { 252 {
250 ObjectCapacity = startupConfig.GetInt("ObjectCapacity", 45000);
251 PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100); 253 PriceEnergyUnit = startupConfig.GetInt("PriceEnergyUnit", 100);
252 PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10); 254 PriceObjectClaim = startupConfig.GetInt("PriceObjectClaim", 10);
253 PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4); 255 PricePublicObjectDecay = startupConfig.GetInt("PricePublicObjectDecay", 4);
@@ -268,27 +270,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
268 270
269 } 271 }
270 272
271 public EconomyData GetEconomyData()
272 {
273 EconomyData edata = new EconomyData();
274 edata.ObjectCapacity = ObjectCapacity;
275 edata.ObjectCount = ObjectCount;
276 edata.PriceEnergyUnit = PriceEnergyUnit;
277 edata.PriceGroupCreate = PriceGroupCreate;
278 edata.PriceObjectClaim = PriceObjectClaim;
279 edata.PriceObjectRent = PriceObjectRent;
280 edata.PriceObjectScaleFactor = PriceObjectScaleFactor;
281 edata.PriceParcelClaim = PriceParcelClaim;
282 edata.PriceParcelClaimFactor = PriceParcelClaimFactor;
283 edata.PriceParcelRent = PriceParcelRent;
284 edata.PricePublicObjectDecay = PricePublicObjectDecay;
285 edata.PricePublicObjectDelete = PricePublicObjectDelete;
286 edata.PriceRentLight = PriceRentLight;
287 edata.PriceUpload = PriceUpload;
288 edata.TeleportMinPrice = TeleportMinPrice;
289 return edata;
290 }
291
292 private void GetClientFunds(IClientAPI client) 273 private void GetClientFunds(IClientAPI client)
293 { 274 {
294 CheckExistAndRefreshFunds(client.AgentId); 275 CheckExistAndRefreshFunds(client.AgentId);
@@ -717,7 +698,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
717 698
718 if (user != null) 699 if (user != null)
719 { 700 {
720 user.SendEconomyData(EnergyEfficiency, ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate, 701 Scene s = LocateSceneClientIn(user.AgentId);
702
703 user.SendEconomyData(EnergyEfficiency, s.RegionInfo.ObjectCapacity, ObjectCount, PriceEnergyUnit, PriceGroupCreate,
721 PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor, 704 PriceObjectClaim, PriceObjectRent, PriceObjectScaleFactor, PriceParcelClaim, PriceParcelClaimFactor,
722 PriceParcelRent, PricePublicObjectDecay, PricePublicObjectDelete, PriceRentLight, PriceUpload, 705 PriceParcelRent, PricePublicObjectDecay, PricePublicObjectDelete, PriceRentLight, PriceUpload,
723 TeleportMinPrice, TeleportPriceExponent); 706 TeleportMinPrice, TeleportPriceExponent);
@@ -790,7 +773,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
790 //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString()); 773 //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString());
791 } 774 }
792 775
793 public int GetBalance(IClientAPI client) 776 public int GetBalance(UUID agentID)
794 { 777 {
795 return 0; 778 return 0;
796 } 779 }
@@ -798,16 +781,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
798 // Please do not refactor these to be just one method 781 // Please do not refactor these to be just one method
799 // Existing implementations need the distinction 782 // Existing implementations need the distinction
800 // 783 //
801 public bool UploadCovered(IClientAPI client) 784 public bool UploadCovered(IClientAPI client, int amount)
802 { 785 {
803 return AmountCovered(client, PriceUpload); 786 return true;
804 }
805
806 public bool GroupCreationCovered(IClientAPI client)
807 {
808 return AmountCovered(client, PriceGroupCreate);
809 } 787 }
810
811 public bool AmountCovered(IClientAPI client, int amount) 788 public bool AmountCovered(IClientAPI client, int amount)
812 { 789 {
813 return true; 790 return true;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 12d6643..2e0450c 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -627,10 +627,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
627 { 627 {
628 } 628 }
629 629
630 public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
631 {
632 }
633
634 public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) 630 public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
635 { 631 {
636 } 632 }
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
index 9d41c9c..a0d6197 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
@@ -28,11 +28,14 @@
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.CoreModules.Avatar.Attachments;
32using OpenSim.Region.CoreModules.Avatar.Gods;
33using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
32 35
33namespace OpenSim.Region.RegionCombinerModule 36namespace OpenSim.Region.RegionCombinerModule
34{ 37{
35 public class RegionCombinerIndividualEventForwarder 38 public class RegionCombinerIndividualEventForwarder
36 { 39 {
37 private Scene m_rootScene; 40 private Scene m_rootScene;
38 private Scene m_virtScene; 41 private Scene m_virtScene;
@@ -46,22 +49,31 @@ namespace OpenSim.Region.RegionCombinerModule
46 public void ClientConnect(IClientAPI client) 49 public void ClientConnect(IClientAPI client)
47 { 50 {
48 m_virtScene.UnSubscribeToClientPrimEvents(client); 51 m_virtScene.UnSubscribeToClientPrimEvents(client);
49 m_virtScene.UnSubscribeToClientPrimRezEvents(client); 52 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
50 m_virtScene.UnSubscribeToClientInventoryEvents(client); 53 m_virtScene.UnSubscribeToClientInventoryEvents(client);
51 m_virtScene.UnSubscribeToClientAttachmentEvents(client); 54 ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
52 //m_virtScene.UnSubscribeToClientTeleportEvents(client); 55 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
53 m_virtScene.UnSubscribeToClientScriptEvents(client); 56 m_virtScene.UnSubscribeToClientScriptEvents(client);
54 m_virtScene.UnSubscribeToClientGodEvents(client); 57
58 IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
59 if (virtGodsModule != null)
60 ((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client);
61
55 m_virtScene.UnSubscribeToClientNetworkEvents(client); 62 m_virtScene.UnSubscribeToClientNetworkEvents(client);
56 63
57 m_rootScene.SubscribeToClientPrimEvents(client); 64 m_rootScene.SubscribeToClientPrimEvents(client);
58 client.OnAddPrim += LocalAddNewPrim; 65 client.OnAddPrim += LocalAddNewPrim;
59 client.OnRezObject += LocalRezObject; 66 client.OnRezObject += LocalRezObject;
67
60 m_rootScene.SubscribeToClientInventoryEvents(client); 68 m_rootScene.SubscribeToClientInventoryEvents(client);
61 m_rootScene.SubscribeToClientAttachmentEvents(client); 69 ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
62 //m_rootScene.SubscribeToClientTeleportEvents(client); 70 //m_rootScene.SubscribeToClientTeleportEvents(client);
63 m_rootScene.SubscribeToClientScriptEvents(client); 71 m_rootScene.SubscribeToClientScriptEvents(client);
64 m_rootScene.SubscribeToClientGodEvents(client); 72
73 IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
74 if (rootGodsModule != null)
75 ((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client);
76
65 m_rootScene.SubscribeToClientNetworkEvents(client); 77 m_rootScene.SubscribeToClientNetworkEvents(client);
66 } 78 }
67 79
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 712bd7d..ed63aee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -451,12 +451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
451 public LSL_Vector llVecNorm(LSL_Vector v) 451 public LSL_Vector llVecNorm(LSL_Vector v)
452 { 452 {
453 m_host.AddScriptLPS(1); 453 m_host.AddScriptLPS(1);
454 double mag = LSL_Vector.Mag(v); 454 return LSL_Vector.Norm(v);
455 LSL_Vector nor = new LSL_Vector();
456 nor.x = v.x / mag;
457 nor.y = v.y / mag;
458 nor.z = v.z / mag;
459 return nor;
460 } 455 }
461 456
462 public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) 457 public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)
@@ -470,22 +465,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
470 465
471 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke 466 //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
472 467
473 // Utility function for llRot2Euler 468 // Old implementation of llRot2Euler. Normalization not required as Atan2 function will
474 469 // only return values >= -PI (-180 degrees) and <= PI (180 degrees).
475 // normalize an angle between -PI and PI (-180 to +180 degrees)
476 protected double NormalizeAngle(double angle)
477 {
478 if (angle > -Math.PI && angle < Math.PI)
479 return angle;
480
481 int numPis = (int)(Math.PI / angle);
482 double remainder = angle - Math.PI * numPis;
483 if (numPis % 2 == 1)
484 return Math.PI - angle;
485 return remainder;
486 }
487
488 // Old implementation of llRot2Euler, now normalized
489 470
490 public LSL_Vector llRot2Euler(LSL_Rotation r) 471 public LSL_Vector llRot2Euler(LSL_Rotation r)
491 { 472 {
@@ -497,13 +478,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
497 double n = 2 * (r.y * r.s + r.x * r.z); 478 double n = 2 * (r.y * r.s + r.x * r.z);
498 double p = m * m - n * n; 479 double p = m * m - n * n;
499 if (p > 0) 480 if (p > 0)
500 return new LSL_Vector(NormalizeAngle(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s))), 481 return new LSL_Vector(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s)),
501 NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), 482 Math.Atan2(n, Math.Sqrt(p)),
502 NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); 483 Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)));
503 else if (n > 0) 484 else if (n > 0)
504 return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); 485 return new LSL_Vector(0.0, Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
505 else 486 else
506 return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); 487 return new LSL_Vector(0.0, -Math.PI * 0.5, Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z));
507 } 488 }
508 489
509 /* From wiki: 490 /* From wiki:
@@ -1953,13 +1934,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1953 } 1934 }
1954 else 1935 else
1955 { 1936 {
1956 if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f) 1937 LSL_Vector rel_vec = SetPosAdjust(currentPos, targetPos);
1957 { 1938 part.OffsetPosition = new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z);
1958 part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z); 1939 SceneObjectGroup parent = part.ParentGroup;
1959 SceneObjectGroup parent = part.ParentGroup; 1940 parent.HasGroupChanged = true;
1960 parent.HasGroupChanged = true; 1941 parent.ScheduleGroupForTerseUpdate();
1961 parent.ScheduleGroupForTerseUpdate();
1962 }
1963 } 1942 }
1964 } 1943 }
1965 1944
@@ -2945,9 +2924,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2945 2924
2946 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 2925 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
2947 if (attachmentsModule != null) 2926 if (attachmentsModule != null)
2948 attachmentsModule.AttachObject( 2927 attachmentsModule.AttachObject(presence.ControllingClient,
2949 presence.ControllingClient, grp.LocalId, 2928 grp, (uint)attachment, false);
2950 (uint)attachment, Quaternion.Identity, Vector3.Zero, false);
2951 } 2929 }
2952 } 2930 }
2953 2931
@@ -3270,17 +3248,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3270 public void llPointAt(LSL_Vector pos) 3248 public void llPointAt(LSL_Vector pos)
3271 { 3249 {
3272 m_host.AddScriptLPS(1); 3250 m_host.AddScriptLPS(1);
3273 ScenePresence Owner = World.GetScenePresence(m_host.UUID);
3274 LSL_Rotation rot = llEuler2Rot(pos);
3275 Owner.PreviousRotation = Owner.Rotation;
3276 Owner.Rotation = (new Quaternion((float)rot.x,(float)rot.y,(float)rot.z,(float)rot.s));
3277 } 3251 }
3278 3252
3279 public void llStopPointAt() 3253 public void llStopPointAt()
3280 { 3254 {
3281 m_host.AddScriptLPS(1); 3255 m_host.AddScriptLPS(1);
3282 ScenePresence Owner = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID);
3283 Owner.Rotation = Owner.PreviousRotation;
3284 } 3256 }
3285 3257
3286 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) 3258 public void llTargetOmega(LSL_Vector axis, double spinrate, double gain)
@@ -3938,22 +3910,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3938 UUID uuid = (UUID)id; 3910 UUID uuid = (UUID)id;
3939 3911
3940 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); 3912 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
3913 if (account == null)
3914 return UUID.Zero.ToString();
3915
3941 3916
3942 PresenceInfo pinfo = null; 3917 PresenceInfo pinfo = null;
3943 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 3918 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
3944 if (pinfos != null && pinfos.Length > 0) 3919 if (pinfos != null && pinfos.Length > 0)
3945 pinfo = pinfos[0]; 3920 pinfo = pinfos[0];
3946 3921
3947 if (pinfo == null)
3948 return UUID.Zero.ToString();
3949
3950 string reply = String.Empty; 3922 string reply = String.Empty;
3951 3923
3952 switch (data) 3924 switch (data)
3953 { 3925 {
3954 case 1: // DATA_ONLINE (0|1) 3926 case 1: // DATA_ONLINE (0|1)
3955 // TODO: implement fetching of this information 3927 if (pinfo != null && pinfo.RegionID != UUID.Zero)
3956 if (pinfo != null)
3957 reply = "1"; 3928 reply = "1";
3958 else 3929 else
3959 reply = "0"; 3930 reply = "0";
@@ -4950,7 +4921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4950 case ',': 4921 case ',':
4951 if (parens == 0) 4922 if (parens == 0)
4952 { 4923 {
4953 result.Add(src.Substring(start,length).Trim()); 4924 result.Add(new LSL_String(src.Substring(start,length).Trim()));
4954 start += length+1; 4925 start += length+1;
4955 length = 0; 4926 length = 0;
4956 } 4927 }
@@ -5879,6 +5850,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5879 PSYS_PART_MAX_AGE = 7, 5850 PSYS_PART_MAX_AGE = 7,
5880 PSYS_SRC_ACCEL = 8, 5851 PSYS_SRC_ACCEL = 8,
5881 PSYS_SRC_PATTERN = 9, 5852 PSYS_SRC_PATTERN = 9,
5853 PSYS_SRC_INNERANGLE = 10,
5854 PSYS_SRC_OUTERANGLE = 11,
5882 PSYS_SRC_TEXTURE = 12, 5855 PSYS_SRC_TEXTURE = 12,
5883 PSYS_SRC_BURST_RATE = 13, 5856 PSYS_SRC_BURST_RATE = 13,
5884 PSYS_SRC_BURST_PART_COUNT = 15, 5857 PSYS_SRC_BURST_PART_COUNT = 15,
@@ -6011,6 +5984,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6011 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; 5984 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
6012 break; 5985 break;
6013 5986
5987 // PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The
5988 // PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The
5989 // client tells the difference between the two by looking at the 0x02 bit in
5990 // the PartFlags variable.
5991 case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
5992 tempf = (float)rules.GetLSLFloatItem(i + 1);
5993 prules.InnerAngle = (float)tempf;
5994 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
5995 break;
5996
5997 case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
5998 tempf = (float)rules.GetLSLFloatItem(i + 1);
5999 prules.OuterAngle = (float)tempf;
6000 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
6001 break;
6002
6014 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: 6003 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
6015 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1)); 6004 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
6016 break; 6005 break;
@@ -6067,11 +6056,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6067 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: 6056 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
6068 tempf = (float)rules.GetLSLFloatItem(i + 1); 6057 tempf = (float)rules.GetLSLFloatItem(i + 1);
6069 prules.InnerAngle = (float)tempf; 6058 prules.InnerAngle = (float)tempf;
6059 prules.PartFlags |= 0x02; // Set new angle format.
6070 break; 6060 break;
6071 6061
6072 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: 6062 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
6073 tempf = (float)rules.GetLSLFloatItem(i + 1); 6063 tempf = (float)rules.GetLSLFloatItem(i + 1);
6074 prules.OuterAngle = (float)tempf; 6064 prules.OuterAngle = (float)tempf;
6065 prules.PartFlags |= 0x02; // Set new angle format.
6075 break; 6066 break;
6076 } 6067 }
6077 6068
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 1ea52c5..91e03ac 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -262,7 +262,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
262 public static Vector3 Norm(Vector3 vector) 262 public static Vector3 Norm(Vector3 vector)
263 { 263 {
264 double mag = Mag(vector); 264 double mag = Mag(vector);
265 return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); 265 if (mag > 0.0)
266 {
267 double invMag = 1.0 / mag;
268 return vector * invMag;
269 }
270 return new Vector3(0, 0, 0);
266 } 271 }
267 272
268 #endregion 273 #endregion
@@ -663,13 +668,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
663 Object[] ret; 668 Object[] ret;
664 669
665 if (start < 0) 670 if (start < 0)
666 start=m_data.Length-start; 671 start=m_data.Length+start;
667 672
668 if (start < 0) 673 if (start < 0)
669 start=0; 674 start=0;
670 675
671 if (end < 0) 676 if (end < 0)
672 end=m_data.Length-end; 677 end=m_data.Length+end;
673 if (end < 0) 678 if (end < 0)
674 end=0; 679 end=0;
675 680
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 09b79d0..0ac8b5c 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -356,9 +356,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
356 // timer: not handled here 356 // timer: not handled here
357 // listen: not handled here 357 // listen: not handled here
358 358
359 public void control(uint localID, UUID itemID, UUID agentID, uint held, uint change) 359 public void control(UUID itemID, UUID agentID, uint held, uint change)
360 { 360 {
361 myScriptEngine.PostObjectEvent(localID, new EventParams( 361 myScriptEngine.PostScriptEvent(itemID, new EventParams(
362 "control",new object[] { 362 "control",new object[] {
363 new LSL_Types.LSLString(agentID.ToString()), 363 new LSL_Types.LSLString(agentID.ToString()),
364 new LSL_Types.LSLInteger(held), 364 new LSL_Types.LSLInteger(held),
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 4715690..b050349 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -488,6 +488,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
488 488
489 if (stateSource == (int)StateSource.ScriptedRez) 489 if (stateSource == (int)StateSource.ScriptedRez)
490 { 490 {
491 lock (m_CompileDict)
492 {
493 m_CompileDict[itemID] = 0;
494 }
495
491 DoOnRezScript(parms); 496 DoOnRezScript(parms);
492 } 497 }
493 else 498 else
@@ -696,9 +701,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
696 } 701 }
697 } 702 }
698 703
704 ScriptInstance instance = null;
699 lock (m_Scripts) 705 lock (m_Scripts)
700 { 706 {
701 ScriptInstance instance = null;
702 // Create the object record 707 // Create the object record
703 708
704 if ((!m_Scripts.ContainsKey(itemID)) || 709 if ((!m_Scripts.ContainsKey(itemID)) ||
@@ -765,8 +770,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
765 item.Name, startParam, postOnRez, 770 item.Name, startParam, postOnRez,
766 stateSource, m_MaxScriptQueue); 771 stateSource, m_MaxScriptQueue);
767 772
768 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}", 773 m_log.DebugFormat(
769 part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString()); 774 "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
775 part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
776 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
770 777
771 if (presence != null) 778 if (presence != null)
772 { 779 {
@@ -779,28 +786,29 @@ namespace OpenSim.Region.ScriptEngine.XEngine
779 786
780 m_Scripts[itemID] = instance; 787 m_Scripts[itemID] = instance;
781 } 788 }
789 }
782 790
783 lock (m_PrimObjects) 791 lock (m_PrimObjects)
784 { 792 {
785 if (!m_PrimObjects.ContainsKey(localID)) 793 if (!m_PrimObjects.ContainsKey(localID))
786 m_PrimObjects[localID] = new List<UUID>(); 794 m_PrimObjects[localID] = new List<UUID>();
787 795
788 if (!m_PrimObjects[localID].Contains(itemID)) 796 if (!m_PrimObjects[localID].Contains(itemID))
789 m_PrimObjects[localID].Add(itemID); 797 m_PrimObjects[localID].Add(itemID);
790 798
791 } 799 }
792 800
793 if (!m_Assemblies.ContainsKey(assetID)) 801 if (!m_Assemblies.ContainsKey(assetID))
794 m_Assemblies[assetID] = assembly; 802 m_Assemblies[assetID] = assembly;
795 803
796 lock (m_AddingAssemblies) 804 lock (m_AddingAssemblies)
797 { 805 {
798 m_AddingAssemblies[assembly]--; 806 m_AddingAssemblies[assembly]--;
799 }
800
801 if (instance!=null)
802 instance.Init();
803 } 807 }
808
809 if (instance != null)
810 instance.Init();
811
804 return true; 812 return true;
805 } 813 }
806 814
@@ -813,60 +821,60 @@ namespace OpenSim.Region.ScriptEngine.XEngine
813 m_CompileDict.Remove(itemID); 821 m_CompileDict.Remove(itemID);
814 } 822 }
815 823
824 IScriptInstance instance = null;
825
816 lock (m_Scripts) 826 lock (m_Scripts)
817 { 827 {
818 // Do we even have it? 828 // Do we even have it?
819 if (!m_Scripts.ContainsKey(itemID)) 829 if (!m_Scripts.ContainsKey(itemID))
820 return; 830 return;
821 831
822 IScriptInstance instance=m_Scripts[itemID]; 832 instance=m_Scripts[itemID];
823 m_Scripts.Remove(itemID); 833 m_Scripts.Remove(itemID);
834 }
824 835
825 instance.ClearQueue(); 836 instance.ClearQueue();
826 instance.Stop(0); 837 instance.Stop(0);
827
828// bool objectRemoved = false; 838// bool objectRemoved = false;
829 839
830 lock (m_PrimObjects) 840 lock (m_PrimObjects)
841 {
842 // Remove the script from it's prim
843 if (m_PrimObjects.ContainsKey(localID))
831 { 844 {
832 // Remove the script from it's prim 845 // Remove inventory item record
833 if (m_PrimObjects.ContainsKey(localID)) 846 if (m_PrimObjects[localID].Contains(itemID))
834 { 847 m_PrimObjects[localID].Remove(itemID);
835 // Remove inventory item record
836 if (m_PrimObjects[localID].Contains(itemID))
837 m_PrimObjects[localID].Remove(itemID);
838 848
839 // If there are no more scripts, remove prim 849 // If there are no more scripts, remove prim
840 if (m_PrimObjects[localID].Count == 0) 850 if (m_PrimObjects[localID].Count == 0)
841 { 851 {
842 m_PrimObjects.Remove(localID); 852 m_PrimObjects.Remove(localID);
843// objectRemoved = true; 853// objectRemoved = true;
844 }
845 } 854 }
846 } 855 }
856 }
847 857
848 instance.RemoveState(); 858 instance.RemoveState();
849 instance.DestroyScriptInstance(); 859 instance.DestroyScriptInstance();
850 860
851 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); 861 m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
852 if (m_DomainScripts[instance.AppDomain].Count == 0) 862 if (m_DomainScripts[instance.AppDomain].Count == 0)
853 { 863 {
854 m_DomainScripts.Remove(instance.AppDomain); 864 m_DomainScripts.Remove(instance.AppDomain);
855 UnloadAppDomain(instance.AppDomain); 865 UnloadAppDomain(instance.AppDomain);
856 } 866 }
857 867
858 instance = null; 868 instance = null;
859 869
860 ObjectRemoved handlerObjectRemoved = OnObjectRemoved; 870 ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
861 if (handlerObjectRemoved != null) 871 if (handlerObjectRemoved != null)
862 { 872 {
863 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); 873 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
864 handlerObjectRemoved(part.UUID); 874 handlerObjectRemoved(part.UUID);
865 }
866
867 CleanAssemblies();
868 } 875 }
869 876
877
870 ScriptRemoved handlerScriptRemoved = OnScriptRemoved; 878 ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
871 if (handlerScriptRemoved != null) 879 if (handlerScriptRemoved != null)
872 handlerScriptRemoved(itemID); 880 handlerScriptRemoved(itemID);
@@ -1000,26 +1008,33 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1000 public bool PostObjectEvent(uint localID, EventParams p) 1008 public bool PostObjectEvent(uint localID, EventParams p)
1001 { 1009 {
1002 bool result = false; 1010 bool result = false;
1003 1011 List<UUID> uuids = null;
1012
1004 lock (m_PrimObjects) 1013 lock (m_PrimObjects)
1005 { 1014 {
1006 if (!m_PrimObjects.ContainsKey(localID)) 1015 if (!m_PrimObjects.ContainsKey(localID))
1007 return false; 1016 return false;
1008 1017
1009 1018 uuids = m_PrimObjects[localID];
1010 foreach (UUID itemID in m_PrimObjects[localID]) 1019 }
1020
1021 foreach (UUID itemID in uuids)
1022 {
1023 IScriptInstance instance = null;
1024 try
1011 { 1025 {
1012 if (m_Scripts.ContainsKey(itemID)) 1026 if (m_Scripts.ContainsKey(itemID))
1013 { 1027 instance = m_Scripts[itemID];
1014 IScriptInstance instance = m_Scripts[itemID]; 1028 }
1015 if (instance != null) 1029 catch { /* ignore race conditions */ }
1016 { 1030
1017 instance.PostEvent(p); 1031 if (instance != null)
1018 result = true; 1032 {
1019 } 1033 instance.PostEvent(p);
1020 } 1034 result = true;
1021 } 1035 }
1022 } 1036 }
1037
1023 return result; 1038 return result;
1024 } 1039 }
1025 1040
@@ -1336,10 +1351,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1336 1351
1337 try 1352 try
1338 { 1353 {
1339 FileStream tfs = File.Open(assemName + ".text", 1354 using (FileStream tfs = File.Open(assemName + ".text",
1340 FileMode.Open, FileAccess.Read); 1355 FileMode.Open, FileAccess.Read))
1341 tfs.Read(tdata, 0, tdata.Length); 1356 {
1342 tfs.Close(); 1357 tfs.Read(tdata, 0, tdata.Length);
1358 tfs.Close();
1359 }
1343 1360
1344 assem = new System.Text.ASCIIEncoding().GetString(tdata); 1361 assem = new System.Text.ASCIIEncoding().GetString(tdata);
1345 } 1362 }
@@ -1359,9 +1376,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1359 1376
1360 try 1377 try
1361 { 1378 {
1362 FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); 1379 using (FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read))
1363 fs.Read(data, 0, data.Length); 1380 {
1364 fs.Close(); 1381 fs.Read(data, 0, data.Length);
1382 fs.Close();
1383 }
1365 1384
1366 assem = System.Convert.ToBase64String(data); 1385 assem = System.Convert.ToBase64String(data);
1367 } 1386 }
@@ -1377,13 +1396,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1377 1396
1378 if (File.Exists(fn + ".map")) 1397 if (File.Exists(fn + ".map"))
1379 { 1398 {
1380 FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read); 1399 using (FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read))
1381 StreamReader msr = new StreamReader(mfs); 1400 {
1382 1401 using (StreamReader msr = new StreamReader(mfs))
1383 map = msr.ReadToEnd(); 1402 {
1384 1403 map = msr.ReadToEnd();
1385 msr.Close(); 1404 msr.Close();
1386 mfs.Close(); 1405 }
1406 mfs.Close();
1407 }
1387 } 1408 }
1388 1409
1389 XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); 1410 XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
@@ -1471,30 +1492,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1471 { 1492 {
1472 Byte[] filedata = Convert.FromBase64String(base64); 1493 Byte[] filedata = Convert.FromBase64String(base64);
1473 1494
1474 FileStream fs = File.Create(path); 1495 try
1475 fs.Write(filedata, 0, filedata.Length); 1496 {
1476 fs.Close(); 1497 using (FileStream fs = File.Create(path))
1477 1498 {
1478 fs = File.Create(path + ".text"); 1499 fs.Write(filedata, 0, filedata.Length);
1479 StreamWriter sw = new StreamWriter(fs); 1500 fs.Close();
1480 1501 }
1481 sw.Write(base64); 1502 }
1482 1503 catch (IOException ex)
1483 sw.Close(); 1504 {
1484 fs.Close(); 1505 // if there already exists a file at that location, it may be locked.
1506 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
1507 }
1508 try
1509 {
1510 using (FileStream fs = File.Create(path + ".text"))
1511 {
1512 using (StreamWriter sw = new StreamWriter(fs))
1513 {
1514 sw.Write(base64);
1515 sw.Close();
1516 }
1517 fs.Close();
1518 }
1519 }
1520 catch (IOException ex)
1521 {
1522 // if there already exists a file at that location, it may be locked.
1523 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
1524 }
1485 } 1525 }
1486 } 1526 }
1487 1527
1488 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); 1528 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1489 statepath = Path.Combine(statepath, itemID.ToString() + ".state"); 1529 statepath = Path.Combine(statepath, itemID.ToString() + ".state");
1490 1530
1491 FileStream sfs = File.Create(statepath); 1531 try
1492 StreamWriter ssw = new StreamWriter(sfs); 1532 {
1493 1533 using (FileStream sfs = File.Create(statepath))
1494 ssw.Write(stateE.OuterXml); 1534 {
1495 1535 using (StreamWriter ssw = new StreamWriter(sfs))
1496 ssw.Close(); 1536 {
1497 sfs.Close(); 1537 ssw.Write(stateE.OuterXml);
1538 ssw.Close();
1539 }
1540 sfs.Close();
1541 }
1542 }
1543 catch (IOException ex)
1544 {
1545 // if there already exists a file at that location, it may be locked.
1546 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
1547 }
1498 1548
1499 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); 1549 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
1500 if (mapL.Count > 0) 1550 if (mapL.Count > 0)
@@ -1504,13 +1554,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1504 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); 1554 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1505 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); 1555 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
1506 1556
1507 FileStream mfs = File.Create(mappath); 1557 try
1508 StreamWriter msw = new StreamWriter(mfs); 1558 {
1509 1559 using (FileStream mfs = File.Create(mappath))
1510 msw.Write(mapE.InnerText); 1560 {
1511 1561 using (StreamWriter msw = new StreamWriter(mfs))
1512 msw.Close(); 1562 {
1513 mfs.Close(); 1563 msw.Write(mapE.InnerText);
1564 msw.Close();
1565 }
1566 mfs.Close();
1567 }
1568 }
1569 catch (IOException ex)
1570 {
1571 // if there already exists a file at that location, it may be locked.
1572 m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
1573 }
1514 } 1574 }
1515 1575
1516 return true; 1576 return true;
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index bc31815..d261678 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -283,6 +283,10 @@ namespace OpenSim.Server.Handlers.Simulation
283 if (m_SimulationService == null) 283 if (m_SimulationService == null)
284 { 284 {
285 m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless."); 285 m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
286 responsedata["content_type"] = "application/json";
287 responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
288 responsedata["str_response_string"] = string.Empty;
289
286 return; 290 return;
287 } 291 }
288 292
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 42eca05..96d2605 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -358,7 +358,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
358 358
359 private bool GetBoolResponse(XmlRpcRequest request, out string reason) 359 private bool GetBoolResponse(XmlRpcRequest request, out string reason)
360 { 360 {
361 //m_log.Debug("[HGrid]: Linking to " + uri); 361 //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL);
362 XmlRpcResponse response = null; 362 XmlRpcResponse response = null;
363 try 363 try
364 { 364 {
@@ -366,14 +366,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
366 } 366 }
367 catch (Exception e) 367 catch (Exception e)
368 { 368 {
369 m_log.Debug("[USER AGENT CONNECTOR]: Unable to contact remote server "); 369 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0}", m_ServerURL);
370 reason = "Exception: " + e.Message; 370 reason = "Exception: " + e.Message;
371 return false; 371 return false;
372 } 372 }
373 373
374 if (response.IsFault) 374 if (response.IsFault)
375 { 375 {
376 m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString); 376 m_log.ErrorFormat("[HGrid]: remote call to {0} returned an error: {1}", m_ServerURL, response.FaultString);
377 reason = "XMLRPC Fault"; 377 reason = "XMLRPC Fault";
378 return false; 378 return false;
379 } 379 }
@@ -383,15 +383,29 @@ namespace OpenSim.Services.Connectors.Hypergrid
383 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); 383 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
384 try 384 try
385 { 385 {
386 if (hash == null)
387 {
388 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
389 reason = "Internal error 1";
390 return false;
391 }
386 bool success = false; 392 bool success = false;
387 reason = string.Empty; 393 reason = string.Empty;
388 Boolean.TryParse((string)hash["result"], out success); 394 if (hash.ContainsKey("result"))
395 Boolean.TryParse((string)hash["result"], out success);
396 else
397 {
398 reason = "Internal error 2";
399 m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURL);
400 }
389 401
390 return success; 402 return success;
391 } 403 }
392 catch (Exception e) 404 catch (Exception e)
393 { 405 {
394 m_log.Error("[HGrid]: Got exception while parsing GetEndPoint response " + e.StackTrace); 406 m_log.ErrorFormat("[HGrid]: Got exception on GetBoolResponse response.");
407 if (hash.ContainsKey("result") && hash["result"] != null)
408 m_log.ErrorFormat("Reply was ", (string)hash["result"]);
395 reason = "Exception: " + e.Message; 409 reason = "Exception: " + e.Message;
396 return false; 410 return false;
397 } 411 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index dc68259..2b6d29c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -745,6 +745,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
745 } 745 }
746 } 746 }
747 747
748 m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invFolders.Count + " folders from SimianGrid response");
748 return invFolders; 749 return invFolders;
749 } 750 }
750 751
@@ -810,6 +811,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
810 } 811 }
811 } 812 }
812 813
814 m_log.Debug("[SIMIAN INVENTORY CONNECTOR]: Parsed " + invItems.Count + " items from SimianGrid response");
813 return invItems; 815 return invItems;
814 } 816 }
815 817
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index fbf4648..704790e 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
88 88
89 public void Initialise(IConfigSource source) 89 public void Initialise(IConfigSource source)
90 { 90 {
91 if (Simian.IsSimianEnabled(source, "UserAccountServices", this.Name)) 91 if (Simian.IsSimianEnabled(source, "UserAccountServices", "SimianUserAccountServiceConnector"))
92 { 92 {
93 IConfig gridConfig = source.Configs["UserAccountService"]; 93 IConfig gridConfig = source.Configs["UserAccountService"];
94 if (gridConfig == null) 94 if (gridConfig == null)
@@ -108,6 +108,23 @@ namespace OpenSim.Services.Connectors.SimianGrid
108 serviceUrl = serviceUrl + '/'; 108 serviceUrl = serviceUrl + '/';
109 109
110 m_serverUrl = serviceUrl; 110 m_serverUrl = serviceUrl;
111 IConfig profilesConfig = source.Configs["Profiles"];
112 if (profilesConfig == null)
113 {
114 // Do not run this module by default.
115 return;
116 }
117 else
118 {
119 // if profiles aren't enabled, we're not needed.
120 // if we're not specified as the connector to use, then we're not wanted
121 if (profilesConfig.GetString("Module", String.Empty) != Name)
122 {
123
124 return;
125 }
126 m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Initializing {0}", this.Name);
127 }
111 } 128 }
112 } 129 }
113 130
@@ -135,6 +152,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
135 152
136 // Profiles 153 // Profiles
137 client.OnRequestAvatarProperties += RequestAvatarPropertiesHandler; 154 client.OnRequestAvatarProperties += RequestAvatarPropertiesHandler;
155
138 client.OnUpdateAvatarProperties += UpdateAvatarPropertiesHandler; 156 client.OnUpdateAvatarProperties += UpdateAvatarPropertiesHandler;
139 client.OnAvatarInterestUpdate += AvatarInterestUpdateHandler; 157 client.OnAvatarInterestUpdate += AvatarInterestUpdateHandler;
140 client.OnUserInfoRequest += UserInfoRequestHandler; 158 client.OnUserInfoRequest += UserInfoRequestHandler;
@@ -302,12 +320,25 @@ namespace OpenSim.Services.Connectors.SimianGrid
302 System.Globalization.CultureInfo.InvariantCulture), charterMember, about["FLAbout"].AsString(), (uint)flags, 320 System.Globalization.CultureInfo.InvariantCulture), charterMember, about["FLAbout"].AsString(), (uint)flags,
303 about["FLImage"].AsUUID(), about["Image"].AsUUID(), about["URL"].AsString(), user["Partner"].AsUUID()); 321 about["FLImage"].AsUUID(), about["Image"].AsUUID(), about["URL"].AsString(), user["Partner"].AsUUID());
304 322
323 OSDMap interests = null;
324 if (user.ContainsKey("LLInterests"))
325 {
326 try
327 {
328 interests = OSDParser.DeserializeJson(user["LLInterests"].AsString()) as OSDMap;
329 client.SendAvatarInterestsReply(avatarID, interests["WantMask"].AsUInteger(), interests["WantText"].AsString(), interests["SkillsMask"].AsUInteger(), interests["SkillsText"].AsString(), interests["languages"].AsString());
330 }
331 catch { }
332 }
333
334 if (about == null)
335 about = new OSDMap(0);
305 } 336 }
306 else 337 else
307 { 338 {
308 m_log.Warn("[SIMIAN PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values"); 339 m_log.Warn("[SIMIAN PROFILES]: Failed to fetch profile information for " + client.Name + ", returning default values");
309 client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes, 340 client.SendAvatarProperties(avatarID, String.Empty, "1/1/1970", Utils.EmptyBytes,
310 String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero); 341 String.Empty, (uint)flags, UUID.Zero, UUID.Zero, String.Empty, UUID.Zero);
311 } 342 }
312 } 343 }
313 344
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 225530f..ebaed42 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Services.GridService
50 private bool m_DeleteOnUnregister = true; 50 private bool m_DeleteOnUnregister = true;
51 private static GridService m_RootInstance = null; 51 private static GridService m_RootInstance = null;
52 protected IConfigSource m_config; 52 protected IConfigSource m_config;
53 protected HypergridLinker m_HypergridLinker; 53 protected static HypergridLinker m_HypergridLinker;
54 54
55 protected IAuthenticationService m_AuthenticationService = null; 55 protected IAuthenticationService m_AuthenticationService = null;
56 protected bool m_AllowDuplicateNames = false; 56 protected bool m_AllowDuplicateNames = false;
@@ -124,7 +124,7 @@ namespace OpenSim.Services.GridService
124 { 124 {
125 // Regions reserved for the null key cannot be taken. 125 // Regions reserved for the null key cannot be taken.
126 if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) 126 if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString())
127 return "Region location us reserved"; 127 return "Region location is reserved";
128 128
129 // Treat it as an auth request 129 // Treat it as an auth request
130 // 130 //
@@ -210,6 +210,7 @@ namespace OpenSim.Services.GridService
210 { 210 {
211 int newFlags = 0; 211 int newFlags = 0;
212 string regionName = rdata.RegionName.Trim().Replace(' ', '_'); 212 string regionName = rdata.RegionName.Trim().Replace(' ', '_');
213 newFlags = ParseFlags(newFlags, gridConfig.GetString("DefaultRegionFlags", String.Empty));
213 newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + regionName, String.Empty)); 214 newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + regionName, String.Empty));
214 newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty)); 215 newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty));
215 rdata.Data["flags"] = newFlags.ToString(); 216 rdata.Data["flags"] = newFlags.ToString();
@@ -278,7 +279,11 @@ namespace OpenSim.Services.GridService
278 279
279 foreach (RegionData rdata in rdatas) 280 foreach (RegionData rdata in rdatas)
280 if (rdata.RegionID != regionID) 281 if (rdata.RegionID != regionID)
281 rinfos.Add(RegionData2RegionInfo(rdata)); 282 {
283 int flags = Convert.ToInt32(rdata.Data["flags"]);
284 if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
285 rinfos.Add(RegionData2RegionInfo(rdata));
286 }
282 287
283 } 288 }
284 m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); 289 m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count);
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index ae80a8c..1f53007 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -378,32 +378,31 @@ namespace OpenSim.Services.GridService
378 378
379 public void HandleShow(string module, string[] cmd) 379 public void HandleShow(string module, string[] cmd)
380 { 380 {
381 MainConsole.Instance.Output("Not Implemented Yet"); 381 if (cmd.Length != 2)
382 //if (cmd.Length != 2) 382 {
383 //{ 383 MainConsole.Instance.Output("Syntax: show hyperlinks");
384 // MainConsole.Instance.Output("Syntax: show hyperlinks"); 384 return;
385 // return; 385 }
386 //} 386 List<RegionData> regions = m_Database.GetHyperlinks(UUID.Zero);
387 //List<GridRegion> regions = new List<GridRegion>(m_HypergridService.m_HyperlinkRegions.Values); 387 if (regions == null || regions.Count < 1)
388 //if (regions == null || regions.Count < 1) 388 {
389 //{ 389 MainConsole.Instance.Output("No hyperlinks");
390 // MainConsole.Instance.Output("No hyperlinks"); 390 return;
391 // return; 391 }
392 //}
393 392
394 //MainConsole.Instance.Output("Region Name Region UUID"); 393 MainConsole.Instance.Output("Region Name Region UUID");
395 //MainConsole.Instance.Output("Location URI"); 394 MainConsole.Instance.Output("Location URI");
396 //MainConsole.Instance.Output("Owner ID "); 395 MainConsole.Instance.Output("-------------------------------------------------------------------------------");
397 //MainConsole.Instance.Output("-------------------------------------------------------------------------------"); 396 foreach (RegionData r in regions)
398 //foreach (GridRegion r in regions) 397 {
399 //{ 398 MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
400 // MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} \n\n", 399 r.RegionName, r.RegionID,
401 // r.RegionName, r.RegionID, 400 String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
402 // String.Format("{0},{1}", r.RegionLocX, r.RegionLocY), "http://" + r.ExternalHostName + ":" + r.HttpPort.ToString(), 401 "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
403 // r.EstateOwner.ToString())); 402 }
404 //} 403 return;
405 //return;
406 } 404 }
405
407 public void RunCommand(string module, string[] cmdparams) 406 public void RunCommand(string module, string[] cmdparams)
408 { 407 {
409 List<string> args = new List<string>(cmdparams); 408 List<string> args = new List<string>(cmdparams);
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index c5cfe75..3aaafe8 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -49,61 +49,64 @@ namespace OpenSim.Services.HypergridService
49 LogManager.GetLogger( 49 LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType); 50 MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 IGridService m_GridService; 52 private static bool m_Initialized = false;
53 IPresenceService m_PresenceService;
54 IUserAccountService m_UserAccountService;
55 IUserAgentService m_UserAgentService;
56 ISimulationService m_SimulationService;
57 53
58 string m_AuthDll; 54 private static IGridService m_GridService;
55 private static IPresenceService m_PresenceService;
56 private static IUserAccountService m_UserAccountService;
57 private static IUserAgentService m_UserAgentService;
58 private static ISimulationService m_SimulationService;
59 59
60 UUID m_ScopeID; 60 private static UUID m_ScopeID;
61 bool m_AllowTeleportsToAnyRegion; 61 private static bool m_AllowTeleportsToAnyRegion;
62 string m_ExternalName; 62 private static string m_ExternalName;
63 GridRegion m_DefaultGatewayRegion; 63 private static GridRegion m_DefaultGatewayRegion;
64 64
65 public GatekeeperService(IConfigSource config, ISimulationService simService) 65 public GatekeeperService(IConfigSource config, ISimulationService simService)
66 { 66 {
67 IConfig serverConfig = config.Configs["GatekeeperService"]; 67 if (!m_Initialized)
68 if (serverConfig == null) 68 {
69 throw new Exception(String.Format("No section GatekeeperService in config file")); 69 m_Initialized = true;
70 70
71 string accountService = serverConfig.GetString("UserAccountService", String.Empty); 71 IConfig serverConfig = config.Configs["GatekeeperService"];
72 string homeUsersService = serverConfig.GetString("HomeUsersSecurityService", string.Empty); 72 if (serverConfig == null)
73 string gridService = serverConfig.GetString("GridService", String.Empty); 73 throw new Exception(String.Format("No section GatekeeperService in config file"));
74 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 74
75 string simulationService = serverConfig.GetString("SimulationService", String.Empty); 75 string accountService = serverConfig.GetString("UserAccountService", String.Empty);
76 76 string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty);
77 //m_AuthDll = serverConfig.GetString("AuthenticationService", String.Empty); 77 string gridService = serverConfig.GetString("GridService", String.Empty);
78 78 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
79 // These 3 are mandatory, the others aren't 79 string simulationService = serverConfig.GetString("SimulationService", String.Empty);
80 if (gridService == string.Empty || presenceService == string.Empty || m_AuthDll == string.Empty) 80
81 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); 81 // These 3 are mandatory, the others aren't
82 82 if (gridService == string.Empty || presenceService == string.Empty)
83 string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); 83 throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
84 UUID.TryParse(scope, out m_ScopeID); 84
85 //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); 85 string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
86 m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); 86 UUID.TryParse(scope, out m_ScopeID);
87 m_ExternalName = serverConfig.GetString("ExternalName", string.Empty); 87 //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
88 88 m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
89 Object[] args = new Object[] { config }; 89 m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
90 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 90
91 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); 91 Object[] args = new Object[] { config };
92 92 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
93 if (accountService != string.Empty) 93 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
94 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); 94
95 if (homeUsersService != string.Empty) 95 if (accountService != string.Empty)
96 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); 96 m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
97 97 if (homeUsersService != string.Empty)
98 if (simService != null) 98 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
99 m_SimulationService = simService; 99
100 else if (simulationService != string.Empty) 100 if (simService != null)
101 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); 101 m_SimulationService = simService;
102 102 else if (simulationService != string.Empty)
103 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) 103 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
104 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); 104
105 105 if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
106 m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); 106 throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
107
108 m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
109 }
107 } 110 }
108 111
109 public GatekeeperService(IConfigSource config) 112 public GatekeeperService(IConfigSource config)
@@ -280,18 +283,23 @@ namespace OpenSim.Services.HypergridService
280 return false; 283 return false;
281 } 284 }
282 285
283 Object[] args = new Object[] { userURL }; 286 if (userURL == m_ExternalName)
284 IUserAgentService userAgentService = new UserAgentServiceConnector(userURL); //ServerUtils.LoadPlugin<IUserAgentService>(m_AuthDll, args); 287 return m_UserAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
285 if (userAgentService != null) 288 else
286 { 289 {
287 try 290 Object[] args = new Object[] { userURL };
291 IUserAgentService userAgentService = new UserAgentServiceConnector(userURL);
292 if (userAgentService != null)
288 { 293 {
289 return userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID); 294 try
290 } 295 {
291 catch 296 return userAgentService.VerifyAgent(aCircuit.SessionID, aCircuit.ServiceSessionID);
292 { 297 }
293 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL); 298 catch
294 return false; 299 {
300 m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to contact authentication service at {0}", userURL);
301 return false;
302 }
295 } 303 }
296 } 304 }
297 305
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 2f1fed4..181d7f2 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -62,11 +62,18 @@ namespace OpenSim.Services.HypergridService
62 protected static IGridUserService m_GridUserService; 62 protected static IGridUserService m_GridUserService;
63 protected static IGridService m_GridService; 63 protected static IGridService m_GridService;
64 protected static GatekeeperServiceConnector m_GatekeeperConnector; 64 protected static GatekeeperServiceConnector m_GatekeeperConnector;
65 protected static IGatekeeperService m_GatekeeperService;
66
67 protected static string m_GridName;
68
69 protected static bool m_BypassClientVerification;
65 70
66 public UserAgentService(IConfigSource config) 71 public UserAgentService(IConfigSource config)
67 { 72 {
68 if (!m_Initialized) 73 if (!m_Initialized)
69 { 74 {
75 m_Initialized = true;
76
70 m_log.DebugFormat("[HOME USERS SECURITY]: Starting..."); 77 m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");
71 78
72 IConfig serverConfig = config.Configs["UserAgentService"]; 79 IConfig serverConfig = config.Configs["UserAgentService"];
@@ -75,16 +82,25 @@ namespace OpenSim.Services.HypergridService
75 82
76 string gridService = serverConfig.GetString("GridService", String.Empty); 83 string gridService = serverConfig.GetString("GridService", String.Empty);
77 string gridUserService = serverConfig.GetString("GridUserService", String.Empty); 84 string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
85 string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty);
86
87 m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);
78 88
79 if (gridService == string.Empty || gridUserService == string.Empty) 89 if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
80 throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function.")); 90 throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
81 91
82 Object[] args = new Object[] { config }; 92 Object[] args = new Object[] { config };
83 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 93 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
84 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); 94 m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
85 m_GatekeeperConnector = new GatekeeperServiceConnector(); 95 m_GatekeeperConnector = new GatekeeperServiceConnector();
96 m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args);
86 97
87 m_Initialized = true; 98 m_GridName = serverConfig.GetString("ExternalName", string.Empty);
99 if (m_GridName == string.Empty)
100 {
101 serverConfig = config.Configs["GatekeeperService"];
102 m_GridName = serverConfig.GetString("ExternalName", string.Empty);
103 }
88 } 104 }
89 } 105 }
90 106
@@ -131,7 +147,13 @@ namespace OpenSim.Services.HypergridService
131 agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); 147 agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random();
132 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); 148 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
133 149
134 bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason); 150 //bool success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
151 bool success = false;
152 string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort;
153 if (m_GridName == gridName)
154 success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
155 else
156 success = m_GatekeeperConnector.CreateAgent(region, agentCircuit, (uint)Constants.TeleportFlags.ViaLogin, out reason);
135 157
136 if (!success) 158 if (!success)
137 { 159 {
@@ -171,7 +193,7 @@ namespace OpenSim.Services.HypergridService
171 m_TravelingAgents[agentCircuit.SessionID] = travel; 193 m_TravelingAgents[agentCircuit.SessionID] = travel;
172 } 194 }
173 travel.UserID = agentCircuit.AgentID; 195 travel.UserID = agentCircuit.AgentID;
174 travel.GridExternalName = region.ExternalHostName + ":" + region.HttpPort; 196 travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort;
175 travel.ServiceToken = agentCircuit.ServiceSessionID; 197 travel.ServiceToken = agentCircuit.ServiceSessionID;
176 if (old != null) 198 if (old != null)
177 travel.ClientToken = old.ClientToken; 199 travel.ClientToken = old.ClientToken;
@@ -207,16 +229,16 @@ namespace OpenSim.Services.HypergridService
207 return false; 229 return false;
208 230
209 TravelingAgentInfo travel = m_TravelingAgents[sessionID]; 231 TravelingAgentInfo travel = m_TravelingAgents[sessionID];
232
210 return travel.GridExternalName == thisGridExternalName; 233 return travel.GridExternalName == thisGridExternalName;
211 } 234 }
212 235
213 public bool VerifyClient(UUID sessionID, string token) 236 public bool VerifyClient(UUID sessionID, string token)
214 { 237 {
215 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with token {1}", sessionID, token); 238 if (m_BypassClientVerification)
216 //return true; 239 return true;
217 240
218 // Commenting this for now until I understand better what part of a sender's 241 m_log.DebugFormat("[USER AGENT SERVICE]: Verifying Client session {0} with token {1}", sessionID, token);
219 // info stays unchanged throughout a session
220 242
221 if (m_TravelingAgents.ContainsKey(sessionID)) 243 if (m_TravelingAgents.ContainsKey(sessionID))
222 return m_TravelingAgents[sessionID].ClientToken == token; 244 return m_TravelingAgents[sessionID].ClientToken == token;
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index f48bf60..f581f76 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Services.InventoryService
45 MethodBase.GetCurrentMethod().DeclaringType); 45 MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected IXInventoryData m_Database; 47 protected IXInventoryData m_Database;
48 protected bool m_AllowDelete = true;
48 49
49 public XInventoryService(IConfigSource config) : base(config) 50 public XInventoryService(IConfigSource config) : base(config)
50 { 51 {
@@ -60,6 +61,7 @@ namespace OpenSim.Services.InventoryService
60 { 61 {
61 dllName = authConfig.GetString("StorageProvider", dllName); 62 dllName = authConfig.GetString("StorageProvider", dllName);
62 connString = authConfig.GetString("ConnectionString", connString); 63 connString = authConfig.GetString("ConnectionString", connString);
64 m_AllowDelete = authConfig.GetBoolean("AllowDelete", true);
63 // realm = authConfig.GetString("Realm", realm); 65 // realm = authConfig.GetString("Realm", realm);
64 } 66 }
65 67
@@ -259,13 +261,15 @@ namespace OpenSim.Services.InventoryService
259 261
260 public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) 262 public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
261 { 263 {
264// m_log.DebugFormat("[XINVENTORY]: Fetch items for folder {0}", folderID);
265
262 // Since we probably don't get a valid principal here, either ... 266 // Since we probably don't get a valid principal here, either ...
263 // 267 //
264 List<InventoryItemBase> invItems = new List<InventoryItemBase>(); 268 List<InventoryItemBase> invItems = new List<InventoryItemBase>();
265 269
266 XInventoryItem[] items = m_Database.GetItems( 270 XInventoryItem[] items = m_Database.GetItems(
267 new string[] { "parentFolderID"}, 271 new string[] { "parentFolderID" },
268 new string[] { UUID.Zero.ToString() }); 272 new string[] { folderID.ToString() });
269 273
270 foreach (XInventoryItem i in items) 274 foreach (XInventoryItem i in items)
271 invItems.Add(ConvertToOpenSim(i)); 275 invItems.Add(ConvertToOpenSim(i));
@@ -302,10 +306,15 @@ namespace OpenSim.Services.InventoryService
302 // 306 //
303 public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs) 307 public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
304 { 308 {
309 if (!m_AllowDelete)
310 return false;
311
305 // Ignore principal ID, it's bogus at connector level 312 // Ignore principal ID, it's bogus at connector level
306 // 313 //
307 foreach (UUID id in folderIDs) 314 foreach (UUID id in folderIDs)
308 { 315 {
316 if (!ParentIsTrash(id))
317 continue;
309 InventoryFolderBase f = new InventoryFolderBase(); 318 InventoryFolderBase f = new InventoryFolderBase();
310 f.ID = id; 319 f.ID = id;
311 PurgeFolder(f); 320 PurgeFolder(f);
@@ -317,6 +326,12 @@ namespace OpenSim.Services.InventoryService
317 326
318 public virtual bool PurgeFolder(InventoryFolderBase folder) 327 public virtual bool PurgeFolder(InventoryFolderBase folder)
319 { 328 {
329 if (!m_AllowDelete)
330 return false;
331
332 if (!ParentIsTrash(folder.ID))
333 return false;
334
320 XInventoryFolder[] subFolders = m_Database.GetFolders( 335 XInventoryFolder[] subFolders = m_Database.GetFolders(
321 new string[] { "parentFolderID" }, 336 new string[] { "parentFolderID" },
322 new string[] { folder.ID.ToString() }); 337 new string[] { folder.ID.ToString() });
@@ -356,6 +371,9 @@ namespace OpenSim.Services.InventoryService
356 371
357 public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) 372 public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
358 { 373 {
374 if (!m_AllowDelete)
375 return false;
376
359 // Just use the ID... *facepalms* 377 // Just use the ID... *facepalms*
360 // 378 //
361 foreach (UUID id in itemIDs) 379 foreach (UUID id in itemIDs)
@@ -517,5 +535,29 @@ namespace OpenSim.Services.InventoryService
517 535
518 return newItem; 536 return newItem;
519 } 537 }
538
539 private bool ParentIsTrash(UUID folderID)
540 {
541 XInventoryFolder[] folder = m_Database.GetFolders(new string[] {"folderID"}, new string[] {folderID.ToString()});
542 if (folder.Length < 1)
543 return false;
544
545 UUID parentFolder = folder[0].parentFolderID;
546
547 while (parentFolder != UUID.Zero)
548 {
549 XInventoryFolder[] parent = m_Database.GetFolders(new string[] {"folderID"}, new string[] {parentFolder.ToString()});
550 if (parent.Length < 1)
551 return false;
552
553 if (parent[0].type == (int)AssetType.TrashFolder)
554 return true;
555 if (parent[0].type == (int)AssetType.RootFolder)
556 return false;
557
558 parentFolder = parent[0].parentFolderID;
559 }
560 return false;
561 }
520 } 562 }
521} 563}
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 54d53fb..3366922 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -170,6 +170,9 @@ namespace OpenSim.Services.LLLoginService
170 private string firstname; 170 private string firstname;
171 private string lastname; 171 private string lastname;
172 172
173 // Web map
174 private string mapTileURL;
175
173 // Error Flags 176 // Error Flags
174 private string errorReason; 177 private string errorReason;
175 private string errorMessage; 178 private string errorMessage;
@@ -218,7 +221,7 @@ namespace OpenSim.Services.LLLoginService
218 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, 221 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
219 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 222 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
220 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 223 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
221 GridRegion home, IPEndPoint clientIP) 224 GridRegion home, IPEndPoint clientIP, string mapTileURL)
222 : this() 225 : this()
223 { 226 {
224 FillOutInventoryData(invSkel, libService); 227 FillOutInventoryData(invSkel, libService);
@@ -234,6 +237,7 @@ namespace OpenSim.Services.LLLoginService
234 Message = message; 237 Message = message;
235 BuddList = ConvertFriendListItem(friendsList); 238 BuddList = ConvertFriendListItem(friendsList);
236 StartLocation = where; 239 StartLocation = where;
240 MapTileURL = mapTileURL;
237 241
238 FillOutHomeData(pinfo, home); 242 FillOutHomeData(pinfo, home);
239 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); 243 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
@@ -405,6 +409,7 @@ namespace OpenSim.Services.LLLoginService
405 InitialOutfitHash["folder_name"] = "Nightclub Female"; 409 InitialOutfitHash["folder_name"] = "Nightclub Female";
406 InitialOutfitHash["gender"] = "female"; 410 InitialOutfitHash["gender"] = "female";
407 initialOutfit.Add(InitialOutfitHash); 411 initialOutfit.Add(InitialOutfitHash);
412 mapTileURL = String.Empty;
408 } 413 }
409 414
410 415
@@ -468,6 +473,9 @@ namespace OpenSim.Services.LLLoginService
468 responseData["region_x"] = (Int32)(RegionX); 473 responseData["region_x"] = (Int32)(RegionX);
469 responseData["region_y"] = (Int32)(RegionY); 474 responseData["region_y"] = (Int32)(RegionY);
470 475
476 if (mapTileURL != String.Empty)
477 responseData["map-server-url"] = mapTileURL;
478
471 if (m_buddyList != null) 479 if (m_buddyList != null)
472 { 480 {
473 responseData["buddy-list"] = m_buddyList.ToArray(); 481 responseData["buddy-list"] = m_buddyList.ToArray();
@@ -564,6 +572,9 @@ namespace OpenSim.Services.LLLoginService
564 map["region_x"] = OSD.FromInteger(RegionX); 572 map["region_x"] = OSD.FromInteger(RegionX);
565 map["region_y"] = OSD.FromInteger(RegionY); 573 map["region_y"] = OSD.FromInteger(RegionY);
566 574
575 if (mapTileURL != String.Empty)
576 map["map-server-url"] = OSD.FromString(mapTileURL);
577
567 if (m_buddyList != null) 578 if (m_buddyList != null)
568 { 579 {
569 map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray()); 580 map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray());
@@ -647,7 +658,7 @@ namespace OpenSim.Services.LLLoginService
647 Hashtable TempHash; 658 Hashtable TempHash;
648 foreach (InventoryFolderBase InvFolder in folders) 659 foreach (InventoryFolderBase InvFolder in folders)
649 { 660 {
650 if (InvFolder.ParentID == UUID.Zero) 661 if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == "My Inventory")
651 { 662 {
652 rootID = InvFolder.ID; 663 rootID = InvFolder.ID;
653 } 664 }
@@ -915,6 +926,12 @@ namespace OpenSim.Services.LLLoginService
915 set { home = value; } 926 set { home = value; }
916 } 927 }
917 928
929 public string MapTileURL
930 {
931 get { return mapTileURL; }
932 set { mapTileURL = value; }
933 }
934
918 public string Message 935 public string Message
919 { 936 {
920 get { return welcomeMessage; } 937 get { return welcomeMessage; }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 00fffff..036bec6 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -73,6 +73,7 @@ namespace OpenSim.Services.LLLoginService
73 protected int m_MinLoginLevel; 73 protected int m_MinLoginLevel;
74 protected string m_GatekeeperURL; 74 protected string m_GatekeeperURL;
75 protected bool m_AllowRemoteSetLoginLevel; 75 protected bool m_AllowRemoteSetLoginLevel;
76 protected string m_MapTileURL;
76 77
77 IConfig m_LoginServerConfig; 78 IConfig m_LoginServerConfig;
78 79
@@ -100,6 +101,7 @@ namespace OpenSim.Services.LLLoginService
100 m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false); 101 m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
101 m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); 102 m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
102 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); 103 m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
104 m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
103 105
104 // These are required; the others aren't 106 // These are required; the others aren't
105 if (accountService == string.Empty || authService == string.Empty) 107 if (accountService == string.Empty || authService == string.Empty)
@@ -356,7 +358,7 @@ namespace OpenSim.Services.LLLoginService
356 // Finally, fill out the response and return it 358 // Finally, fill out the response and return it
357 // 359 //
358 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 360 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
359 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP); 361 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL);
360 362
361 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); 363 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
362 return response; 364 return response;
@@ -752,10 +754,8 @@ namespace OpenSim.Services.LLLoginService
752 m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName); 754 m_log.Debug("[LLOGIN SERVICE] Launching agent at " + destination.RegionName);
753 if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason)) 755 if (m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason))
754 { 756 {
755 // We may need to do this at some point, 757 IPAddress addr = NetworkUtil.GetExternalIPOf(clientIP.Address);
756 // so leaving it here in comments. 758 m_UserAgentService.SetClientToken(aCircuit.SessionID, addr.ToString() /* clientIP.Address.ToString() */);
757 //IPAddress addr = NetworkUtil.GetIPFor(clientIP.Address, destination.ExternalEndPoint.Address);
758 m_UserAgentService.SetClientToken(aCircuit.SessionID, /*addr.Address.ToString() */ clientIP.Address.ToString());
759 return true; 759 return true;
760 } 760 }
761 return false; 761 return false;
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 496cfb8..999cf5e 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -630,10 +630,6 @@ namespace OpenSim.Tests.Common.Mock
630 { 630 {
631 } 631 }
632 632
633 public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
634 {
635 }
636
637 public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) 633 public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
638 { 634 {
639 } 635 }
diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs
index 1619a22..e74debb 100644
--- a/OpenSim/Tools/Configger/ConfigurationLoader.cs
+++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs
@@ -241,36 +241,6 @@ namespace OpenSim.Tools.Configger
241 config.Set("EventQueue", true); 241 config.Set("EventQueue", true);
242 } 242 }
243 243
244 {
245 IConfig config = defaultConfig.Configs["StandAlone"];
246
247 if (null == config)
248 config = defaultConfig.AddConfig("StandAlone");
249
250 config.Set("accounts_authenticate", true);
251 config.Set("welcome_message", "Welcome to OpenSimulator");
252 config.Set("inventory_plugin", "OpenSim.Data.SQLite.dll");
253 config.Set("inventory_source", "");
254 config.Set("userDatabase_plugin", "OpenSim.Data.SQLite.dll");
255 config.Set("user_source", "");
256 config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar));
257 }
258
259 {
260 IConfig config = defaultConfig.Configs["Network"];
261
262 if (null == config)
263 config = defaultConfig.AddConfig("Network");
264
265 config.Set("default_location_x", 1000);
266 config.Set("default_location_y", 1000);
267 config.Set("grid_send_key", "null");
268 config.Set("grid_recv_key", "null");
269 config.Set("user_send_key", "null");
270 config.Set("user_recv_key", "null");
271 config.Set("secure_inventory_server", "true");
272 }
273
274 return defaultConfig; 244 return defaultConfig;
275 } 245 }
276 246