aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMike Rieker2010-07-06 02:23:10 +0000
committerMike Rieker2010-07-06 02:23:10 +0000
commit6e7f1a3ac11b889175c87f59a3c5361c704363a6 (patch)
tree2ed5bebf54db3adc420e1510045b84b880ecb157 /OpenSim
parentrewrote hanging llParseStringKeepNulls() (diff)
parentUndo fix is now complete. This commit repairs the special case of the root pr... (diff)
downloadopensim-SC_OLD-6e7f1a3ac11b889175c87f59a3c5361c704363a6.zip
opensim-SC_OLD-6e7f1a3ac11b889175c87f59a3c5361c704363a6.tar.gz
opensim-SC_OLD-6e7f1a3ac11b889175c87f59a3c5361c704363a6.tar.bz2
opensim-SC_OLD-6e7f1a3ac11b889175c87f59a3c5361c704363a6.tar.xz
Merge branch 'careminster-presence-refactor' of www.3dhosting.de:/var/git/careminster into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/AssetDataBase.cs2
-rw-r--r--OpenSim/Data/IAssetData.cs2
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs4
-rw-r--r--OpenSim/Data/Migration.cs9
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs4
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs10
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteXInventoryData.cs8
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs4
-rw-r--r--OpenSim/Framework/AssetBase.cs8
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs2
-rw-r--r--OpenSim/Framework/IMoneyModule.cs30
-rw-r--r--OpenSim/Framework/ParcelMediaCommandEnum.cs2
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs1
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs17
-rw-r--r--OpenSim/Framework/UndoStack.cs58
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs24
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs11
-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/Friends/FriendsModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs65
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs1
-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/Scripting/LSLHttp/UrlModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEmailModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs64
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs138
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs168
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs52
-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.cs66
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs43
-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.cs12
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs5
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs120
-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/Services/LLLoginService/LLLoginResponse.cs21
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs4
-rw-r--r--OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs3
-rw-r--r--OpenSim/Tools/Robust.32BitLaunch/Robust.32BitLaunch.csproj4
65 files changed, 914 insertions, 386 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs
index e1a810c..b4ae913 100644
--- a/OpenSim/Data/AssetDataBase.cs
+++ b/OpenSim/Data/AssetDataBase.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Data
38 { 38 {
39 public abstract AssetBase GetAsset(UUID uuid); 39 public abstract AssetBase GetAsset(UUID uuid);
40 40
41 public abstract void StoreAsset(AssetBase asset); 41 public abstract bool StoreAsset(AssetBase asset);
42 public abstract bool ExistsAsset(UUID uuid); 42 public abstract bool ExistsAsset(UUID uuid);
43 43
44 public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); 44 public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs
index 90d5eeb..065d3a5 100644
--- a/OpenSim/Data/IAssetData.cs
+++ b/OpenSim/Data/IAssetData.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Data
34 public interface IAssetDataPlugin : IPlugin 34 public interface IAssetDataPlugin : IPlugin
35 { 35 {
36 AssetBase GetAsset(UUID uuid); 36 AssetBase GetAsset(UUID uuid);
37 void StoreAsset(AssetBase asset); 37 bool StoreAsset(AssetBase asset);
38 bool ExistsAsset(UUID uuid); 38 bool ExistsAsset(UUID uuid);
39 List<AssetMetadata> FetchAssetMetadataSet(int start, int count); 39 List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
40 void Initialise(string connect); 40 void Initialise(string connect);
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index c7488d8..c882555 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -143,7 +143,7 @@ namespace OpenSim.Data.MSSQL
143 /// Create asset in m_database 143 /// Create asset in m_database
144 /// </summary> 144 /// </summary>
145 /// <param name="asset">the asset</param> 145 /// <param name="asset">the asset</param>
146 override public void StoreAsset(AssetBase asset) 146 override public bool StoreAsset(AssetBase asset)
147 { 147 {
148 148
149 string sql = 149 string sql =
@@ -192,10 +192,12 @@ namespace OpenSim.Data.MSSQL
192 try 192 try
193 { 193 {
194 command.ExecuteNonQuery(); 194 command.ExecuteNonQuery();
195 return true;
195 } 196 }
196 catch(Exception e) 197 catch(Exception e)
197 { 198 {
198 m_log.Error("[ASSET DB]: Error storing item :" + e.Message); 199 m_log.Error("[ASSET DB]: Error storing item :" + e.Message);
200 return false;
199 } 201 }
200 } 202 }
201 } 203 }
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs
index 4f113a2..c177097 100644
--- a/OpenSim/Data/Migration.cs
+++ b/OpenSim/Data/Migration.cs
@@ -67,7 +67,6 @@ namespace OpenSim.Data
67 /// really want is the assembly of your database class. 67 /// really want is the assembly of your database class.
68 /// 68 ///
69 /// </summary> 69 /// </summary>
70
71 public class Migration 70 public class Migration
72 { 71 {
73 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -173,8 +172,6 @@ namespace OpenSim.Data
173 ExecuteScript(_conn, script); 172 ExecuteScript(_conn, script);
174 } 173 }
175 174
176
177
178 public void Update() 175 public void Update()
179 { 176 {
180 InitMigrationsTable(); 177 InitMigrationsTable();
@@ -186,8 +183,8 @@ namespace OpenSim.Data
186 return; 183 return;
187 184
188 // to prevent people from killing long migrations. 185 // to prevent people from killing long migrations.
189 m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); 186 m_log.InfoFormat("[MIGRATIONS]: Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]);
190 m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); 187 m_log.Info("[MIGRATIONS]: NOTE - this may take a while, don't interrupt this process!");
191 188
192 foreach (KeyValuePair<int, string[]> kvp in migrations) 189 foreach (KeyValuePair<int, string[]> kvp in migrations)
193 { 190 {
@@ -206,7 +203,7 @@ namespace OpenSim.Data
206 } 203 }
207 catch (Exception e) 204 catch (Exception e)
208 { 205 {
209 m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", e.Message.Replace("\n", " ")); 206 m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " "));
210 m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing."); 207 m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.");
211 ExecuteScript("ROLLBACK;"); 208 ExecuteScript("ROLLBACK;");
212 } 209 }
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index fe5152a..f9ce3d9 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Data.MySQL
153 /// </summary> 153 /// </summary>
154 /// <param name="asset">Asset UUID to create</param> 154 /// <param name="asset">Asset UUID to create</param>
155 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> 155 /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
156 override public void StoreAsset(AssetBase asset) 156 override public bool StoreAsset(AssetBase asset)
157 { 157 {
158 lock (m_dbLock) 158 lock (m_dbLock)
159 { 159 {
@@ -201,12 +201,14 @@ namespace OpenSim.Data.MySQL
201 cmd.Parameters.AddWithValue("?data", asset.Data); 201 cmd.Parameters.AddWithValue("?data", asset.Data);
202 cmd.ExecuteNonQuery(); 202 cmd.ExecuteNonQuery();
203 cmd.Dispose(); 203 cmd.Dispose();
204 return true;
204 } 205 }
205 } 206 }
206 catch (Exception e) 207 catch (Exception e)
207 { 208 {
208 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", 209 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
209 asset.FullID, asset.Name, e.Message); 210 asset.FullID, asset.Name, e.Message);
211 return false;
210 } 212 }
211 } 213 }
212 } 214 }
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/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index 16e560c..75e51a3 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLite
119 /// Create an asset 119 /// Create an asset
120 /// </summary> 120 /// </summary>
121 /// <param name="asset">Asset Base</param> 121 /// <param name="asset">Asset Base</param>
122 override public void StoreAsset(AssetBase asset) 122 override public bool StoreAsset(AssetBase asset)
123 { 123 {
124 //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); 124 //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
125 if (ExistsAsset(asset.FullID)) 125 if (ExistsAsset(asset.FullID))
@@ -141,6 +141,7 @@ namespace OpenSim.Data.SQLite
141 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 141 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
142 142
143 cmd.ExecuteNonQuery(); 143 cmd.ExecuteNonQuery();
144 return true;
144 } 145 }
145 } 146 }
146 } 147 }
@@ -161,6 +162,7 @@ namespace OpenSim.Data.SQLite
161 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 162 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
162 163
163 cmd.ExecuteNonQuery(); 164 cmd.ExecuteNonQuery();
165 return true;
164 } 166 }
165 } 167 }
166 } 168 }
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/Data/SQLiteLegacy/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
index df50902..3da298b 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLiteLegacy
119 /// Create an asset 119 /// Create an asset
120 /// </summary> 120 /// </summary>
121 /// <param name="asset">Asset Base</param> 121 /// <param name="asset">Asset Base</param>
122 override public void StoreAsset(AssetBase asset) 122 override public bool StoreAsset(AssetBase asset)
123 { 123 {
124 //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); 124 //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
125 if (ExistsAsset(asset.FullID)) 125 if (ExistsAsset(asset.FullID))
@@ -139,6 +139,7 @@ namespace OpenSim.Data.SQLiteLegacy
139 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 139 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
140 140
141 cmd.ExecuteNonQuery(); 141 cmd.ExecuteNonQuery();
142 return true;
142 } 143 }
143 } 144 }
144 } 145 }
@@ -157,6 +158,7 @@ namespace OpenSim.Data.SQLiteLegacy
157 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); 158 cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
158 159
159 cmd.ExecuteNonQuery(); 160 cmd.ExecuteNonQuery();
161 return true;
160 } 162 }
161 } 163 }
162 } 164 }
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 53d28be..98fa846 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Framework
60 /// </summary> 60 /// </summary>
61 private AssetMetadata m_metadata; 61 private AssetMetadata m_metadata;
62 62
63 private int m_uploadAttempts;
64
63 // This is needed for .NET serialization!!! 65 // This is needed for .NET serialization!!!
64 // Do NOT "Optimize" away! 66 // Do NOT "Optimize" away!
65 public AssetBase() 67 public AssetBase()
@@ -197,6 +199,12 @@ namespace OpenSim.Framework
197 set { m_metadata.Type = value; } 199 set { m_metadata.Type = value; }
198 } 200 }
199 201
202 public int UploadAttempts
203 {
204 get { return m_uploadAttempts; }
205 set { m_uploadAttempts = value; }
206 }
207
200 /// <summary> 208 /// <summary>
201 /// Is this a region only asset, or does this exist on the asset server also 209 /// Is this a region only asset, or does this exist on the asset server also
202 /// </summary> 210 /// </summary>
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/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/ParcelMediaCommandEnum.cs b/OpenSim/Framework/ParcelMediaCommandEnum.cs
index 93c41ec..e714382 100644
--- a/OpenSim/Framework/ParcelMediaCommandEnum.cs
+++ b/OpenSim/Framework/ParcelMediaCommandEnum.cs
@@ -27,7 +27,7 @@
27 27
28namespace OpenSim.Framework 28namespace OpenSim.Framework
29{ 29{
30 public enum ParcelMediaCommandEnum 30 public enum ParcelMediaCommandEnum : int
31 { 31 {
32 Stop = 0, 32 Stop = 0,
33 Pause = 1, 33 Pause = 1,
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 4d1de22..990c859 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -1196,7 +1196,7 @@ namespace OpenSim.Framework
1196 prim.Textures = this.Textures; 1196 prim.Textures = this.Textures;
1197 1197
1198 prim.Properties = new Primitive.ObjectProperties(); 1198 prim.Properties = new Primitive.ObjectProperties();
1199 prim.Properties.Name = "Primitive"; 1199 prim.Properties.Name = "Object";
1200 prim.Properties.Description = ""; 1200 prim.Properties.Description = "";
1201 prim.Properties.CreatorID = UUID.Zero; 1201 prim.Properties.CreatorID = UUID.Zero;
1202 prim.Properties.GroupID = UUID.Zero; 1202 prim.Properties.GroupID = UUID.Zero;
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index afc4060..2a74e79 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -40,6 +40,7 @@ using OpenSim.Framework.Console;
40 40
41namespace OpenSim.Framework 41namespace OpenSim.Framework
42{ 42{
43 [Serializable]
43 public class RegionLightShareData : ICloneable 44 public class RegionLightShareData : ICloneable
44 { 45 {
45 public UUID regionID = UUID.Zero; 46 public UUID regionID = UUID.Zero;
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
index eab463c..f07f7ab 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
@@ -57,11 +57,27 @@ namespace OpenSim.Framework.Servers.HttpServer
57 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> 57 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
58 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 58 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
59 { 59 {
60 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 100);
61 }
62 /// <summary>
63 /// Perform a synchronous REST request.
64 /// </summary>
65 /// <param name="verb"></param>
66 /// <param name="requestUrl"></param>
67 /// <param name="obj"> </param>
68 /// <param name="timeout"> </param>
69 /// <returns></returns>
70 ///
71 /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
72 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
73 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
74 {
60 Type type = typeof (TRequest); 75 Type type = typeof (TRequest);
61 TResponse deserial = default(TResponse); 76 TResponse deserial = default(TResponse);
62 77
63 WebRequest request = WebRequest.Create(requestUrl); 78 WebRequest request = WebRequest.Create(requestUrl);
64 request.Method = verb; 79 request.Method = verb;
80 request.Timeout = pTimeout * 1000;
65 81
66 if ((verb == "POST") || (verb == "PUT")) 82 if ((verb == "POST") || (verb == "PUT"))
67 { 83 {
@@ -81,7 +97,6 @@ namespace OpenSim.Framework.Servers.HttpServer
81 97
82 int length = (int) buffer.Length; 98 int length = (int) buffer.Length;
83 request.ContentLength = length; 99 request.ContentLength = length;
84
85 Stream requestStream = null; 100 Stream requestStream = null;
86 try 101 try
87 { 102 {
diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs
index 4d800ae..4cd779a 100644
--- a/OpenSim/Framework/UndoStack.cs
+++ b/OpenSim/Framework/UndoStack.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29 30
30namespace OpenSim.Framework 31namespace OpenSim.Framework
31{ 32{
@@ -36,33 +37,30 @@ namespace OpenSim.Framework
36 [Serializable] 37 [Serializable]
37 public class UndoStack<T> 38 public class UndoStack<T>
38 { 39 {
39 private int m_new = 1; 40 private List<T> m_undolist;
40 private int m_old = 0; 41 private int m_max;
41 private T[] m_Undos;
42 42
43 public UndoStack(int capacity) 43 public UndoStack(int capacity)
44 { 44 {
45 m_Undos = new T[capacity + 1]; 45 m_undolist = new List<T>();
46 m_max = capacity;
46 } 47 }
47 48
48 public bool IsFull 49 public bool IsFull
49 { 50 {
50 get { return m_new == m_old; } 51 get { return m_undolist.Count >= m_max; }
51 } 52 }
52 53
53 public int Capacity 54 public int Capacity
54 { 55 {
55 get { return m_Undos.Length - 1; } 56 get { return m_max; }
56 } 57 }
57 58
58 public int Count 59 public int Count
59 { 60 {
60 get 61 get
61 { 62 {
62 int count = m_new - m_old - 1; 63 return m_undolist.Count;
63 if (count < 0)
64 count += m_Undos.Length;
65 return count;
66 } 64 }
67 } 65 }
68 66
@@ -70,45 +68,39 @@ namespace OpenSim.Framework
70 { 68 {
71 if (IsFull) 69 if (IsFull)
72 { 70 {
73 m_old++; 71 m_undolist.RemoveAt(0);
74 if (m_old >= m_Undos.Length)
75 m_old -= m_Undos.Length;
76 } 72 }
77 if (++m_new >= m_Undos.Length) 73 m_undolist.Add(item);
78 m_new -= m_Undos.Length;
79 m_Undos[m_new] = item;
80 } 74 }
81 75
82 public T Pop() 76 public T Pop()
83 { 77 {
84 if (Count > 0) 78 if (m_undolist.Count > 0)
85 { 79 {
86 T deleted = m_Undos[m_new]; 80 int ind = m_undolist.Count - 1;
87 m_Undos[m_new--] = default(T); 81 T item = m_undolist[ind];
88 if (m_new < 0) 82 m_undolist.RemoveAt(ind);
89 m_new += m_Undos.Length; 83 return item;
90 return deleted;
91 } 84 }
92 else 85 else
93 throw new InvalidOperationException("Cannot pop from emtpy stack"); 86 throw new InvalidOperationException("Cannot pop from empty stack");
94 } 87 }
95 88
96 public T Peek() 89 public T Peek()
97 { 90 {
98 return m_Undos[m_new]; 91 if (m_undolist.Count > 0)
92 {
93 return m_undolist[m_undolist.Count - 1];
94 }
95 else
96 {
97 return default(T);
98 }
99 } 99 }
100 100
101 public void Clear() 101 public void Clear()
102 { 102 {
103 if (Count > 0) 103 m_undolist.Clear();
104 {
105 for (int i = 0; i < m_Undos.Length; i++)
106 {
107 m_Undos[i] = default(T);
108 }
109 m_new = 1;
110 m_old = 0;
111 }
112 } 104 }
113 } 105 }
114} 106}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index f071841..4dfd5d1 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2208,6 +2208,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2208 OutPacket(sound, ThrottleOutPacketType.Task); 2208 OutPacket(sound, ThrottleOutPacketType.Task);
2209 } 2209 }
2210 2210
2211 public void SendTransferAbort(TransferRequestPacket transferRequest)
2212 {
2213 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2214 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2215 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2216 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2217 OutPacket(abort, ThrottleOutPacketType.Task);
2218 }
2219
2211 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2220 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2212 { 2221 {
2213 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2222 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -6307,8 +6316,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6307 if (handlerObjectDuplicate != null) 6316 if (handlerObjectDuplicate != null)
6308 { 6317 {
6309 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, 6318 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
6310 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, 6319 dupe.SharedData.DuplicateFlags, AgentId,
6311 AgentandGroupData.GroupID); 6320 m_activeGroupID);
6312 } 6321 }
6313 } 6322 }
6314 6323
@@ -6898,7 +6907,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6898 if (handlerObjectDuplicateOnRay != null) 6907 if (handlerObjectDuplicateOnRay != null)
6899 { 6908 {
6900 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, 6909 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
6901 dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, 6910 AgentId, m_activeGroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
6902 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, 6911 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
6903 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); 6912 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
6904 } 6913 }
@@ -11502,7 +11511,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11502 11511
11503// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 11512// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
11504 11513
11514
11515 //Note, the bool returned from the below function is useless since it is always false.
11505 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 11516 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
11517
11506 } 11518 }
11507 11519
11508 /// <summary> 11520 /// <summary>
@@ -11551,8 +11563,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11551 } 11563 }
11552 11564
11553 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID); 11565 //m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing. Dropping", requestID);
11554 11566
11555 // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. 11567 //We need to send a TransferAbort here, so the client doesn't wait forever for the asset,
11568 //which causes it to not request any more for a while. Which is bad.
11569 SendTransferAbort(transferRequest);
11556 return; 11570 return;
11557 } 11571 }
11558 11572
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index cda461c..f2bcc0b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -900,7 +900,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
900 900
901 // Start the IClientAPI 901 // Start the IClientAPI
902 // Spin it off so that it doesn't clog up the LLUDPServer 902 // Spin it off so that it doesn't clog up the LLUDPServer
903 Util.FireAndForget(delegate(object o) { client.Start(); }); 903 //Util.FireAndForget(delegate(object o) { client.Start(); });
904
905 // NOTE: DO NOT CALL THIS ASYNCHRONOUSLY!!!!!
906 // This method will ultimately cause the modules to hook
907 // client events in OnNewClient. If they can't do this
908 // before further packets are processed, packets WILL BE LOST.
909 // This includes the all-important EconomyDataRequest!
910 // So using FireAndForget here WILL screw up money. Badly.
911 // You have been warned!
912 client.Start();
904 } 913 }
905 else 914 else
906 { 915 {
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/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index c6f8b88..ca0b7ad 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -769,8 +769,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
769 bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0; 769 bool canEditObjectsChanged = ((rights ^ userFlags) & (int)FriendRights.CanModifyObjects) != 0;
770 if (canEditObjectsChanged) 770 if (canEditObjectsChanged)
771 friendClient.SendChangeUserRights(userID, friendID, rights); 771 friendClient.SendChangeUserRights(userID, friendID, rights);
772
772 } 773 }
773 774
775 // update local cache
776 //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
777 foreach (FriendInfo finfo in m_Friends[friendID].Friends)
778 if (finfo.Friend == userID.ToString())
779 finfo.TheirFlags = rights;
780
774 return true; 781 return true;
775 } 782 }
776 783
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index 2dc7384..ffdac58 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -156,12 +156,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
156 return; 156 return;
157 } 157 }
158 158
159 if (dialog == (byte)InstantMessageDialog.MessageFromAgent || 159 DateTime dt = DateTime.UtcNow;
160 dialog == (byte)InstantMessageDialog.MessageFromObject) 160
161 // Ticks from UtcNow, but make it look like local. Evil, huh?
162 dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
163
164 try
165 {
166 // Convert that to the PST timezone
167 TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
168 dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
169 }
170 catch
161 { 171 {
162 im.offline = 1; 172 m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp.");
163 } 173 }
164 174
175 // And make it look local again to fool the unix time util
176 dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
177
178 im.timestamp = (uint)Util.ToUnixTime(dt);
179
180 // If client is null, this message comes from storage and IS offline
181 if (client != null)
182 im.offline = 0;
183
165 if (m_TransferModule != null) 184 if (m_TransferModule != null)
166 { 185 {
167 m_TransferModule.SendInstantMessage(im, 186 m_TransferModule.SendInstantMessage(im,
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index a2dc91f..feeb9e6 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -192,6 +192,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
192 // Needed for proper state management for stored group 192 // Needed for proper state management for stored group
193 // invitations 193 // invitations
194 // 194 //
195
196 im.offline = 1;
197
198 // Reconstruct imSessionID
199 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
200 {
201 UUID fromAgentID = new UUID(im.fromAgentID);
202 UUID sessionID = fromAgentID ^ client.AgentId;
203 im.imSessionID = new Guid(sessionID.ToString());
204 }
205
195 Scene s = FindScene(client.AgentId); 206 Scene s = FindScene(client.AgentId);
196 if (s != null) 207 if (s != null)
197 s.EventManager.TriggerIncomingInstantMessage(im); 208 s.EventManager.TriggerIncomingInstantMessage(im);
@@ -201,35 +212,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
201 212
202 private void UndeliveredMessage(GridInstantMessage im) 213 private void UndeliveredMessage(GridInstantMessage im)
203 { 214 {
204 if (im.dialog == 19) 215 if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
205 im.offline = 1; // We want them pushed out to the server 216 im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
206 if ((im.offline != 0) 217 im.dialog != (byte)InstantMessageDialog.GroupNotice &&
207 && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) 218 im.dialog != (byte)InstantMessageDialog.InventoryOffered)
208 { 219 {
209 // It's not delivered. Make sure the scope id is saved 220 return;
210 // We don't need the imSessionID here anymore, overwrite it 221 }
211 Scene scene = FindScene(new UUID(im.fromAgentID));
212 if (scene == null)
213 scene = m_SceneList[0];
214 im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString());
215 222
216 bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( 223 // It's not delivered. Make sure the scope id is saved
217 "POST", m_RestURL+"/SaveMessage/", im); 224 // We don't need the imSessionID here anymore, overwrite it
225 Scene scene = FindScene(new UUID(im.fromAgentID));
226 if (scene == null)
227 scene = m_SceneList[0];
228 im.imSessionID = new Guid(scene.RegionInfo.ScopeID.ToString());
218 229
219 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) 230 bool success = SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
220 { 231 "POST", m_RestURL+"/SaveMessage/", im);
221 IClientAPI client = FindClient(new UUID(im.fromAgentID)); 232
222 if (client == null) 233 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
223 return; 234 {
224 235 IClientAPI client = FindClient(new UUID(im.fromAgentID));
225 client.SendInstantMessage(new GridInstantMessage( 236 if (client == null)
226 null, new UUID(im.toAgentID), 237 return;
227 "System", new UUID(im.fromAgentID), 238
228 (byte)InstantMessageDialog.MessageFromAgent, 239 client.SendInstantMessage(new GridInstantMessage(
229 "User is not logged in. "+ 240 null, new UUID(im.toAgentID),
230 (success ? "Message saved." : "Message not saved"), 241 "System", new UUID(im.fromAgentID),
231 false, new Vector3())); 242 (byte)InstantMessageDialog.MessageFromAgent,
232 } 243 "User is not logged in. "+
244 (success ? "Message saved." : "Message not saved"),
245 false, new Vector3()));
233 } 246 }
234 } 247 }
235 } 248 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 2ab46aa..b0555da 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -131,6 +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 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
135 SceneObjectGroup objectGroup, IClientAPI remoteClient) 136 SceneObjectGroup objectGroup, IClientAPI remoteClient)
136 { 137 {
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/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 9b565ed..1fd1f47 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
142 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); 142 engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
143 return urlcode; 143 return urlcode;
144 } 144 }
145 string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; 145 string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString();
146 146
147 UrlData urlData = new UrlData(); 147 UrlData urlData = new UrlData();
148 urlData.hostID = host.UUID; 148 urlData.hostID = host.UUID;
@@ -152,10 +152,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
152 urlData.urlcode = urlcode; 152 urlData.urlcode = urlcode;
153 urlData.requests = new Dictionary<UUID, RequestData>(); 153 urlData.requests = new Dictionary<UUID, RequestData>();
154 154
155
156 m_UrlMap[url] = urlData; 155 m_UrlMap[url] = urlData;
157 156
158 string uri = "/lslhttp/" + urlcode.ToString() + "/"; 157 string uri = "/lslhttp/" + urlcode.ToString();
159 158
160 m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, 159 m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll,
161 new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, 160 new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents,
@@ -386,6 +385,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
386 385
387 return response; 386 return response;
388 } 387 }
388
389 public void HttpRequestHandler(UUID requestID, Hashtable request) 389 public void HttpRequestHandler(UUID requestID, Hashtable request)
390 { 390 {
391 lock (request) 391 lock (request)
@@ -400,8 +400,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
400 400
401 int pos1 = uri.IndexOf("/");// /lslhttp 401 int pos1 = uri.IndexOf("/");// /lslhttp
402 int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ 402 int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/
403 int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ 403 int pos3 = pos2 + 37; // /lslhttp/urlcode
404 string uri_tmp = uri.Substring(0, pos3 + 1); 404 string uri_tmp = uri.Substring(0, pos3);
405 //HTTP server code doesn't provide us with QueryStrings 405 //HTTP server code doesn't provide us with QueryStrings
406 string pathInfo; 406 string pathInfo;
407 string queryString; 407 string queryString;
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/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 91c8130..cfee1b0 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1303,18 +1303,31 @@ namespace OpenSim.Region.CoreModules.World.Land
1303 1303
1304 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1304 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1305 { 1305 {
1306 for (int i = 0; i < data.Count; i++) 1306 lock (m_landList)
1307 { 1307 {
1308 IncomingLandObjectFromStorage(data[i]); 1308 //Remove all the land objects in the sim and then process our new data
1309 foreach (int n in m_landList.Keys)
1310 {
1311 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID);
1312 }
1313 m_landIDList.Initialize();
1314 m_landList.Clear();
1315
1316 for (int i = 0; i < data.Count; i++)
1317 {
1318 IncomingLandObjectFromStorage(data[i]);
1319 }
1309 } 1320 }
1310 } 1321 }
1311 1322
1312 public void IncomingLandObjectFromStorage(LandData data) 1323 public void IncomingLandObjectFromStorage(LandData data)
1313 { 1324 {
1325
1314 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1326 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1315 new_land.LandData = data.Copy(); 1327 new_land.LandData = data.Copy();
1316 new_land.SetLandBitmapFromByteArray(); 1328 new_land.SetLandBitmapFromByteArray();
1317 AddLandObject(new_land); 1329 AddLandObject(new_land);
1330 new_land.SendLandUpdateToAvatarsOverMe();
1318 } 1331 }
1319 1332
1320 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 1333 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 1e7ea7b..0c20393 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -544,6 +544,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
544 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); 544 m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised());
545 m_scene.SaveTerrain(); 545 m_scene.SaveTerrain();
546 546
547 m_scene.EventManager.TriggerTerrainUpdate();
548
547 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. 549 // Clients who look at the map will never see changes after they looked at the map, so i've commented this out.
548 //m_scene.CreateTerrainTexture(true); 550 //m_scene.CreateTerrainTexture(true);
549 } 551 }
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/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/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index ef125cd..0c9759d 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -55,8 +55,12 @@ namespace OpenSim.Region.Framework.Scenes
55 55
56 public delegate void OnTerrainTickDelegate(); 56 public delegate void OnTerrainTickDelegate();
57 57
58 public delegate void OnTerrainUpdateDelegate();
59
58 public event OnTerrainTickDelegate OnTerrainTick; 60 public event OnTerrainTickDelegate OnTerrainTick;
59 61
62 public event OnTerrainUpdateDelegate OnTerrainUpdate;
63
60 public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); 64 public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
61 65
62 public event OnBackupDelegate OnBackup; 66 public event OnBackupDelegate OnBackup;
@@ -716,6 +720,26 @@ namespace OpenSim.Region.Framework.Scenes
716 } 720 }
717 } 721 }
718 } 722 }
723 public void TriggerTerrainUpdate()
724 {
725 OnTerrainUpdateDelegate handlerTerrainUpdate = OnTerrainUpdate;
726 if (handlerTerrainUpdate != null)
727 {
728 foreach (OnTerrainUpdateDelegate d in handlerTerrainUpdate.GetInvocationList())
729 {
730 try
731 {
732 d();
733 }
734 catch (Exception e)
735 {
736 m_log.ErrorFormat(
737 "[EVENT MANAGER]: Delegate for TriggerTerrainUpdate failed - continuing. {0} {1}",
738 e.Message, e.StackTrace);
739 }
740 }
741 }
742 }
719 743
720 public void TriggerTerrainTick() 744 public void TriggerTerrainTick()
721 { 745 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 5e1798b..b859042 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);
@@ -400,9 +400,9 @@ namespace OpenSim.Region.Framework.Scenes
400 if (Permissions.PropagatePermissions() && recipient != senderId) 400 if (Permissions.PropagatePermissions() && recipient != senderId)
401 { 401 {
402 // First, make sore base is limited to the next perms 402 // First, make sore base is limited to the next perms
403 itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; 403 itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move);
404 // By default, current equals base 404 // By default, current equals base
405 itemCopy.CurrentPermissions = itemCopy.BasePermissions; 405 itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions;
406 406
407 // If this is an object, replace current perms 407 // If this is an object, replace current perms
408 // with folded perms 408 // with folded perms
@@ -413,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
413 } 413 }
414 414
415 // Ensure there is no escalation 415 // Ensure there is no escalation
416 itemCopy.CurrentPermissions &= item.NextPermissions; 416 itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move);
417 417
418 // Need slam bit on xfer 418 // Need slam bit on xfer
419 itemCopy.CurrentPermissions |= 8; 419 itemCopy.CurrentPermissions |= 8;
@@ -916,14 +916,15 @@ namespace OpenSim.Region.Framework.Scenes
916 916
917 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) 917 if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
918 { 918 {
919 agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions; 919 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
920 if (taskItem.InvType == (int)InventoryType.Object) 920 if (taskItem.InvType == (int)InventoryType.Object)
921 agentItem.CurrentPermissions = agentItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13); 921 agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move));
922 agentItem.CurrentPermissions = agentItem.BasePermissions ; 922 else
923 agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
923 924
924 agentItem.CurrentPermissions |= 8; 925 agentItem.CurrentPermissions |= 8;
925 agentItem.NextPermissions = taskItem.NextPermissions; 926 agentItem.NextPermissions = taskItem.NextPermissions;
926 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions; 927 agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
927 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; 928 agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions;
928 } 929 }
929 else 930 else
@@ -1105,13 +1106,13 @@ namespace OpenSim.Region.Framework.Scenes
1105 if (Permissions.PropagatePermissions()) 1106 if (Permissions.PropagatePermissions())
1106 { 1107 {
1107 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & 1108 destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions &
1108 srcTaskItem.NextPermissions; 1109 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1109 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions & 1110 destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions &
1110 srcTaskItem.NextPermissions; 1111 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1111 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions & 1112 destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions &
1112 srcTaskItem.NextPermissions; 1113 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1113 destTaskItem.BasePermissions = srcTaskItem.BasePermissions & 1114 destTaskItem.BasePermissions = srcTaskItem.BasePermissions &
1114 srcTaskItem.NextPermissions; 1115 (srcTaskItem.NextPermissions | (uint)PermissionMask.Move);
1115 destTaskItem.CurrentPermissions |= 8; // Slam! 1116 destTaskItem.CurrentPermissions |= 8; // Slam!
1116 } 1117 }
1117 } 1118 }
@@ -1284,7 +1285,7 @@ namespace OpenSim.Region.Framework.Scenes
1284 } 1285 }
1285 if (part.Inventory.UpdateInventoryItem(itemInfo)) 1286 if (part.Inventory.UpdateInventoryItem(itemInfo))
1286 { 1287 {
1287 remoteClient.SendAgentAlertMessage("Notecard saved", false); 1288 // remoteClient.SendAgentAlertMessage("Notecard saved", false);
1288 part.GetProperties(remoteClient); 1289 part.GetProperties(remoteClient);
1289 } 1290 }
1290 } 1291 }
@@ -1377,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
1377 return; 1378 return;
1378 1379
1379 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, 1380 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
1380 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), 1381 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
1381 remoteClient.AgentId); 1382 remoteClient.AgentId);
1382 AssetService.Store(asset); 1383 AssetService.Store(asset);
1383 1384
@@ -1592,18 +1593,36 @@ namespace OpenSim.Region.Framework.Scenes
1592 // for when deleting the object from it 1593 // for when deleting the object from it
1593 ForceSceneObjectBackup(grp); 1594 ForceSceneObjectBackup(grp);
1594 1595
1595 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) 1596 if (remoteClient == null)
1596 permissionToTakeCopy = false; 1597 {
1597 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) 1598 // Autoreturn has a null client. Nothing else does. So
1598 permissionToTake = false; 1599 // allow only returns
1600 if (action != DeRezAction.Return)
1601 return;
1599 1602
1600 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) 1603 permissionToTakeCopy = false;
1601 permissionToDelete = false; 1604 }
1605 else
1606 {
1607 if (action == DeRezAction.TakeCopy)
1608 {
1609 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
1610 permissionToTakeCopy = false;
1611 }
1612 else
1613 {
1614 permissionToTakeCopy = false;
1615 }
1616 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
1617 permissionToTake = false;
1602 1618
1619 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
1620 permissionToDelete = false;
1621 }
1603 } 1622 }
1604 1623
1605 // Handle god perms 1624 // Handle god perms
1606 if (Permissions.IsGod(remoteClient.AgentId)) 1625 if (remoteClient != null && Permissions.IsGod(remoteClient.AgentId))
1607 { 1626 {
1608 permissionToTake = true; 1627 permissionToTake = true;
1609 permissionToTakeCopy = true; 1628 permissionToTakeCopy = true;
@@ -1614,7 +1633,7 @@ namespace OpenSim.Region.Framework.Scenes
1614 if (action == DeRezAction.SaveToExistingUserInventoryItem) 1633 if (action == DeRezAction.SaveToExistingUserInventoryItem)
1615 permissionToDelete = false; 1634 permissionToDelete = false;
1616 1635
1617 // if we want to take a copy,, we also don't want to delete 1636 // if we want to take a copy, we also don't want to delete
1618 // Note: after this point, the permissionToTakeCopy flag 1637 // Note: after this point, the permissionToTakeCopy flag
1619 // becomes irrelevant. It already includes the permissionToTake 1638 // becomes irrelevant. It already includes the permissionToTake
1620 // permission and after excluding no copy items here, we can 1639 // permission and after excluding no copy items here, we can
@@ -1625,6 +1644,7 @@ namespace OpenSim.Region.Framework.Scenes
1625 if (!permissionToTakeCopy) 1644 if (!permissionToTakeCopy)
1626 return; 1645 return;
1627 1646
1647 permissionToTake = true;
1628 // Don't delete 1648 // Don't delete
1629 permissionToDelete = false; 1649 permissionToDelete = false;
1630 } 1650 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index dc58d84..c5fb198 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1770,6 +1770,7 @@ namespace OpenSim.Region.Framework.Scenes
1770 public void StoreWindlightProfile(RegionLightShareData wl) 1770 public void StoreWindlightProfile(RegionLightShareData wl)
1771 { 1771 {
1772 m_regInfo.WindlightSettings = wl; 1772 m_regInfo.WindlightSettings = wl;
1773 wl.Save();
1773 m_storageManager.DataStore.StoreRegionWindlightSettings(wl); 1774 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1774 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1775 m_eventManager.TriggerOnSaveNewWindlightProfile();
1775 } 1776 }
@@ -2183,6 +2184,15 @@ namespace OpenSim.Region.Framework.Scenes
2183 /// </summary> 2184 /// </summary>
2184 public void DeleteAllSceneObjects() 2185 public void DeleteAllSceneObjects()
2185 { 2186 {
2187 DeleteAllSceneObjects(false);
2188 }
2189
2190 /// <summary>
2191 /// Delete every object from the scene. This does not include attachments worn by avatars.
2192 /// </summary>
2193 public void DeleteAllSceneObjects(bool exceptNoCopy)
2194 {
2195 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2186 lock (Entities) 2196 lock (Entities)
2187 { 2197 {
2188 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2198 ICollection<EntityBase> entities = new List<EntityBase>(Entities);
@@ -2192,11 +2202,24 @@ namespace OpenSim.Region.Framework.Scenes
2192 if (e is SceneObjectGroup) 2202 if (e is SceneObjectGroup)
2193 { 2203 {
2194 SceneObjectGroup sog = (SceneObjectGroup)e; 2204 SceneObjectGroup sog = (SceneObjectGroup)e;
2195 if (!sog.IsAttachment) 2205 if (sog != null && !sog.IsAttachment)
2196 DeleteSceneObject((SceneObjectGroup)e, false); 2206 {
2207 if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
2208 {
2209 DeleteSceneObject((SceneObjectGroup)e, false);
2210 }
2211 else
2212 {
2213 toReturn.Add((SceneObjectGroup)e);
2214 }
2215 }
2197 } 2216 }
2198 } 2217 }
2199 } 2218 }
2219 if (toReturn.Count > 0)
2220 {
2221 returnObjects(toReturn.ToArray(), UUID.Zero);
2222 }
2200 } 2223 }
2201 2224
2202 /// <summary> 2225 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 81ef54f..a36800b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1848,9 +1848,31 @@ namespace OpenSim.Region.Framework.Scenes
1848 { 1848 {
1849 if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition)) 1849 if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition))
1850 { 1850 {
1851 SceneObjectGroup copy = original.Copy(AgentID, GroupID, true); 1851 SceneObjectGroup copy = original.Copy(true);
1852 copy.AbsolutePosition = copy.AbsolutePosition + offset; 1852 copy.AbsolutePosition = copy.AbsolutePosition + offset;
1853 1853
1854 if (original.OwnerID != AgentID)
1855 {
1856 copy.SetOwnerId(AgentID);
1857 copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
1858
1859 List<SceneObjectPart> partList =
1860 new List<SceneObjectPart>(copy.Children.Values);
1861
1862 if (m_parentScene.Permissions.PropagatePermissions())
1863 {
1864 foreach (SceneObjectPart child in partList)
1865 {
1866 child.Inventory.ChangeInventoryOwner(AgentID);
1867 child.TriggerScriptChangedEvent(Changed.OWNER);
1868 child.ApplyNextOwnerPermissions();
1869 }
1870 }
1871
1872 copy.RootPart.ObjectSaleType = 0;
1873 copy.RootPart.SalePrice = 10;
1874 }
1875
1854 Entities.Add(copy); 1876 Entities.Add(copy);
1855 1877
1856 // Since we copy from a source group that is in selected 1878 // 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 7081ced..f85d3d9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -349,7 +349,21 @@ namespace OpenSim.Region.Framework.Scenes
349 public virtual Quaternion Rotation 349 public virtual Quaternion Rotation
350 { 350 {
351 get { return m_rotation; } 351 get { return m_rotation; }
352 set { m_rotation = value; } 352 set {
353 lockPartsForRead(true);
354 try
355 {
356 foreach(SceneObjectPart p in m_parts.Values)
357 {
358 p.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
359 }
360 }
361 finally
362 {
363 lockPartsForRead(false);
364 }
365 m_rotation = value;
366 }
353 } 367 }
354 368
355 public Quaternion GroupRotation 369 public Quaternion GroupRotation
@@ -431,7 +445,10 @@ namespace OpenSim.Region.Framework.Scenes
431 } 445 }
432 446
433 lockPartsForRead(true); 447 lockPartsForRead(true);
434 448 foreach (SceneObjectPart part in m_parts.Values)
449 {
450 part.IgnoreUndoUpdate = true;
451 }
435 if (RootPart.GetStatusSandbox()) 452 if (RootPart.GetStatusSandbox())
436 { 453 {
437 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) 454 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
@@ -443,12 +460,12 @@ namespace OpenSim.Region.Framework.Scenes
443 return; 460 return;
444 } 461 }
445 } 462 }
446
447 foreach (SceneObjectPart part in m_parts.Values) 463 foreach (SceneObjectPart part in m_parts.Values)
448 { 464 {
465 part.IgnoreUndoUpdate = false;
466 part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
449 part.GroupPosition = val; 467 part.GroupPosition = val;
450 } 468 }
451
452 lockPartsForRead(false); 469 lockPartsForRead(false);
453 470
454 //if (m_rootPart.PhysActor != null) 471 //if (m_rootPart.PhysActor != null)
@@ -724,7 +741,6 @@ namespace OpenSim.Region.Framework.Scenes
724 { 741 {
725 foreach (SceneObjectPart part in m_parts.Values) 742 foreach (SceneObjectPart part in m_parts.Values)
726 { 743 {
727
728 Vector3 partscale = part.Scale; 744 Vector3 partscale = part.Scale;
729 Vector3 partoffset = part.OffsetPosition; 745 Vector3 partoffset = part.OffsetPosition;
730 746
@@ -1471,7 +1487,7 @@ namespace OpenSim.Region.Framework.Scenes
1471 1487
1472 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) 1488 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
1473 { 1489 {
1474 part.StoreUndoState(); 1490 part.StoreUndoState(UndoType.STATE_PRIM_ALL);
1475 part.OnGrab(offsetPos, remoteClient); 1491 part.OnGrab(offsetPos, remoteClient);
1476 } 1492 }
1477 1493
@@ -1700,7 +1716,7 @@ namespace OpenSim.Region.Framework.Scenes
1700 "[SCENE]: Storing {0}, {1} in {2}", 1716 "[SCENE]: Storing {0}, {1} in {2}",
1701 Name, UUID, m_scene.RegionInfo.RegionName); 1717 Name, UUID, m_scene.RegionInfo.RegionName);
1702 1718
1703 SceneObjectGroup backup_group = Copy(OwnerID, GroupID, false); 1719 SceneObjectGroup backup_group = Copy(false);
1704 backup_group.RootPart.Velocity = RootPart.Velocity; 1720 backup_group.RootPart.Velocity = RootPart.Velocity;
1705 backup_group.RootPart.Acceleration = RootPart.Acceleration; 1721 backup_group.RootPart.Acceleration = RootPart.Acceleration;
1706 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1722 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
@@ -1758,7 +1774,7 @@ namespace OpenSim.Region.Framework.Scenes
1758 /// Duplicates this object, including operations such as physics set up and attaching to the backup event. 1774 /// Duplicates this object, including operations such as physics set up and attaching to the backup event.
1759 /// </summary> 1775 /// </summary>
1760 /// <returns></returns> 1776 /// <returns></returns>
1761 public SceneObjectGroup Copy(UUID cAgentID, UUID cGroupID, bool userExposed) 1777 public SceneObjectGroup Copy(bool userExposed)
1762 { 1778 {
1763 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 1779 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
1764 dupe.m_isBackedUp = false; 1780 dupe.m_isBackedUp = false;
@@ -1781,7 +1797,9 @@ namespace OpenSim.Region.Framework.Scenes
1781 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 1797 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
1782 1798
1783 if (!userExposed) 1799 if (!userExposed)
1800 {
1784 dupe.RootPart.IsAttachment = previousAttachmentStatus; 1801 dupe.RootPart.IsAttachment = previousAttachmentStatus;
1802 }
1785 1803
1786 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 1804 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
1787 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 1805 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
@@ -1806,16 +1824,6 @@ namespace OpenSim.Region.Framework.Scenes
1806 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); 1824 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
1807 } 1825 }
1808 1826
1809 // Now we've made a copy that replaces this one, we need to
1810 // switch the owner to the person who did the copying
1811 // Second Life copies an object and duplicates the first one in it's place
1812 // So, we have to make a copy of this one, set it in it's place then set the owner on this one
1813 if (userExposed)
1814 {
1815 SetRootPartOwner(m_rootPart, cAgentID, cGroupID);
1816 m_rootPart.ScheduleFullUpdate();
1817 }
1818
1819 List<SceneObjectPart> partList; 1827 List<SceneObjectPart> partList;
1820 1828
1821 lockPartsForRead(true); 1829 lockPartsForRead(true);
@@ -1837,12 +1845,6 @@ namespace OpenSim.Region.Framework.Scenes
1837 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); 1845 SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed);
1838 1846
1839 newPart.LinkNum = part.LinkNum; 1847 newPart.LinkNum = part.LinkNum;
1840
1841 if (userExposed)
1842 {
1843 SetPartOwner(newPart, cAgentID, cGroupID);
1844 newPart.ScheduleFullUpdate();
1845 }
1846 } 1848 }
1847 } 1849 }
1848 1850
@@ -3146,7 +3148,6 @@ namespace OpenSim.Region.Framework.Scenes
3146 SceneObjectPart part = GetChildPart(localID); 3148 SceneObjectPart part = GetChildPart(localID);
3147 if (part != null) 3149 if (part != null)
3148 { 3150 {
3149 part.IgnoreUndoUpdate = true;
3150 if (scale.X > m_scene.m_maxNonphys) 3151 if (scale.X > m_scene.m_maxNonphys)
3151 scale.X = m_scene.m_maxNonphys; 3152 scale.X = m_scene.m_maxNonphys;
3152 if (scale.Y > m_scene.m_maxNonphys) 3153 if (scale.Y > m_scene.m_maxNonphys)
@@ -3232,8 +3233,7 @@ namespace OpenSim.Region.Framework.Scenes
3232 y *= a; 3233 y *= a;
3233 z *= a; 3234 z *= a;
3234 } 3235 }
3235 obPart.IgnoreUndoUpdate = false; 3236
3236 obPart.StoreUndoState();
3237 } 3237 }
3238 } 3238 }
3239 } 3239 }
@@ -3243,16 +3243,24 @@ namespace OpenSim.Region.Framework.Scenes
3243 Vector3 prevScale = part.Scale; 3243 Vector3 prevScale = part.Scale;
3244 prevScale.X *= x; 3244 prevScale.X *= x;
3245 prevScale.Y *= y; 3245 prevScale.Y *= y;
3246 prevScale.Z *= z; 3246 prevScale.Z *= z;;
3247
3248 part.IgnoreUndoUpdate = false;
3249 part.StoreUndoState(UndoType.STATE_GROUP_SCALE);
3250 part.IgnoreUndoUpdate = true;
3247 part.Resize(prevScale); 3251 part.Resize(prevScale);
3252 part.IgnoreUndoUpdate = false;
3248 3253
3249 lockPartsForRead(true); 3254 lockPartsForRead(true);
3250 { 3255 {
3251 foreach (SceneObjectPart obPart in m_parts.Values) 3256 foreach (SceneObjectPart obPart in m_parts.Values)
3252 { 3257 {
3253 obPart.IgnoreUndoUpdate = true;
3254 if (obPart.UUID != m_rootPart.UUID) 3258 if (obPart.UUID != m_rootPart.UUID)
3255 { 3259 {
3260 obPart.IgnoreUndoUpdate = false;
3261 obPart.StoreUndoState(UndoType.STATE_GROUP_SCALE);
3262 obPart.IgnoreUndoUpdate = true;
3263
3256 Vector3 currentpos = new Vector3(obPart.OffsetPosition); 3264 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
3257 currentpos.X *= x; 3265 currentpos.X *= x;
3258 currentpos.Y *= y; 3266 currentpos.Y *= y;
@@ -3265,7 +3273,6 @@ namespace OpenSim.Region.Framework.Scenes
3265 obPart.UpdateOffSet(currentpos); 3273 obPart.UpdateOffSet(currentpos);
3266 } 3274 }
3267 obPart.IgnoreUndoUpdate = false; 3275 obPart.IgnoreUndoUpdate = false;
3268 obPart.StoreUndoState();
3269 } 3276 }
3270 } 3277 }
3271 lockPartsForRead(false); 3278 lockPartsForRead(false);
@@ -3277,7 +3284,6 @@ namespace OpenSim.Region.Framework.Scenes
3277 } 3284 }
3278 3285
3279 part.IgnoreUndoUpdate = false; 3286 part.IgnoreUndoUpdate = false;
3280 part.StoreUndoState();
3281 HasGroupChanged = true; 3287 HasGroupChanged = true;
3282 ScheduleGroupForTerseUpdate(); 3288 ScheduleGroupForTerseUpdate();
3283 } 3289 }
@@ -3293,14 +3299,11 @@ namespace OpenSim.Region.Framework.Scenes
3293 /// <param name="pos"></param> 3299 /// <param name="pos"></param>
3294 public void UpdateGroupPosition(Vector3 pos) 3300 public void UpdateGroupPosition(Vector3 pos)
3295 { 3301 {
3296 foreach (SceneObjectPart part in Children.Values)
3297 {
3298 part.StoreUndoState();
3299 }
3300 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 3302 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
3301 { 3303 {
3302 if (IsAttachment) 3304 if (IsAttachment)
3303 { 3305 {
3306 m_rootPart.StoreUndoState(UndoType.STATE_GROUP_POSITION);
3304 m_rootPart.AttachedPos = pos; 3307 m_rootPart.AttachedPos = pos;
3305 } 3308 }
3306 if (RootPart.GetStatusSandbox()) 3309 if (RootPart.GetStatusSandbox())
@@ -3333,7 +3336,7 @@ namespace OpenSim.Region.Framework.Scenes
3333 SceneObjectPart part = GetChildPart(localID); 3336 SceneObjectPart part = GetChildPart(localID);
3334 foreach (SceneObjectPart parts in Children.Values) 3337 foreach (SceneObjectPart parts in Children.Values)
3335 { 3338 {
3336 parts.StoreUndoState(); 3339 parts.StoreUndoState(UndoType.STATE_PRIM_POSITION);
3337 } 3340 }
3338 if (part != null) 3341 if (part != null)
3339 { 3342 {
@@ -3358,7 +3361,7 @@ namespace OpenSim.Region.Framework.Scenes
3358 { 3361 {
3359 foreach (SceneObjectPart part in Children.Values) 3362 foreach (SceneObjectPart part in Children.Values)
3360 { 3363 {
3361 part.StoreUndoState(); 3364 part.StoreUndoState(UndoType.STATE_PRIM_POSITION);
3362 } 3365 }
3363 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3366 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3364 Vector3 oldPos = 3367 Vector3 oldPos =
@@ -3383,10 +3386,27 @@ namespace OpenSim.Region.Framework.Scenes
3383 } 3386 }
3384 lockPartsForRead(false); 3387 lockPartsForRead(false);
3385 3388
3386 AbsolutePosition = newPos; 3389 //We have to set undoing here because otherwise an undo state will be saved
3390 if (!m_rootPart.Undoing)
3391 {
3392 m_rootPart.Undoing = true;
3393 AbsolutePosition = newPos;
3394 m_rootPart.Undoing = false;
3395 }
3396 else
3397 {
3398 AbsolutePosition = newPos;
3399 }
3387 3400
3388 HasGroupChanged = true; 3401 HasGroupChanged = true;
3389 ScheduleGroupForTerseUpdate(); 3402 if (m_rootPart.Undoing)
3403 {
3404 ScheduleGroupForFullUpdate();
3405 }
3406 else
3407 {
3408 ScheduleGroupForTerseUpdate();
3409 }
3390 } 3410 }
3391 3411
3392 public void OffsetForNewRegion(Vector3 offset) 3412 public void OffsetForNewRegion(Vector3 offset)
@@ -3406,7 +3426,7 @@ namespace OpenSim.Region.Framework.Scenes
3406 { 3426 {
3407 foreach (SceneObjectPart parts in Children.Values) 3427 foreach (SceneObjectPart parts in Children.Values)
3408 { 3428 {
3409 parts.StoreUndoState(); 3429 parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
3410 } 3430 }
3411 m_rootPart.UpdateRotation(rot); 3431 m_rootPart.UpdateRotation(rot);
3412 3432
@@ -3430,7 +3450,7 @@ namespace OpenSim.Region.Framework.Scenes
3430 { 3450 {
3431 foreach (SceneObjectPart parts in Children.Values) 3451 foreach (SceneObjectPart parts in Children.Values)
3432 { 3452 {
3433 parts.StoreUndoState(); 3453 parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
3434 } 3454 }
3435 m_rootPart.UpdateRotation(rot); 3455 m_rootPart.UpdateRotation(rot);
3436 3456
@@ -3457,7 +3477,7 @@ namespace OpenSim.Region.Framework.Scenes
3457 SceneObjectPart part = GetChildPart(localID); 3477 SceneObjectPart part = GetChildPart(localID);
3458 foreach (SceneObjectPart parts in Children.Values) 3478 foreach (SceneObjectPart parts in Children.Values)
3459 { 3479 {
3460 parts.StoreUndoState(); 3480 parts.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3461 } 3481 }
3462 if (part != null) 3482 if (part != null)
3463 { 3483 {
@@ -3485,15 +3505,24 @@ namespace OpenSim.Region.Framework.Scenes
3485 if (part.UUID == m_rootPart.UUID) 3505 if (part.UUID == m_rootPart.UUID)
3486 { 3506 {
3487 UpdateRootRotation(rot); 3507 UpdateRootRotation(rot);
3488 AbsolutePosition = pos; 3508 if (!m_rootPart.Undoing)
3509 {
3510 m_rootPart.Undoing = true;
3511 AbsolutePosition = pos;
3512 m_rootPart.Undoing = false;
3513 }
3514 else
3515 {
3516 AbsolutePosition = pos;
3517 }
3489 } 3518 }
3490 else 3519 else
3491 { 3520 {
3521 part.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3492 part.IgnoreUndoUpdate = true; 3522 part.IgnoreUndoUpdate = true;
3493 part.UpdateRotation(rot); 3523 part.UpdateRotation(rot);
3494 part.OffsetPosition = pos; 3524 part.OffsetPosition = pos;
3495 part.IgnoreUndoUpdate = false; 3525 part.IgnoreUndoUpdate = false;
3496 part.StoreUndoState();
3497 } 3526 }
3498 } 3527 }
3499 } 3528 }
@@ -3507,7 +3536,13 @@ namespace OpenSim.Region.Framework.Scenes
3507 Quaternion axRot = rot; 3536 Quaternion axRot = rot;
3508 Quaternion oldParentRot = m_rootPart.RotationOffset; 3537 Quaternion oldParentRot = m_rootPart.RotationOffset;
3509 3538
3510 m_rootPart.StoreUndoState(); 3539 m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3540 bool cancelUndo = false;
3541 if (!m_rootPart.Undoing)
3542 {
3543 m_rootPart.Undoing = true;
3544 cancelUndo = true;
3545 }
3511 m_rootPart.UpdateRotation(rot); 3546 m_rootPart.UpdateRotation(rot);
3512 if (m_rootPart.PhysActor != null) 3547 if (m_rootPart.PhysActor != null)
3513 { 3548 {
@@ -3531,18 +3566,13 @@ namespace OpenSim.Region.Framework.Scenes
3531 newRot *= Quaternion.Inverse(axRot); 3566 newRot *= Quaternion.Inverse(axRot);
3532 prim.RotationOffset = newRot; 3567 prim.RotationOffset = newRot;
3533 prim.ScheduleTerseUpdate(); 3568 prim.ScheduleTerseUpdate();
3569 prim.IgnoreUndoUpdate = false;
3534 } 3570 }
3535 } 3571 }
3536 3572 if (cancelUndo == true)
3537 foreach (SceneObjectPart childpart in Children.Values)
3538 { 3573 {
3539 if (childpart != m_rootPart) 3574 m_rootPart.Undoing = false;
3540 {
3541 childpart.IgnoreUndoUpdate = false;
3542 childpart.StoreUndoState();
3543 }
3544 } 3575 }
3545
3546 lockPartsForRead(false); 3576 lockPartsForRead(false);
3547 3577
3548 m_rootPart.ScheduleTerseUpdate(); 3578 m_rootPart.ScheduleTerseUpdate();
@@ -3911,7 +3941,7 @@ namespace OpenSim.Region.Framework.Scenes
3911 3941
3912 public virtual ISceneObject CloneForNewScene() 3942 public virtual ISceneObject CloneForNewScene()
3913 { 3943 {
3914 SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false); 3944 SceneObjectGroup sog = Copy(false);
3915 sog.m_isDeleted = false; 3945 sog.m_isDeleted = false;
3916 return sog; 3946 return sog;
3917 } 3947 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 09c945b..3327b1e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -358,7 +358,7 @@ namespace OpenSim.Region.Framework.Scenes
358 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, 358 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
359 Quaternion rotationOffset, Vector3 offsetPosition) 359 Quaternion rotationOffset, Vector3 offsetPosition)
360 { 360 {
361 m_name = "Primitive"; 361 m_name = "Object";
362 362
363 Rezzed = DateTime.UtcNow; 363 Rezzed = DateTime.UtcNow;
364 _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); 364 _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
@@ -697,7 +697,7 @@ namespace OpenSim.Region.Framework.Scenes
697 get { return m_offsetPosition; } 697 get { return m_offsetPosition; }
698 set 698 set
699 { 699 {
700 StoreUndoState(); 700 StoreUndoState(UndoType.STATE_PRIM_POSITION);
701 m_offsetPosition = value; 701 m_offsetPosition = value;
702 702
703 if (ParentGroup != null && !ParentGroup.IsDeleted) 703 if (ParentGroup != null && !ParentGroup.IsDeleted)
@@ -759,7 +759,7 @@ namespace OpenSim.Region.Framework.Scenes
759 759
760 set 760 set
761 { 761 {
762 StoreUndoState(); 762 StoreUndoState(UndoType.STATE_PRIM_ROTATION);
763 m_rotationOffset = value; 763 m_rotationOffset = value;
764 764
765 PhysicsActor actor = PhysActor; 765 PhysicsActor actor = PhysActor;
@@ -958,7 +958,7 @@ namespace OpenSim.Region.Framework.Scenes
958 get { return m_shape.Scale; } 958 get { return m_shape.Scale; }
959 set 959 set
960 { 960 {
961 StoreUndoState(); 961 StoreUndoState(UndoType.STATE_PRIM_SCALE);
962 if (m_shape != null) 962 if (m_shape != null)
963 { 963 {
964 m_shape.Scale = value; 964 m_shape.Scale = value;
@@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Framework.Scenes
1522 { 1522 {
1523 m_redo.Clear(); 1523 m_redo.Clear();
1524 } 1524 }
1525 StoreUndoState(); 1525 StoreUndoState(UndoType.STATE_ALL);
1526 } 1526 }
1527 1527
1528 public byte ConvertScriptUintToByte(uint indata) 1528 public byte ConvertScriptUintToByte(uint indata)
@@ -1625,7 +1625,7 @@ namespace OpenSim.Region.Framework.Scenes
1625 PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); 1625 PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
1626 part.Shape = shape; 1626 part.Shape = shape;
1627 1627
1628 part.Name = "Primitive"; 1628 part.Name = "Object";
1629 part._ownerID = UUID.Random(); 1629 part._ownerID = UUID.Random();
1630 1630
1631 return part; 1631 return part;
@@ -2721,7 +2721,7 @@ namespace OpenSim.Region.Framework.Scenes
2721 /// <param name="scale"></param> 2721 /// <param name="scale"></param>
2722 public void Resize(Vector3 scale) 2722 public void Resize(Vector3 scale)
2723 { 2723 {
2724 StoreUndoState(); 2724 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2725 m_shape.Scale = scale; 2725 m_shape.Scale = scale;
2726 2726
2727 ParentGroup.HasGroupChanged = true; 2727 ParentGroup.HasGroupChanged = true;
@@ -3504,10 +3504,9 @@ namespace OpenSim.Region.Framework.Scenes
3504 m_parentGroup.ScheduleGroupForTerseUpdate(); 3504 m_parentGroup.ScheduleGroupForTerseUpdate();
3505 //m_parentGroup.ScheduleGroupForFullUpdate(); 3505 //m_parentGroup.ScheduleGroupForFullUpdate();
3506 } 3506 }
3507 3507 public void StoreUndoState(UndoType type)
3508 public void StoreUndoState()
3509 { 3508 {
3510 if (!Undoing) 3509 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3511 { 3510 {
3512 if (!IgnoreUndoUpdate) 3511 if (!IgnoreUndoUpdate)
3513 { 3512 {
@@ -3518,17 +3517,25 @@ namespace OpenSim.Region.Framework.Scenes
3518 if (m_undo.Count > 0) 3517 if (m_undo.Count > 0)
3519 { 3518 {
3520 UndoState last = m_undo.Peek(); 3519 UndoState last = m_undo.Peek();
3521 if (last != null) 3520
3522 {
3523 if (last.Compare(this))
3524 return;
3525 }
3526 } 3521 }
3527 3522
3528 if (m_parentGroup.GetSceneMaxUndo() > 0) 3523 if (m_parentGroup.GetSceneMaxUndo() > 0)
3529 { 3524 {
3530 UndoState nUndo = new UndoState(this); 3525 UndoState lastUndo = m_undo.Peek();
3526
3527 UndoState nUndo = new UndoState(this, type);
3531 3528
3529 if (lastUndo != null)
3530 {
3531 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3532 if (ts.TotalMilliseconds < 500)
3533 {
3534 //Delete the last entry since it was less than 500 milliseconds ago
3535 nUndo.Merge(lastUndo);
3536 m_undo.Pop();
3537 }
3538 }
3532 m_undo.Push(nUndo); 3539 m_undo.Push(nUndo);
3533 } 3540 }
3534 3541
@@ -4005,11 +4012,13 @@ namespace OpenSim.Region.Framework.Scenes
4005 if (m_undo.Count > 0) 4012 if (m_undo.Count > 0)
4006 { 4013 {
4007 UndoState nUndo = null; 4014 UndoState nUndo = null;
4015 UndoState goback = m_undo.Pop();
4008 if (m_parentGroup.GetSceneMaxUndo() > 0) 4016 if (m_parentGroup.GetSceneMaxUndo() > 0)
4009 { 4017 {
4010 nUndo = new UndoState(this); 4018 nUndo = new UndoState(this, goback.Type);
4011 } 4019 }
4012 UndoState goback = m_undo.Pop(); 4020
4021
4013 if (goback != null) 4022 if (goback != null)
4014 { 4023 {
4015 goback.PlaybackState(this); 4024 goback.PlaybackState(this);
@@ -4024,13 +4033,13 @@ namespace OpenSim.Region.Framework.Scenes
4024 { 4033 {
4025 lock (m_redo) 4034 lock (m_redo)
4026 { 4035 {
4036 UndoState gofwd = m_redo.Pop();
4027 if (m_parentGroup.GetSceneMaxUndo() > 0) 4037 if (m_parentGroup.GetSceneMaxUndo() > 0)
4028 { 4038 {
4029 UndoState nUndo = new UndoState(this); 4039 UndoState nUndo = new UndoState(this, gofwd.Type);
4030 4040
4031 m_undo.Push(nUndo); 4041 m_undo.Push(nUndo);
4032 } 4042 }
4033 UndoState gofwd = m_redo.Pop();
4034 if (gofwd != null) 4043 if (gofwd != null)
4035 gofwd.PlayfwdState(this); 4044 gofwd.PlayfwdState(this);
4036 } 4045 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4a4cac9..e51d9ee 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3730,8 +3730,11 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
3730 { 3730 {
3731 CollidingMessage.Colliders = colliding; 3731 CollidingMessage.Colliders = colliding;
3732 3732
3733 foreach (SceneObjectGroup att in Attachments) 3733 lock (m_attachments)
3734 Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage); 3734 {
3735 foreach (SceneObjectGroup att in m_attachments)
3736 Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage);
3737 }
3735 } 3738 }
3736 } 3739 }
3737 3740
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 5bdaa17..77e477f 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
105 sceneObject.AddPart(part); 105 sceneObject.AddPart(part);
106 part.LinkNum = linkNum; 106 part.LinkNum = linkNum;
107 part.TrimPermissions(); 107 part.TrimPermissions();
108 part.StoreUndoState(); 108 part.StoreUndoState(UndoType.STATE_ALL);
109 reader.Close(); 109 reader.Close();
110 sr.Close(); 110 sr.Close();
111 } 111 }
@@ -231,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
231 if (originalLinkNum != 0) 231 if (originalLinkNum != 0)
232 part.LinkNum = originalLinkNum; 232 part.LinkNum = originalLinkNum;
233 233
234 part.StoreUndoState(); 234 part.StoreUndoState(UndoType.STATE_ALL);
235 reader.Close(); 235 reader.Close();
236 sr.Close(); 236 sr.Close();
237 } 237 }
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 55e407e..f71b507 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -27,48 +27,125 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Region.Framework.Interfaces; 29using OpenSim.Region.Framework.Interfaces;
30using System;
30 31
31namespace OpenSim.Region.Framework.Scenes 32namespace OpenSim.Region.Framework.Scenes
32{ 33{
34 [Flags]
35 public enum UndoType
36 {
37 STATE_PRIM_POSITION = 1,
38 STATE_PRIM_ROTATION = 2,
39 STATE_PRIM_SCALE = 4,
40 STATE_PRIM_ALL = 7,
41 STATE_GROUP_POSITION = 8,
42 STATE_GROUP_ROTATION = 16,
43 STATE_GROUP_SCALE = 32,
44 STATE_GROUP_ALL = 56,
45 STATE_ALL = 63
46 }
47
33 public class UndoState 48 public class UndoState
34 { 49 {
35 public Vector3 Position = Vector3.Zero; 50 public Vector3 Position = Vector3.Zero;
36 public Vector3 Scale = Vector3.Zero; 51 public Vector3 Scale = Vector3.Zero;
37 public Quaternion Rotation = Quaternion.Identity; 52 public Quaternion Rotation = Quaternion.Identity;
53 public Vector3 GroupPosition = Vector3.Zero;
54 public Quaternion GroupRotation = Quaternion.Identity;
55 public Vector3 GroupScale = Vector3.Zero;
56 public DateTime LastUpdated = DateTime.Now;
57 public UndoType Type;
38 58
39 public UndoState(SceneObjectPart part) 59 public UndoState(SceneObjectPart part, UndoType type)
40 { 60 {
61 Type = type;
41 if (part != null) 62 if (part != null)
42 { 63 {
43 if (part.ParentID == 0) 64 if (part.ParentID == 0)
44 { 65 {
45 Position = part.ParentGroup.AbsolutePosition; 66 GroupScale = part.ParentGroup.RootPart.Shape.Scale;
67
68 //FUBAR WARNING: Do NOT get the group's absoluteposition here
69 //or you'll experience a loop and/or a stack issue
70 GroupPosition = part.ParentGroup.RootPart.AbsolutePosition;
71 GroupRotation = part.ParentGroup.GroupRotation;
72 Position = part.ParentGroup.RootPart.AbsolutePosition;
46 Rotation = part.RotationOffset; 73 Rotation = part.RotationOffset;
47 Scale = part.Shape.Scale; 74 Scale = part.Shape.Scale;
75 LastUpdated = DateTime.Now;
48 } 76 }
49 else 77 else
50 { 78 {
79 GroupScale = part.Shape.Scale;
80
81 //FUBAR WARNING: Do NOT get the group's absoluteposition here
82 //or you'll experience a loop and/or a stack issue
83 GroupPosition = part.ParentGroup.RootPart.AbsolutePosition;
84 GroupRotation = part.ParentGroup.Rotation;
51 Position = part.OffsetPosition; 85 Position = part.OffsetPosition;
52 Rotation = part.RotationOffset; 86 Rotation = part.RotationOffset;
53 Scale = part.Shape.Scale; 87 Scale = part.Shape.Scale;
88 LastUpdated = DateTime.Now;
54 } 89 }
55 } 90 }
56 } 91 }
57 92 public void Merge(UndoState last)
93 {
94 if ((Type & UndoType.STATE_GROUP_POSITION) == 0 || ((last.Type & UndoType.STATE_GROUP_POSITION) >= (Type & UndoType.STATE_GROUP_POSITION)))
95 {
96 GroupPosition = last.GroupPosition;
97 Position = last.Position;
98 }
99 if ((Type & UndoType.STATE_GROUP_SCALE) == 0 || ((last.Type & UndoType.STATE_GROUP_SCALE) >= (Type & UndoType.STATE_GROUP_SCALE)))
100 {
101 GroupScale = last.GroupScale;
102 Scale = last.Scale;
103 }
104 if ((Type & UndoType.STATE_GROUP_ROTATION) == 0 || ((last.Type & UndoType.STATE_GROUP_ROTATION) >= (Type & UndoType.STATE_GROUP_ROTATION)))
105 {
106 GroupRotation = last.GroupRotation;
107 Rotation = last.Rotation;
108 }
109 if ((Type & UndoType.STATE_PRIM_POSITION) == 0 || ((last.Type & UndoType.STATE_PRIM_POSITION) >= (Type & UndoType.STATE_PRIM_POSITION)))
110 {
111 Position = last.Position;
112 }
113 if ((Type & UndoType.STATE_PRIM_SCALE) == 0 || ((last.Type & UndoType.STATE_PRIM_SCALE) >= (Type & UndoType.STATE_PRIM_SCALE)))
114 {
115 Scale = last.Scale;
116 }
117 if ((Type & UndoType.STATE_PRIM_ROTATION) == 0 || ((last.Type & UndoType.STATE_PRIM_ROTATION) >= (Type & UndoType.STATE_PRIM_ROTATION)))
118 {
119 Rotation = last.Rotation;
120 }
121 Type = Type | last.Type;
122 }
123 public bool Compare(UndoState undo)
124 {
125 if (undo == null || Position == null) return false;
126 if (undo.Position == Position && undo.Rotation == Rotation && undo.Scale == Scale && undo.GroupPosition == GroupPosition && undo.GroupScale == GroupScale && undo.GroupRotation == GroupRotation)
127 {
128 return true;
129 }
130 else
131 {
132 return false;
133 }
134 }
58 public bool Compare(SceneObjectPart part) 135 public bool Compare(SceneObjectPart part)
59 { 136 {
60 if (part != null) 137 if (part != null)
61 { 138 {
62 if (part.ParentID == 0) 139 if (part.ParentID == 0)
63 { 140 {
64 if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation) 141 if (Position == part.ParentGroup.RootPart.AbsolutePosition && Rotation == part.ParentGroup.Rotation && GroupPosition == part.ParentGroup.RootPart.AbsolutePosition && part.ParentGroup.Rotation == GroupRotation && part.Shape.Scale == GroupScale)
65 return true; 142 return true;
66 else 143 else
67 return false; 144 return false;
68 } 145 }
69 else 146 else
70 { 147 {
71 if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale) 148 if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale && GroupPosition == part.ParentGroup.RootPart.AbsolutePosition && part.ParentGroup.Rotation == GroupRotation && part.Shape.Scale == GroupScale)
72 return true; 149 return true;
73 else 150 else
74 return false; 151 return false;
@@ -78,62 +155,70 @@ namespace OpenSim.Region.Framework.Scenes
78 return false; 155 return false;
79 } 156 }
80 157
81 public void PlaybackState(SceneObjectPart part) 158 private void RestoreState(SceneObjectPart part)
82 { 159 {
160 bool GroupChange = false;
161 if ((Type & UndoType.STATE_GROUP_POSITION) != 0
162 || (Type & UndoType.STATE_GROUP_ROTATION) != 0
163 || (Type & UndoType.STATE_GROUP_SCALE) != 0)
164 {
165 GroupChange = true;
166 }
167
83 if (part != null) 168 if (part != null)
84 { 169 {
85 part.Undoing = true; 170 part.Undoing = true;
86 171
87 if (part.ParentID == 0) 172 if (part.ParentID == 0 && GroupChange == false)
88 { 173 {
89 if (Position != Vector3.Zero) 174 if (Position != Vector3.Zero)
90 part.ParentGroup.AbsolutePosition = Position; 175
91 part.RotationOffset = Rotation; 176 part.ParentGroup.UpdateSinglePosition(Position, part.LocalId);
177 part.ParentGroup.UpdateSingleRotation(Rotation, part.LocalId);
92 if (Scale != Vector3.Zero) 178 if (Scale != Vector3.Zero)
93 part.Resize(Scale); 179 part.Resize(Scale);
94 part.ParentGroup.ScheduleGroupForTerseUpdate(); 180 part.ParentGroup.ScheduleGroupForTerseUpdate();
95 } 181 }
96 else 182 else
97 { 183 {
98 if (Position != Vector3.Zero) 184 if (GroupChange)
99 part.OffsetPosition = Position; 185 {
100 part.UpdateRotation(Rotation); 186 part.ParentGroup.RootPart.Undoing = true;
101 if (Scale != Vector3.Zero) 187 if (GroupPosition != Vector3.Zero)
102 part.Resize(Scale); part.ScheduleTerseUpdate(); 188 {
189 //Calculate the scale...
190 Vector3 gs = part.Shape.Scale;
191 float scale = GroupScale.Z / gs.Z;
192
193 //Scale first since it can affect our position
194 part.ParentGroup.GroupResize(gs * scale, part.LocalId);
195 part.ParentGroup.AbsolutePosition = GroupPosition;
196 part.ParentGroup.UpdateGroupRotationR(GroupRotation);
197
198 }
199 part.ParentGroup.RootPart.Undoing = false;
200 }
201 else
202 {
203 if (Position != Vector3.Zero) //We can use this for all the updates since all are set
204 {
205 part.OffsetPosition = Position;
206 part.UpdateRotation(Rotation);
207 part.Resize(Scale); part.ScheduleTerseUpdate();
208 }
209 }
103 } 210 }
104 part.Undoing = false; 211 part.Undoing = false;
105 212
106 } 213 }
107 } 214 }
215 public void PlaybackState(SceneObjectPart part)
216 {
217 RestoreState(part);
218 }
108 public void PlayfwdState(SceneObjectPart part) 219 public void PlayfwdState(SceneObjectPart part)
109 { 220 {
110 if (part != null) 221 RestoreState(part);
111 {
112 part.Undoing = true;
113
114 if (part.ParentID == 0)
115 {
116 if (Position != Vector3.Zero)
117 part.ParentGroup.AbsolutePosition = Position;
118 if (Rotation != Quaternion.Identity)
119 part.UpdateRotation(Rotation);
120 if (Scale != Vector3.Zero)
121 part.Resize(Scale);
122 part.ParentGroup.ScheduleGroupForTerseUpdate();
123 }
124 else
125 {
126 if (Position != Vector3.Zero)
127 part.OffsetPosition = Position;
128 if (Rotation != Quaternion.Identity)
129 part.UpdateRotation(Rotation);
130 if (Scale != Vector3.Zero)
131 part.Resize(Scale);
132 part.ScheduleTerseUpdate();
133 }
134 part.Undoing = false;
135
136 }
137 } 222 }
138 } 223 }
139 public class LandUndoState 224 public class LandUndoState
@@ -161,3 +246,4 @@ namespace OpenSim.Region.Framework.Scenes
161 } 246 }
162 } 247 }
163} 248}
249
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/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/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index b9a75cc..6f5ef9e 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>
@@ -188,15 +198,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
188 // Please do not refactor these to be just one method 198 // Please do not refactor these to be just one method
189 // Existing implementations need the distinction 199 // Existing implementations need the distinction
190 // 200 //
191 public void ApplyUploadCharge(UUID agentID) 201 public void ApplyCharge(UUID agentID, int amount, string text)
192 {
193 }
194
195 public void ApplyGroupCreationCharge(UUID agentID)
196 { 202 {
197 } 203 }
198 204 public void ApplyUploadCharge(UUID agentID, int amount, string text)
199 public void ApplyCharge(UUID agentID, int amount, string text)
200 { 205 {
201 } 206 }
202 207
@@ -268,27 +273,6 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
268 273
269 } 274 }
270 275
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) 276 private void GetClientFunds(IClientAPI client)
293 { 277 {
294 CheckExistAndRefreshFunds(client.AgentId); 278 CheckExistAndRefreshFunds(client.AgentId);
@@ -790,7 +774,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
790 //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString()); 774 //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString());
791 } 775 }
792 776
793 public int GetBalance(IClientAPI client) 777 public int GetBalance(UUID agentID)
794 { 778 {
795 return 0; 779 return 0;
796 } 780 }
@@ -798,16 +782,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
798 // Please do not refactor these to be just one method 782 // Please do not refactor these to be just one method
799 // Existing implementations need the distinction 783 // Existing implementations need the distinction
800 // 784 //
801 public bool UploadCovered(IClientAPI client) 785 public bool UploadCovered(IClientAPI client, int amount)
802 { 786 {
803 return AmountCovered(client, PriceUpload); 787 return true;
804 }
805
806 public bool GroupCreationCovered(IClientAPI client)
807 {
808 return AmountCovered(client, PriceGroupCreate);
809 } 788 }
810
811 public bool AmountCovered(IClientAPI client, int amount) 789 public bool AmountCovered(IClientAPI client, int amount)
812 { 790 {
813 return true; 791 return true;
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 be7c348..2e39726 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 1459778..b9b3318 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3252,7 +3252,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3252 msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here 3252 msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here
3253// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); 3253// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
3254// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); 3254// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString());
3255 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp; 3255 DateTime dt = DateTime.UtcNow;
3256
3257 // Ticks from UtcNow, but make it look like local. Evil, huh?
3258 dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
3259
3260 try
3261 {
3262 // Convert that to the PST timezone
3263 TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
3264 dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
3265 }
3266 catch
3267 {
3268 // No logging here, as it could be VERY spammy
3269 }
3270
3271 // And make it look local again to fool the unix time util
3272 dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
3273
3274 msg.timestamp = (uint)Util.ToUnixTime(dt);
3275
3256 //if (client != null) 3276 //if (client != null)
3257 //{ 3277 //{
3258 msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName; 3278 msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName;
@@ -5247,7 +5267,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5247 case ',': 5267 case ',':
5248 if (parens == 0) 5268 if (parens == 0)
5249 { 5269 {
5250 result.Add(src.Substring(start,length).Trim()); 5270 result.Add(new LSL_String(src.Substring(start,length).Trim()));
5251 start += length+1; 5271 start += length+1;
5252 length = 0; 5272 length = 0;
5253 } 5273 }
@@ -9369,7 +9389,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9369 9389
9370 if (aList.Data[i] != null) 9390 if (aList.Data[i] != null)
9371 { 9391 {
9372 switch ((ParcelMediaCommandEnum) aList.Data[i]) 9392 switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString()))
9373 { 9393 {
9374 case ParcelMediaCommandEnum.Url: 9394 case ParcelMediaCommandEnum.Url:
9375 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL)); 9395 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL));
@@ -9804,19 +9824,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9804 public LSL_String llXorBase64StringsCorrect(string str1, string str2) 9824 public LSL_String llXorBase64StringsCorrect(string str1, string str2)
9805 { 9825 {
9806 m_host.AddScriptLPS(1); 9826 m_host.AddScriptLPS(1);
9807 string ret = String.Empty; 9827
9808 string src1 = llBase64ToString(str1); 9828 if (str1 == String.Empty)
9809 string src2 = llBase64ToString(str2); 9829 return String.Empty;
9810 int c = 0; 9830 if (str2 == String.Empty)
9811 for (int i = 0; i < src1.Length; i++) 9831 return str1;
9832
9833 byte[] data1 = Convert.FromBase64String(str1);
9834 byte[] data2 = Convert.FromBase64String(str2);
9835
9836 byte[] d2 = new Byte[data1.Length];
9837 int pos = 0;
9838
9839 if (data1.Length <= data2.Length)
9812 { 9840 {
9813 ret += (char) (src1[i] ^ src2[c]); 9841 Array.Copy(data2, 0, d2, 0, data1.Length);
9842 }
9843 else
9844 {
9845 while (pos < data1.Length)
9846 {
9847 int len = data1.Length - pos;
9848 if (len > data2.Length)
9849 len = data2.Length;
9814 9850
9815 c++; 9851 Array.Copy(data2, 0, d2, pos, len);
9816 if (c >= src2.Length) 9852 pos += len;
9817 c = 0; 9853 }
9818 } 9854 }
9819 return llStringToBase64(ret); 9855
9856 for (pos = 0 ; pos < data1.Length ; pos++ )
9857 data1[pos] ^= d2[pos];
9858
9859 return Convert.ToBase64String(data1);
9820 } 9860 }
9821 9861
9822 public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) 9862 public LSL_String llHTTPRequest(string url, LSL_List parameters, string body)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index fe71ed5..1fa8c30 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -73,6 +73,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
73 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) 73 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
74 m_LSFunctionsEnabled = true; 74 m_LSFunctionsEnabled = true;
75 75
76 if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
77 m_LSFunctionsEnabled = true;
78
76 m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); 79 m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
77 if (m_comms == null) 80 if (m_comms == null)
78 m_LSFunctionsEnabled = false; 81 m_LSFunctionsEnabled = false;
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 212dbe3..5927973 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -663,13 +663,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
663 Object[] ret; 663 Object[] ret;
664 664
665 if (start < 0) 665 if (start < 0)
666 start=m_data.Length-start; 666 start=m_data.Length+start;
667 667
668 if (start < 0) 668 if (start < 0)
669 start=0; 669 start=0;
670 670
671 if (end < 0) 671 if (end < 0)
672 end=m_data.Length-end; 672 end=m_data.Length+end;
673 if (end < 0) 673 if (end < 0)
674 end=0; 674 end=0;
675 675
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 30e127d..a6ab5e9 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -556,6 +556,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
556 556
557 if (stateSource == (int)StateSource.ScriptedRez) 557 if (stateSource == (int)StateSource.ScriptedRez)
558 { 558 {
559 lock (m_CompileDict)
560 {
561 m_CompileDict[itemID] = 0;
562 }
563
559 DoOnRezScript(parms); 564 DoOnRezScript(parms);
560 } 565 }
561 else 566 else
@@ -835,8 +840,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
835 item.Name, startParam, postOnRez, 840 item.Name, startParam, postOnRez,
836 stateSource, m_MaxScriptQueue); 841 stateSource, m_MaxScriptQueue);
837 842
838 m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}", 843 m_log.DebugFormat(
839 part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString()); 844 "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}",
845 part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID,
846 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
840 847
841 if (presence != null) 848 if (presence != null)
842 { 849 {
@@ -1356,9 +1363,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1356 string xml = instance.GetXMLState(); 1363 string xml = instance.GetXMLState();
1357 1364
1358 XmlDocument sdoc = new XmlDocument(); 1365 XmlDocument sdoc = new XmlDocument();
1359 sdoc.LoadXml(xml); 1366 bool loadedState = true;
1360 XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); 1367 try
1361 XmlNode rootNode = rootL[0]; 1368 {
1369 sdoc.LoadXml(xml);
1370 }
1371 catch (System.Xml.XmlException e)
1372 {
1373 loadedState = false;
1374 }
1375
1376 XmlNodeList rootL = null;
1377 XmlNode rootNode = null;
1378 if (loadedState)
1379 {
1380 rootL = sdoc.GetElementsByTagName("ScriptState");
1381 rootNode = rootL[0];
1382 }
1362 1383
1363 // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> 1384 // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
1364 XmlDocument doc = new XmlDocument(); 1385 XmlDocument doc = new XmlDocument();
@@ -1374,8 +1395,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1374 stateData.Attributes.Append(engineName); 1395 stateData.Attributes.Append(engineName);
1375 doc.AppendChild(stateData); 1396 doc.AppendChild(stateData);
1376 1397
1398 XmlNode xmlstate = null;
1399
1377 // Add <ScriptState>...</ScriptState> 1400 // Add <ScriptState>...</ScriptState>
1378 XmlNode xmlstate = doc.ImportNode(rootNode, true); 1401 if (loadedState)
1402 {
1403 xmlstate = doc.ImportNode(rootNode, true);
1404 }
1405 else
1406 {
1407 xmlstate = doc.CreateElement("", "ScriptState", "");
1408 }
1409
1379 stateData.AppendChild(xmlstate); 1410 stateData.AppendChild(xmlstate);
1380 1411
1381 string assemName = instance.GetAssemblyName(); 1412 string assemName = instance.GetAssemblyName();
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 c4117f5..9739e5a 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -277,7 +277,7 @@ namespace OpenSim.Server.Handlers.Simulation
277 //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead 277 //responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead
278 } 278 }
279 279
280 // subclasses cab override this 280 // subclasses can override this
281 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent) 281 protected virtual bool UpdateAgent(GridRegion destination, AgentData agent)
282 { 282 {
283 return m_SimulationService.UpdateAgent(destination, agent); 283 return m_SimulationService.UpdateAgent(destination, agent);
@@ -285,6 +285,16 @@ namespace OpenSim.Server.Handlers.Simulation
285 285
286 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 286 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
287 { 287 {
288 if (m_SimulationService == null)
289 {
290 m_log.Debug("[AGENT HANDLER]: Agent GET called. Harmless but useless.");
291 responsedata["content_type"] = "application/json";
292 responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
293 responsedata["str_response_string"] = string.Empty;
294
295 return;
296 }
297
288 GridRegion destination = new GridRegion(); 298 GridRegion destination = new GridRegion();
289 destination.RegionID = regionID; 299 destination.RegionID = regionID;
290 300
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 470a4dd..3122382 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -144,7 +144,10 @@ namespace OpenSim.Services.AssetService
144 public string Store(AssetBase asset) 144 public string Store(AssetBase asset)
145 { 145 {
146 //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); 146 //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
147 m_Database.StoreAsset(asset); 147 if (!m_Database.StoreAsset(asset))
148 {
149 return UUID.Zero.ToString();
150 }
148 151
149 return asset.ID; 152 return asset.ID;
150 } 153 }
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index 65b3537..ad18a23 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -30,6 +30,7 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Timers;
33using Nini.Config; 34using Nini.Config;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -48,7 +49,9 @@ namespace OpenSim.Services.Connectors
48 49
49 private string m_ServerURI = String.Empty; 50 private string m_ServerURI = String.Empty;
50 private IImprovedAssetCache m_Cache = null; 51 private IImprovedAssetCache m_Cache = null;
51 52 private int m_retryCounter;
53 private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>();
54 private Timer m_retryTimer;
52 public AssetServicesConnector() 55 public AssetServicesConnector()
53 { 56 {
54 } 57 }
@@ -85,6 +88,55 @@ namespace OpenSim.Services.Connectors
85 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset", 88 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset",
86 "dump asset <id> <file>", 89 "dump asset <id> <file>",
87 "dump one cached asset", HandleDumpAsset); 90 "dump one cached asset", HandleDumpAsset);
91
92 m_retryTimer = new Timer();
93 m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck);
94 m_retryTimer.Interval = 60000;
95 }
96
97 protected void retryCheck(object source, ElapsedEventArgs e)
98 {
99 m_retryCounter++;
100 if (m_retryCounter > 60) m_retryCounter -= 60;
101 List<int> keys = new List<int>();
102 foreach (int a in m_retryQueue.Keys)
103 {
104 keys.Add(a);
105 }
106 foreach (int a in keys)
107 {
108 //We exponentially fall back on frequency until we reach one attempt per hour
109 //The net result is that we end up in the queue for roughly 24 hours..
110 //24 hours worth of assets could be a lot, so the hope is that the region admin
111 //will have gotten the asset connector back online quickly!
112
113 int timefactor = a ^ 2;
114 if (timefactor > 60)
115 {
116 timefactor = 60;
117 }
118
119 //First, find out if we care about this timefactor
120 if (timefactor % a == 0)
121 {
122 //Yes, we do!
123 List<AssetBase> retrylist = m_retryQueue[a];
124 m_retryQueue.Remove(a);
125
126 foreach(AssetBase ass in retrylist)
127 {
128 Store(ass); //Store my ass. This function will put it back in the dictionary if it fails
129 }
130 }
131 }
132
133 if (m_retryQueue.Count == 0)
134 {
135 //It might only be one tick per minute, but I have
136 //repented and abandoned my wasteful ways
137 m_retryCounter = 0;
138 m_retryTimer.Stop();
139 }
88 } 140 }
89 141
90 protected void SetCache(IImprovedAssetCache cache) 142 protected void SetCache(IImprovedAssetCache cache)
@@ -99,8 +151,8 @@ namespace OpenSim.Services.Connectors
99 AssetBase asset = null; 151 AssetBase asset = null;
100 if (m_Cache != null) 152 if (m_Cache != null)
101 asset = m_Cache.Get(id); 153 asset = m_Cache.Get(id);
102 154
103 if (asset == null) 155 if (asset == null || asset.Data == null || asset.Data.Length == 0)
104 { 156 {
105 asset = SynchronousRestObjectRequester. 157 asset = SynchronousRestObjectRequester.
106 MakeRequest<int, AssetBase>("GET", uri, 0); 158 MakeRequest<int, AssetBase>("GET", uri, 0);
@@ -177,7 +229,7 @@ namespace OpenSim.Services.Connectors
177 if (m_Cache != null) 229 if (m_Cache != null)
178 asset = m_Cache.Get(id); 230 asset = m_Cache.Get(id);
179 231
180 if (asset == null) 232 if (asset == null || asset.Data == null || asset.Data.Length == 0)
181 { 233 {
182 bool result = false; 234 bool result = false;
183 235
@@ -204,11 +256,10 @@ namespace OpenSim.Services.Connectors
204 256
205 public string Store(AssetBase asset) 257 public string Store(AssetBase asset)
206 { 258 {
259 if (m_Cache != null)
260 m_Cache.Cache(asset);
207 if (asset.Temporary || asset.Local) 261 if (asset.Temporary || asset.Local)
208 { 262 {
209 if (m_Cache != null)
210 m_Cache.Cache(asset);
211
212 return asset.ID; 263 return asset.ID;
213 } 264 }
214 265
@@ -218,24 +269,57 @@ namespace OpenSim.Services.Connectors
218 try 269 try
219 { 270 {
220 newID = SynchronousRestObjectRequester. 271 newID = SynchronousRestObjectRequester.
221 MakeRequest<AssetBase, string>("POST", uri, asset); 272 MakeRequest<AssetBase, string>("POST", uri, asset, 25);
273 if (newID == null || newID == "")
274 {
275 newID = UUID.Zero.ToString();
276 }
222 } 277 }
223 catch (Exception e) 278 catch (Exception e)
224 { 279 {
225 m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); 280 newID = UUID.Zero.ToString();
226 } 281 }
227 282
228 if (newID != String.Empty) 283 if (newID == UUID.Zero.ToString())
229 { 284 {
230 // Placing this here, so that this work with old asset servers that don't send any reply back 285 //The asset upload failed, put it in a queue for later
231 // SynchronousRestObjectRequester returns somethins that is not an empty string 286 asset.UploadAttempts++;
232 if (newID != null) 287 if (asset.UploadAttempts > 30)
233 asset.ID = newID; 288 {
234 289 //By this stage we've been in the queue for a good few hours;
235 if (m_Cache != null) 290 //We're going to drop the asset.
236 m_Cache.Cache(asset); 291 m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString());
292 }
293 else
294 {
295 if (!m_retryQueue.ContainsKey(asset.UploadAttempts))
296 {
297 m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>());
298 }
299 List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts];
300 m_queue.Add(asset);
301 m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString());
302 m_retryTimer.Start();
303 }
304 }
305 else
306 {
307 if (asset.UploadAttempts > 0)
308 {
309 m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString());
310 }
311 if (newID != String.Empty)
312 {
313 // Placing this here, so that this work with old asset servers that don't send any reply back
314 // SynchronousRestObjectRequester returns somethins that is not an empty string
315 if (newID != null)
316 asset.ID = newID;
317
318 if (m_Cache != null)
319 m_Cache.Cache(asset);
320 }
237 } 321 }
238 return newID; 322 return asset.ID;
239 } 323 }
240 324
241 public bool UpdateContent(string id, byte[] data) 325 public bool UpdateContent(string id, byte[] data)
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/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index 6a2cbeb..240f5b1 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -175,6 +175,9 @@ namespace OpenSim.Services.LLLoginService
175 private string firstname; 175 private string firstname;
176 private string lastname; 176 private string lastname;
177 177
178 // Web map
179 private string mapTileURL;
180
178 // Error Flags 181 // Error Flags
179 private string errorReason; 182 private string errorReason;
180 private string errorMessage; 183 private string errorMessage;
@@ -223,7 +226,7 @@ namespace OpenSim.Services.LLLoginService
223 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, 226 public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
224 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService, 227 GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
225 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message, 228 string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
226 GridRegion home, IPEndPoint clientIP) 229 GridRegion home, IPEndPoint clientIP, string mapTileURL)
227 : this() 230 : this()
228 { 231 {
229 FillOutInventoryData(invSkel, libService); 232 FillOutInventoryData(invSkel, libService);
@@ -239,6 +242,7 @@ namespace OpenSim.Services.LLLoginService
239 Message = message; 242 Message = message;
240 BuddList = ConvertFriendListItem(friendsList); 243 BuddList = ConvertFriendListItem(friendsList);
241 StartLocation = where; 244 StartLocation = where;
245 MapTileURL = mapTileURL;
242 246
243 FillOutHomeData(pinfo, home); 247 FillOutHomeData(pinfo, home);
244 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); 248 LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z);
@@ -411,6 +415,7 @@ namespace OpenSim.Services.LLLoginService
411 InitialOutfitHash["folder_name"] = "Nightclub Female"; 415 InitialOutfitHash["folder_name"] = "Nightclub Female";
412 InitialOutfitHash["gender"] = "female"; 416 InitialOutfitHash["gender"] = "female";
413 initialOutfit.Add(InitialOutfitHash); 417 initialOutfit.Add(InitialOutfitHash);
418 mapTileURL = String.Empty;
414 } 419 }
415 420
416 421
@@ -474,6 +479,9 @@ namespace OpenSim.Services.LLLoginService
474 responseData["region_x"] = (Int32)(RegionX); 479 responseData["region_x"] = (Int32)(RegionX);
475 responseData["region_y"] = (Int32)(RegionY); 480 responseData["region_y"] = (Int32)(RegionY);
476 481
482 if (mapTileURL != String.Empty)
483 responseData["map-server-url"] = mapTileURL;
484
477 if (m_buddyList != null) 485 if (m_buddyList != null)
478 { 486 {
479 responseData["buddy-list"] = m_buddyList.ToArray(); 487 responseData["buddy-list"] = m_buddyList.ToArray();
@@ -570,6 +578,9 @@ namespace OpenSim.Services.LLLoginService
570 map["region_x"] = OSD.FromInteger(RegionX); 578 map["region_x"] = OSD.FromInteger(RegionX);
571 map["region_y"] = OSD.FromInteger(RegionY); 579 map["region_y"] = OSD.FromInteger(RegionY);
572 580
581 if (mapTileURL != String.Empty)
582 map["map-server-url"] = OSD.FromString(mapTileURL);
583
573 if (m_buddyList != null) 584 if (m_buddyList != null)
574 { 585 {
575 map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray()); 586 map["buddy-list"] = ArrayListToOSDArray(m_buddyList.ToArray());
@@ -653,7 +664,7 @@ namespace OpenSim.Services.LLLoginService
653 Hashtable TempHash; 664 Hashtable TempHash;
654 foreach (InventoryFolderBase InvFolder in folders) 665 foreach (InventoryFolderBase InvFolder in folders)
655 { 666 {
656 if (InvFolder.ParentID == UUID.Zero) 667 if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == "My Inventory")
657 { 668 {
658 rootID = InvFolder.ID; 669 rootID = InvFolder.ID;
659 } 670 }
@@ -921,6 +932,12 @@ namespace OpenSim.Services.LLLoginService
921 set { home = value; } 932 set { home = value; }
922 } 933 }
923 934
935 public string MapTileURL
936 {
937 get { return mapTileURL; }
938 set { mapTileURL = value; }
939 }
940
924 public string Message 941 public string Message
925 { 942 {
926 get { return welcomeMessage; } 943 get { return welcomeMessage; }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 5c12a54..d27c26d 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)
@@ -362,7 +364,7 @@ namespace OpenSim.Services.LLLoginService
362 // Finally, fill out the response and return it 364 // Finally, fill out the response and return it
363 // 365 //
364 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, 366 LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
365 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP); 367 where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL);
366 368
367 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); 369 m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
368 return response; 370 return response;
diff --git a/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
index 4a15cf2..5bab62c 100644
--- a/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
@@ -54,9 +54,10 @@ namespace OpenSim.Tests.Common.Mock
54 return assets.Find(x=>x.FullID == uuid); 54 return assets.Find(x=>x.FullID == uuid);
55 } 55 }
56 56
57 public void StoreAsset(AssetBase asset) 57 public bool StoreAsset(AssetBase asset)
58 { 58 {
59 assets.Add(asset); 59 assets.Add(asset);
60 return true;
60 } 61 }
61 62
62 public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); } 63 public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); }
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">