aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-21 07:33:13 +0000
committerMelanie Thielker2008-11-21 07:33:13 +0000
commitee4d4d784eb9b51b29fe4bda3fc9ec3594d24f5a (patch)
tree9ce899e33c2550d61048ca0690ba5e103aa8abd6 /OpenSim/Region/Environment/Scenes
parentAllow selecting group objects and selecting objects by owner from the (diff)
downloadopensim-SC_OLD-ee4d4d784eb9b51b29fe4bda3fc9ec3594d24f5a.zip
opensim-SC_OLD-ee4d4d784eb9b51b29fe4bda3fc9ec3594d24f5a.tar.gz
opensim-SC_OLD-ee4d4d784eb9b51b29fe4bda3fc9ec3594d24f5a.tar.bz2
opensim-SC_OLD-ee4d4d784eb9b51b29fe4bda3fc9ec3594d24f5a.tar.xz
Fully implement object return from the parcel dialog
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/ReturnInfo.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs144
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs90
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
4 files changed, 58 insertions, 179 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ReturnInfo.cs b/OpenSim/Region/Environment/Scenes/ReturnInfo.cs
index 68c563d..898baab 100644
--- a/OpenSim/Region/Environment/Scenes/ReturnInfo.cs
+++ b/OpenSim/Region/Environment/Scenes/ReturnInfo.cs
@@ -34,5 +34,6 @@ namespace OpenSim.Region.Environment.Scenes
34 public int count; 34 public int count;
35 public Vector3 location; 35 public Vector3 location;
36 public string objectName; 36 public string objectName;
37 public string reason;
37 } 38 }
38} 39}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 79d79ef..19b8e16 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1610,6 +1610,10 @@ namespace OpenSim.Region.Environment.Scenes
1610 ExternalChecks.ExternalChecksCanDeleteObject( 1610 ExternalChecks.ExternalChecksCanDeleteObject(
1611 grp.UUID, 1611 grp.UUID,
1612 remoteClient.AgentId); 1612 remoteClient.AgentId);
1613 if (permissionToDelete)
1614 {
1615 AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
1616 }
1613 } 1617 }
1614 else // Auto return passes through here with null agent 1618 else // Auto return passes through here with null agent
1615 { 1619 {
@@ -2207,145 +2211,13 @@ namespace OpenSim.Region.Environment.Scenes
2207 2211
2208 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) 2212 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)
2209 { 2213 {
2210 string message = ""; 2214 foreach (SceneObjectGroup grp in returnobjects)
2211 if (returnobjects.Length <= 0)
2212 return false;
2213
2214 // for the moment we're going to store them individually.. however, in the future, the rezObject
2215 // will be able to have more items.
2216
2217 //string returnstring = "";
2218 //returnstring += "<scene>\n";
2219 //for (int i = 0; i < returnobjects.Length; i++)
2220 //{
2221 // returnstring += grp.ToXmlString2();
2222 //}
2223 //returnstring += "</scene>\n";
2224
2225 bool permissionToDelete = false;
2226
2227 for (int i = 0; i < returnobjects.Length; i++)
2228 {
2229 CachedUserInfo userInfo =
2230 CommsManager.UserProfileCacheService.GetUserDetails(returnobjects[i].OwnerID);
2231 if (userInfo == null)
2232 {
2233 CommsManager.UserProfileCacheService.AddNewUser(returnobjects[i].OwnerID);
2234
2235 }
2236 if (userInfo != null)
2237 {
2238 if (userInfo.HasReceivedInventory)
2239 {
2240 UUID folderID = UUID.Zero;
2241
2242 List<InventoryFolderBase> subrootfolders = userInfo.RootFolder.RequestListOfFolders();
2243 foreach (InventoryFolderBase flder in subrootfolders)
2244 {
2245 if (flder.Name == "Lost And Found")
2246 {
2247 folderID = flder.ID;
2248 break;
2249 }
2250 }
2251
2252 if (folderID == UUID.Zero)
2253 {
2254 folderID = userInfo.RootFolder.ID;
2255 }
2256 permissionToDelete = ExternalChecks.ExternalChecksCanReturnObject(returnobjects[i].UUID, AgentId);
2257
2258 // If the user doesn't have permission, go on to the next one.
2259 if (!permissionToDelete)
2260 continue;
2261
2262 string sceneObjectXml = returnobjects[i].ToXmlString2();
2263 AssetBase asset = CreateAsset(
2264 returnobjects[i].GetPartName(returnobjects[i].LocalId),
2265 returnobjects[i].GetPartDescription(returnobjects[i].LocalId),
2266 (sbyte)AssetType.Object,
2267 Utils.StringToBytes(sceneObjectXml));
2268 AssetCache.AddAsset(asset);
2269
2270 InventoryItemBase item = new InventoryItemBase();
2271 item.Creator = returnobjects[i].RootPart.CreatorID;
2272 item.Owner = returnobjects[i].OwnerID;
2273 item.ID = UUID.Random();
2274 item.AssetID = asset.FullID;
2275 item.Description = asset.Description;
2276 item.Name = asset.Name;
2277 item.AssetType = asset.Type;
2278 item.InvType = (int)InventoryType.Object;
2279 item.Folder = folderID;
2280
2281 if ((AgentId != returnobjects[i].RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
2282 {
2283 uint perms = returnobjects[i].GetEffectivePermissions();
2284 uint nextPerms = (perms & 7) << 13;
2285 if ((nextPerms & (uint)PermissionMask.Copy) == 0)
2286 perms &= ~(uint)PermissionMask.Copy;
2287 if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
2288 perms &= ~(uint)PermissionMask.Transfer;
2289 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
2290 perms &= ~(uint)PermissionMask.Modify;
2291
2292 item.BasePermissions = perms & returnobjects[i].RootPart.NextOwnerMask;
2293 item.CurrentPermissions = item.BasePermissions;
2294 item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask;
2295 item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask & returnobjects[i].RootPart.NextOwnerMask;
2296 item.GroupPermissions = returnobjects[i].RootPart.GroupMask & returnobjects[i].RootPart.NextOwnerMask;
2297 item.CurrentPermissions |= 8; // Slam!
2298 }
2299 else
2300 {
2301 item.BasePermissions = returnobjects[i].GetEffectivePermissions();
2302 item.CurrentPermissions = returnobjects[i].GetEffectivePermissions();
2303 item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask;
2304 item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask;
2305 item.GroupPermissions = returnobjects[i].RootPart.GroupMask;
2306 }
2307
2308 // TODO: add the new fields (Flags, Sale info, etc)
2309
2310 userInfo.AddItem(item);
2311
2312 ScenePresence notifyUser = GetScenePresence(item.Owner);
2313 if (notifyUser != null)
2314 {
2315 notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item);
2316 }
2317
2318 SceneObjectGroup ObjectDeleting = returnobjects[i];
2319
2320 returnobjects[i] = null;
2321
2322 DeleteSceneObject(ObjectDeleting, false);
2323 ObjectDeleting = null;
2324 }
2325 else
2326 {
2327 CommsManager.UserProfileCacheService.RequestInventoryForUser(returnobjects[i].OwnerID);
2328 message = "Still waiting on the inventory service, some of the items won't be returned until the inventory services completes it's task. Try again shortly.";
2329 }
2330 }
2331 else
2332 {
2333 message = "Still waiting on the inventory service, some of the items won't be returned until the inventory services completes it's task. Try again shortly.";
2334 }
2335 //return true;
2336 }
2337
2338 if (message.Length != 0)
2339 { 2215 {
2340 ScenePresence returningavatar = GetScenePresence(AgentId); 2216 AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
2341 if (returningavatar != null) 2217 DeRezObject(null, grp.RootPart.LocalId,
2342 { 2218 grp.RootPart.GroupID, 9, UUID.Zero);
2343 returningavatar.ControllingClient.SendAlertMessage(message);
2344 }
2345 return false;
2346 } 2219 }
2347 return true; 2220 return true;
2348
2349 } 2221 }
2350 2222
2351 public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) 2223 public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f37ba25..741c47e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -966,54 +966,60 @@ namespace OpenSim.Region.Environment.Scenes
966 /// <returns></returns> 966 /// <returns></returns>
967 public void Backup() 967 public void Backup()
968 { 968 {
969 m_returns.Clear(); 969 lock(m_returns)
970 970 {
971 EventManager.TriggerOnBackup(m_storageManager.DataStore); 971 EventManager.TriggerOnBackup(m_storageManager.DataStore);
972 m_backingup = false; 972 m_backingup = false;
973
974 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
975 {
976 UUID transaction = UUID.Random();
977
978 GridInstantMessage msg = new GridInstantMessage();
979 msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server
980 msg.toAgentID = new Guid(ret.Key.ToString());
981 msg.imSessionID = new Guid(transaction.ToString());
982 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
983 msg.fromAgentName = "Server";
984 msg.dialog = (byte)19; // Object msg
985 msg.fromGroup = false;
986 msg.offline = (byte)1;
987 msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
988 msg.Position = Vector3.Zero;
989 msg.RegionID = RegionInfo.RegionID.Guid;
990 msg.binaryBucket = new byte[0];
991 if (ret.Value.count > 1)
992 msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to parcel auto return", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName);
993 else
994 msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to parcel auto return", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName);
995 973
996 IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); 974 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
997 if (tr != null) 975 {
998 tr.SendInstantMessage(msg, delegate(bool success) {} ); 976 UUID transaction = UUID.Random();
977
978 GridInstantMessage msg = new GridInstantMessage();
979 msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server
980 msg.toAgentID = new Guid(ret.Key.ToString());
981 msg.imSessionID = new Guid(transaction.ToString());
982 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
983 msg.fromAgentName = "Server";
984 msg.dialog = (byte)19; // Object msg
985 msg.fromGroup = false;
986 msg.offline = (byte)1;
987 msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
988 msg.Position = Vector3.Zero;
989 msg.RegionID = RegionInfo.RegionID.Guid;
990 msg.binaryBucket = new byte[0];
991 if (ret.Value.count > 1)
992 msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason);
993 else
994 msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to {3}", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason);
995
996 IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>();
997 if (tr != null)
998 tr.SendInstantMessage(msg, delegate(bool success) {} );
999 }
1000 m_returns.Clear();
999 } 1001 }
1000 } 1002 }
1001 1003
1002 public void AddReturn(UUID agentID, string objectName, Vector3 location) 1004 public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason)
1003 { 1005 {
1004 if (m_returns.ContainsKey(agentID)) 1006 lock(m_returns)
1005 {
1006 ReturnInfo info = m_returns[agentID];
1007 info.count++;
1008 m_returns[agentID] = info;
1009 }
1010 else
1011 { 1007 {
1012 ReturnInfo info = new ReturnInfo(); 1008 if (m_returns.ContainsKey(agentID))
1013 info.count = 1; 1009 {
1014 info.objectName = objectName; 1010 ReturnInfo info = m_returns[agentID];
1015 info.location = location; 1011 info.count++;
1016 m_returns[agentID] = info; 1012 m_returns[agentID] = info;
1013 }
1014 else
1015 {
1016 ReturnInfo info = new ReturnInfo();
1017 info.count = 1;
1018 info.objectName = objectName;
1019 info.location = location;
1020 info.reason = reason;
1021 m_returns[agentID] = info;
1022 }
1017 } 1023 }
1018 } 1024 }
1019 1025
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 82ab4eb..e8eaef8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1224,7 +1224,7 @@ namespace OpenSim.Region.Environment.Scenes
1224 parcel.landData.OtherCleanTime) 1224 parcel.landData.OtherCleanTime)
1225 { 1225 {
1226 m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); 1226 m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString());
1227 m_scene.AddReturn(OwnerID, Name, AbsolutePosition); 1227 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return");
1228 m_scene.DeRezObject(null, RootPart.LocalId, 1228 m_scene.DeRezObject(null, RootPart.LocalId,
1229 RootPart.GroupID, 9, UUID.Zero); 1229 RootPart.GroupID, 9, UUID.Zero);
1230 1230