示例#1
0
        public void KickUser(UUID avatarID, string message)
        {
            //Get required interfaces
            IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>();
            ICapsService             capsService = m_registry.RequestModuleInterface <ICapsService>();
            IClientCapsService       client      = capsService.GetClientCapsService(avatarID);

            if (client != null)
            {
                IRegionClientCapsService regionClient = client.GetRootCapsService();
                if (regionClient != null)
                {
                    //Send the message to the client
                    messagePost.Post(regionClient.RegionHandle,
                                     BuildRequest("KickUserMessage", message, regionClient.AgentID.ToString()));
                    IAgentProcessing agentProcessor = m_registry.RequestModuleInterface <IAgentProcessing>();
                    if (agentProcessor != null)
                    {
                        agentProcessor.LogoutAgent(regionClient, true);
                    }
                    MainConsole.Instance.Info("User will be kicked in less than 30 seconds.");
                    return;
                }
            }
            MainConsole.Instance.Info("Could not find user to send message to.");
        }
        public void KickUser(UUID avatarID, string message)
        {
            //Get required interfaces
            IClientCapsService client = m_capsService.GetClientCapsService(avatarID);

            if (client != null)
            {
                IRegionClientCapsService regionClient = client.GetRootCapsService();
                if (regionClient != null)
                {
                    //Send the message to the client
                    m_messagePost.Get(regionClient.Region.ServerURI,
                                      BuildRequest("KickUserMessage", message, regionClient.AgentID.ToString()),
                                      (resp) =>
                    {
                        IAgentProcessing agentProcessor =
                            m_registry.RequestModuleInterface <IAgentProcessing>();
                        if (agentProcessor != null)
                        {
                            agentProcessor.LogoutAgent(regionClient, true);
                        }
                        MainConsole.Instance.Info("User has been kicked.");
                    });

                    return;
                }
            }
            MainConsole.Instance.Info("Could not find user to send message to.");
        }
示例#3
0
        protected void KickUserMessage(string module, string[] cmd)
        {
            //Combine the params and figure out the message
            string user = CombineParams(cmd, 2, 4);

            if (user.EndsWith(" "))
            {
                user = user.Remove(user.Length - 1);
            }
            string message = CombineParams(cmd, 5);

            //Get required interfaces
            IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>();
            ICapsService             capsService = m_registry.RequestModuleInterface <ICapsService>();
            IUserAccountService      userService = m_registry.RequestModuleInterface <IUserAccountService>();
            UserAccount account = userService.GetUserAccount(UUID.Zero, user);

            if (account == null)
            {
                m_log.Info("User does not exist.");
                return;
            }
            IClientCapsService client = capsService.GetClientCapsService(account.PrincipalID);

            if (client != null)
            {
                IRegionClientCapsService regionClient = client.GetRootCapsService();
                if (regionClient != null)
                {
                    //Send the message to the client
                    messagePost.Post(regionClient.RegionHandle, BuildRequest("KickUserMessage", message, regionClient.AgentID.ToString()));
                    IAgentProcessing agentProcessor = m_registry.RequestModuleInterface <IAgentProcessing>();
                    if (agentProcessor != null)
                    {
                        agentProcessor.LogoutAgent(regionClient);
                    }
                    m_log.Info("User Kicked sent.");
                    return;
                }
            }
            m_log.Info("Could not find user to send message to.");
        }