diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 144 |
1 files changed, 8 insertions, 136 deletions
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) |