private void HandleLogoutReply(Message m, ViewerConnection vc, ViewerAgentAccessor accessor)
        {
            ViewerCircuit removeCircuit;

            if (vc.ViewerCircuits.TryGetValue((uint)accessor.CircuitCode, out removeCircuit))
            {
                vc.PostEvent(new LogoutReplyReceivedEvent(accessor));
                removeCircuit.Stop();
                vc.ClientUDP.RemoveCircuit(removeCircuit);
            }
        }
        private void HandleImageNotInDatabase(Message m, ViewerConnection vc, ViewerAgentAccessor agent)
        {
            ImageNotInDatabase res = (ImageNotInDatabase)m;

            m_ActiveImageTransfers.Remove(res.ID);
            vc.PostEvent(new TextureReceivedEvent
            {
                Agent     = agent,
                TextureID = res.ID,
                Success   = 0,
                Data      = new ByteArrayApi.ByteArray()
            });
        }
Ejemplo n.º 3
0
        private void TranslateEstateOwnerMessageSetExperience(EstateOwnerMessage m, ViewerConnection vc, ViewerAgentAccessor agent)
        {
            if (m.ParamList.Count < 5)
            {
                return;
            }
            var ev = new EstateOwnerMessageSetExperienceReceivedEvent
            {
                Agent         = agent,
                TransactionID = m.TransactionID,
                Invoice       = m.Invoice,
            };

            int blockedCount;
            int trustedCount;
            int allowedCount;

            if (!int.TryParse(m.ParamList[0].FromUTF8Bytes(), out ev.EstateID) ||
                !int.TryParse(m.ParamList[2].FromUTF8Bytes(), out blockedCount) ||
                !int.TryParse(m.ParamList[3].FromUTF8Bytes(), out trustedCount) ||
                !int.TryParse(m.ParamList[4].FromUTF8Bytes(), out allowedCount))
            {
                return;
            }
            if (m.ParamList.Count < 5 + blockedCount + trustedCount + allowedCount)
            {
                return;
            }

            int offset = 5;

            while (blockedCount-- > 0)
            {
                ev.Blocked.Add(new LSLKey(new UUID(m.ParamList[offset++], 0)));
            }
            while (trustedCount-- > 0)
            {
                ev.Trusted.Add(new LSLKey(new UUID(m.ParamList[offset++], 0)));
            }
            while (allowedCount-- > 0)
            {
                ev.Allowed.Add(new LSLKey(new UUID(m.ParamList[offset++], 0)));
            }

            vc.PostEvent(ev);
        }
        private void HandleImagePacket(Message m, ViewerConnection vc, ViewerAgentAccessor agent)
        {
            ImagePacket      res = (ImagePacket)m;
            ImageReceiveInfo info;

            if (m_ActiveImageTransfers.TryGetValue(res.ID, out info))
            {
                info.Segments[res.Packet] = res;
                if (info.IsComplete)
                {
                    vc.PostEvent(new TextureReceivedEvent
                    {
                        Agent     = agent,
                        TextureID = res.ID,
                        Success   = 1,
                        Data      = new ByteArrayApi.ByteArray(info.Data)
                    });
                    m_ActiveImageTransfers.Remove(res.ID);
                }
            }
        }
Ejemplo n.º 5
0
        private void TranslateEstateOwnerMessageSetAccess(EstateOwnerMessage m, ViewerConnection vc, ViewerAgentAccessor agent)
        {
            if (m.ParamList.Count < 6)
            {
                return;
            }
            var res = new EstateOwnerMessageSetAccessReceivedEvent
            {
                Agent         = agent,
                TransactionID = m.TransactionID,
                Invoice       = m.Invoice
            };

            int offset        = 6;
            int allowedAgents = int.Parse(m.ParamList[2].FromUTF8Bytes());
            int allowedGroups = int.Parse(m.ParamList[3].FromUTF8Bytes());
            int bannedAgents  = int.Parse(m.ParamList[4].FromUTF8Bytes());
            int managers      = int.Parse(m.ParamList[5].FromUTF8Bytes());

            while (allowedAgents-- > 0)
            {
                res.AllowedAgents.Add(new LSLKey(new UUID(m.ParamList[offset++], 0)));
            }
            while (allowedGroups-- > 0)
            {
                res.AllowedGroups.Add(new LSLKey(new UUID(m.ParamList[offset++], 0)));
            }
            while (bannedAgents-- > 0)
            {
                res.BannedAgents.Add(new LSLKey(new UUID(m.ParamList[offset++], 0)));
            }
            while (managers-- > 0)
            {
                res.Managers.Add(new LSLKey(new UUID(m.ParamList[offset++], 0)));
            }
            vc.PostEvent(res);
        }
Ejemplo n.º 6
0
        private void TranslateEstateOwnerMessageEstateUpdateInfo(EstateOwnerMessage m, ViewerConnection vc, ViewerAgentAccessor agent)
        {
            if (m.ParamList.Count < 10)
            {
                return;
            }

            vc.PostEvent(new EstateOwnerMessageEstateUpdateInfoReceivedEvent
            {
                Agent             = agent,
                TransactionID     = m.TransactionID,
                Invoice           = m.Invoice,
                EstateName        = m.ParamList[0].FromUTF8Bytes(),
                EstateOwner       = UUID.Parse(m.ParamList[1].FromUTF8Bytes()),
                EstateID          = int.Parse(m.ParamList[2].FromUTF8Bytes()),
                Flags             = (int)uint.Parse(m.ParamList[3].FromUTF8Bytes()),
                SunPosition       = int.Parse(m.ParamList[4].FromUTF8Bytes()) / 1024.0 - 6,
                ParentEstateID    = int.Parse(m.ParamList[5].FromUTF8Bytes()),
                CovenantID        = UUID.Parse(m.ParamList[6].FromUTF8Bytes()),
                CovenantTimestamp = (long)ulong.Parse(m.ParamList[7].FromUTF8Bytes()),
                SendToAgentOnly   = int.Parse(m.ParamList[8].FromUTF8Bytes()),
                AbuseEmail        = m.ParamList[9].FromUTF8Bytes()
            });
        }
Ejemplo n.º 7
0
            public void HandleRequest(object unused)
            {
                try
                {
                    var reqmap = new Map
                    {
                        { "ack", new Undef() },
                        { "done", false }
                    };
                    HttpStatusCode statusCode;

                    using (Stream s = new HttpClient.Post(m_Url, "application/llsd+xml", (Stream o) => LlsdXml.Serialize(reqmap, o))
                    {
                        TimeoutMs = m_TimeoutMs,
                        DisableExceptions = HttpClient.Request.DisableExceptionFlags.Disable5XX
                    }.ExecuteStreamRequest(out statusCode))
                    {
                        if (statusCode == HttpStatusCode.OK)
                        {
                            var resmap = (Map)LlsdXml.Deserialize(s);
                            foreach (Map evmap in ((AnArray)resmap["events"]).OfType <Map>())
                            {
                                IValue body;
                                string msgtype;
                                Func <IValue, Message> del;
                                if (evmap.TryGetValue("message", out msgtype) &&
                                    evmap.TryGetValue("body", out body) &&
                                    m_EQGDecoder.EQGDecoders.TryGetValue(msgtype, out del))
                                {
                                    Message m;
                                    try
                                    {
                                        m = del(body);
                                    }
                                    catch
                                    {
                                        continue;
                                    }

                                    Action <Message> handle;
                                    if (msgtype == "ObjectPhysicsProperties")
                                    {
                                        var msg = (ObjectPhysicsProperties)m;
                                        var ev  = new ObjectPhysicsPropertiesReceivedEvent
                                        {
                                            Agent = m_ViewerAgent
                                        };
                                        foreach (ObjectPhysicsProperties.ObjectDataEntry d in msg.ObjectData)
                                        {
                                            ev.ObjectData.Add(new ObjectPhysicsPropertiesData
                                            {
                                                LocalID           = (int)d.LocalID,
                                                PhysicsShapeType  = (int)d.PhysicsShapeType,
                                                Density           = d.Density,
                                                Friction          = d.Friction,
                                                Restitution       = d.Restitution,
                                                GravityMultiplier = d.GravityMultiplier
                                            });
                                        }
                                    }
                                    else if (msgtype == "EstablishAgentCommunication")
                                    {
                                        var msg = (EstablishAgentCommunication)m;
                                        m_ViewerConnection.PostEvent(new EstablishAgentCommunicationReceivedEvent
                                        {
                                            Agent          = m_ViewerAgent,
                                            SimIpAndPort   = msg.SimIpAndPort.ToString(),
                                            SeedCapability = msg.SeedCapability,
                                            GridPositionX  = (int)msg.GridPosition.X,
                                            GridPositionY  = (int)msg.GridPosition.Y,
                                            RegionSizeX    = (int)msg.RegionSize.X,
                                            RegionSizeY    = (int)msg.RegionSize.Y
                                        });
                                    }
                                    else if (msgtype == "ParcelVoiceInfo")
                                    {
                                        var msg = (ParcelVoiceInfo)m;
                                        m_ViewerConnection.PostEvent(new ParcelVoiceInfoReceivedEvent
                                        {
                                            Agent              = m_ViewerAgent,
                                            ParcelLocalId      = msg.ParcelLocalId,
                                            ChannelUri         = msg.ChannelUri,
                                            ChannelCredentials = msg.ChannelCredentials
                                        });
                                    }
                                    else if (msgtype == "SimConsoleResponse")
                                    {
                                        var msg = (SimConsoleResponse)m;
                                        m_ViewerConnection.PostEvent(new SimConsoleResponseReceivedEvent
                                        {
                                            Agent    = m_ViewerAgent,
                                            Response = msg.Message
                                        });
                                    }
                                    else if (m_MessageRouting.TryGetValue(m.Number, out handle))
                                    {
                                        handle(m);
                                    }
                                }
                            }
                        }
                        m_ViewerConnection.PostEvent(new EventQueueGetFinishedEvent(
                                                         m_ViewerAgent,
                                                         m_ReqID,
                                                         (int)statusCode));
                    }
                }
                catch
                {
                    m_ViewerConnection.PostEvent(new EventQueueGetFinishedEvent(
                                                     m_ViewerAgent,
                                                     m_ReqID,
                                                     499));
                }
            }