diff options
Diffstat (limited to 'OpenSim')
23 files changed, 458 insertions, 97 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index f11606a..2831326 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs | |||
@@ -496,12 +496,13 @@ namespace OpenSim.Groups | |||
496 | Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp); | 496 | Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out giver, out tmp, out tmp, out tmp, out tmp); |
497 | 497 | ||
498 | m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); | 498 | m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); |
499 | string message; | ||
499 | InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, | 500 | InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, |
500 | giver, notice.noticeData.AttachmentItemID); | 501 | giver, notice.noticeData.AttachmentItemID, out message); |
501 | 502 | ||
502 | if (itemCopy == null) | 503 | if (itemCopy == null) |
503 | { | 504 | { |
504 | remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); | 505 | remoteClient.SendAgentAlertMessage(message, false); |
505 | return; | 506 | return; |
506 | } | 507 | } |
507 | 508 | ||
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 5761200..ce63ee0 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -35,6 +35,10 @@ namespace OpenSim.Framework | |||
35 | /// </summary> | 35 | /// </summary> |
36 | public class InventoryItemBase : InventoryNodeBase, ICloneable | 36 | public class InventoryItemBase : InventoryNodeBase, ICloneable |
37 | { | 37 | { |
38 | public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase"; | ||
39 | public static readonly sbyte SUITCASE_FOLDER_TYPE = 100; | ||
40 | public static readonly sbyte SUITCASE_FOLDER_FAKE_TYPE = 8; | ||
41 | |||
38 | /// <value> | 42 | /// <value> |
39 | /// The inventory type of the item. This is slightly different from the asset type in some situations. | 43 | /// The inventory type of the item. This is slightly different from the asset type in some situations. |
40 | /// </value> | 44 | /// </value> |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 544accf..59b4614 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -272,6 +272,7 @@ namespace OpenSim | |||
272 | + " [--no-objects]" | 272 | + " [--no-objects]" |
273 | + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" | 273 | + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" |
274 | + " [--displacement \"<x,y,z>\"]" | 274 | + " [--displacement \"<x,y,z>\"]" |
275 | + " [--default-user \"User Name\"]" | ||
275 | + " [<OAR path>]", | 276 | + " [<OAR path>]", |
276 | "Load a region's data from an OAR archive.", | 277 | "Load a region's data from an OAR archive.", |
277 | "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine | 278 | "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine |
@@ -401,6 +402,12 @@ namespace OpenSim | |||
401 | "Delete a region from disk", | 402 | "Delete a region from disk", |
402 | RunCommand); | 403 | RunCommand); |
403 | 404 | ||
405 | m_console.Commands.AddCommand("Estates", false, "estate create", | ||
406 | "estate create <owner UUID> <estate name>", | ||
407 | "Creates a new estate with the specified name, owned by the specified user." | ||
408 | + " Estate name must be unique.", | ||
409 | CreateEstateCommand); | ||
410 | |||
404 | m_console.Commands.AddCommand("Estates", false, "estate set owner", | 411 | m_console.Commands.AddCommand("Estates", false, "estate set owner", |
405 | "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]", | 412 | "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]", |
406 | "Sets the owner of the specified estate to the specified UUID or user. ", | 413 | "Sets the owner of the specified estate to the specified UUID or user. ", |
@@ -410,6 +417,11 @@ namespace OpenSim | |||
410 | "estate set name <estate-id> <new name>", | 417 | "estate set name <estate-id> <new name>", |
411 | "Sets the name of the specified estate to the specified value. New name must be unique.", | 418 | "Sets the name of the specified estate to the specified value. New name must be unique.", |
412 | SetEstateNameCommand); | 419 | SetEstateNameCommand); |
420 | |||
421 | m_console.Commands.AddCommand("Estates", false, "estate link region", | ||
422 | "estate link region <estate ID> <region ID>", | ||
423 | "Attaches the specified region to the specified estate.", | ||
424 | EstateLinkRegionCommand); | ||
413 | } | 425 | } |
414 | 426 | ||
415 | protected override void ShutdownSpecific() | 427 | protected override void ShutdownSpecific() |
@@ -1176,6 +1188,58 @@ namespace OpenSim | |||
1176 | SceneManager.SaveCurrentSceneToArchive(cmdparams); | 1188 | SceneManager.SaveCurrentSceneToArchive(cmdparams); |
1177 | } | 1189 | } |
1178 | 1190 | ||
1191 | protected void CreateEstateCommand(string module, string[] args) | ||
1192 | { | ||
1193 | string response = null; | ||
1194 | UUID userID; | ||
1195 | |||
1196 | if (args.Length == 2) | ||
1197 | { | ||
1198 | response = "No user specified."; | ||
1199 | } | ||
1200 | else if (!UUID.TryParse(args[2], out userID)) | ||
1201 | { | ||
1202 | response = String.Format("{0} is not a valid UUID", args[2]); | ||
1203 | } | ||
1204 | else if (args.Length == 3) | ||
1205 | { | ||
1206 | response = "No estate name specified."; | ||
1207 | } | ||
1208 | else | ||
1209 | { | ||
1210 | Scene scene = SceneManager.CurrentOrFirstScene; | ||
1211 | |||
1212 | // TODO: Is there a better choice here? | ||
1213 | UUID scopeID = UUID.Zero; | ||
1214 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, userID); | ||
1215 | if (account == null) | ||
1216 | { | ||
1217 | response = String.Format("Could not find user {0}", userID); | ||
1218 | } | ||
1219 | else | ||
1220 | { | ||
1221 | // concatenate it all to "name" | ||
1222 | StringBuilder sb = new StringBuilder(args[3]); | ||
1223 | for (int i = 4; i < args.Length; i++) | ||
1224 | sb.Append (" " + args[i]); | ||
1225 | string estateName = sb.ToString().Trim(); | ||
1226 | |||
1227 | // send it off for processing. | ||
1228 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1229 | response = estateModule.CreateEstate(estateName, userID); | ||
1230 | if (response == String.Empty) | ||
1231 | { | ||
1232 | List<int> estates = scene.EstateDataService.GetEstates(estateName); | ||
1233 | response = String.Format("Estate {0} created as \"{1}\"", estates.ElementAt(0), estateName); | ||
1234 | } | ||
1235 | } | ||
1236 | } | ||
1237 | |||
1238 | // give the user some feedback | ||
1239 | if (response != null) | ||
1240 | MainConsole.Instance.Output(response); | ||
1241 | } | ||
1242 | |||
1179 | protected void SetEstateOwnerCommand(string module, string[] args) | 1243 | protected void SetEstateOwnerCommand(string module, string[] args) |
1180 | { | 1244 | { |
1181 | string response = null; | 1245 | string response = null; |
@@ -1298,6 +1362,56 @@ namespace OpenSim | |||
1298 | MainConsole.Instance.Output(response); | 1362 | MainConsole.Instance.Output(response); |
1299 | } | 1363 | } |
1300 | 1364 | ||
1365 | private void EstateLinkRegionCommand(string module, string[] args) | ||
1366 | { | ||
1367 | int estateId =-1; | ||
1368 | UUID regionId = UUID.Zero; | ||
1369 | Scene scene = null; | ||
1370 | string response = null; | ||
1371 | |||
1372 | if (args.Length == 3) | ||
1373 | { | ||
1374 | response = "No estate specified."; | ||
1375 | } | ||
1376 | else if (!int.TryParse(args [3], out estateId)) | ||
1377 | { | ||
1378 | response = String.Format("\"{0}\" is not a valid ID for an Estate", args [3]); | ||
1379 | } | ||
1380 | else if (args.Length == 4) | ||
1381 | { | ||
1382 | response = "No region specified."; | ||
1383 | } | ||
1384 | else if (!UUID.TryParse(args[4], out regionId)) | ||
1385 | { | ||
1386 | response = String.Format("\"{0}\" is not a valid UUID for a Region", args [4]); | ||
1387 | } | ||
1388 | else if (!SceneManager.TryGetScene(regionId, out scene)) | ||
1389 | { | ||
1390 | // region may exist, but on a different sim. | ||
1391 | response = String.Format("No access to Region \"{0}\"", args [4]); | ||
1392 | } | ||
1393 | |||
1394 | if (response != null) | ||
1395 | { | ||
1396 | MainConsole.Instance.Output(response); | ||
1397 | return; | ||
1398 | } | ||
1399 | |||
1400 | // send it off for processing. | ||
1401 | IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); | ||
1402 | response = estateModule.SetRegionEstate(scene.RegionInfo, estateId); | ||
1403 | if (response == String.Empty) | ||
1404 | { | ||
1405 | estateModule.TriggerRegionInfoChange(); | ||
1406 | estateModule.sendRegionHandshakeToAll(); | ||
1407 | response = String.Format ("Region {0} is now attached to estate {1}", regionId, estateId); | ||
1408 | } | ||
1409 | |||
1410 | // give the user some feedback | ||
1411 | if (response != null) | ||
1412 | MainConsole.Instance.Output (response); | ||
1413 | } | ||
1414 | |||
1301 | #endregion | 1415 | #endregion |
1302 | 1416 | ||
1303 | private static string CombineParams(string[] commandParams, int pos) | 1417 | private static string CombineParams(string[] commandParams, int pos) |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 79bc5ef..0eb15f8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -865,18 +865,26 @@ namespace OpenSim.Region.ClientStack.Linden | |||
865 | item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); | 865 | item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); |
866 | if (item != null) | 866 | if (item != null) |
867 | { | 867 | { |
868 | copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID); | 868 | string message; |
869 | if (copyItem != null && client != null) | 869 | copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message); |
870 | if (client != null) | ||
870 | { | 871 | { |
871 | m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); | 872 | if (copyItem != null) |
872 | client.SendBulkUpdateInventory(copyItem); | 873 | { |
874 | m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); | ||
875 | client.SendBulkUpdateInventory(copyItem); | ||
876 | } | ||
877 | else | ||
878 | { | ||
879 | client.SendAgentAlertMessage(message, false); | ||
880 | } | ||
873 | } | 881 | } |
874 | } | 882 | } |
875 | else | 883 | else |
876 | { | 884 | { |
877 | m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); | 885 | m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); |
878 | if (client != null) | 886 | if (client != null) |
879 | client.SendAlertMessage("Failed to retrieve item"); | 887 | client.SendAgentAlertMessage("Failed to retrieve item", false); |
880 | } | 888 | } |
881 | } | 889 | } |
882 | catch (Exception e) | 890 | catch (Exception e) |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 3b39153..8cdebcd 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -129,12 +129,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
129 | m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | 129 | m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); |
130 | if (cacheItems.Length > 0) | 130 | if (cacheItems.Length > 0) |
131 | { | 131 | { |
132 | m_log.Debug("[Cacheitems]: " + cacheItems.Length); | 132 | // m_log.Debug("[Cacheitems]: " + cacheItems.Length); |
133 | for (int iter = 0; iter < maxCacheitemsLoop; iter++) | 133 | // for (int iter = 0; iter < maxCacheitemsLoop; iter++) |
134 | { | 134 | // { |
135 | m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + | 135 | // m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + |
136 | cacheItems[iter].TextureID); | 136 | // cacheItems[iter].TextureID); |
137 | } | 137 | // } |
138 | 138 | ||
139 | ScenePresence p = null; | 139 | ScenePresence p = null; |
140 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) | 140 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7cb5b53..53217a0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -1761,6 +1761,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1761 | newBlock.Name = Util.StringToBytes256(folder.Name); | 1761 | newBlock.Name = Util.StringToBytes256(folder.Name); |
1762 | newBlock.ParentID = folder.ParentID; | 1762 | newBlock.ParentID = folder.ParentID; |
1763 | newBlock.Type = (sbyte)folder.Type; | 1763 | newBlock.Type = (sbyte)folder.Type; |
1764 | if (newBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) | ||
1765 | newBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; | ||
1764 | 1766 | ||
1765 | return newBlock; | 1767 | return newBlock; |
1766 | } | 1768 | } |
@@ -2010,8 +2012,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2010 | 2012 | ||
2011 | folderBlock.FolderID = folder.ID; | 2013 | folderBlock.FolderID = folder.ID; |
2012 | folderBlock.ParentID = folder.ParentID; | 2014 | folderBlock.ParentID = folder.ParentID; |
2013 | //folderBlock.Type = -1; | ||
2014 | folderBlock.Type = (sbyte)folder.Type; | 2015 | folderBlock.Type = (sbyte)folder.Type; |
2016 | if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) | ||
2017 | folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; | ||
2015 | folderBlock.Name = Util.StringToBytes256(folder.Name); | 2018 | folderBlock.Name = Util.StringToBytes256(folder.Name); |
2016 | 2019 | ||
2017 | return folderBlock; | 2020 | return folderBlock; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 0b10dd8..c632798 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -180,8 +180,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", | 180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", |
181 | folderID, new UUID(im.toAgentID)); | 181 | folderID, new UUID(im.toAgentID)); |
182 | 182 | ||
183 | InventoryFolderBase folderCopy | 183 | InventoryFolderBase folderCopy |
184 | = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); | 184 | = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero); |
185 | 185 | ||
186 | if (folderCopy == null) | 186 | if (folderCopy == null) |
187 | { | 187 | { |
@@ -217,13 +217,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
217 | "into agent {1}'s inventory", | 217 | "into agent {1}'s inventory", |
218 | itemID, new UUID(im.toAgentID)); | 218 | itemID, new UUID(im.toAgentID)); |
219 | 219 | ||
220 | InventoryItemBase itemCopy = scene.GiveInventoryItem( | 220 | string message; |
221 | new UUID(im.toAgentID), | 221 | InventoryItemBase itemCopy = scene.GiveInventoryItem(new UUID(im.toAgentID), client.AgentId, itemID, out message); |
222 | client.AgentId, itemID); | ||
223 | 222 | ||
224 | if (itemCopy == null) | 223 | if (itemCopy == null) |
225 | { | 224 | { |
226 | client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); | 225 | client.SendAgentAlertMessage(message, false); |
227 | return; | 226 | return; |
228 | } | 227 | } |
229 | 228 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index a1629fb..e9c6fb6 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -160,10 +160,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
160 | private IAssetService m_assetService = null; | 160 | private IAssetService m_assetService = null; |
161 | 161 | ||
162 | 162 | ||
163 | private UUID m_defaultUser; | ||
164 | |||
163 | public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options) | 165 | public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options) |
164 | { | 166 | { |
165 | m_rootScene = scene; | 167 | m_rootScene = scene; |
166 | 168 | ||
169 | if (options.ContainsKey("default-user")) | ||
170 | { | ||
171 | m_defaultUser = (UUID)options["default-user"]; | ||
172 | m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); | ||
173 | } | ||
174 | else | ||
175 | { | ||
176 | m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; | ||
177 | } | ||
178 | |||
167 | m_loadPath = loadPath; | 179 | m_loadPath = loadPath; |
168 | try | 180 | try |
169 | { | 181 | { |
@@ -206,6 +218,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
206 | m_merge = options.ContainsKey("merge"); | 218 | m_merge = options.ContainsKey("merge"); |
207 | m_requestId = requestId; | 219 | m_requestId = requestId; |
208 | 220 | ||
221 | m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; | ||
222 | |||
209 | // Zero can never be a valid user id | 223 | // Zero can never be a valid user id |
210 | m_validUserUuids[UUID.Zero] = false; | 224 | m_validUserUuids[UUID.Zero] = false; |
211 | 225 | ||
@@ -562,16 +576,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
562 | if (string.IsNullOrEmpty(part.CreatorData)) | 576 | if (string.IsNullOrEmpty(part.CreatorData)) |
563 | { | 577 | { |
564 | if (!ResolveUserUuid(scene, part.CreatorID)) | 578 | if (!ResolveUserUuid(scene, part.CreatorID)) |
565 | part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; | 579 | part.CreatorID = m_defaultUser; |
566 | } | 580 | } |
567 | if (UserManager != null) | 581 | if (UserManager != null) |
568 | UserManager.AddUser(part.CreatorID, part.CreatorData); | 582 | UserManager.AddUser(part.CreatorID, part.CreatorData); |
569 | 583 | ||
570 | if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID))) | 584 | if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID))) |
571 | part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | 585 | part.OwnerID = m_defaultUser; |
572 | 586 | ||
573 | if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(part.LastOwnerID))) | 587 | if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(part.LastOwnerID))) |
574 | part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | 588 | part.LastOwnerID = m_defaultUser; |
575 | 589 | ||
576 | if (!ResolveGroupUuid(part.GroupID)) | 590 | if (!ResolveGroupUuid(part.GroupID)) |
577 | part.GroupID = UUID.Zero; | 591 | part.GroupID = UUID.Zero; |
@@ -590,13 +604,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
590 | { | 604 | { |
591 | if (!(ResolveUserUuid(scene, kvp.Value.OwnerID) || ResolveGroupUuid(kvp.Value.OwnerID))) | 605 | if (!(ResolveUserUuid(scene, kvp.Value.OwnerID) || ResolveGroupUuid(kvp.Value.OwnerID))) |
592 | { | 606 | { |
593 | kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | 607 | kvp.Value.OwnerID = m_defaultUser; |
594 | } | 608 | } |
595 | 609 | ||
596 | if (string.IsNullOrEmpty(kvp.Value.CreatorData)) | 610 | if (string.IsNullOrEmpty(kvp.Value.CreatorData)) |
597 | { | 611 | { |
598 | if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) | 612 | if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) |
599 | kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; | 613 | kvp.Value.CreatorID = m_defaultUser; |
600 | } | 614 | } |
601 | 615 | ||
602 | if (UserManager != null) | 616 | if (UserManager != null) |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2b2da6f..6a09caf 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -108,6 +108,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
108 | bool forceParcels = false; | 108 | bool forceParcels = false; |
109 | bool noObjects = false; | 109 | bool noObjects = false; |
110 | Vector3 displacement = new Vector3(0f, 0f, 0f); | 110 | Vector3 displacement = new Vector3(0f, 0f, 0f); |
111 | String defaultUser = ""; | ||
111 | float rotation = 0f; | 112 | float rotation = 0f; |
112 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); | 113 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); |
113 | 114 | ||
@@ -119,6 +120,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
119 | options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); | 120 | options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); |
120 | options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility | 121 | options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility |
121 | options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); | 122 | options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); |
123 | options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); | ||
122 | options.Add("displacement=", delegate (string v) { | 124 | options.Add("displacement=", delegate (string v) { |
123 | try | 125 | try |
124 | { | 126 | { |
@@ -131,7 +133,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
131 | return; | 133 | return; |
132 | } | 134 | } |
133 | }); | 135 | }); |
134 | options.Add("rotation=", delegate (string v) { | 136 | options.Add("rotation=", delegate(string v) |
137 | { | ||
135 | try | 138 | try |
136 | { | 139 | { |
137 | rotation = v == null ? 0f : float.Parse(v); | 140 | rotation = v == null ? 0f : float.Parse(v); |
@@ -181,6 +184,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
181 | if (forceTerrain) archiveOptions.Add("force-terrain", null); | 184 | if (forceTerrain) archiveOptions.Add("force-terrain", null); |
182 | if (forceParcels) archiveOptions.Add("force-parcels", null); | 185 | if (forceParcels) archiveOptions.Add("force-parcels", null); |
183 | if (noObjects) archiveOptions.Add("no-objects", null); | 186 | if (noObjects) archiveOptions.Add("no-objects", null); |
187 | if (defaultUser != "") | ||
188 | { | ||
189 | UUID defaultUserUUID = UUID.Zero; | ||
190 | try | ||
191 | { | ||
192 | defaultUserUUID = Scene.UserManagementModule.GetUserIdByName(defaultUser); | ||
193 | } | ||
194 | catch | ||
195 | { | ||
196 | m_log.ErrorFormat("[ARCHIVER MODULE] default user must be in format \"First Last\"", defaultUser); | ||
197 | } | ||
198 | if (defaultUserUUID == UUID.Zero) | ||
199 | { | ||
200 | m_log.ErrorFormat("[ARCHIVER MODULE] cannot find specified default user {0}", defaultUser); | ||
201 | return; | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | archiveOptions.Add("default-user", defaultUserUUID); | ||
206 | } | ||
207 | } | ||
184 | archiveOptions.Add("displacement", displacement); | 208 | archiveOptions.Add("displacement", displacement); |
185 | archiveOptions.Add("rotation", rotation); | 209 | archiveOptions.Add("rotation", rotation); |
186 | archiveOptions.Add("rotation-center", rotationCenter); | 210 | archiveOptions.Add("rotation-center", rotationCenter); |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 54a7302..a032bc7 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -313,6 +313,69 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
313 | return response; | 313 | return response; |
314 | } | 314 | } |
315 | 315 | ||
316 | public string SetRegionEstate(RegionInfo regionInfo, int estateID) | ||
317 | { | ||
318 | string response; | ||
319 | |||
320 | if (regionInfo.EstateSettings.EstateID == estateID) | ||
321 | { | ||
322 | response = String.Format("\"{0}\" is already part of estate {1}", regionInfo.RegionName, estateID); | ||
323 | } | ||
324 | else | ||
325 | { | ||
326 | // get the current settings from DB | ||
327 | EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
328 | if (dbSettings.EstateID == 0) | ||
329 | { | ||
330 | response = String.Format("No estate found with ID {0}", estateID); | ||
331 | } | ||
332 | else if (Scene.EstateDataService.LinkRegion(regionInfo.RegionID, estateID)) | ||
333 | { | ||
334 | // make sure there's a log entry to document the change | ||
335 | m_log.InfoFormat("[ESTATE]: Region {0} ({1}) moved to Estate {2} ({3}).", regionInfo.RegionID, regionInfo.RegionName, estateID, dbSettings.EstateName); | ||
336 | |||
337 | // propagate the change | ||
338 | ChangeDelegate change = OnEstateInfoChange; | ||
339 | |||
340 | if (change != null) | ||
341 | change(regionInfo.RegionID); | ||
342 | |||
343 | response = String.Empty; | ||
344 | } | ||
345 | else | ||
346 | { | ||
347 | response = String.Format("Could not move \"{0}\" to estate {1}", regionInfo.RegionName, estateID); | ||
348 | } | ||
349 | } | ||
350 | return response; | ||
351 | } | ||
352 | |||
353 | public string CreateEstate(string estateName, UUID ownerID) | ||
354 | { | ||
355 | string response; | ||
356 | if (string.IsNullOrEmpty(estateName)) | ||
357 | { | ||
358 | response = "No estate name specified."; | ||
359 | } | ||
360 | else | ||
361 | { | ||
362 | List<int> estates = Scene.EstateDataService.GetEstates(estateName); | ||
363 | if (estates.Count() > 0) | ||
364 | { | ||
365 | response = String.Format("An estate named \"{0}\" already exists.", estateName); | ||
366 | } | ||
367 | else | ||
368 | { | ||
369 | EstateSettings settings = Scene.EstateDataService.CreateNewEstate(); | ||
370 | settings.EstateOwner = ownerID; | ||
371 | settings.EstateName = estateName; | ||
372 | settings.Save(); | ||
373 | response = String.Empty; | ||
374 | } | ||
375 | } | ||
376 | return response; | ||
377 | } | ||
378 | |||
316 | #endregion | 379 | #endregion |
317 | 380 | ||
318 | #region Packet Data Responders | 381 | #region Packet Data Responders |
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 600ecfe..461c880 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Framework; | ||
29 | using OpenSim.Services.Interfaces; | 30 | using OpenSim.Services.Interfaces; |
30 | 31 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
@@ -44,6 +45,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
44 | 45 | ||
45 | string SetEstateOwner(int estateID, UserAccount account); | 46 | string SetEstateOwner(int estateID, UserAccount account); |
46 | string SetEstateName(int estateID, string newName); | 47 | string SetEstateName(int estateID, string newName); |
48 | string SetRegionEstate(RegionInfo regionInfo, int estateID); | ||
49 | string CreateEstate(string estateName, UUID ownerID); | ||
47 | 50 | ||
48 | /// <summary> | 51 | /// <summary> |
49 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). | 52 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.). |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 64da5f6..3c3d077 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
46 | { | 46 | { |
47 | public partial class Scene | 47 | public partial class Scene |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private static readonly string LogHeader = "[SCENE INVENTORY]"; | 50 | private static readonly string LogHeader = "[SCENE INVENTORY]"; |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
@@ -541,9 +541,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
541 | /// <param name="recipientClient"></param> | 541 | /// <param name="recipientClient"></param> |
542 | /// <param name="senderId">ID of the sender of the item</param> | 542 | /// <param name="senderId">ID of the sender of the item</param> |
543 | /// <param name="itemId"></param> | 543 | /// <param name="itemId"></param> |
544 | public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) | 544 | public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId, out string message) |
545 | { | 545 | { |
546 | InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); | 546 | InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId, out message); |
547 | 547 | ||
548 | if (itemCopy != null) | 548 | if (itemCopy != null) |
549 | recipientClient.SendBulkUpdateInventory(itemCopy); | 549 | recipientClient.SendBulkUpdateInventory(itemCopy); |
@@ -556,9 +556,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
556 | /// <param name="senderId">ID of the sender of the item</param> | 556 | /// <param name="senderId">ID of the sender of the item</param> |
557 | /// <param name="itemId"></param> | 557 | /// <param name="itemId"></param> |
558 | /// <returns>The inventory item copy given, null if the give was unsuccessful</returns> | 558 | /// <returns>The inventory item copy given, null if the give was unsuccessful</returns> |
559 | public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) | 559 | public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId, out string message) |
560 | { | 560 | { |
561 | return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); | 561 | return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero, out message); |
562 | } | 562 | } |
563 | 563 | ||
564 | /// <summary> | 564 | /// <summary> |
@@ -575,12 +575,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
575 | /// The inventory item copy given, null if the give was unsuccessful | 575 | /// The inventory item copy given, null if the give was unsuccessful |
576 | /// </returns> | 576 | /// </returns> |
577 | public virtual InventoryItemBase GiveInventoryItem( | 577 | public virtual InventoryItemBase GiveInventoryItem( |
578 | UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) | 578 | UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId, out string message) |
579 | { | 579 | { |
580 | //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); | 580 | //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); |
581 | 581 | ||
582 | if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient)) | 582 | if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient)) |
583 | { | ||
584 | message = "Not allowed to transfer this item."; | ||
583 | return null; | 585 | return null; |
586 | } | ||
584 | 587 | ||
585 | InventoryItemBase item = new InventoryItemBase(itemId, senderId); | 588 | InventoryItemBase item = new InventoryItemBase(itemId, senderId); |
586 | item = InventoryService.GetItem(item); | 589 | item = InventoryService.GetItem(item); |
@@ -589,6 +592,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | { | 592 | { |
590 | m_log.WarnFormat( | 593 | m_log.WarnFormat( |
591 | "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); | 594 | "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); |
595 | message = string.Format("Item not found: {0}.", itemId); | ||
592 | return null; | 596 | return null; |
593 | } | 597 | } |
594 | 598 | ||
@@ -597,6 +601,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
597 | m_log.WarnFormat( | 601 | m_log.WarnFormat( |
598 | "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", | 602 | "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", |
599 | item.Name, item.ID, recipient, senderId, item.Owner); | 603 | item.Name, item.ID, recipient, senderId, item.Owner); |
604 | message = "Sender did not match item owner."; | ||
600 | return null; | 605 | return null; |
601 | } | 606 | } |
602 | 607 | ||
@@ -607,7 +612,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
607 | if (!Permissions.BypassPermissions()) | 612 | if (!Permissions.BypassPermissions()) |
608 | { | 613 | { |
609 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 614 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
615 | { | ||
616 | message = "Item doesn't have the Transfer permission."; | ||
610 | return null; | 617 | return null; |
618 | } | ||
611 | } | 619 | } |
612 | 620 | ||
613 | // Insert a copy of the item into the recipient | 621 | // Insert a copy of the item into the recipient |
@@ -743,9 +751,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
743 | InventoryFolderBase root = InventoryService.GetRootFolder(recipient); | 751 | InventoryFolderBase root = InventoryService.GetRootFolder(recipient); |
744 | 752 | ||
745 | if (root != null) | 753 | if (root != null) |
754 | { | ||
746 | itemCopy.Folder = root.ID; | 755 | itemCopy.Folder = root.ID; |
756 | } | ||
747 | else | 757 | else |
748 | return null; // No destination | 758 | { |
759 | message = "Can't find a folder to add the item to."; | ||
760 | return null; | ||
761 | } | ||
749 | } | 762 | } |
750 | } | 763 | } |
751 | 764 | ||
@@ -770,6 +783,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
770 | } | 783 | } |
771 | } | 784 | } |
772 | 785 | ||
786 | message = null; | ||
773 | return itemCopy; | 787 | return itemCopy; |
774 | } | 788 | } |
775 | 789 | ||
@@ -787,7 +801,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
787 | /// <returns> | 801 | /// <returns> |
788 | /// The inventory folder copy given, null if the copy was unsuccessful | 802 | /// The inventory folder copy given, null if the copy was unsuccessful |
789 | /// </returns> | 803 | /// </returns> |
790 | public virtual InventoryFolderBase GiveInventoryFolder( | 804 | public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client, |
791 | UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) | 805 | UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) |
792 | { | 806 | { |
793 | //// Retrieve the folder from the sender | 807 | //// Retrieve the folder from the sender |
@@ -822,13 +836,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
822 | InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); | 836 | InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); |
823 | foreach (InventoryFolderBase childFolder in contents.Folders) | 837 | foreach (InventoryFolderBase childFolder in contents.Folders) |
824 | { | 838 | { |
825 | GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID); | 839 | GiveInventoryFolder(client, recipientId, senderId, childFolder.ID, newFolder.ID); |
826 | } | 840 | } |
827 | 841 | ||
828 | // Give all the items | 842 | // Give all the items |
829 | foreach (InventoryItemBase item in contents.Items) | 843 | foreach (InventoryItemBase item in contents.Items) |
830 | { | 844 | { |
831 | GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID); | 845 | string message; |
846 | if (GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID, out message) == null) | ||
847 | { | ||
848 | if (client != null) | ||
849 | client.SendAgentAlertMessage(message, false); | ||
850 | } | ||
832 | } | 851 | } |
833 | 852 | ||
834 | return newFolder; | 853 | return newFolder; |
@@ -1155,11 +1174,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1155 | 1174 | ||
1156 | InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); | 1175 | InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); |
1157 | 1176 | ||
1158 | // Move the item to trash. If this is a copiable item, only | 1177 | // Move the item to trash. If this is a copyable item, only |
1159 | // a copy will be moved and we will still need to delete | 1178 | // a copy will be moved and we will still need to delete |
1160 | // the item from the prim. If it was no copy, is will be | 1179 | // the item from the prim. If it was no copy, it will be |
1161 | // deleted by this method. | 1180 | // deleted by this method. |
1162 | MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); | 1181 | string message; |
1182 | InventoryItemBase item2 = MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID, out message); | ||
1183 | |||
1184 | if (item2 == null) | ||
1185 | { | ||
1186 | m_log.WarnFormat("[SCENE INVENTORY]: RemoveTaskInventory of item {0} failed: {1}", itemID, message); | ||
1187 | remoteClient.SendAgentAlertMessage(message, false); | ||
1188 | return; | ||
1189 | } | ||
1163 | 1190 | ||
1164 | if (group.GetInventoryItem(localID, itemID) != null) | 1191 | if (group.GetInventoryItem(localID, itemID) != null) |
1165 | { | 1192 | { |
@@ -1171,11 +1198,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1171 | 1198 | ||
1172 | group.RemoveInventoryItem(localID, itemID); | 1199 | group.RemoveInventoryItem(localID, itemID); |
1173 | } | 1200 | } |
1201 | |||
1174 | part.SendPropertiesToClient(remoteClient); | 1202 | part.SendPropertiesToClient(remoteClient); |
1175 | } | 1203 | } |
1176 | } | 1204 | } |
1177 | 1205 | ||
1178 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) | 1206 | |
1207 | /// <summary> | ||
1208 | /// Creates (in memory only) a user inventory item that will contain a copy of a task inventory item. | ||
1209 | /// </summary> | ||
1210 | private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId, out string message) | ||
1179 | { | 1211 | { |
1180 | TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); | 1212 | TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); |
1181 | 1213 | ||
@@ -1186,12 +1218,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1186 | + " inventory item from a prim's inventory item " | 1218 | + " inventory item from a prim's inventory item " |
1187 | + " but the required item does not exist in the prim's inventory", | 1219 | + " but the required item does not exist in the prim's inventory", |
1188 | itemId, part.Name, part.UUID); | 1220 | itemId, part.Name, part.UUID); |
1189 | 1221 | message = "Item not found: " + itemId; | |
1190 | return null; | 1222 | return null; |
1191 | } | 1223 | } |
1192 | 1224 | ||
1193 | if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) | 1225 | if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) |
1194 | { | 1226 | { |
1227 | message = "Item doesn't have the Transfer permission."; | ||
1195 | return null; | 1228 | return null; |
1196 | } | 1229 | } |
1197 | 1230 | ||
@@ -1237,11 +1270,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1237 | agentItem.GroupPermissions = taskItem.GroupPermissions; | 1270 | agentItem.GroupPermissions = taskItem.GroupPermissions; |
1238 | } | 1271 | } |
1239 | 1272 | ||
1273 | message = null; | ||
1274 | return agentItem; | ||
1275 | } | ||
1276 | |||
1277 | /// <summary> | ||
1278 | /// If the task item is not-copyable then remove it from the prim. | ||
1279 | /// </summary> | ||
1280 | private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId) | ||
1281 | { | ||
1282 | TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); | ||
1283 | if (taskItem == null) | ||
1284 | return; | ||
1285 | |||
1240 | if (!Permissions.BypassPermissions()) | 1286 | if (!Permissions.BypassPermissions()) |
1241 | { | 1287 | { |
1242 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 1288 | if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1243 | { | 1289 | { |
1244 | if (taskItem.Type == 10) | 1290 | if (taskItem.Type == (int)AssetType.LSLText) |
1245 | { | 1291 | { |
1246 | part.RemoveScriptEvents(itemId); | 1292 | part.RemoveScriptEvents(itemId); |
1247 | EventManager.TriggerRemoveScript(part.LocalId, itemId); | 1293 | EventManager.TriggerRemoveScript(part.LocalId, itemId); |
@@ -1250,8 +1296,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1250 | part.Inventory.RemoveInventoryItem(itemId); | 1296 | part.Inventory.RemoveInventoryItem(itemId); |
1251 | } | 1297 | } |
1252 | } | 1298 | } |
1253 | |||
1254 | return agentItem; | ||
1255 | } | 1299 | } |
1256 | 1300 | ||
1257 | /// <summary> | 1301 | /// <summary> |
@@ -1261,19 +1305,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1261 | /// <param name="folderID"></param> | 1305 | /// <param name="folderID"></param> |
1262 | /// <param name="part"></param> | 1306 | /// <param name="part"></param> |
1263 | /// <param name="itemID"></param> | 1307 | /// <param name="itemID"></param> |
1264 | public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) | 1308 | public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId, out string message) |
1265 | { | 1309 | { |
1266 | m_log.DebugFormat( | 1310 | m_log.DebugFormat( |
1267 | "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", | 1311 | "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", |
1268 | itemId, part.Name, folderId, remoteClient.Name); | 1312 | itemId, part.Name, folderId, remoteClient.Name); |
1269 | 1313 | ||
1270 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); | 1314 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId, out message); |
1271 | |||
1272 | if (agentItem == null) | 1315 | if (agentItem == null) |
1273 | return null; | 1316 | return null; |
1274 | 1317 | ||
1275 | agentItem.Folder = folderId; | 1318 | agentItem.Folder = folderId; |
1276 | AddInventoryItem(remoteClient, agentItem); | 1319 | AddInventoryItem(remoteClient, agentItem); |
1320 | |||
1321 | RemoveNonCopyTaskItemFromPrim(part, itemId); | ||
1322 | |||
1323 | message = null; | ||
1277 | return agentItem; | 1324 | return agentItem; |
1278 | } | 1325 | } |
1279 | 1326 | ||
@@ -1324,7 +1371,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1324 | return; | 1371 | return; |
1325 | } | 1372 | } |
1326 | 1373 | ||
1327 | MoveTaskInventoryItem(remoteClient, folderId, part, itemId); | 1374 | string message; |
1375 | InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message); | ||
1376 | |||
1377 | if (item == null) | ||
1378 | remoteClient.SendAgentAlertMessage(message, false); | ||
1328 | } | 1379 | } |
1329 | 1380 | ||
1330 | /// <summary> | 1381 | /// <summary> |
@@ -1338,17 +1389,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1338 | /// </param> | 1389 | /// </param> |
1339 | /// <param name="part"></param> | 1390 | /// <param name="part"></param> |
1340 | /// <param name="itemID"></param> | 1391 | /// <param name="itemID"></param> |
1341 | public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) | 1392 | public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId, out string message) |
1342 | { | 1393 | { |
1343 | ScenePresence avatar; | 1394 | ScenePresence avatar; |
1344 | 1395 | ||
1345 | if (TryGetScenePresence(avatarId, out avatar)) | 1396 | if (TryGetScenePresence(avatarId, out avatar)) |
1346 | { | 1397 | { |
1347 | return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); | 1398 | return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId, out message); |
1348 | } | 1399 | } |
1349 | else | 1400 | else |
1350 | { | 1401 | { |
1351 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); | 1402 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId, out message); |
1352 | 1403 | ||
1353 | if (agentItem == null) | 1404 | if (agentItem == null) |
1354 | return null; | 1405 | return null; |
@@ -1357,6 +1408,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1357 | 1408 | ||
1358 | AddInventoryItem(agentItem); | 1409 | AddInventoryItem(agentItem); |
1359 | 1410 | ||
1411 | RemoveNonCopyTaskItemFromPrim(part, itemId); | ||
1412 | |||
1360 | return agentItem; | 1413 | return agentItem; |
1361 | } | 1414 | } |
1362 | } | 1415 | } |
@@ -1462,6 +1515,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1462 | 1515 | ||
1463 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1516 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1464 | { | 1517 | { |
1518 | ScenePresence avatar; | ||
1519 | IClientAPI remoteClient = null; | ||
1520 | if (TryGetScenePresence(destID, out avatar)) | ||
1521 | remoteClient = avatar.ControllingClient; | ||
1522 | |||
1465 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); | 1523 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1466 | 1524 | ||
1467 | UUID newFolderID = UUID.Random(); | 1525 | UUID newFolderID = UUID.Random(); |
@@ -1471,26 +1529,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1471 | 1529 | ||
1472 | foreach (UUID itemID in items) | 1530 | foreach (UUID itemID in items) |
1473 | { | 1531 | { |
1474 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID); | 1532 | string message; |
1533 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID, out message); | ||
1475 | 1534 | ||
1476 | if (agentItem != null) | 1535 | if (agentItem != null) |
1477 | { | 1536 | { |
1478 | agentItem.Folder = newFolderID; | 1537 | agentItem.Folder = newFolderID; |
1479 | 1538 | ||
1480 | AddInventoryItem(agentItem); | 1539 | AddInventoryItem(agentItem); |
1540 | |||
1541 | RemoveNonCopyTaskItemFromPrim(host, itemID); | ||
1542 | } | ||
1543 | else | ||
1544 | { | ||
1545 | if (remoteClient != null) | ||
1546 | remoteClient.SendAgentAlertMessage(message, false); | ||
1481 | } | 1547 | } |
1482 | } | 1548 | } |
1483 | 1549 | ||
1484 | ScenePresence avatar = null; | 1550 | if (remoteClient != null) |
1485 | if (TryGetScenePresence(destID, out avatar)) | ||
1486 | { | 1551 | { |
1487 | //profile.SendInventoryDecendents(avatar.ControllingClient, | 1552 | SendInventoryUpdate(remoteClient, rootFolder, true, false); |
1488 | // profile.RootFolder.ID, true, false); | 1553 | SendInventoryUpdate(remoteClient, newFolder, false, true); |
1489 | //profile.SendInventoryDecendents(avatar.ControllingClient, | ||
1490 | // newFolderID, false, true); | ||
1491 | |||
1492 | SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false); | ||
1493 | SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true); | ||
1494 | } | 1554 | } |
1495 | 1555 | ||
1496 | return newFolderID; | 1556 | return newFolderID; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0356599..3b1c5d8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1421,7 +1421,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1421 | 1421 | ||
1422 | Scene.ForEachScenePresence(sp => | 1422 | Scene.ForEachScenePresence(sp => |
1423 | { | 1423 | { |
1424 | if (!sp.IsChildAgent && sp.ParentID == LocalId) | 1424 | if (!sp.IsChildAgent && sp.ParentID == part.LocalId) |
1425 | sp.StandUp(); | 1425 | sp.StandUp(); |
1426 | 1426 | ||
1427 | if (!silent) | 1427 | if (!silent) |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 6e0ea7d..f809267 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -136,7 +136,8 @@ namespace OpenSim.Region.Framework.Tests | |||
136 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 136 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
137 | 137 | ||
138 | // Perform test | 138 | // Perform test |
139 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); | 139 | string message; |
140 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID, out message); | ||
140 | 141 | ||
141 | InventoryItemBase ncUserItem | 142 | InventoryItemBase ncUserItem |
142 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); | 143 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); |
@@ -165,7 +166,8 @@ namespace OpenSim.Region.Framework.Tests | |||
165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); | 166 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
166 | 167 | ||
167 | // Perform test | 168 | // Perform test |
168 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 169 | string message; |
170 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID, out message); | ||
169 | 171 | ||
170 | InventoryItemBase ncUserItem | 172 | InventoryItemBase ncUserItem |
171 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); | 173 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index e50b4da..0736278 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -95,7 +95,9 @@ namespace OpenSim.Region.Framework.Tests | |||
95 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); | 95 | UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); |
96 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); | 96 | InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); |
97 | 97 | ||
98 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); | 98 | string message; |
99 | |||
100 | scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID, out message); | ||
99 | 101 | ||
100 | InventoryItemBase retrievedItem1 | 102 | InventoryItemBase retrievedItem1 |
101 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); | 103 | = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); |
@@ -103,7 +105,7 @@ namespace OpenSim.Region.Framework.Tests | |||
103 | Assert.That(retrievedItem1, Is.Not.Null); | 105 | Assert.That(retrievedItem1, Is.Not.Null); |
104 | 106 | ||
105 | // Try giving back the freshly received item | 107 | // Try giving back the freshly received item |
106 | scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); | 108 | scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID, out message); |
107 | 109 | ||
108 | List<InventoryItemBase> reretrievedItems | 110 | List<InventoryItemBase> reretrievedItems |
109 | = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); | 111 | = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); |
@@ -123,7 +125,7 @@ namespace OpenSim.Region.Framework.Tests | |||
123 | InventoryFolderBase folder1 | 125 | InventoryFolderBase folder1 |
124 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); | 126 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); |
125 | 127 | ||
126 | scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); | 128 | scene.GiveInventoryFolder(null, user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); |
127 | 129 | ||
128 | InventoryFolderBase retrievedFolder1 | 130 | InventoryFolderBase retrievedFolder1 |
129 | = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); | 131 | = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); |
@@ -131,7 +133,7 @@ namespace OpenSim.Region.Framework.Tests | |||
131 | Assert.That(retrievedFolder1, Is.Not.Null); | 133 | Assert.That(retrievedFolder1, Is.Not.Null); |
132 | 134 | ||
133 | // Try giving back the freshly received folder | 135 | // Try giving back the freshly received folder |
134 | scene.GiveInventoryFolder(user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); | 136 | scene.GiveInventoryFolder(null, user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); |
135 | 137 | ||
136 | List<InventoryFolderBase> reretrievedFolders | 138 | List<InventoryFolderBase> reretrievedFolders |
137 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); | 139 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index fc8cae2..f34152c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -560,12 +560,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
560 | if (m_debugEnabled) | 560 | if (m_debugEnabled) |
561 | m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); | 561 | m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); |
562 | 562 | ||
563 | string message; | ||
563 | InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, | 564 | InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, |
564 | giver, attachmentUUID); | 565 | giver, attachmentUUID, out message); |
565 | 566 | ||
566 | if (itemCopy == null) | 567 | if (itemCopy == null) |
567 | { | 568 | { |
568 | remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); | 569 | remoteClient.SendAgentAlertMessage(message, false); |
569 | return; | 570 | return; |
570 | } | 571 | } |
571 | 572 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4d20e13..5590cd5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1884,9 +1884,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1884 | part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f); | 1884 | part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f); |
1885 | part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f); | 1885 | part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f); |
1886 | part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f); | 1886 | part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f); |
1887 | part.Shape.LightIntensity = intensity; | 1887 | part.Shape.LightIntensity = Util.Clip((float)intensity, 0.0f, 1.0f); |
1888 | part.Shape.LightRadius = radius; | 1888 | part.Shape.LightRadius = Util.Clip((float)radius, 0.1f, 20.0f); |
1889 | part.Shape.LightFalloff = falloff; | 1889 | part.Shape.LightFalloff = Util.Clip((float)falloff, 0.01f, 2.0f); |
1890 | } | 1890 | } |
1891 | else | 1891 | else |
1892 | { | 1892 | { |
@@ -3162,6 +3162,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3162 | } | 3162 | } |
3163 | } | 3163 | } |
3164 | 3164 | ||
3165 | public LSL_Float llGetMassMKS() | ||
3166 | { | ||
3167 | // this is what the wiki says it does! | ||
3168 | // http://wiki.secondlife.com/wiki/LlGetMassMKS | ||
3169 | return llGetMass() * 100.0; | ||
3170 | } | ||
3171 | |||
3165 | public void llCollisionFilter(string name, string id, int accept) | 3172 | public void llCollisionFilter(string name, string id, int accept) |
3166 | { | 3173 | { |
3167 | m_host.AddScriptLPS(1); | 3174 | m_host.AddScriptLPS(1); |
@@ -4127,10 +4134,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4127 | } | 4134 | } |
4128 | } | 4135 | } |
4129 | // destination is an avatar | 4136 | // destination is an avatar |
4130 | InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); | 4137 | string message; |
4138 | InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out message); | ||
4131 | 4139 | ||
4132 | if (agentItem == null) | 4140 | if (agentItem == null) |
4141 | { | ||
4142 | llSay(0, message); | ||
4133 | return; | 4143 | return; |
4144 | } | ||
4134 | 4145 | ||
4135 | if (m_TransferModule != null) | 4146 | if (m_TransferModule != null) |
4136 | { | 4147 | { |
@@ -6144,10 +6155,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6144 | if (UUID.TryParse(id, out key)) | 6155 | if (UUID.TryParse(id, out key)) |
6145 | { | 6156 | { |
6146 | ScenePresence av = World.GetScenePresence(key); | 6157 | ScenePresence av = World.GetScenePresence(key); |
6158 | List<ScenePresence> sittingAvatars = m_host.ParentGroup.GetSittingAvatars(); | ||
6147 | 6159 | ||
6148 | if (av != null) | 6160 | if (av != null) |
6149 | { | 6161 | { |
6150 | if (llAvatarOnSitTarget() == id) | 6162 | if (sittingAvatars.Contains(av)) |
6151 | { | 6163 | { |
6152 | // if the avatar is sitting on this object, then | 6164 | // if the avatar is sitting on this object, then |
6153 | // we can unsit them. We don't want random scripts unsitting random people | 6165 | // we can unsit them. We don't want random scripts unsitting random people |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 6302455..de2c3f7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3397,14 +3397,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3397 | if (sp == null) | 3397 | if (sp == null) |
3398 | return; | 3398 | return; |
3399 | 3399 | ||
3400 | InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID); | 3400 | string message; |
3401 | InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID, out message); | ||
3401 | 3402 | ||
3402 | if (newItem == null) | 3403 | if (newItem == null) |
3403 | { | 3404 | { |
3404 | m_log.ErrorFormat( | 3405 | m_log.ErrorFormat( |
3405 | "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}", | 3406 | "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}", |
3406 | itemName, m_host.Name, attachmentPoint, World.Name); | 3407 | itemName, m_host.Name, attachmentPoint, World.Name, message); |
3407 | 3408 | ((LSL_Api)m_LSL_Api).llSay(0, message); | |
3408 | return; | 3409 | return; |
3409 | } | 3410 | } |
3410 | 3411 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 340edb3..18a1e84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -149,6 +149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
149 | LSL_Vector llGetLocalPos(); | 149 | LSL_Vector llGetLocalPos(); |
150 | LSL_Rotation llGetLocalRot(); | 150 | LSL_Rotation llGetLocalRot(); |
151 | LSL_Float llGetMass(); | 151 | LSL_Float llGetMass(); |
152 | LSL_Float llGetMassMKS(); | ||
152 | LSL_Integer llGetMemoryLimit(); | 153 | LSL_Integer llGetMemoryLimit(); |
153 | void llGetNextEmail(string address, string subject); | 154 | void llGetNextEmail(string address, string subject); |
154 | LSL_String llGetNotecardLine(string name, int line); | 155 | LSL_String llGetNotecardLine(string name, int line); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 7cd17e7..49e39fe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -584,6 +584,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
584 | return m_LSL_Functions.llGetMass(); | 584 | return m_LSL_Functions.llGetMass(); |
585 | } | 585 | } |
586 | 586 | ||
587 | public LSL_Float llGetMassMKS() | ||
588 | { | ||
589 | return m_LSL_Functions.llGetMassMKS(); | ||
590 | } | ||
591 | |||
587 | public LSL_Integer llGetMemoryLimit() | 592 | public LSL_Integer llGetMemoryLimit() |
588 | { | 593 | { |
589 | return m_LSL_Functions.llGetMemoryLimit(); | 594 | return m_LSL_Functions.llGetMemoryLimit(); |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index 5122a77..a77e67d 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
64 | { | 64 | { |
65 | asset = (AssetBase)xs.Deserialize(request); | 65 | asset = (AssetBase)xs.Deserialize(request); |
66 | } | 66 | } |
67 | catch (XmlException) | 67 | catch (Exception) |
68 | { | 68 | { |
69 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; | 69 | httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; |
70 | return null; | 70 | return null; |
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 8269d36..3de2330 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -156,9 +156,9 @@ namespace OpenSim.Services.HypergridService | |||
156 | if (suitcase == null) | 156 | if (suitcase == null) |
157 | { | 157 | { |
158 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); | 158 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); |
159 | // make one, and let's add it to the user's inventory as a direct child of the root folder | 159 | // Create the My Suitcase folder under the user's root folder. |
160 | // In the DB we tag it as type 100, but we use -1 (Unknown) outside | 160 | // In the DB we tag it as type 100, but we use type 8 (Folder) outside, as this affects the sort order. |
161 | suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase"); | 161 | suitcase = CreateFolder(principalID, root.folderID, InventoryItemBase.SUITCASE_FOLDER_TYPE, InventoryItemBase.SUITCASE_FOLDER_NAME); |
162 | if (suitcase == null) | 162 | if (suitcase == null) |
163 | { | 163 | { |
164 | m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); | 164 | m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); |
@@ -248,7 +248,10 @@ namespace OpenSim.Services.HypergridService | |||
248 | InventoryCollection coll = null; | 248 | InventoryCollection coll = null; |
249 | 249 | ||
250 | if (!IsWithinSuitcaseTree(principalID, folderID)) | 250 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
251 | { | ||
252 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID); | ||
251 | return new InventoryCollection(); | 253 | return new InventoryCollection(); |
254 | } | ||
252 | 255 | ||
253 | coll = base.GetFolderContent(principalID, folderID); | 256 | coll = base.GetFolderContent(principalID, folderID); |
254 | 257 | ||
@@ -265,7 +268,10 @@ namespace OpenSim.Services.HypergridService | |||
265 | // Let's do a bit of sanity checking, more than the base service does | 268 | // Let's do a bit of sanity checking, more than the base service does |
266 | // make sure the given folder exists under the suitcase tree of this user | 269 | // make sure the given folder exists under the suitcase tree of this user |
267 | if (!IsWithinSuitcaseTree(principalID, folderID)) | 270 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
271 | { | ||
272 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} is not within Suitcase tree", folderID); | ||
268 | return new List<InventoryItemBase>(); | 273 | return new List<InventoryItemBase>(); |
274 | } | ||
269 | 275 | ||
270 | return base.GetFolderItems(principalID, folderID); | 276 | return base.GetFolderItems(principalID, folderID); |
271 | } | 277 | } |
@@ -277,7 +283,10 @@ namespace OpenSim.Services.HypergridService | |||
277 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 283 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
278 | 284 | ||
279 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | 285 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) |
286 | { | ||
287 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} is not within Suitcase tree", folder.ParentID); | ||
280 | return false; | 288 | return false; |
289 | } | ||
281 | 290 | ||
282 | // OK, it's legit | 291 | // OK, it's legit |
283 | if (base.AddFolder(folder)) | 292 | if (base.AddFolder(folder)) |
@@ -297,7 +306,7 @@ namespace OpenSim.Services.HypergridService | |||
297 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); | 306 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); |
298 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) | 307 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
299 | { | 308 | { |
300 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: folder {0} not within Suitcase tree", folder.Name); | 309 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} is not within Suitcase tree", folder.Name, folder.ID); |
301 | return false; | 310 | return false; |
302 | } | 311 | } |
303 | 312 | ||
@@ -307,9 +316,17 @@ namespace OpenSim.Services.HypergridService | |||
307 | 316 | ||
308 | public override bool MoveFolder(InventoryFolderBase folder) | 317 | public override bool MoveFolder(InventoryFolderBase folder) |
309 | { | 318 | { |
310 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) || | 319 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
311 | !IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | 320 | { |
321 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID); | ||
312 | return false; | 322 | return false; |
323 | } | ||
324 | |||
325 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | ||
326 | { | ||
327 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ParentID); | ||
328 | return false; | ||
329 | } | ||
313 | 330 | ||
314 | return base.MoveFolder(folder); | 331 | return base.MoveFolder(folder); |
315 | } | 332 | } |
@@ -331,7 +348,10 @@ namespace OpenSim.Services.HypergridService | |||
331 | // Let's do a bit of sanity checking, more than the base service does | 348 | // Let's do a bit of sanity checking, more than the base service does |
332 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 349 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
333 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | 350 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
351 | { | ||
352 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} is not within Suitcase tree", item.Folder); | ||
334 | return false; | 353 | return false; |
354 | } | ||
335 | 355 | ||
336 | // OK, it's legit | 356 | // OK, it's legit |
337 | return base.AddItem(item); | 357 | return base.AddItem(item); |
@@ -341,7 +361,10 @@ namespace OpenSim.Services.HypergridService | |||
341 | public override bool UpdateItem(InventoryItemBase item) | 361 | public override bool UpdateItem(InventoryItemBase item) |
342 | { | 362 | { |
343 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | 363 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
364 | { | ||
365 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} is not within Suitcase tree", item.Folder); | ||
344 | return false; | 366 | return false; |
367 | } | ||
345 | 368 | ||
346 | return base.UpdateItem(item); | 369 | return base.UpdateItem(item); |
347 | } | 370 | } |
@@ -350,11 +373,28 @@ namespace OpenSim.Services.HypergridService | |||
350 | { | 373 | { |
351 | // Principal is b0rked. *sigh* | 374 | // Principal is b0rked. *sigh* |
352 | 375 | ||
353 | if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder)) | 376 | // Check the items' destination folders |
354 | return false; | 377 | foreach (InventoryItemBase item in items) |
378 | { | ||
379 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | ||
380 | { | ||
381 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", item.Folder); | ||
382 | return false; | ||
383 | } | ||
384 | } | ||
355 | 385 | ||
356 | return base.MoveItems(principalID, items); | 386 | // Check the items' current folders |
387 | foreach (InventoryItemBase item in items) | ||
388 | { | ||
389 | InventoryItemBase originalItem = base.GetItem(item); | ||
390 | if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) | ||
391 | { | ||
392 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", originalItem.Folder); | ||
393 | return false; | ||
394 | } | ||
395 | } | ||
357 | 396 | ||
397 | return base.MoveItems(principalID, items); | ||
358 | } | 398 | } |
359 | 399 | ||
360 | public override bool DeleteItems(UUID principalID, List<UUID> itemIDs) | 400 | public override bool DeleteItems(UUID principalID, List<UUID> itemIDs) |
@@ -374,8 +414,8 @@ namespace OpenSim.Services.HypergridService | |||
374 | 414 | ||
375 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) | 415 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) |
376 | { | 416 | { |
377 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0} (folder {1}) is not within Suitcase", | 417 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0}/{1} (folder {2}) is not within Suitcase tree or Appearance", |
378 | it.Name, it.Folder); | 418 | it.Name, it.ID, it.Folder); |
379 | return null; | 419 | return null; |
380 | } | 420 | } |
381 | 421 | ||
@@ -396,7 +436,11 @@ namespace OpenSim.Services.HypergridService | |||
396 | if (f != null) | 436 | if (f != null) |
397 | { | 437 | { |
398 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) | 438 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) |
439 | { | ||
440 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Folder {0}/{1} is not within Suitcase tree", | ||
441 | f.Name, f.ID); | ||
399 | return null; | 442 | return null; |
443 | } | ||
400 | } | 444 | } |
401 | 445 | ||
402 | return f; | 446 | return f; |
@@ -464,7 +508,7 @@ namespace OpenSim.Services.HypergridService | |||
464 | // Warp! Root folder for travelers | 508 | // Warp! Root folder for travelers |
465 | XInventoryFolder[] folders = m_Database.GetFolders( | 509 | XInventoryFolder[] folders = m_Database.GetFolders( |
466 | new string[] { "agentID", "type" }, | 510 | new string[] { "agentID", "type" }, |
467 | new string[] { principalID.ToString(), "100" }); // This is a special folder type... | 511 | new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_TYPE.ToString() }); // This is a special folder type... |
468 | 512 | ||
469 | if (folders != null && folders.Length > 0) | 513 | if (folders != null && folders.Length > 0) |
470 | return folders[0]; | 514 | return folders[0]; |
@@ -472,13 +516,13 @@ namespace OpenSim.Services.HypergridService | |||
472 | // check to see if we have the old Suitcase folder | 516 | // check to see if we have the old Suitcase folder |
473 | folders = m_Database.GetFolders( | 517 | folders = m_Database.GetFolders( |
474 | new string[] { "agentID", "folderName", "parentFolderID" }, | 518 | new string[] { "agentID", "folderName", "parentFolderID" }, |
475 | new string[] { principalID.ToString(), "My Suitcase", UUID.Zero.ToString() }); | 519 | new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_NAME, UUID.Zero.ToString() }); |
476 | if (folders != null && folders.Length > 0) | 520 | if (folders != null && folders.Length > 0) |
477 | { | 521 | { |
478 | // Move it to under the root folder | 522 | // Move it to under the root folder |
479 | XInventoryFolder root = GetRootXFolder(principalID); | 523 | XInventoryFolder root = GetRootXFolder(principalID); |
480 | folders[0].parentFolderID = root.folderID; | 524 | folders[0].parentFolderID = root.folderID; |
481 | folders[0].type = 100; | 525 | folders[0].type = InventoryItemBase.SUITCASE_FOLDER_TYPE; |
482 | m_Database.StoreFolder(folders[0]); | 526 | m_Database.StoreFolder(folders[0]); |
483 | return folders[0]; | 527 | return folders[0]; |
484 | } | 528 | } |
@@ -488,7 +532,7 @@ namespace OpenSim.Services.HypergridService | |||
488 | 532 | ||
489 | private void SetAsNormalFolder(XInventoryFolder suitcase) | 533 | private void SetAsNormalFolder(XInventoryFolder suitcase) |
490 | { | 534 | { |
491 | suitcase.type = (short)AssetType.Folder; | 535 | suitcase.type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; |
492 | } | 536 | } |
493 | 537 | ||
494 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) | 538 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 3bee433..7c16ca9 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -631,8 +631,8 @@ namespace OpenSim.Services.InventoryService | |||
631 | newFolder.ParentID = folder.parentFolderID; | 631 | newFolder.ParentID = folder.parentFolderID; |
632 | newFolder.Type = (short)folder.type; | 632 | newFolder.Type = (short)folder.type; |
633 | // Viewer can't understand anything that's not in it's LLFolderType enum | 633 | // Viewer can't understand anything that's not in it's LLFolderType enum |
634 | if (newFolder.Type == 100) | 634 | if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) |
635 | newFolder.Type = -1; | 635 | newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; |
636 | newFolder.Version = (ushort)folder.version; | 636 | newFolder.Version = (ushort)folder.version; |
637 | newFolder.Name = folder.folderName; | 637 | newFolder.Name = folder.folderName; |
638 | newFolder.Owner = folder.agentID; | 638 | newFolder.Owner = folder.agentID; |