public static ChatUser AddChatUser(Mobile from) { ChatUser user = GetChatUser(from); if (user == null) { user = new ChatUser(from); m_Users.Add(user); m_Table[from] = user; Channel.SendChannelsTo(user); ArrayList list = Channel.Channels; for (int i = 0; i < list.Count; ++i) { Channel c = (Channel)list[i]; if (c.AddUser(user)) { break; } } //ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username ); } return(user); }
public static void JoinChannel(ChatUser from, Channel channel, string param) { string name; string password = null; int start = param.IndexOf('\"'); if (start >= 0) { int end = param.IndexOf('\"', ++start); if (end >= 0) { name = param.Substring(start, end - start); password = param.Substring(++end); } else { name = param.Substring(start); } } else { int indexOf = param.IndexOf(' '); if (indexOf >= 0) { name = param.Substring(0, indexOf++); password = param.Substring(indexOf); } else { name = param; } } if (password != null) { password = password.Trim(); } if (password != null && password.Length == 0) { password = null; } Channel joined = Channel.FindChannelByName(name); if (joined == null) { // There is no conference named '%1'. from.SendMessage(33, name); } else { joined.AddUser(from, password); } }
private static void CreateAndJoin(ChatUser from, string name) { Channel joined = Channel.FindChannelByName(name); if (joined == null) { if (ChatSystem.AllowCreateChannels) { from.Mobile.SendMessage("You have created the channel {0}", name); joined = Channel.AddChannel(name); } else { from.Mobile.SendMessage("Channel creation is not allowed right now. Switching to default channel..."); joined = Channel.Default; } } joined.AddUser(from); }