public void UpdateMute(MuteList mute, UUID PrincipalID) { Dictionary <string, object> sendData = mute.ToKVP(); sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["METHOD"] = "updatemute"; string reqString = WebUtils.BuildQueryString(sendData); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(PrincipalID.ToString(), "RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { AsynchronousRestObjectRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteMuteListConnector]: Exception when contacting server: {0}", e); } }
public MuteList[] GetMuteList(UUID PrincipalID) { List <MuteList> Mutes = new List <MuteList>(); Dictionary <string, OSDMap> Map = null; #if (!ISWIN) foreach (string mServerUri in m_ServerURIs) { if (SimianUtils.GetGenericEntries(PrincipalID, "MuteList", mServerUri, out Map)) { foreach (object OSDMap in Map.Values) { MuteList mute = new MuteList(); mute.FromOSD((OSDMap)OSDMap); Mutes.Add(mute); } return(Mutes.ToArray()); } } #else if (m_ServerURIs.Any(m_ServerURI => SimianUtils.GetGenericEntries(PrincipalID, "MuteList", m_ServerURI, out Map))) { foreach (object OSDMap in Map.Values) { MuteList mute = new MuteList(); mute.FromOSD((OSDMap)OSDMap); Mutes.Add(mute); } return(Mutes.ToArray()); } #endif return(null); }
public void UpdateMute(MuteList mute, UUID PrincipalID) { foreach (string m_ServerURI in m_ServerURIs) { SimianUtils.AddGeneric(PrincipalID, "MuteList", mute.MuteID.ToString(), Util.DictionaryToOSD(mute.ToKeyValuePairs()), m_ServerURI); } }
public void UpdateMute(MuteList mute, UUID PrincipalID) { foreach (string m_ServerURI in m_ServerURIs) { SimianUtils.AddGeneric(PrincipalID, "MuteList", mute.MuteID.ToString(), mute.ToOSD(), m_ServerURI); } }
public void UpdateMute(MuteList mute, UUID AgentID) { if (m_doRemoteOnly) { DoRemote(mute, AgentID); return; } GenericUtils.AddGeneric(AgentID, "MuteList", mute.MuteID.ToString(), mute.ToOSD(), GD); }
public void UpdateMute(MuteList mute, UUID AgentID) { object remoteValue = DoRemote(mute, AgentID); if (remoteValue != null || m_doRemoteOnly) { return; } GenericUtils.AddGeneric(AgentID, "MuteList", mute.MuteID.ToString(), mute.ToOSD(), GD); }
private void OnRemoveMuteListEntry(IClientAPI client, UUID AgentID, UUID muteID, string name) { m_log.DebugFormat("[MUTE LIST] Remove from {0} for ID {1} Name {2}", AgentID, muteID, name); Dictionary <UUID, MuteListEntry> MuteList; MuteList = GetMuteList(AgentID); if (MuteList.ContainsKey(muteID)) { MuteList.Remove(muteID); DBRemoveMuteListEntry(AgentID, muteID); } }
public override void FromOSD(OSDMap map) { AgentInfo = new IAgentInfo(); AgentInfo.FromOSD((OSDMap)(map["AgentInfo"])); UserAccount = new UserAccount(); UserAccount.FromOSD((OSDMap)(map["UserAccount"])); if (!map.ContainsKey("ActiveGroup")) { ActiveGroup = null; } else { ActiveGroup = new GroupMembershipData(); ActiveGroup.FromOSD((OSDMap)(map["ActiveGroup"])); } GroupMemberships = ((OSDArray)map["GroupMemberships"]).ConvertAll <GroupMembershipData>((o) => { GroupMembershipData group = new GroupMembershipData (); group .FromOSD ((OSDMap )o); return(group); }); OfflineMessages = ((OSDArray)map["OfflineMessages"]).ConvertAll <GridInstantMessage>((o) => { GridInstantMessage group = new GridInstantMessage (); group.FromOSD( (OSDMap)o); return(group); }); MuteList = ((OSDArray)map["MuteList"]).ConvertAll <MuteList>((o) => { MuteList group = new MuteList(); group.FromOSD((OSDMap)o); return(group); }); if (map.ContainsKey("Appearance")) { Appearance = new AvatarAppearance(); Appearance.FromOSD((OSDMap)map["Appearance"]); } }
public void UpdateMute(MuteList mute, UUID AgentID) { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(AgentID.ToString(), "FriendsServerURI"); if (serverURIs.Count > 0) //Remote user... or should be { m_remoteService.UpdateMute(mute, AgentID); } else { m_localService.UpdateMute(mute, AgentID); } }
/// <summary> /// Update the mute in the database /// </summary> /// <param name="muteID"></param> /// <param name="muteName"></param> /// <param name="flags"></param> /// <param name="agentID"></param> public void UpdateMuteList(UUID muteID, string muteName, int flags, UUID agentID) { if (muteID == UUID.Zero) { return; } MuteList Mute = new MuteList { MuteID = muteID, MuteName = muteName, MuteType = flags.ToString() }; MuteListConnector.UpdateMute(Mute, agentID); lock (MuteListCache) MuteListCache.Remove(agentID); }
/// <summary> /// Update the mute in the database /// </summary> /// <param name="MuteID"></param> /// <param name="Name"></param> /// <param name="Flags"></param> /// <param name="AgentID"></param> public void UpdateMuteList(UUID MuteID, string Name, int Flags, UUID AgentID) { if (MuteID == UUID.Zero) { return; } MuteList Mute = new MuteList() { MuteID = MuteID, MuteName = Name, MuteType = Flags.ToString() }; MuteListConnector.UpdateMute(Mute, AgentID); MuteListCache.Remove(AgentID); }
public MuteList[] GetMuteList(UUID PrincipalID) { Dictionary <string, object> sendData = new Dictionary <string, object>(); sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["METHOD"] = "getmutelist"; string reqString = WebUtils.BuildQueryString(sendData); List <MuteList> Mutes = new List <MuteList>(); try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(PrincipalID.ToString(), "RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); if (reply != string.Empty) { Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); foreach (object f in replyData) { KeyValuePair <string, object> value = (KeyValuePair <string, object>)f; if (value.Value is Dictionary <string, object> ) { Dictionary <string, object> valuevalue = value.Value as Dictionary <string, object>; MuteList mute = new MuteList(); mute.FromKVP(valuevalue); Mutes.Add(mute); } } } } return(Mutes.ToArray()); } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteMuteListConnector]: Exception when contacting server: {0}", e); } return(Mutes.ToArray()); }
/// <summary> /// Get all the mutes from the database /// </summary> /// <param name="AgentID"></param> /// <param name="Cached"></param> /// <returns></returns> public MuteList[] GetMutes(UUID AgentID, out bool Cached) { Cached = false; MuteList[] List = new MuteList[0]; if (MuteListConnector == null) { return(List); } if (!MuteListCache.TryGetValue(AgentID, out List)) { List = MuteListConnector.GetMuteList(AgentID); } else { Cached = true; } return(List); }
private void OnUpdateMuteListEntry(IClientAPI client, UUID AgentID, int muteType, UUID muteID, string Name, uint muteFlags) { Dictionary <UUID, MuteListEntry> MuteList; bool isUpdate = false; MuteList = GetMuteList(AgentID); isUpdate = MuteList.ContainsKey(muteID); if (isUpdate) { MuteList.Remove(muteID); } switch ((MuteType)muteType) { case MuteType.BY_NAME: m_log.DebugFormat("[MUTE LIST] Update from {0} for name: {1} (ID {2}) flags={3}", AgentID, Name, muteID, muteFlags); break; case MuteType.AGENT: m_log.DebugFormat("[MUTE LIST] Update from {0} for agent: {1} ({2}) flags={3}", AgentID, muteID, Name, muteFlags); break; case MuteType.OBJECT: m_log.DebugFormat("[MUTE LIST] Update from {0} for object: {1} ({2}) flags={3}", AgentID, muteID, Name, muteFlags); break; case MuteType.GROUP: m_log.DebugFormat("[MUTE LIST] Update from {0} for group: {1} ({2}) flags={3}", AgentID, muteID, Name, muteFlags); break; case MuteType.COUNT: m_log.DebugFormat("[MUTE LIST] Update from {0} for count: {1} ({2}) flags={3}", AgentID, muteID, Name, muteFlags); break; default: m_log.ErrorFormat("[MUTE LIST] Update from {0} unknown type {1} with ID {2} Name {3} flags={4}", AgentID, muteType, muteID, Name, muteFlags); break; } MuteListEntry entry = new MuteListEntry(muteType, Name, muteFlags); MuteList.Add(muteID, entry); DBStoreMuteListEntry(AgentID, muteID, entry, isUpdate); }
/// <summary> /// Get all the mutes from the database /// </summary> /// <param name="agentID"></param> /// <param name="cached"></param> /// <returns></returns> public MuteList [] GetMutes(UUID agentID, out bool cached) { cached = false; MuteList [] muteList = new MuteList [0]; if (MuteListConnector == null) { return(muteList); } lock (MuteListCache) { if (!MuteListCache.TryGetValue(agentID, out muteList)) { muteList = MuteListConnector.GetMuteList(agentID).ToArray(); MuteListCache.Add(agentID, muteList); } else { cached = true; } } return(muteList); }
/// <summary> /// Add the following Player to the MuteList. /// </summary> /// <param name="Player">Player to mute.</param> /// <param name="Duration">How long?</param> /// <param name="Reason">Reason.</param> /// <param name="PlayerList">Player in which is trying to mute. Null == Global.</param> public static void AddMuteList(this Player Player, int Duration, string Reason, Player PlayerList = null) { if (PlayerList == null) { if (Player.IsMuteListed()) { MuteList MuteList = Player.GetMuteList(); MuteList.Name = Player.Name; MuteList.StartTime = DateTime.Now; MuteList.Duration = Duration; MuteList.Reason = Reason; Core.Setting.Save(); } else { Core.Setting.MuteListData.Add(new MuteList(Player.Name, Player.GameJoltID, Reason, DateTime.Now, Duration)); Core.Setting.Save(); } } else { if (Player.IsMuteListed(PlayerList)) { MuteList MuteList = Player.GetMuteList(PlayerList); MuteList.Name = Player.Name; MuteList.StartTime = DateTime.Now; MuteList.Duration = Duration; MuteList.Reason = Reason; PlayerList.GetOnlineSetting().Save(); } else { PlayerList.GetOnlineSetting().MuteListData.Add(new MuteList(Player.Name, Player.GameJoltID, Reason, DateTime.Now, Duration)); PlayerList.GetOnlineSetting().Save(); } } }
private void HandleChatMessage() { if (Core.Settings.Features.Chat.AllowChatInServer) { // Check if you are muted if (Core.Settings.Features.MuteList) { List <MuteList> item = Core.SQLite.Query <MuteList>(a => a.MuteID == Network.Player.PlayerInfo.ID); if (item.Count > 0) { if (item.Where(a => a.PlayerID == -1).Count() > 0) { MuteList mute = item.Where(a => a.PlayerID == -1).First(); if (mute.Duration == -1 || DateTime.Now < mute.StartTime.AddSeconds(mute.Duration)) { Network.SentToPlayer(new Package(Core, PackageTypes.ChatMessage, -1, Core.Settings.Tokens.ToString("SERVER_MUTED", item[0].Reason, ((item[0].Duration > 0 ? item[0].StartTime.AddSeconds(item[0].Duration) : DateTime.MaxValue) - DateTime.Now).ToString("d\\:hh\\:mm\\:ss")), Network)); Core.Logger.Log(Network.Player.IsGameJoltPlayer ? Core.Settings.Tokens.ToString("SERVER_GAMEJOLT", Network.Player.Name, Network.Player.GameJoltID, "is unable to chat in the server with the following reason: " + Core.Settings.Tokens.ToString("SERVER_MUTED", item[0].Reason, ((item[0].Duration > 0 ? item[0].StartTime.AddSeconds(item[0].Duration) : DateTime.MaxValue) - DateTime.Now).ToString("d\\:hh\\:mm\\:ss"))) : Core.Settings.Tokens.ToString("SERVER_NOGAMEJOLT", Network.Player.Name, "is unable to chat in the server with the following reason: " + Core.Settings.Tokens.ToString("SERVER_MUTED", item[0].Reason, ((item[0].Duration > 0 ? item[0].StartTime.AddSeconds(item[0].Duration) : DateTime.MaxValue) - DateTime.Now).ToString("d\\:hh\\:mm\\:ss"))), "Chat", Network); return; } } if (item.Where(a => a.PlayerID != -1).Count() > 0) { foreach (Networking network in Core.TcpClientCollection.ActivePlayer.SkipWhile(a => { foreach (MuteList mute in item) { if (mute.PlayerID == a.Player.PlayerInfo.ID) { if (mute.Duration == -1 || DateTime.Now < mute.StartTime.AddSeconds(mute.Duration)) { return(true); } } } return(false); })) { network.SentToPlayer(new Package(Core, PackageTypes.ChatMessage, Network.Player.ID, DataItems[0], Network)); } Core.Logger.Log(Network.Player.IsGameJoltPlayer ? Core.Settings.Tokens.ToString("SERVER_CHATGAMEJOLT", Network.Player.Name, Network.Player.GameJoltID, DataItems[0]) : Core.Settings.Tokens.ToString("SERVER_CHATNOGAMEJOLT", Network.Player.Name, DataItems[0]), "Chat", Network); } else { InternalHandleChatMessage(); } } } else { InternalHandleChatMessage(); } } else { Network.SentToPlayer(new Package(Core, PackageTypes.ChatMessage, -1, Core.Settings.Tokens.ToString("SERVER_NOCHAT"), Network)); } }
public void UpdateMute(MuteList mute, UUID AgentID) { object remoteValue = DoRemote(mute, AgentID); if (remoteValue != null || m_doRemoteOnly) return; GenericUtils.AddGeneric(AgentID, "MuteList", mute.MuteID.ToString(), mute.ToOSD(), GD); }
/// <summary> /// Update the mute in the database /// </summary> /// <param name="MuteID"></param> /// <param name="Name"></param> /// <param name="Flags"></param> /// <param name="AgentID"></param> public void UpdateMuteList(UUID MuteID, string Name, int Flags, UUID AgentID) { if (MuteID == UUID.Zero) return; MuteList Mute = new MuteList { MuteID = MuteID, MuteName = Name, MuteType = Flags.ToString() }; MuteListConnector.UpdateMute(Mute, AgentID); lock (MuteListCache) MuteListCache.Remove(AgentID); }
/// <summary> /// Get all the mutes from the database /// </summary> /// <param name="AgentID"></param> /// <param name="Cached"></param> /// <returns></returns> public MuteList[] GetMutes(UUID AgentID, out bool Cached) { Cached = false; MuteList[] List = new MuteList[0]; if (MuteListConnector == null) return List; lock (MuteListCache) { if (!MuteListCache.TryGetValue(AgentID, out List)) { List = MuteListConnector.GetMuteList(AgentID).ToArray(); MuteListCache.Add(AgentID, List); } else Cached = true; } return List; }
/// <summary> /// Updates or adds a mute for the given agent /// </summary> /// <param name = "mute"></param> /// <param name = "AgentID"></param> public void UpdateMute(MuteList mute, UUID AgentID) { GenericUtils.AddGeneric(AgentID, "MuteList", mute.MuteID.ToString(), mute.ToOSD(), GD); }
public void UpdateMute(MuteList mute, UUID AgentID) { m_localService.UpdateMute(mute, AgentID); m_remoteService.UpdateMute(mute, AgentID); }
/// <summary> /// Return if the player is muted. /// </summary> /// <param name="Player">Player to check.</param> /// <param name="PlayerList">Player List to check. Null == Global.</param> public static bool IsMuteListed(this Player Player, Player PlayerList = null) { if (PlayerList == null) { // Use Global List if (Core.Setting.MuteList) { MuteList MuteList = Player.GetMuteList(); if (MuteList == null) { return(false); } else { if (MuteList.Duration == -1 || DateTime.Now < MuteList.StartTime.AddSeconds(MuteList.Duration)) { return(true); } else { Core.Setting.MuteListData.Remove(MuteList); Core.Setting.Save(); return(false); } } } else { return(false); } } else { // Use PlayerList if (Core.Setting.OnlineSettingList) { MuteList MuteList = Player.GetMuteList(PlayerList); if (MuteList == null) { return(false); } else { if (MuteList.Duration == -1 || DateTime.Now < MuteList.StartTime.AddSeconds(MuteList.Duration)) { return(true); } else { OnlineSetting OnlineSetting = PlayerList.GetOnlineSetting(); OnlineSetting.MuteListData.Remove(MuteList); OnlineSetting.Save(); return(false); } } } else { return(false); } } }