Exemplo n.º 1
0
        public static void RemoveModerator(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target != null)
            {
                channel.RemoveModerator(target, from);
            }
        }
Exemplo n.º 2
0
        public static void Kick(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target != null)
            {
                channel.Kick(target, from);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        public static void RemoveIgnore(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target == null)
            {
                return;
            }

            from.RemoveIgnored(target);
        }
Exemplo n.º 5
0
        public static void SendChannelsTo(ChatUser user)
        {
            for (int i = 0; i < m_Channels.Count; ++i)
            {
                Channel channel = m_Channels[i];

                if (!channel.IsBanned(user))
                {
                    ChatSystem.SendCommandTo(user.Mobile, ChatCommand.AddChannel, channel.Name, "0");
                }
            }
        }
Exemplo n.º 6
0
        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);
                }
            }
        }
Exemplo n.º 7
0
        public static void QueryWhoIs(ChatUser from, Channel channel, string param)
        {
            ChatUser target = ChatSystem.SearchForUser(from, param);

            if (target == null)
            {
                return;
            }

            if (target.Anonymous)
            {
                from.SendMessage(41, target.Username); // %1 is remaining anonymous.
            }
            else
            {
                from.SendMessage(43, target.Username, target.Mobile.Name); // %2 is known in the lands of Britannia as %2.
            }
        }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
        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);
            }
        }
Exemplo n.º 10
0
        public void SendCommand(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.Mobile, command, param1, param2);
                }
                else if (!Contains(user))
                {
                    --i;
                }
            }
        }
Exemplo n.º 11
0
        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);
            }
        }