aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs10
-rw-r--r--OpenSim/Data/SQLite/SQLiteXInventoryData.cs8
-rw-r--r--OpenSim/Framework/RegionInfo.cs20
-rw-r--r--OpenSim/Region/Application/OpenSim.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs6
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEmailModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs22
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs99
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs41
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs4
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs8
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs2
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs6
-rw-r--r--OpenSim/Services/InventoryService/HGInventoryService.cs4
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs9
-rw-r--r--OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj4
31 files changed, 284 insertions, 115 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
index 0fe801d..3c73095 100644
--- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
@@ -64,14 +64,22 @@ namespace OpenSim.Data.MySQL
64 64
65 public bool StoreFolder(XInventoryFolder folder) 65 public bool StoreFolder(XInventoryFolder folder)
66 { 66 {
67 if (folder.folderName.Length > 64)
68 folder.folderName = folder.folderName.Substring(0, 64);
69
67 return m_Folders.Store(folder); 70 return m_Folders.Store(folder);
68 } 71 }
69 72
70 public bool StoreItem(XInventoryItem item) 73 public bool StoreItem(XInventoryItem item)
71 { 74 {
75 if (item.inventoryName.Length > 64)
76 item.inventoryName = item.inventoryName.Substring(0, 64);
77 if (item.inventoryDescription.Length > 128)
78 item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
79
72 return m_Items.Store(item); 80 return m_Items.Store(item);
73 } 81 }
74 82
75 public bool DeleteFolders(string field, string val) 83 public bool DeleteFolders(string field, string val)
76 { 84 {
77 return m_Folders.Delete(field, val); 85 return m_Folders.Delete(field, val);
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
index 6064538..ca651e1 100644
--- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -66,11 +66,19 @@ namespace OpenSim.Data.SQLite
66 66
67 public bool StoreFolder(XInventoryFolder folder) 67 public bool StoreFolder(XInventoryFolder folder)
68 { 68 {
69 if (folder.folderName.Length > 64)
70 folder.folderName = folder.folderName.Substring(0, 64);
71
69 return m_Folders.Store(folder); 72 return m_Folders.Store(folder);
70 } 73 }
71 74
72 public bool StoreItem(XInventoryItem item) 75 public bool StoreItem(XInventoryItem item)
73 { 76 {
77 if (item.inventoryName.Length > 64)
78 item.inventoryName = item.inventoryName.Substring(0, 64);
79 if (item.inventoryDescription.Length > 128)
80 item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
81
74 return m_Items.Store(item); 82 return m_Items.Store(item);
75 } 83 }
76 84
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index ad98816..afc4060 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -29,14 +29,15 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using System.Reflection;
32using System.Xml; 33using System.Xml;
33using System.IO; 34using System.IO;
35using log4net;
34using Nini.Config; 36using Nini.Config;
35using OpenMetaverse; 37using OpenMetaverse;
36using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
37using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
38 40
39
40namespace OpenSim.Framework 41namespace OpenSim.Framework
41{ 42{
42 public class RegionLightShareData : ICloneable 43 public class RegionLightShareData : ICloneable
@@ -96,10 +97,9 @@ namespace OpenSim.Framework
96 97
97 [Serializable] 98 [Serializable]
98 public class SimpleRegionInfo 99 public class SimpleRegionInfo
99 { 100 {
100 // private static readonly log4net.ILog m_log 101// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
101 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 102
102
103 /// <summary> 103 /// <summary>
104 /// The port by which http communication occurs with the region (most noticeably, CAPS communication) 104 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
105 /// </summary> 105 /// </summary>
@@ -327,8 +327,7 @@ namespace OpenSim.Framework
327 327
328 public class RegionInfo 328 public class RegionInfo
329 { 329 {
330 // private static readonly log4net.ILog m_log 330 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
331 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
332 331
333 public bool commFailTF = false; 332 public bool commFailTF = false;
334 public ConfigurationMember configMember; 333 public ConfigurationMember configMember;
@@ -772,9 +771,16 @@ namespace OpenSim.Framework
772 } 771 }
773 772
774 if (externalName == "SYSTEMIP") 773 if (externalName == "SYSTEMIP")
774 {
775 m_externalHostName = Util.GetLocalHost().ToString(); 775 m_externalHostName = Util.GetLocalHost().ToString();
776 m_log.InfoFormat(
777 "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
778 m_externalHostName, name);
779 }
776 else 780 else
781 {
777 m_externalHostName = externalName; 782 m_externalHostName = externalName;
783 }
778 784
779 m_regionType = config.GetString("RegionType", String.Empty); 785 m_regionType = config.GetString("RegionType", String.Empty);
780 786
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a09b903..501d47f 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -192,9 +192,7 @@ namespace OpenSim
192 // Hook up to the watchdog timer 192 // Hook up to the watchdog timer
193 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; 193 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
194 194
195 PrintFileToConsole("startuplogo.txt"); 195 PrintFileToConsole("startuplogo.txt");
196
197 m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString());
198 196
199 // For now, start at the 'root' level by default 197 // For now, start at the 'root' level by default
200 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it 198 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 83be61e..f535fe8 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -367,13 +367,13 @@ namespace OpenSim
367 Environment.Exit(1); 367 Environment.Exit(1);
368 } 368 }
369 369
370 scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
371 scene.EventManager.TriggerParcelPrimCountUpdate();
372
370 // We need to do this after we've initialized the 373 // We need to do this after we've initialized the
371 // scripting engines. 374 // scripting engines.
372 scene.CreateScriptInstances(); 375 scene.CreateScriptInstances();
373 376
374 scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
375 scene.EventManager.TriggerParcelPrimCountUpdate();
376
377 m_sceneManager.Add(scene); 377 m_sceneManager.Add(scene);
378 378
379 if (m_autoCreateClientStack) 379 if (m_autoCreateClientStack)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index cdd22de..d2824bd 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6303,8 +6303,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6303 if (handlerObjectDuplicate != null) 6303 if (handlerObjectDuplicate != null)
6304 { 6304 {
6305 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, 6305 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
6306 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, 6306 dupe.SharedData.DuplicateFlags, AgentId,
6307 AgentandGroupData.GroupID); 6307 m_activeGroupID);
6308 } 6308 }
6309 } 6309 }
6310 6310
@@ -6894,7 +6894,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6894 if (handlerObjectDuplicateOnRay != null) 6894 if (handlerObjectDuplicateOnRay != null)
6895 { 6895 {
6896 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, 6896 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
6897 dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, 6897 AgentId, m_activeGroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
6898 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, 6898 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
6899 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); 6899 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
6900 } 6900 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index f8e3d59..75efb79 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -131,6 +131,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
131 131
132 if (texture != null) 132 if (texture != null)
133 { 133 {
134 if (texture.Type != (sbyte)AssetType.Texture)
135 {
136 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
137 httpResponse.Send();
138 return null;
139 }
134 SendTexture(httpRequest, httpResponse, texture); 140 SendTexture(httpRequest, httpResponse, texture);
135 } 141 }
136 else 142 else
@@ -147,6 +153,12 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
147 153
148 if (texture != null) 154 if (texture != null)
149 { 155 {
156 if (texture.Type != (sbyte)AssetType.Texture)
157 {
158 httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
159 httpResponse.Send();
160 return null;
161 }
150 SendTexture(httpRequest, httpResponse, texture); 162 SendTexture(httpRequest, httpResponse, texture);
151 } 163 }
152 else 164 else
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 5552be7..6f044cb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -768,8 +768,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
768 bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; 768 bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
769 if (canEditObjectsChanged) 769 if (canEditObjectsChanged)
770 friendClient.SendChangeUserRights(userID, friendID, rights); 770 friendClient.SendChangeUserRights(userID, friendID, rights);
771
771 } 772 }
772 773
774 // update local cache
775 //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
776 foreach (FriendInfo finfo in m_Friends[friendID].Friends)
777 if (finfo.Friend == userID.ToString())
778 finfo.TheirFlags = rights;
779
773 return true; 780 return true;
774 } 781 }
775 782
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 2ab46aa..58c396c 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 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 134 public override UUID DeleteToInventory(DeRezAction action, UUID folderID,
135 SceneObjectGroup objectGroup, IClientAPI remoteClient) 135 SceneObjectGroup objectGroup, IClientAPI remoteClient)
136 { 136 {
137 UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient); 137 UUID assetID = base.DeleteToInventory(action, folderID, new List<SceneObjectGroup>() {objectGroup}, remoteClient);
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 3035d88..12b6aa0 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -286,23 +286,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
286 { 286 {
287 // Deleting someone else's item 287 // Deleting someone else's item
288 // 288 //
289
290
291 if (remoteClient == null || 289 if (remoteClient == null ||
292 objectGroup.OwnerID != remoteClient.AgentId) 290 objectGroup.OwnerID != remoteClient.AgentId)
293 { 291 {
294 // Folder skeleton may not be loaded and we 292
295 // have to wait for the inventory to find
296 // the destination folder
297 //
298 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); 293 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
299 } 294 }
300 else 295 else
301 { 296 {
302 // Assume inventory skeleton was loaded during login 297 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
303 // and all folders can be found
304 //
305 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
306 } 298 }
307 } 299 }
308 else if (action == DeRezAction.Return) 300 else if (action == DeRezAction.Return)
@@ -332,7 +324,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
332 324
333 if (folder == null) // None of the above 325 if (folder == null) // None of the above
334 { 326 {
335 //folder = userInfo.RootFolder.FindFolder(folderID);
336 folder = new InventoryFolderBase(folderID); 327 folder = new InventoryFolderBase(folderID);
337 328
338 if (folder == null) // Nowhere to put it 329 if (folder == null) // Nowhere to put it
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index 83f004d..c0975ea 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -40,7 +40,7 @@ using OpenSim.Region.Framework.Scenes;
40 40
41namespace OpenSim.Region.CoreModules.Scripting.EmailModules 41namespace OpenSim.Region.CoreModules.Scripting.EmailModules
42{ 42{
43 public class EmailModule : IEmailModule 43 public class EmailModule : IRegionModule, IEmailModule
44 { 44 {
45 // 45 //
46 // Log 46 // Log
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index ae03cdf..209cf0d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
96 96
97 Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" }; 97 Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" };
98 98
99 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:HGInventoryServiceInConnector", args); 99 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:XInventoryInConnector", args);
100 } 100 }
101 } 101 }
102 102
diff --git a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
index 3a2c423..4f1b91a 100644
--- a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces
38 public int numLeft; 38 public int numLeft;
39 } 39 }
40 40
41 public interface IEmailModule : IRegionModule 41 public interface IEmailModule
42 { 42 {
43 void SendEmail(UUID objectID, string address, string subject, string body); 43 void SendEmail(UUID objectID, string address, string subject, string body);
44 Email GetNextEmail(UUID objectID, string sender, string subject); 44 Email GetNextEmail(UUID objectID, string sender, string subject);
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 7b7677b..de3c360 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -52,6 +52,9 @@ namespace OpenSim.Region.Framework.Scenes
52 public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) 52 public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
53 { 53 {
54 double priority = 0; 54 double priority = 0;
55
56 if (entity == null)
57 return 100000;
55 58
56 switch (m_scene.UpdatePrioritizationScheme) 59 switch (m_scene.UpdatePrioritizationScheme)
57 { 60 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 64bdc99..9278164 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -385,9 +385,9 @@ namespace OpenSim.Region.Framework.Scenes
385 if (Permissions.PropagatePermissions() && recipient != senderId) 385 if (Permissions.PropagatePermissions() && recipient != senderId)
386 { 386 {
387 // First, make sore base is limited to the next perms 387 // First, make sore base is limited to the next perms
388 itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; 388 itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move);
389 // By default, current equals base 389 // By default, current equals base
390 itemCopy.CurrentPermissions = itemCopy.BasePermissions; 390 itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions;
391 391
392 // If this is an object, replace current perms 392 // If this is an object, replace current perms
393 // with folded perms 393 // with folded perms
@@ -398,7 +398,7 @@ namespace OpenSim.Region.Framework.Scenes
398 } 398 }
399 399
400 // Ensure there is no escalation 400 // Ensure there is no escalation
401 itemCopy.CurrentPermissions &= item.NextPermissions; 401 itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move);
402 402
403 // Need slam bit on xfer 403 // Need slam bit on xfer
404 itemCopy.CurrentPermissions |= 8; 404 itemCopy.CurrentPermissions |= 8;
@@ -897,14 +897,15 @@ namespace OpenSim.Region.Framework.Scenes
897 897
898 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) 898 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
899 { 899 {
900 agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions; 900 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
901 if (taskItem.InvType == (int)InventoryType.Object) 901 if (taskItem.InvType == (int)InventoryType.Object)
902 agentItem.CurrentPermissions = agentItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13); 902 agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move));
903 agentItem.CurrentPermissions = agentItem.BasePermissions ; 903 else
904 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
904 905
905 agentItem.CurrentPermissions |= 8; 906 agentItem.CurrentPermissions |= 8;
906 agentItem.NextPermissions = taskItem.NextPermissions; 907 agentItem.NextPermissions = taskItem.NextPermissions;
907 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions; 908 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
908 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 909 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
909 } 910 }
910 else 911 else
@@ -1086,13 +1087,13 @@ namespace OpenSim.Region.Framework.Scenes
1086 if (Permissions.PropagatePermissions()) 1087 if (Permissions.PropagatePermissions())
1087 { 1088 {
1088 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & 1089 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
1089 srcTaskItem.NextPermissions; 1090 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1090 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions & 1091 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
1091 srcTaskItem.NextPermissions; 1092 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1092 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions & 1093 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
1093 srcTaskItem.NextPermissions; 1094 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1094 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1095 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1095 srcTaskItem.NextPermissions; 1096 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1096 destTaskItem.CurrentPermissions |= 8; // Slam! 1097 destTaskItem.CurrentPermissions |= 8; // Slam!
1097 } 1098 }
1098 } 1099 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 240c688..40332a6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1747,9 +1747,31 @@ namespace OpenSim.Region.Framework.Scenes
1747 { 1747 {
1748 if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition)) 1748 if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition))
1749 { 1749 {
1750 SceneObjectGroup copy = original.Copy(AgentID, GroupID, true); 1750 SceneObjectGroup copy = original.Copy(true);
1751 copy.AbsolutePosition = copy.AbsolutePosition + offset; 1751 copy.AbsolutePosition = copy.AbsolutePosition + offset;
1752 1752
1753 if (original.OwnerID != AgentID)
1754 {
1755 copy.SetOwnerId(AgentID);
1756 copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
1757
1758 List<SceneObjectPart> partList =
1759 new List<SceneObjectPart>(copy.Children.Values);
1760
1761 if (m_parentScene.Permissions.PropagatePermissions())
1762 {
1763 foreach (SceneObjectPart child in partList)
1764 {
1765 child.Inventory.ChangeInventoryOwner(AgentID);
1766 child.TriggerScriptChangedEvent(Changed.OWNER);
1767 child.ApplyNextOwnerPermissions();
1768 }
1769 }
1770
1771 copy.RootPart.ObjectSaleType = 0;
1772 copy.RootPart.SalePrice = 10;
1773 }
1774
1753 Entities.Add(copy); 1775 Entities.Add(copy);
1754 1776
1755 // Since we copy from a source group that is in selected 1777 // Since we copy from a source group that is in selected
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e23f39f..1ca390a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1472,7 +1472,7 @@ namespace OpenSim.Region.Framework.Scenes
1472 "[SCENE]: Storing {0}, {1} in {2}", 1472 "[SCENE]: Storing {0}, {1} in {2}",
1473 Name, UUID, m_scene.RegionInfo.RegionName); 1473 Name, UUID, m_scene.RegionInfo.RegionName);
1474 1474
1475 SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false); 1475 SceneObjectGroup backup_group = Copy(false);
1476 backup_group.RootPart.Velocity = RootPart.Velocity; 1476 backup_group.RootPart.Velocity = RootPart.Velocity;
1477 backup_group.RootPart.Acceleration = RootPart.Acceleration; 1477 backup_group.RootPart.Acceleration = RootPart.Acceleration;
1478 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1478 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
@@ -1528,7 +1528,7 @@ namespace OpenSim.Region.Framework.Scenes
1528 /// Duplicates this object, including operations such as physics set up and attaching to the backup event. 1528 /// Duplicates this object, including operations such as physics set up and attaching to the backup event.
1529 /// </summary> 1529 /// </summary>
1530 /// <returns></returns> 1530 /// <returns></returns>
1531 public SceneObjectGroup Copy(UUID cAgentID, UUID cGroupID, bool userExposed) 1531 public SceneObjectGroup Copy(bool userExposed)
1532 { 1532 {
1533 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 1533 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
1534 dupe.m_isBackedUp = false; 1534 dupe.m_isBackedUp = false;
@@ -1551,7 +1551,9 @@ namespace OpenSim.Region.Framework.Scenes
1551 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1551 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1552 1552
1553 if (!userExposed) 1553 if (!userExposed)
1554 {
1554 dupe.RootPart.IsAttachment = previousAttachmentStatus; 1555 dupe.RootPart.IsAttachment = previousAttachmentStatus;
1556 }
1555 1557
1556 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1558 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1557 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1559 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
@@ -1576,16 +1578,6 @@ namespace OpenSim.Region.Framework.Scenes
1576 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); 1578 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
1577 } 1579 }
1578 1580
1579 // Now we've made a copy that replaces this one, we need to
1580 // switch the owner to the person who did the copying
1581 // Second Life copies an object and duplicates the first one in it's place
1582 // So, we have to make a copy of this one, set it in it's place then set the owner on this one
1583 if (userExposed)
1584 {
1585 SetRootPartOwner(m_rootPart, cAgentID, cGroupID);
1586 m_rootPart.ScheduleFullUpdate();
1587 }
1588
1589 List<SceneObjectPart> partList; 1581 List<SceneObjectPart> partList;
1590 1582
1591 lock (m_parts) 1583 lock (m_parts)
@@ -1606,12 +1598,6 @@ namespace OpenSim.Region.Framework.Scenes
1606 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); 1598 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1607 1599
1608 newPart.LinkNum = part.LinkNum; 1600 newPart.LinkNum = part.LinkNum;
1609
1610 if (userExposed)
1611 {
1612 SetPartOwner(newPart, cAgentID, cGroupID);
1613 newPart.ScheduleFullUpdate();
1614 }
1615 } 1601 }
1616 } 1602 }
1617 1603
@@ -3595,7 +3581,7 @@ namespace OpenSim.Region.Framework.Scenes
3595 3581
3596 public virtual ISceneObject CloneForNewScene() 3582 public virtual ISceneObject CloneForNewScene()
3597 { 3583 {
3598 SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false); 3584 SceneObjectGroup sog = Copy(false);
3599 sog.m_isDeleted = false; 3585 sog.m_isDeleted = false;
3600 return sog; 3586 return sog;
3601 } 3587 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 866bb6e..3a8f168 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Collections; 32using System.Collections;
33using System.Reflection; 33using System.Reflection;
34using System.Threading;
34using OpenMetaverse; 35using OpenMetaverse;
35using log4net; 36using log4net;
36using OpenSim.Framework; 37using OpenSim.Framework;
@@ -200,6 +201,7 @@ namespace OpenSim.Region.Framework.Scenes
200 if ((int)InventoryType.LSL == item.InvType) 201 if ((int)InventoryType.LSL == item.InvType)
201 { 202 {
202 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); 203 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
204 Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
203 } 205 }
204 } 206 }
205 } 207 }
@@ -257,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes
257 // m_log.InfoFormat( 259 // m_log.InfoFormat(
258 // "[PRIM INVENTORY]: " + 260 // "[PRIM INVENTORY]: " +
259 // "Starting script {0}, {1} in prim {2}, {3}", 261 // "Starting script {0}, {1} in prim {2}, {3}",
260 // item.Name, item.ItemID, Name, UUID); 262 // item.Name, item.ItemID, m_part.Name, m_part.UUID);
261 263
262 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 264 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
263 return; 265 return;
@@ -293,20 +295,20 @@ namespace OpenSim.Region.Framework.Scenes
293 } 295 }
294 else 296 else
295 { 297 {
296 if (m_part.ParentGroup.m_savedScriptState != null)
297 RestoreSavedScriptState(item.OldItemID, item.ItemID);
298
299 lock (m_items) 298 lock (m_items)
300 { 299 {
300 if (m_part.ParentGroup.m_savedScriptState != null)
301 RestoreSavedScriptState(item.OldItemID, item.ItemID);
302
301 m_items[item.ItemID].PermsMask = 0; 303 m_items[item.ItemID].PermsMask = 0;
302 m_items[item.ItemID].PermsGranter = UUID.Zero; 304 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();
303 } 311 }
304
305 string script = Utils.BytesToString(asset.Data);
306 m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
307 m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
308 m_part.ParentGroup.AddActiveScriptCount(1);
309 m_part.ScheduleFullUpdate();
310 } 312 }
311 } 313 }
312 } 314 }
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index c277034..ada6701 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
73 public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics) 73 public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics)
74 : base(Unchanged, false) 74 : base(Unchanged, false)
75 { 75 {
76 m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false); 76 m_UnchangedEntity = Unchanged.Copy(false);
77 } 77 }
78 78
79 public ContentManagementEntity(string objectXML, Scene scene, bool physics) 79 public ContentManagementEntity(string objectXML, Scene scene, bool physics)
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
index 1a72971..841ee00 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
80 /// </summary> 80 /// </summary>
81 public MetaEntity(SceneObjectGroup orig, bool physics) 81 public MetaEntity(SceneObjectGroup orig, bool physics)
82 { 82 {
83 m_Entity = orig.Copy(orig.RootPart.OwnerID, orig.RootPart.GroupID, false); 83 m_Entity = orig.Copy(false);
84 Initialize(physics); 84 Initialize(physics);
85 } 85 }
86 86
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
index 9beeabb..2342bfa 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
@@ -675,7 +675,7 @@ namespace OpenSim.Region.Physics.OdePlugin
675 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity 675 m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
676 676
677 d.Vector3 pos = d.BodyGetPosition(Body); 677 d.Vector3 pos = d.BodyGetPosition(Body);
678 Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); 678// Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f);
679 Vector3 posChange = new Vector3(); 679 Vector3 posChange = new Vector3();
680 posChange.X = pos.X - m_lastPositionVector.X; 680 posChange.X = pos.X - m_lastPositionVector.X;
681 posChange.Y = pos.Y - m_lastPositionVector.Y; 681 posChange.Y = pos.Y - m_lastPositionVector.Y;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 0720b5e..3cf4501 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -1576,19 +1576,19 @@ Console.WriteLine(" JointCreateFixed");
1576//Console.WriteLine("Move " + m_primName); 1576//Console.WriteLine("Move " + m_primName);
1577 if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 1577 if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
1578 // NON-'VEHICLES' are dealt with here 1578 // NON-'VEHICLES' are dealt with here
1579 if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) 1579// if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
1580 { 1580// {
1581 d.Vector3 avel2 = d.BodyGetAngularVel(Body); 1581// d.Vector3 avel2 = d.BodyGetAngularVel(Body);
1582 /* 1582// /*
1583 if (m_angularlock.X == 1) 1583// if (m_angularlock.X == 1)
1584 avel2.X = 0; 1584// avel2.X = 0;
1585 if (m_angularlock.Y == 1) 1585// if (m_angularlock.Y == 1)
1586 avel2.Y = 0; 1586// avel2.Y = 0;
1587 if (m_angularlock.Z == 1) 1587// if (m_angularlock.Z == 1)
1588 avel2.Z = 0; 1588// avel2.Z = 0;
1589 d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); 1589// d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z);
1590 */ 1590// */
1591 } 1591// }
1592 //float PID_P = 900.0f; 1592 //float PID_P = 900.0f;
1593 1593
1594 float m_mass = CalculateMass(); 1594 float m_mass = CalculateMass();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 59ab26b..712bd7d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -705,22 +705,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
705 { 705 {
706 //A and B should both be normalized 706 //A and B should both be normalized
707 m_host.AddScriptLPS(1); 707 m_host.AddScriptLPS(1);
708 double dotProduct = LSL_Vector.Dot(a, b); 708 LSL_Rotation rotBetween;
709 LSL_Vector crossProduct = LSL_Vector.Cross(a, b); 709 // Check for zero vectors. If either is zero, return zero rotation. Otherwise,
710 double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b); 710 // continue calculation.
711 double angle = Math.Acos(dotProduct / magProduct); 711 if (a == new LSL_Vector(0.0f, 0.0f, 0.0f) || b == new LSL_Vector(0.0f, 0.0f, 0.0f))
712 LSL_Vector axis = LSL_Vector.Norm(crossProduct); 712 {
713 double s = Math.Sin(angle / 2); 713 rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
714 714 }
715 double x = axis.x * s; 715 else
716 double y = axis.y * s; 716 {
717 double z = axis.z * s; 717 a = LSL_Vector.Norm(a);
718 double w = Math.Cos(angle / 2); 718 b = LSL_Vector.Norm(b);
719 719 double dotProduct = LSL_Vector.Dot(a, b);
720 if (Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w)) 720 // There are two degenerate cases possible. These are for vectors 180 or
721 return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f); 721 // 0 degrees apart. These have to be detected and handled individually.
722 722 //
723 return new LSL_Rotation((float)x, (float)y, (float)z, (float)w); 723 // Check for vectors 180 degrees apart.
724 // A dot product of -1 would mean the angle between vectors is 180 degrees.
725 if (dotProduct < -0.9999999f)
726 {
727 // First assume X axis is orthogonal to the vectors.
728 LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f);
729 orthoVector = orthoVector - a * (a.x / LSL_Vector.Dot(a, a));
730 // Check for near zero vector. A very small non-zero number here will create
731 // a rotation in an undesired direction.
732 if (LSL_Vector.Mag(orthoVector) > 0.0001)
733 {
734 rotBetween = new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f);
735 }
736 // If the magnitude of the vector was near zero, then assume the X axis is not
737 // orthogonal and use the Z axis instead.
738 else
739 {
740 // Set 180 z rotation.
741 rotBetween = new LSL_Rotation(0.0f, 0.0f, 1.0f, 0.0f);
742 }
743 }
744 // Check for parallel vectors.
745 // A dot product of 1 would mean the angle between vectors is 0 degrees.
746 else if (dotProduct > 0.9999999f)
747 {
748 // Set zero rotation.
749 rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
750 }
751 else
752 {
753 // All special checks have been performed so get the axis of rotation.
754 LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
755 // Quarternion s value is the length of the unit vector + dot product.
756 double qs = 1.0 + dotProduct;
757 rotBetween = new LSL_Rotation(crossProduct.x, crossProduct.y, crossProduct.z, qs);
758 // Normalize the rotation.
759 double mag = LSL_Rotation.Mag(rotBetween);
760 // We shouldn't have to worry about a divide by zero here. The qs value will be
761 // non-zero because we already know if we're here, then the dotProduct is not -1 so
762 // qs will not be zero. Also, we've already handled the input vectors being zero so the
763 // crossProduct vector should also not be zero.
764 rotBetween.x = rotBetween.x / mag;
765 rotBetween.y = rotBetween.y / mag;
766 rotBetween.z = rotBetween.z / mag;
767 rotBetween.s = rotBetween.s / mag;
768 // Check for undefined values and set zero rotation if any found. This code might not actually be required
769 // any longer since zero vectors are checked for at the top.
770 if (Double.IsNaN(rotBetween.x) || Double.IsNaN(rotBetween.y) || Double.IsNaN(rotBetween.z) || Double.IsNaN(rotBetween.s))
771 {
772 rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
773 }
774 }
775 }
776 return rotBetween;
724 } 777 }
725 778
726 public void llWhisper(int channelID, string text) 779 public void llWhisper(int channelID, string text)
@@ -6520,6 +6573,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6520 if (cut.y - cut.x < 0.05f) 6573 if (cut.y - cut.x < 0.05f)
6521 { 6574 {
6522 cut.x = cut.y - 0.05f; 6575 cut.x = cut.y - 0.05f;
6576 if (cut.x < 0.0f)
6577 {
6578 cut.x = 0.0f;
6579 cut.y = 0.05f;
6580 }
6523 } 6581 }
6524 shapeBlock.ProfileBegin = (ushort)(50000 * cut.x); 6582 shapeBlock.ProfileBegin = (ushort)(50000 * cut.x);
6525 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y)); 6583 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y));
@@ -6715,9 +6773,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6715 { 6773 {
6716 profilecut.y = 1f; 6774 profilecut.y = 1f;
6717 } 6775 }
6718 if (profilecut.y - cut.x < 0.05f) 6776 if (profilecut.y - profilecut.x < 0.05f)
6719 { 6777 {
6720 profilecut.x = cut.y - 0.05f; 6778 profilecut.x = profilecut.y - 0.05f;
6779 if (profilecut.x < 0.0f)
6780 {
6781 profilecut.x = 0.0f;
6782 profilecut.y = 0.05f;
6783 }
6721 } 6784 }
6722 shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x); 6785 shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x);
6723 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - profilecut.y)); 6786 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - profilecut.y));
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index a5bebb8..dee31bd 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -230,6 +230,12 @@ namespace OpenSim.Server.Base
230 "shutdown", 230 "shutdown",
231 "Quit the application", HandleQuit); 231 "Quit the application", HandleQuit);
232 232
233 // Register a command to read other commands from a file
234 MainConsole.Instance.Commands.AddCommand("base", false, "command-script",
235 "command-script <script>",
236 "Run a command script from file", HandleScript);
237
238
233 // Allow derived classes to perform initialization that 239 // Allow derived classes to perform initialization that
234 // needs to be done after the console has opened 240 // needs to be done after the console has opened
235 // 241 //
@@ -259,6 +265,41 @@ namespace OpenSim.Server.Base
259 m_log.Info("[CONSOLE] Quitting"); 265 m_log.Info("[CONSOLE] Quitting");
260 } 266 }
261 267
268 protected virtual void HandleScript(string module, string[] parms)
269 {
270 if (parms.Length != 2)
271 {
272 return;
273 }
274 RunCommandScript(parms[1]);
275 }
276
277 /// <summary>
278 /// Run an optional startup list of commands
279 /// </summary>
280 /// <param name="fileName"></param>
281 private void RunCommandScript(string fileName)
282 {
283 if (File.Exists(fileName))
284 {
285 m_log.Info("[COMMANDFILE]: Running " + fileName);
286
287 using (StreamReader readFile = File.OpenText(fileName))
288 {
289 string currentCommand;
290 while ((currentCommand = readFile.ReadLine()) != null)
291 {
292 if (currentCommand != String.Empty)
293 {
294 m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
295 MainConsole.Instance.RunCommand(currentCommand);
296 }
297 }
298 }
299 }
300 }
301
302
262 protected virtual void ReadConfig() 303 protected virtual void ReadConfig()
263 { 304 {
264 } 305 }
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 6e580f1..ac6a3ab 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -44,6 +44,8 @@ namespace OpenSim.Server.Handlers.Asset
44{ 44{
45 public class XInventoryInConnector : ServiceConnector 45 public class XInventoryInConnector : ServiceConnector
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
47 private IInventoryService m_InventoryService; 49 private IInventoryService m_InventoryService;
48 private string m_ConfigName = "InventoryService"; 50 private string m_ConfigName = "InventoryService";
49 51
@@ -53,6 +55,8 @@ namespace OpenSim.Server.Handlers.Asset
53 if (configName != String.Empty) 55 if (configName != String.Empty)
54 m_ConfigName = configName; 56 m_ConfigName = configName;
55 57
58 m_log.DebugFormat("[XInventoryInConnector]: Starting with config name {0}", m_ConfigName);
59
56 IConfig serverConfig = config.Configs[m_ConfigName]; 60 IConfig serverConfig = config.Configs[m_ConfigName];
57 if (serverConfig == null) 61 if (serverConfig == null)
58 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); 62 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 191acc9..bc31815 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -272,7 +272,7 @@ namespace OpenSim.Server.Handlers.Simulation
272 //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead 272 //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead
273 } 273 }
274 274
275 // subclasses cab override this 275 // subclasses can override this
276 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) 276 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent)
277 { 277 {
278 return m_SimulationService.UpdateAgent(destination, agent); 278 return m_SimulationService.UpdateAgent(destination, agent);
@@ -280,6 +280,12 @@ namespace OpenSim.Server.Handlers.Simulation
280 280
281 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 281 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
282 { 282 {
283 if (m_SimulationService == null)
284 {
285 m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
286 return;
287 }
288
283 GridRegion destination = new GridRegion(); 289 GridRegion destination = new GridRegion();
284 destination.RegionID = regionID; 290 destination.RegionID = regionID;
285 291
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 34bb8b3..7a420e4 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -371,7 +371,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
371 /// <returns></returns> 371 /// <returns></returns>
372 public bool Delete(string id) 372 public bool Delete(string id)
373 { 373 {
374 string errorMessage = String.Empty; 374 //string errorMessage = String.Empty;
375 string url = m_serverUrl + id; 375 string url = m_serverUrl + id;
376 376
377 if (m_cache != null) 377 if (m_cache != null)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index af603b2..ae80a8c 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -255,7 +255,11 @@ namespace OpenSim.Services.GridService
255 { 255 {
256 m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); 256 m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName);
257 } 257 }
258 regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName; 258 string name = regInfo.RegionName;
259 regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort;
260 if (name != string.Empty)
261 regInfo.RegionName += ":" + name;
262
259 // Try get the map image 263 // Try get the map image
260 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); 264 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
261 // I need a texture that works for this... the one I tried doesn't seem to be working 265 // I need a texture that works for this... the one I tried doesn't seem to be working
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs
index 061effe..6e6b019 100644
--- a/OpenSim/Services/InventoryService/HGInventoryService.cs
+++ b/OpenSim/Services/InventoryService/HGInventoryService.cs
@@ -108,13 +108,13 @@ namespace OpenSim.Services.InventoryService
108 // Warp! Root folder for travelers 108 // Warp! Root folder for travelers
109 XInventoryFolder[] folders = m_Database.GetFolders( 109 XInventoryFolder[] folders = m_Database.GetFolders(
110 new string[] { "agentID", "folderName"}, 110 new string[] { "agentID", "folderName"},
111 new string[] { principalID.ToString(), "Suitcase" }); 111 new string[] { principalID.ToString(), "My Suitcase" });
112 112
113 if (folders.Length > 0) 113 if (folders.Length > 0)
114 return ConvertToOpenSim(folders[0]); 114 return ConvertToOpenSim(folders[0]);
115 115
116 // make one 116 // make one
117 XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "Suitcase"); 117 XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Suitcase");
118 return ConvertToOpenSim(suitcase); 118 return ConvertToOpenSim(suitcase);
119 } 119 }
120 120
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index af831fd..f48bf60 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -200,7 +200,14 @@ namespace OpenSim.Services.InventoryService
200 if (folders.Length == 0) 200 if (folders.Length == 0)
201 return null; 201 return null;
202 202
203 return ConvertToOpenSim(folders[0]); 203 XInventoryFolder root = null;
204 foreach (XInventoryFolder folder in folders)
205 if (folder.folderName == "My Inventory")
206 root = folder;
207 if (folders == null) // oops
208 root = folders[0];
209
210 return ConvertToOpenSim(root);
204 } 211 }
205 212
206 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 213 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
diff --git a/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj b/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj
index f19e082..481b3f8 100644
--- a/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj
+++ b/OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj
@@ -36,9 +36,9 @@
36 <SpecificVersion>False</SpecificVersion> 36 <SpecificVersion>False</SpecificVersion>
37 <HintPath>..\..\..\bin\log4net.dll</HintPath> 37 <HintPath>..\..\..\bin\log4net.dll</HintPath>
38 </Reference> 38 </Reference>
39 <Reference Include="OpenSim.Server, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> 39 <Reference Include="Robust, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
40 <SpecificVersion>False</SpecificVersion> 40 <SpecificVersion>False</SpecificVersion>
41 <HintPath>..\..\..\bin\OpenSim.Server.exe</HintPath> 41 <HintPath>..\..\..\bin\Robust.exe</HintPath>
42 </Reference> 42 </Reference>
43 <Reference Include="System" /> 43 <Reference Include="System" />
44 <Reference Include="System.Core"> 44 <Reference Include="System.Core">