public void SendUsersTo(ChatUser to) { for (int i = 0; i < m_Users.Count; ++i) { ChatUser user = m_Users[i]; ChatSystem.SendCommandTo(to.Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username); } }
public static void Kick(ChatUser from, Channel channel, string param) { var target = ChatSystem.SearchForUser(from, param); if (target != null) { channel.Kick(target, from); } }
public static void RemoveModerator(ChatUser from, Channel channel, string param) { var target = ChatSystem.SearchForUser(from, param); if (target != null) { channel.RemoveModerator(target, from); } }
public static void RemoveVoice(ChatUser from, Channel channel, string param) { ChatUser target = ChatSystem.SearchForUser(from, param); if (target != null) { channel.RemoveVoiced(target, from); } }
public static void RemoveIgnore(ChatUser from, Channel channel, string param) { ChatUser target = ChatSystem.SearchForUser(from, param); if (target == null) { return; } from.RemoveIgnored(target); }
public static void SendChannelsTo(ChatUser user) { for (int i = 0; i < m_Channels.Count; ++i) { Channel channel = (Channel)m_Channels[i]; if (!channel.IsBanned(user)) { ChatSystem.SendCommandTo(user.Mobile, ChatCommand.AddChannel, channel.Name, "0"); } } }
private static void DisplayChatTo(Mobile player) { if (player.Account == null) { return; } Account account = player.Account as Account; string accountChatName = account.GetTag("ChatName"); ChatSystem.SendCommandTo(player, ChatCommand.OpenChatWindow, accountChatName); ChatUser.AddChatUser(player); }
private static void HideChatFrom(Mobile player) { if (player.Account == null) { return; } Account account = player.Account as Account; ChatSystem.SendCommandTo(player, ChatCommand.CloseChatWindow); ChatUser user = ChatUser.GetChatUser(player); ChatUser.RemoveChatUser(user); }
public void SendCommand(ChatCommand command, ChatUser initiator, string param1 = null, string param2 = null) { foreach (var user in m_Users.ToArray()) { if (user == initiator) { continue; } if (user.CheckOnline()) { ChatSystem.SendCommandTo(user.Mobile, command, param1, param2); } } }
public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1, string param2) { for (int i = 0; i < m_Users.Count; ++i) { ChatUser user = m_Users[i]; if (user == initiator) { continue; } if (user.CheckOnline()) { ChatSystem.SendCommandTo(user.m_Mobile, command, param1, param2); } } }
public static void QueryWhoIs(ChatUser from, Channel channel, string param) { ChatUser target = ChatSystem.SearchForUser(from, param); if (target == null) { return; } if (target.Anonymous) { from.SendAsciiMessage(41, target.Username); // %1 is remaining anonymous. } else { from.SendAsciiMessage(43, target.Username, target.Mobile.Name); // %2 is known in the lands of Britannia as %2. } }
public static void ToggleModerator(ChatUser from, Channel channel, string param) { ChatUser target = ChatSystem.SearchForUser(from, param); if (target == null) { return; } if (channel.IsModerator(target)) { channel.RemoveModerator(target, from); } else { channel.AddModerator(target, from); } }
public static void ToggleIgnore(ChatUser from, Channel channel, string param) { ChatUser target = ChatSystem.SearchForUser(from, param); if (target == null) { return; } if (from.IsIgnored(target)) { from.RemoveIgnored(target); } else { from.AddIgnored(target); } }
public static void ToggleVoice(ChatUser from, Channel channel, string param) { var target = ChatSystem.SearchForUser(from, param); if (target == null) { return; } if (channel.IsVoiced(target)) { channel.RemoveVoiced(target, from); } else { channel.AddVoiced(target, from); } }
public void RemoveUser(ChatUser user) { if (Contains(user)) { m_Users.Remove(user); user.CurrentChannel = null; SendCommand(ChatCommand.RemoveUserFromChannel, user, user.Username); ChatSystem.SendCommandTo(user.Mobile, ChatCommand.LeaveChannel, string.Format("{{{0}}}", m_Name)); ChatSystem.SendCommandTo(user.Mobile, ChatCommand.LeftChannel, m_Name); ChatLogging.LogLeave(Name, user.Username); if (m_Users.Count == 0 && !m_AlwaysAvailable) { RemoveChannel(this); } } }
public static void OpenChatWindowRequest(NetState state, CircularBufferReader reader, int packetLength) { var from = state.Mobile; if (!ChatSystem.Enabled) { from.SendMessage("The chat system has been disabled."); return; } // Newer clients don't send chat username anymore so we are ignoring the rest of this packet. // TODO: How does OSI handle incognito/disguise kits? // TODO: Does OSI still allow duplicate names? // For now we assume they should use their raw name. var chatName = from.RawName ?? $"Unknown User {Utility.RandomMinMax(1000000, 9999999)}"; ChatSystem.SendCommandTo(from, ChatCommand.OpenChatWindow, chatName); ChatUser.AddChatUser(from, chatName); }
public static void RemoveChatUser(ChatUser user) { if (user == null) { return; } if (m_Users.Contains(user)) { ChatSystem.SendCommandTo(user.Mobile, ChatCommand.CloseChatWindow); if (user.m_Channel != null) { user.m_Channel.RemoveUser(user); } m_Users.Remove(user); m_Table.Remove(user.m_Mobile); } }
public static void RemoveChatUser(ChatUser user) { if (user == null) { return; } for (var i = 0; i < user.Ignoring.Count; ++i) { user.Ignoring[i].RemoveIgnored(user); } if (m_Users.Remove(user)) { ChatSystem.SendCommandTo(user.Mobile, ChatCommand.CloseChatWindow); user.CurrentChannel?.RemoveUser(user); m_Table.Remove(user.Mobile); } }
public void SendCommand(ChatCommand command, ChatUser initiator, string param1, string param2) { for (int i = 0; i < m_Users.Count; ++i) { ChatUser user = (ChatUser)m_Users[i]; if (user == initiator) { continue; } if (user.CheckOnline()) { ChatSystem.SendCommandTo(user.Mobile, command, param1, param2); } else if (!Contains(user)) { --i; } } }
public bool AddUser(ChatUser user, string password) { if (Contains(user)) { user.SendMessage(46, m_Name); // You are already in the conference '%1'. return(true); } else if (IsBanned(user)) { user.SendMessage(64); // You have been banned from this conference. return(false); } else if (!ValidatePassword(password)) { user.SendMessage(34); // That is not the correct password. return(false); } else { if (user.CurrentChannel != null) { user.CurrentChannel.RemoveUser(user); // Remove them from their current channel first } ChatSystem.SendCommandTo(user.Mobile, ChatCommand.JoinedChannel, m_Name); SendCommand(ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username); m_Users.Add(user); user.CurrentChannel = this; if (user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!m_AlwaysAvailable && m_Users.Count == 1)) { AddModerator(user); } SendUsersTo(user); return(true); } }
public void AddUser(ChatUser user) { if (Contains(user)) { user.SendMessage(46, m_Name); // You are already in the conference '%1'. } else { if (user.CurrentChannel != null) { user.CurrentChannel.RemoveUser(user); // Remove them from their current channel first } ChatSystem.SendCommandTo(user.Mobile, ChatCommand.JoinedChannel, m_Name); SendCommand(ChatCommand.AddUserToChannel, ChatUser.GetColorCharacter() + user.Username); m_Users.Add(user); user.CurrentChannel = this; SendUsersTo(user); ChatLogging.LogJoin(Name, user.Username); } }