/// <summary>
        /// Return a decoded capabilities message as a strongly typed object
        /// </summary>
        /// <param name="eventName">A string containing the name of the capabilities message key</param>
        /// <param name="map">An <see cref="OSDMap"/> to decode</param>
        /// <returns>A strongly typed object containing the decoded information from the capabilities message, or null
        /// if no existing Message object exists for the specified event</returns>
        public static IMessage DecodeEvent(string eventName, OSDMap map)
        {
            IMessage message = null;

            switch (eventName)
            {
                case "AgentGroupDataUpdate": message = new AgentGroupDataUpdateMessage(); break;
                case "AvatarGroupsReply": message = new AgentGroupDataUpdateMessage(); break; // OpenSim sends the above with the wrong? key
                case "ParcelProperties": message = new ParcelPropertiesMessage(); break;
                case "ParcelObjectOwnersReply": message = new ParcelObjectOwnersReplyMessage(); break;
                case "TeleportFinish": message = new TeleportFinishMessage(); break;
                case "EnableSimulator": message = new EnableSimulatorMessage(); break;
                case "ParcelPropertiesUpdate": message = new ParcelPropertiesUpdateMessage(); break;
                case "EstablishAgentCommunication": message = new EstablishAgentCommunicationMessage(); break;
                case "ChatterBoxInvitation": message = new ChatterBoxInvitationMessage(); break;
                case "ChatterBoxSessionEventReply": message = new ChatterboxSessionEventReplyMessage(); break;
                case "ChatterBoxSessionStartReply": message = new ChatterBoxSessionStartReplyMessage(); break;
                case "ChatterBoxSessionAgentListUpdates": message = new ChatterBoxSessionAgentListUpdatesMessage(); break;
                case "RequiredVoiceVersion": message = new RequiredVoiceVersionMessage(); break;
                case "MapLayer": message = new MapLayerMessage(); break;
                case "ChatSessionRequest": message = new ChatSessionRequestMessage(); break;
                case "CopyInventoryFromNotecard": message = new CopyInventoryFromNotecardMessage(); break;
                case "ProvisionVoiceAccountRequest": message = new ProvisionVoiceAccountRequestMessage(); break;
                case "Viewerstats": message = new ViewerStatsMessage(); break;
                case "UpdateAgentLanguage": message = new UpdateAgentLanguageMessage(); break;
                case "RemoteParcelRequest": message = new RemoteParcelRequestMessage(); break;
                case "UpdateScriptTask": message = new UpdateScriptTaskMessage(); break;
                case "UpdateScriptAgent": message = new UpdateScriptAgentMessage(); break;
                case "SendPostcard": message = new SendPostcardMessage(); break;
                case "UpdateGestureAgentInventory": message = new UpdateGestureAgentInventoryMessage(); break;
                case "UpdateNotecardAgentInventory": message = new UpdateNotecardAgentInventoryMessage(); break;
                case "LandStatReply": message = new LandStatReplyMessage(); break;
                case "ParcelVoiceInfoRequest": message = new ParcelVoiceInfoRequestMessage(); break;
                case "ViewerStats": message = new ViewerStatsMessage(); break;
                case "EventQueueGet": message = new EventQueueGetMessage(); break;
                case "CrossedRegion": message = new CrossedRegionMessage(); break;
                case "TeleportFailed": message = new TeleportFailedMessage(); break;
                case "PlacesReply": message = new PlacesReplyMessage(); break;
                case "UpdateAgentInformation": message = new UpdateAgentInformationMessage(); break;
                case "DirLandReply": message = new DirLandReplyMessage(); break;
                case "ScriptRunningReply": message = new ScriptRunningReplyMessage(); break;
                case "SearchStatRequest": message = new SearchStatRequestMessage(); break;
                case "AgentDropGroup": message = new AgentDropGroupMessage(); break;
                case "AgentStateUpdate": message = new AgentStateUpdateMessage(); break;
                case "ForceCloseChatterBoxSession": message = new ForceCloseChatterBoxSessionMessage(); break;
                case "UploadBakedTexture": message = new UploadBakedTextureMessage(); break;
                case "RegionInfo": message = new RegionInfoMessage(); break;
                case "ObjectMediaNavigate": message = new ObjectMediaNavigateMessage(); break;
                case "ObjectMedia": message = new ObjectMediaMessage(); break;
                case "AttachmentResources": message = AttachmentResourcesMessage.GetMessageHandler(map); break;
                case "LandResources": message = LandResourcesMessage.GetMessageHandler(map); break;
                case "GetDisplayNames": message = new GetDisplayNamesMessage(); break;
                case "SetDisplayName": message = new SetDisplayNameMessage(); break;
                case "SetDisplayNameReply": message = new SetDisplayNameReplyMessage(); break;
                case "DisplayNameUpdate": message = new DisplayNameUpdateMessage(); break;
                //case "ProductInfoRequest": message = new ProductInfoRequestMessage(); break;
                case "ObjectPhysicsProperties": message = new ObjectPhysicsPropertiesMessage(); break;
                case "BulkUpdateInventory": message = new BulkUpdateInventoryMessage(); break;
                case "RenderMaterials": message = new RenderMaterialsMessage(); break;
                case "GetObjectCost": message = GetObjectCostMessage.GetMessageHandler(map); break;

                // Capabilities TODO:
                // DispatchRegionInfo
                // EstateChangeInfo
                // EventQueueGet
                // FetchInventoryDescendents
                // GroupProposalBallot
                // MapLayerGod
                // NewFileAgentInventory
                // RequestTextureDownload
                // SearchStatTracking
                // SendUserReport
                // SendUserReportWithScreenshot
                // ServerReleaseNotes
                // StartGroupProposal
                // UpdateGestureTaskInventory
                // UpdateNotecardTaskInventory
                // ViewerStartAuction
                // UntrustedSimulatorMessage
            }

            if (message != null)
            {
                try
                {
                    message.Deserialize(map);
                    return message;
                }
                catch (Exception e)
                {
                    Logger.Log("Exception while trying to Deserialize " + eventName + ":" + e.Message + ": " + e.StackTrace, Helpers.LogLevel.Error);
                }

                return null;
            }
            else
            {
                return null;
            }
        }
 public static OSD LandStatReply(LandStatReplyMessage statReplyMessage)
 {
     OSDMap message = new OSDMap {{"message", OSD.FromString("LandStatReply")}};
     OSD message_body = statReplyMessage.Serialize();
     OSDArray m = (OSDArray) ((OSDMap) message_body)["DataExtended"];
     int num = 0;
     foreach (OSDMap innerMap in m.Cast<OSDMap>())
     {
         innerMap["TimeStamp"] =
             OSD.FromUInteger((uint) Util.ToUnixTime(statReplyMessage.ReportDataBlocks[num].TimeStamp));
         num++;
     }
     message.Add("body", message_body);
     return message;
 }
        public void LandStatReplyMessage()
        {
            LandStatReplyMessage s = new LandStatReplyMessage();
            s.ReportType = 22;
            s.RequestFlags = 44;
            s.TotalObjectCount = 2;
            s.ReportDataBlocks = new LandStatReplyMessage.ReportDataBlock[2];

            LandStatReplyMessage.ReportDataBlock block1 = new LandStatReplyMessage.ReportDataBlock();
            block1.Location = Vector3.One;
            block1.MonoScore = 99;
            block1.OwnerName = "Profoky Neva";
            block1.Score = 10;
            block1.TaskID = UUID.Random();
            block1.TaskLocalID = 987341;
            block1.TaskName = "Verbal Flogging";
            block1.TimeStamp = new DateTime(2009, 5, 23, 4, 30, 0);
            s.ReportDataBlocks[0] = block1;

            LandStatReplyMessage.ReportDataBlock block2 = new LandStatReplyMessage.ReportDataBlock();
            block2.Location = Vector3.One;
            block2.MonoScore = 1;
            block2.OwnerName = "Philip Linden";
            block2.Score = 5;
            block2.TaskID = UUID.Random();
            block2.TaskLocalID = 987342;
            block2.TaskName = "Happy Ant";
            block2.TimeStamp = new DateTime(2008, 4, 22, 3, 29, 55);
            s.ReportDataBlocks[1] = block2;

            OSDMap map = s.Serialize();

            LandStatReplyMessage t = new LandStatReplyMessage();
            t.Deserialize(map);

            Assert.AreEqual(s.ReportType, t.ReportType);
            Assert.AreEqual(s.RequestFlags, t.RequestFlags);
            Assert.AreEqual(s.TotalObjectCount, t.TotalObjectCount);

            for (int i = 0; i < t.ReportDataBlocks.Length; i++)
            {
                Assert.AreEqual(s.ReportDataBlocks[i].Location, t.ReportDataBlocks[i].Location);
                Assert.AreEqual(s.ReportDataBlocks[i].MonoScore, t.ReportDataBlocks[i].MonoScore);
                Assert.AreEqual(s.ReportDataBlocks[i].OwnerName, t.ReportDataBlocks[i].OwnerName);
                Assert.AreEqual(s.ReportDataBlocks[i].Score, t.ReportDataBlocks[i].Score);
                Assert.AreEqual(s.ReportDataBlocks[i].TaskID, t.ReportDataBlocks[i].TaskID);
                Assert.AreEqual(s.ReportDataBlocks[i].TaskLocalID, t.ReportDataBlocks[i].TaskLocalID);
                Assert.AreEqual(s.ReportDataBlocks[i].TaskName, t.ReportDataBlocks[i].TaskName);
                Assert.AreEqual(s.ReportDataBlocks[i].TimeStamp, t.ReportDataBlocks[i].TimeStamp);
            }
        }
 public void LandStatReply(LandStatReplyMessage message, UUID AgentID, UUID regionID)
 {
     OSD item = EventQueueHelper.LandStatReply(message);
     Enqueue(item, AgentID, regionID);
 }
Example #5
0
 public void LandStatReply(LandStatReplyMessage message, UUID AgentID, ulong RegionHandle)
 {
     OSD item = EventQueueHelper.LandStatReply(message);
     Enqueue(item, AgentID, RegionHandle);
 }