public static void RemoveChannel(Channel channel) { if (channel == null) { return; } if (Channels.Contains(channel) && channel.m_Users.Count == 0) { ChatUser.GlobalSendCommand(ChatCommand.RemoveChannel, channel.Name); Channels.Remove(channel); ChatLogging.LogRemoveChannel(channel.Name); } }
public static Channel AddChannel(string name) { var channel = FindChannelByName(name); if (channel == null) { channel = new Channel(name); m_Channels.Add(channel); } ChatUser.GlobalSendCommand(ChatCommand.AddChannel, name, "0"); ChatLogging.LogCreateChannel(name); return(channel); }
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 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); } }
public static void ChannelMessage(ChatUser from, Channel channel, string param) { channel.SendMessage(57, from, from.GetColorCharacter() + from.Username, String.Format("{{{0}}} {1}", channel.Name, param)); // %1: %2 ChatLogging.LogMessage(channel.Name, from.Username, param); }