public void Leave(UGI group, UUID sessionid, UGUI agent) { GroupSession session; if (m_ActiveSessions.TryGetValue(sessionid, out session) && group.EqualsGrid(session.Group)) { session.Participants.Remove(agent); m_ActiveChats.RemoveIf(session.Group.ID, (r) => r.Participants.Count == 0); } }
internal void DecrementUseCount(UUID id, PrimitivePhysicsShapeType physicsShape, PhysicsConvexShape shape) { if (0 == Interlocked.Decrement(ref shape.UseCount)) { m_Lock.AcquireWriterLock(() => m_ConvexShapesBySculptMesh.RemoveIf(GetMeshKey(id, physicsShape), (PhysicsConvexShape s) => s.UseCount == 0)); } }
public override Map UploadedData(UUID transactionID, AssetData data) { KeyValuePair <UUID, TransactionInfo> kvp; if (m_Transactions.RemoveIf(transactionID, (TransactionInfo v) => true, out kvp)) { var m = new Map(); ObjectPartInventoryItem item; var part = m_Scene.Primitives[kvp.Value.TaskID]; try { item = part.Inventory[kvp.Value.ItemID]; } catch { throw new UrlNotFoundException(); } if (item.AssetType != data.Type) { throw new UrlNotFoundException(); } if (!part.CheckPermissions(m_Agent.Owner, m_Agent.Group, InventoryPermissionsMask.Modify) || !item.CheckPermissions(m_Agent.Owner, m_Agent.Group, InventoryPermissionsMask.Modify)) { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "NotAllowedToModifyNotecard", "Not allowed to modify notecard")); } data.Name = item.Name; try { m_Scene.AssetService.Store(data); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreAsset", "Failed to store asset")); } try { item.Flags &= ~(InventoryFlags.NotecardSlamPerm | InventoryFlags.NotecardSlamSale); part.Inventory.SetAssetID(item.ID, data.ID); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreInventoryItem", "Failed to store inventory item")); } part.SendObjectUpdate(); part.ObjectGroup.Scene.SendObjectPropertiesToAgent(m_Agent, part); return(m); } else { throw new UrlNotFoundException(); } }
private void IMSessionStarted(GroupInstantMessage im) { if (!m_GroupsService.Members.ContainsKey(im.FromAgent, im.ToGroup, im.FromAgent)) { throw new Exception("Not a member"); } GroupSession session = m_ActiveChats.GetOrAddIfNotExists(im.ToGroup.ID, () => new GroupSession(im.ToGroup)); im.IMSessionID = session.SessionID; im.FromGroup = im.ToGroup; try { foreach (GroupMember gm in m_GroupsService.Members[im.FromAgent, im.ToGroup]) { session.Participants.AddIfNotExists(gm.Principal); } } finally { m_ActiveSessions.RemoveIf(im.IMSessionID, (entry) => entry.Participants.Count == 0); m_ActiveChats.RemoveIf(im.ToGroup.ID, (entry) => entry.Participants.Count == 0); } DistributeMessage(session, im); }
public override Map UploadedData(UUID transactionID, AssetData data) { KeyValuePair <UUID, UUID> kvp; if (m_Transactions.RemoveIf(transactionID, (UUID v) => true, out kvp)) { var m = new Map(); if (data.Type != NewAssetType) { throw new UrlNotFoundException(); } data.Name = "Baked Texture for Agent " + Creator.ID.ToString(); try { m_AssetService.Store(data); m_Log.InfoFormat("Uploaded baked texture {1} for {0}", Creator.ToString(), data.ID); } catch { throw new UploadErrorException("Failed to store asset"); } return(m); } else { throw new UrlNotFoundException(); } }
internal void DecrementUseCount(ObjectPart.PrimitiveShape primshape, PhysicsConvexShape shape) { if (0 == Interlocked.Decrement(ref shape.UseCount)) { m_Lock.AcquireWriterLock(() => m_ConvexShapesByPrimShape.RemoveIf(primshape, (PhysicsConvexShape s) => s.UseCount == 0)); } }
internal void ExpireHandler() { foreach (UUID id in m_ExperienceInfoCache.Keys) { m_ExperienceInfoCache.RemoveIf(id, (entry) => m_ClockSource.TicksElapsed(m_ClockSource.TickCount, entry.ExpiryTickCount) > m_ClockSource.SecsToTicks(ExperienceInfoTimeout)); } }
protected internal void Remove(Listener listener) { ChannelInfo channel; if (m_Channels.TryGetValue(listener.Channel, out channel)) { channel.Listeners.Remove(listener); m_Channels.RemoveIf(listener.Channel, (ChannelInfo ch) => ch.Listeners.Count == 0); } m_ChatPass.Remove(listener); }
public override Map UploadedData(UUID transactionID, AssetData data) { KeyValuePair <UUID, UUID> kvp; if (m_Transactions.RemoveIf(transactionID, (UUID v) => true, out kvp)) { var m = new Map(); InventoryItem item; try { item = m_InventoryService.Item[Creator.ID, kvp.Value]; } catch { throw new UrlNotFoundException(); } if (item.AssetType != data.Type) { throw new UrlNotFoundException(); } if (!item.CheckPermissions(m_Agent.Owner, m_Agent.Group, InventoryPermissionsMask.Modify)) { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "NotAllowedToModifyNotecard", "Not allowed to modify notecard")); } item.AssetID = data.ID; try { m_AssetService.Store(data); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreAsset", "Failed to store asset")); } try { item.Flags &= ~(InventoryFlags.NotecardSlamPerm | InventoryFlags.NotecardSlamSale); m_InventoryService.Item.Update(item); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreInventoryItem", "Failed to store inventory item")); } return(m); } else { throw new UrlNotFoundException(); } }
public override Map UploadedData(UUID transactionID, AssetData data) { KeyValuePair <UUID, InventoryItem> kvp; if (m_Transactions.RemoveIf(transactionID, (InventoryItem v) => true, out kvp)) { var m = new Map { { "new_inventory_item", kvp.Value.ID.ToString() } }; kvp.Value.AssetID = data.ID; data.Type = kvp.Value.AssetType; data.Name = kvp.Value.Name; if (kvp.Value.AssetType == AssetType.Mesh) { /* special upload format for objects */ UploadObject(data); kvp.Value.AssetType = AssetType.Object; } else if (kvp.Value.AssetType == AssetType.Object) { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreAsset", "Failed to store asset")); } try { m_AssetService.Store(data); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreAsset", "Failed to store asset")); } try { m_InventoryService.Item.Add(kvp.Value); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreNewInventoryItem", "Failed to store new inventory item")); } return(m); } else { throw new UrlNotFoundException(); } }
public static void Remove(UUID assetID, ScriptInstance instance) => m_CompilerLock.AcquireWriterLock(() => { if (m_LoadedInstances.RemoveIf(assetID, (RwLockedList <ScriptInstance> list) => { list.Remove(instance); return(list.Count == 0); })) { m_LoadedAssemblies.Remove(assetID); AppDomain appDom; if (m_LoadedDomains.Remove(assetID, out appDom)) { AppDomain.Unload(appDom); } } });
public override void UnregisterRegion(UUID regionID) { if (IsDeleteOnUnregister) { /* first line deletes only when region is not persistent */ m_Data.RemoveIf(regionID, (RegionInfo regInfo) => (regInfo.Flags & RegionFlags.Persistent) == 0); /* second step is to set it offline when it is persistent */ } RegionInfo rInfo; if (m_Data.TryGetValue(regionID, out rInfo)) { rInfo.Flags &= ~RegionFlags.RegionOnline; } }
public override Map UploadedData(UUID transactionID, AssetData data) { KeyValuePair <UUID, UUID> kvp; if (m_Transactions.RemoveIf(transactionID, (UUID v) => true, out kvp)) { var m = new Map(); InventoryItem item; try { item = m_InventoryService.Item[Creator.ID, kvp.Value]; } catch { throw new UrlNotFoundException(); } if (item.AssetType != data.Type) { throw new UrlNotFoundException(); } if (!item.CheckPermissions(m_Agent.Owner, m_Agent.Group, InventoryPermissionsMask.Modify)) { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "NotAllowedToModifyScript", "Not allowed to modify script")); } item.AssetID = data.ID; data.Name = item.Name; try { m_AssetService.Store(data); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreAsset", "Failed to store asset")); } try { m_InventoryService.Item.Update(item); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreInventoryItem", "Failed to store inventory item")); } try { ScriptLoader.SyntaxCheck(item.Owner, data, m_Agent.CurrentCulture); m.Add("compiled", true); } catch (CompilerException e) { var errors = new AnArray(); foreach (var line in e.Messages) { int lineNumber = line.Key - 1; /* Viewer editors count lines from 0 */ if (lineNumber < 0) { lineNumber = 0; } errors.Add(string.Format("{0}:{1}", lineNumber, line.Value)); } m.Add("errors", errors); m.Add("compiled", false); } catch (Exception e) { m_Log.ErrorFormat("Unexpected exception: {0}: {1}\n{2}", e.GetType().FullName, e.Message, e.StackTrace); var errors = new AnArray { "0:Unexpected compiler error " + e.GetType().Name }; m.Add("errors", errors); m.Add("compiled", false); } return(m); } else { throw new UrlNotFoundException(); } }
public override void ReleaseToken(UUID accountId, UUID secureSessionId) { m_Tokens.RemoveIf(secureSessionId, (AuthToken tok) => accountId == tok.UserID); }
public override bool Remove(UUID userid, UUID dstTransactionID) => m_Transactions.RemoveIf(dstTransactionID, (info) => info.DstAgent.ID == userid);
public override Map UploadedData(UUID transactionID, AssetData data) { KeyValuePair <UUID, TransactionInfo> kvp; if (m_Transactions.RemoveIf(transactionID, (TransactionInfo v) => true, out kvp)) { var m = new Map(); ObjectPartInventoryItem item; var part = m_Scene.Primitives[kvp.Value.TaskID]; try { item = part.Inventory[kvp.Value.ItemID]; } catch { m_Log.WarnFormat("Inventory not found for {0}", transactionID.ToString()); throw new UrlNotFoundException(); } if (item.AssetType != data.Type) { m_Log.WarnFormat("Wrong inventory type for {0}", transactionID.ToString()); throw new UrlNotFoundException(); } if (!part.CheckPermissions(m_Agent.Owner, m_Agent.Group, InventoryPermissionsMask.Modify)) { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "NotAllowedToModifyScript", "Not allowed to modify script")); } data.Name = item.Name; UEI uei = UEI.Unknown; if (kvp.Value.ExperienceID != UUID.Zero && !m_Scene.ExperienceService.TryGetValue(kvp.Value.ExperienceID, out uei)) { uei = UEI.Unknown; } item.ExperienceID = uei; item.SetNewID(kvp.Value.ItemID); try { part.Inventory.SetAssetID(item.ID, data.ID); m_Scene.AssetService.Store(data); } catch { throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreAsset", "Failed to store asset")); } ScriptInstance instance; try { instance = item.RemoveScriptInstance; instance?.Abort(); } catch #if DEBUG (Exception e) #endif { #if DEBUG m_Log.DebugFormat("Failed to abort script: {0}\n{1}", e.Message, e.StackTrace); #endif throw new UploadErrorException(this.GetLanguageString(m_Agent.CurrentCulture, "FailedToStoreInventoryItem", "Failed to store inventory item")); } try { instance = ScriptLoader.Load(part, item, item.Owner, data, m_Agent.CurrentCulture, openInclude: part.OpenScriptInclude); item.ScriptInstance = instance; item.ScriptInstance.IsRunning = kvp.Value.IsScriptRunning; item.ScriptInstance.Reset(); m.Add("compiled", true); } catch (CompilerException e) { var errors = new AnArray(); foreach (var line in e.Messages) { int lineNumber = line.Key - 1; /* Viewer editors count lines from 0 */ if (lineNumber < 0) { lineNumber = 0; } errors.Add(string.Format("{0}:{1}", lineNumber, line.Value)); } m.Add("errors", errors); m.Add("compiled", false); } catch (Exception e) { m_Log.ErrorFormat("Unexpected exception: {0}: {1}\n{2}", e.GetType().FullName, e.Message, e.StackTrace); var errors = new AnArray { "0:Unexpected compiler error " + e.GetType().Name }; m.Add("errors", errors); m.Add("compiled", false); } part.SendObjectUpdate(); part.ObjectGroup.Scene.SendObjectPropertiesToAgent(m_Agent, part); return(m); } else { throw new UrlNotFoundException(); } }
public override void Delete(UUID id) { m_Assets.RemoveIf(id, (AssetData d) => d.Flags != AssetFlags.Normal); }