Exemplo n.º 1
0
        private void UUIDNameRequestHandler(Packet packet, LLAgent agent)
        {
            UUIDNameRequestPacket request = (UUIDNameRequestPacket)packet;

            List <UUIDNameReplyPacket.UUIDNameBlockBlock> responses = new List <UUIDNameReplyPacket.UUIDNameBlockBlock>();

            for (int i = 0; i < request.UUIDNameBlock.Length; i++)
            {
                UUID   requestID = request.UUIDNameBlock[i].ID;
                string firstName = null, lastName = null;

                // See if we can fetch a presence in the local scene with the requested UUID first
                IScenePresence localPresence;
                if (m_scene.TryGetPresence(requestID, out localPresence))
                {
                    Util.GetFirstLastName(localPresence.Name, out firstName, out lastName);
                }
                else if (m_userClient != null)
                {
                    // TODO: We might want to switch to a batch user service command in the future
                    User user;
                    if (m_userClient.TryGetUser(requestID, out user))
                    {
                        Util.GetFirstLastName(user.Name, out firstName, out lastName);
                    }
                }

                if (firstName != null && lastName != null)
                {
                    UUIDNameReplyPacket.UUIDNameBlockBlock block = new UUIDNameReplyPacket.UUIDNameBlockBlock();
                    block.ID        = requestID;
                    block.FirstName = Utils.StringToBytes(firstName);
                    block.LastName  = Utils.StringToBytes(lastName);

                    responses.Add(block);
                }
            }

            // Build the response packet
            UUIDNameReplyPacket response = new UUIDNameReplyPacket();

            response.UUIDNameBlock = responses.ToArray();

            m_udp.SendPacket(agent, response, ThrottleCategory.Task, true);
        }
Exemplo n.º 2
0
        private void UUIDNameRequestHandler(Packet packet, LLAgent agent)
        {
            UUIDNameRequestPacket request = (UUIDNameRequestPacket)packet;

            List<UUIDNameReplyPacket.UUIDNameBlockBlock> responses = new List<UUIDNameReplyPacket.UUIDNameBlockBlock>();

            for (int i = 0; i < request.UUIDNameBlock.Length; i++)
            {
                UUID requestID = request.UUIDNameBlock[i].ID;
                string firstName = null, lastName = null;

                // See if we can fetch a presence in the local scene with the requested UUID first
                IScenePresence localPresence;
                if (m_scene.TryGetPresence(requestID, out localPresence))
                {
                    Util.GetFirstLastName(localPresence.Name, out firstName, out lastName);
                }
                else if (m_userClient != null)
                {
                    // TODO: We might want to switch to a batch user service command in the future
                    User user;
                    if (m_userClient.TryGetUser(requestID, out user))
                        Util.GetFirstLastName(user.Name, out firstName, out lastName);
                }

                if (firstName != null && lastName != null)
                {
                    UUIDNameReplyPacket.UUIDNameBlockBlock block = new UUIDNameReplyPacket.UUIDNameBlockBlock();
                    block.ID = requestID;
                    block.FirstName = Utils.StringToBytes(firstName);
                    block.LastName = Utils.StringToBytes(lastName);

                    responses.Add(block);
                }
            }

            // Build the response packet
            UUIDNameReplyPacket response = new UUIDNameReplyPacket();
            response.UUIDNameBlock = responses.ToArray();

            m_udp.SendPacket(agent, response, ThrottleCategory.Task, true);
        }