aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
35 files changed, 618 insertions, 280 deletions
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();