예제 #1
0
        private Hashtable SimulatorFeaturesCAP (Hashtable mDhttpMethod)
        {
            //OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)mDhttpMethod["requestbody"]);


            OSDMap data = new OSDMap ();
            data["MeshRezEnabled"] = true;
            data["MeshUploadEnabled"] = true;
            data["MeshXferEnabled"] = true;
            data["PhysicsMaterialsEnabled"] = true;
            OSDMap typesMap = new OSDMap ();

            typesMap["convex"] = true;
            typesMap["none"] = true;
            typesMap["prim"] = true;

            data["PhysicsShapeTypes"] = typesMap;


            //Send back data
            Hashtable responsedata = new Hashtable ();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
            return responsedata;
        }
        private Hashtable SimulatorFeaturesCAP (Hashtable mDhttpMethod)
        {
            OSDMap data = new OSDMap ();
            data["MeshRezEnabled"] = true;
            data["MeshUploadEnabled"] = true;
            data["MeshXferEnabled"] = true;
            data["PhysicsMaterialsEnabled"] = true;


            OSDMap typesMap = new OSDMap ();

            typesMap["convex"] = true;
            typesMap["none"] = true;
            typesMap["prim"] = true;

            data["PhysicsShapeTypes"] = typesMap;



            //Data URLS need sent as well
            //Not yet...
            //data["DataUrls"] = m_service.Registry.RequestModuleInterface<IGridRegistrationService> ().GetUrlForRegisteringClient (m_service.AgentID + "|" + m_service.RegionHandle);

            //Send back data
            Hashtable responsedata = new Hashtable ();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
            return responsedata;
        }
        private OSDMap EventManager_OnRegisterCaps(UUID agentID, IHttpServer server)
        {
            OSDMap retVal = new OSDMap();
            retVal["EnvironmentSettings"] = CapsUtil.CreateCAPS("EnvironmentSettings", "");
#if (!ISWIN)
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return SetEnvironment(m_dhttpMethod, agentID);
                                                      }));
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return EnvironmentSettings(m_dhttpMethod, agentID);
                                                      }));
#else
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
                                                        m_dhttpMethod => SetEnvironment(m_dhttpMethod, agentID)));
            //Sets the windlight settings
            server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
                                                        m_dhttpMethod => EnvironmentSettings(m_dhttpMethod, agentID)));
#endif
            return retVal;
        }
예제 #4
0
        public OSDMap RegisterCaps (UUID agentID, IHttpServer server)
        {
            OSDMap retVal = new OSDMap ();
            retVal["SimulatorFeatures"] = CapsUtil.CreateCAPS ("SimulatorFeatures", "");

            server.AddStreamHandler (new RestHTTPHandler ("GET", retVal["SimulatorFeatures"],
                                                      delegate (Hashtable m_dhttpMethod)
                                                      {
                                                          return SimulatorFeaturesCAP (m_dhttpMethod);
                                                      }));
            return retVal;
        }
예제 #5
0
        public OSDMap RegisterCaps(UUID agentID, IHttpServer server)
        {
            OSDMap retVal = new OSDMap();
            retVal["ObjectAdd"] = CapsUtil.CreateCAPS("ObjectAdd", "");
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["ObjectAdd"],
                                                       delegate(Hashtable m_dhttpMethod)
                                                       {
                                                           return ProcessAdd(m_dhttpMethod, agentID);
                                                       }));

            retVal["ServerReleaseNotes"] = CapsUtil.CreateCAPS("ServerReleaseNotes", "");
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["ServerReleaseNotes"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return ProcessServerReleaseNotes(m_dhttpMethod, agentID);
                                                      }));
            return retVal;
        }
예제 #6
0
        /// <summary>
        /// Set up the CAPS for display names
        /// </summary>
        /// <param name="agentID"></param>
        /// <param name="caps"></param>
        public OSDMap RegisterCaps(UUID agentID, IHttpServer server)
        {
            OSDMap retVal = new OSDMap();
            retVal["SetDisplayName"] = CapsUtil.CreateCAPS("SetDisplayName", "");

            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["SetDisplayName"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return ProcessSetDisplayName(m_dhttpMethod, agentID);
                                                      }));

            retVal["GetDisplayNames"] = CapsUtil.CreateCAPS("GetDisplayNames", "");
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["GetDisplayNames"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return ProcessGetDisplayName(m_dhttpMethod, agentID);
                                                      }));
            return retVal;
        }
예제 #7
0
        private Hashtable MeshUploadFlagCAP(Hashtable mDhttpMethod)
        {
            OSDMap data = new OSDMap();
            UserAccount acct = m_userService.GetUserAccount(UUID.Zero, m_service.AgentID);
            IUserProfileInfo info = m_profileConnector.GetUserProfile(m_service.AgentID);

            data["id"] = m_service.AgentID;
            data["username"] = acct.Name;
            data["display_name"] = info.DisplayName;
            data["display_name_next_update"] = Utils.UnixTimeToDateTime(0);
            data["legacy_first_name"] = acct.FirstName;
            data["legacy_last_name"] = acct.LastName;
            data["mesh_upload_status"] = "valid"; // add if account has ability to upload mesh?
            bool isDisplayNameNDefault = (info.DisplayName == acct.Name) || (info.DisplayName == acct.FirstName + "." + acct.LastName);
            data["is_display_name_default"] = isDisplayNameNDefault;

            //Send back data
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
            return responsedata;
        }
예제 #8
0
 private void LoadAssets(OSDMap assets, AvatarAppearance appearance)
 {
     foreach (KeyValuePair<string, OSD> kvp in assets)
     {
         UUID AssetID = UUID.Parse(kvp.Key);
         OSDMap assetMap = (OSDMap)kvp.Value;
         AssetBase asset = AssetService.Get(AssetID.ToString());
         m_log.Info("[AvatarArchive]: Loading asset " + AssetID.ToString());
         if (asset == null) //Don't overwrite
         {
             asset = LoadAssetBase(assetMap);
             UUID oldassetID = asset.ID;
             UUID newAssetID = AssetService.Store(asset);
             asset.ID = newAssetID;
             //Fix the IDs
             AvatarWearable[] wearables = new AvatarWearable[appearance.Wearables.Length];
             appearance.Wearables.CopyTo(wearables, 0);
             for (int a = 0; a < wearables.Length; a++)
             {
                 for (int i = 0; i < wearables[a].Count; i++)
                 {
                     if (wearables[a][i].AssetID == oldassetID)
                     {
                         //Fix the ItemID
                         AvatarWearable w = wearables[a];
                         UUID itemID = w.GetItem(oldassetID);
                         w.RemoveItem(oldassetID);
                         w.Add(itemID, newAssetID);
                         appearance.SetWearable(a, w);
                         break;
                     }
                 }
             }
         }
     }
 }
예제 #9
0
        private void SaveItem(UUID ItemID, OSDMap itemMap, OSDMap assets)
        {
            InventoryItemBase saveItem = InventoryService.GetItem(new InventoryItemBase(ItemID));
            if (saveItem == null)
            {
                m_log.Warn("[AvatarArchive]: Could not find item to save: " + ItemID.ToString());
                return;
            }
            m_log.Info("[AvatarArchive]: Saving item " + ItemID.ToString());
            string serialization = OpenSim.Framework.Serialization.External.UserInventoryItemSerializer.Serialize(saveItem);
            itemMap[ItemID.ToString()] = OSD.FromString(serialization);

            SaveAsset(saveItem.AssetID, assets);
        }
예제 #10
0
 private AssetBase LoadAssetBase(OSDMap map)
 {
     AssetBase asset = new AssetBase();
     asset.Data = map["AssetData"].AsBinary();
     asset.TypeString = map["ContentType"].AsString();
     asset.CreationDate = map["CreationDate"].AsDate();
     asset.CreatorID = map["CreatorID"].AsUUID();
     asset.Description = map["Description"].AsString();
     asset.ID = map["ID"].AsUUID();
     asset.Name = map["Name"].AsString();
     asset.Type = map["Type"].AsInteger();
     return asset;
 }
예제 #11
0
 private void CreateMetaDataMap(AssetBase data, OSDMap map)
 {
     map["ContentType"] = OSD.FromString(data.TypeString);
     map["CreationDate"] = OSD.FromDate(data.CreationDate);
     map["CreatorID"] = OSD.FromUUID(data.CreatorID);
     map["Description"] = OSD.FromString(data.Description);
     map["ID"] = OSD.FromUUID(data.ID);
     map["Name"] = OSD.FromString(data.Name);
     map["Type"] = OSD.FromInteger(data.Type);
 }
예제 #12
0
        public string HandleInventoryItemCreate(string request, UUID AgentID)
        {
            OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(request);
            string asset_type = map["asset_type"].AsString();
            //m_log.Info("[CAPS]: NewAgentInventoryRequest Request is: " + map.ToString());
            //m_log.Debug("asset upload request via CAPS" + llsdRequest.inventory_type + " , " + llsdRequest.asset_type);

            if (asset_type == "texture" ||
                asset_type == "animation" ||
                asset_type == "sound")
            {
                /* Disabled until we have a money module that can hook up to this
                 * IMoneyModule mm = .RequestModuleInterface<IMoneyModule>();

                    if (mm != null)
                    {
                        if (!mm.UploadCovered(client, mm.UploadCharge))
                        {
                            if (client != null)
                                client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);

                            map = new OSDMap();
                            map["uploader"] = "";
                            map["state"] = "error";
                            return OSDParser.SerializeLLSDXmlString(map);
                        }
                        else
                            mm.ApplyUploadCharge(client.AgentId, mm.UploadCharge, "Upload asset.");
                    }
                 */
            }


            string assetName = map["name"].AsString();
            string assetDes = map["description"].AsString();
            UUID parentFolder = map["folder_id"].AsUUID();
            string inventory_type = map["inventory_type"].AsString();

            UUID newAsset = UUID.Random();
            UUID newInvItem = UUID.Random();
            string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
            string uploadpath = m_service.CreateCAPS("Upload" + uploaderPath, uploaderPath);
                
            AssetUploader uploader =
                new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, inventory_type,
                                  asset_type, uploadpath, "Upload" + uploaderPath, m_service, this);
            m_service.AddStreamHandler("Upload" + uploaderPath,
                new BinaryStreamHandler("POST", uploadpath, uploader.uploaderCaps));

            string uploaderURL = m_service.HostUri + uploadpath;
            map = new OSDMap();
            map["uploader"] = uploaderURL;
            map["state"] = "upload";
            return OSDParser.SerializeLLSDXmlString(map);
        }
예제 #13
0
        private string OnChatSessionRequest(UUID Agent, OSDMap rm)
        {
            string method = rm["method"].AsString();

            UUID sessionid = UUID.Parse(rm["session-id"].AsString());

            IScenePresence SP = findScenePresence(Agent);
            IEventQueueService eq = SP.Scene.RequestModuleInterface<IEventQueueService>();

            if (method == "start conference")
            {
                //Create the session.
                CreateSession(new ChatSession
                                  {
                                      Members = new List<ChatSessionMember>(),
                                      SessionID = sessionid,
                                      Name = SP.Name + " Conference"
                                  });

                OSDArray parameters = (OSDArray) rm["params"];
                //Add other invited members.
                foreach (OSD param in parameters)
                {
                    AddDefaultPermsMemberToSession(param.AsUUID(), sessionid);
                }

                //Add us to the session!
                AddMemberToGroup(new ChatSessionMember
                                     {
                                         AvatarKey = Agent,
                                         CanVoiceChat = true,
                                         IsModerator = true,
                                         MuteText = false,
                                         MuteVoice = false,
                                         HasBeenAdded = true
                                     }, sessionid);


                //Inform us about our room
                ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
                    new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
                        {
                            AgentID = Agent,
                            CanVoiceChat = true,
                            IsModerator = true,
                            MuteText = false,
                            MuteVoice = false,
                            Transition = "ENTER"
                        };
                eq.ChatterBoxSessionAgentListUpdates(sessionid, new[] {block}, Agent, "ENTER",
                                                     findScene(Agent).RegionInfo.RegionHandle);

                ChatterBoxSessionStartReplyMessage cs = new ChatterBoxSessionStartReplyMessage
                                                            {
                                                                VoiceEnabled = true,
                                                                TempSessionID = UUID.Random(),
                                                                Type = 1,
                                                                Success = true,
                                                                SessionID = sessionid,
                                                                SessionName = SP.Name + " Conference",
                                                                ModeratedVoice = true
                                                            };

                return cs.Serialize().ToString();
            }
            else if (method == "accept invitation")
            {
                //They would like added to the group conversation
                List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> Us =
                    new List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();
                List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> NotUsAgents =
                    new List<ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();

                ChatSession session = GetSession(sessionid);
                if (session != null)
                {
                    ChatSessionMember thismember = FindMember(sessionid, Agent);
                    //Tell all the other members about the incoming member
                    foreach (ChatSessionMember sessionMember in session.Members)
                    {
                        ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
                            new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
                                {
                                    AgentID = sessionMember.AvatarKey,
                                    CanVoiceChat = sessionMember.CanVoiceChat,
                                    IsModerator = sessionMember.IsModerator,
                                    MuteText = sessionMember.MuteText,
                                    MuteVoice = sessionMember.MuteVoice,
                                    Transition = "ENTER"
                                };
                        if (sessionMember.AvatarKey == thismember.AvatarKey)
                            Us.Add(block);
                        else
                        {
                            if (sessionMember.HasBeenAdded)
                                // Don't add not joined yet agents. They don't want to be here.
                                NotUsAgents.Add(block);
                        }
                    }
                    thismember.HasBeenAdded = true;
                    foreach (ChatSessionMember member in session.Members)
                    {
                        eq.ChatterBoxSessionAgentListUpdates(session.SessionID,
                                                             member.AvatarKey == thismember.AvatarKey
                                                                 ? NotUsAgents.ToArray()
                                                                 : Us.ToArray(),
                                                             member.AvatarKey, "ENTER",
                                                             findScene(Agent).RegionInfo.RegionHandle);
                    }
                    return "Accepted";
                }
                else
                    return ""; //not this type of session
            }
            else if (method == "mute update")
            {
                //Check if the user is a moderator
                Hashtable responsedata = new Hashtable();
                if (!CheckModeratorPermission(Agent, sessionid))
                {
                    return "";
                }

                OSDMap parameters = (OSDMap) rm["params"];
                UUID AgentID = parameters["agent_id"].AsUUID();
                OSDMap muteInfoMap = (OSDMap) parameters["mute_info"];

                ChatSessionMember thismember = FindMember(sessionid, AgentID);
                if (muteInfoMap.ContainsKey("text"))
                    thismember.MuteText = muteInfoMap["text"].AsBoolean();
                if (muteInfoMap.ContainsKey("voice"))
                    thismember.MuteVoice = muteInfoMap["voice"].AsBoolean();

                ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
                    new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
                        {
                            AgentID = thismember.AvatarKey,
                            CanVoiceChat = thismember.CanVoiceChat,
                            IsModerator = thismember.IsModerator,
                            MuteText = thismember.MuteText,
                            MuteVoice = thismember.MuteVoice,
                            Transition = "ENTER"
                        };

                // Send an update to the affected user
                eq.ChatterBoxSessionAgentListUpdates(sessionid, new[] {block}, AgentID, "",
                                                     findScene(Agent).RegionInfo.RegionHandle);

                return "Accepted";
            }
            else
            {
                MainConsole.Instance.Warn("ChatSessionRequest : " + method);
                return "";
            }
        }
예제 #14
0
        /// <summary>
        /// Send 'remoteClient' the group membership 'data' for agent 'dataForAgentID'.
        /// </summary>
        private void SendGroupMembershipInfoViaCaps(IClientAPI remoteClient, UUID dataForAgentID, GroupMembershipData[] data)
        {
            if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            OSDArray AgentData = new OSDArray(1);
            OSDMap AgentDataMap = new OSDMap(1);
            AgentDataMap.Add("AgentID", OSD.FromUUID(dataForAgentID));
            AgentData.Add(AgentDataMap);


            OSDArray GroupData = new OSDArray(data.Length);
            OSDArray NewGroupData = new OSDArray(data.Length);

            foreach (GroupMembershipData membership in data)
            {
                if (GetRequestingAgentID(remoteClient) != dataForAgentID)
                {
                    if (!membership.ListInProfile)
                    {
                        // If we're sending group info to remoteclient about another agent, 
                        // filter out groups the other agent doesn't want to share.
                        continue;
                    }
                }

                OSDMap GroupDataMap = new OSDMap(6);
                OSDMap NewGroupDataMap = new OSDMap(1);

                GroupDataMap.Add("GroupID", OSD.FromUUID(membership.GroupID));
                GroupDataMap.Add("GroupPowers", OSD.FromULong(membership.GroupPowers));
                GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(membership.AcceptNotices));
                GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(membership.GroupPicture));
                GroupDataMap.Add("Contribution", OSD.FromInteger(membership.Contribution));
                GroupDataMap.Add("GroupName", OSD.FromString(membership.GroupName));
                NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(membership.ListInProfile));

                GroupData.Add(GroupDataMap);
                NewGroupData.Add(NewGroupDataMap);
            }

            OSDMap llDataStruct = new OSDMap(3);
            llDataStruct.Add("AgentData", AgentData);
            llDataStruct.Add("GroupData", GroupData);
            llDataStruct.Add("NewGroupData", NewGroupData);

            if (m_debugEnabled)
            {
                m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct));
            }

            IEventQueueService queue = remoteClient.Scene.RequestModuleInterface<IEventQueueService>();

            if (queue != null)
            {
                queue.Enqueue(buildEvent("AgentGroupDataUpdate", llDataStruct), GetRequestingAgentID(remoteClient), remoteClient.Scene.RegionInfo.RegionHandle);
            }
        }
예제 #15
0
 private Hashtable ProcessServerReleaseNotes(Hashtable m_dhttpMethod, UUID agentID)
 {
     Hashtable responsedata = new Hashtable();
     responsedata["int_response_code"] = 200; //501; //410; //404;
     responsedata["content_type"] = "text/plain";
     responsedata["keepalive"] = false;
     
     OSDMap osd = new OSDMap();
     osd.Add("ServerReleaseNotes", new OSDString(Aurora.Framework.Utilities.GetServerReleaseNotesURL()));
     string response = OSDParser.SerializeLLSDXmlString(osd);
     responsedata["str_response_string"] = response;
     return responsedata;
 }
예제 #16
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            if (!message.ContainsKey("Method"))
                return null;

            UUID AgentID = message["AgentID"].AsUUID();
            ulong requestingRegion = message["RequestingRegion"].AsULong();
            ICapsService capsService = m_registry.RequestModuleInterface<ICapsService>();
            if (capsService == null)
            {
                //m_log.Info("[AgentProcessing]: Failed OnMessageReceived ICapsService is null");
                return new OSDMap();
            }
            IClientCapsService clientCaps = capsService.GetClientCapsService(AgentID);

            IRegionClientCapsService regionCaps = null;
            if (clientCaps != null)
                regionCaps = clientCaps.GetCapsService(requestingRegion);
            if (message["Method"] == "LogoutRegionAgents")
            {
                LogOutAllAgentsForRegion(requestingRegion);
            }
            else if (message["Method"] == "RegionIsOnline") //This gets fired when the scene is fully finished starting up
            {
                //Log out all the agents first, then add any child agents that should be in this region
                LogOutAllAgentsForRegion(requestingRegion);
                IGridService GridService = m_registry.RequestModuleInterface<IGridService>();
                if (GridService != null)
                {
                    int x, y;
                    Util.UlongToInts(requestingRegion, out x, out y);
                    GridRegion requestingGridRegion = GridService.GetRegionByPosition(UUID.Zero, x, y);
                    if (requestingGridRegion != null)
                        EnableChildAgentsForRegion(requestingGridRegion);
                }
            }
            else if (message["Method"] == "DisableSimulator")
            {
                //KILL IT!
                if (regionCaps == null || clientCaps == null)
                    return null;
                IEventQueueService eventQueue = m_registry.RequestModuleInterface<IEventQueueService> ();
                eventQueue.DisableSimulator (regionCaps.AgentID, regionCaps.RegionHandle);
                //regionCaps.Close();
                //clientCaps.RemoveCAPS(requestingRegion);
            }
            else if (message["Method"] == "ArrivedAtDestination")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                //Recieved a callback
                if (clientCaps.InTeleport) //Only set this if we are in a teleport, 
                    //  otherwise (such as on login), this won't check after the first tp!
                    clientCaps.CallbackHasCome = true;

                regionCaps.Disabled = false;

                //The agent is getting here for the first time (eg. login)
                OSDMap body = ((OSDMap)message["Message"]);

                //Parse the OSDMap
                int DrawDistance = body["DrawDistance"].AsInteger();

                AgentCircuitData circuitData = new AgentCircuitData();
                circuitData.UnpackAgentCircuitData((OSDMap)body["Circuit"]);

                //Now do the creation
                EnableChildAgents(AgentID, requestingRegion, DrawDistance, circuitData);
            }
            else if (message["Method"] == "CancelTeleport")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                //Only the region the client is root in can do this
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService ();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    //The user has requested to cancel the teleport, stop them.
                    clientCaps.RequestToCancelTeleport = true;
                    regionCaps.Disabled = false;
                }
            }
            else if (message["Method"] == "AgentLoggedOut")
            {
                //ONLY if the agent is root do we even consider it
                if (regionCaps != null)
                {
                    if (regionCaps.RootAgent)
                    {
                        LogoutAgent(regionCaps);
                    }
                }
            }
            else if (message["Method"] == "SendChildAgentUpdate")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService ();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    OSDMap body = ((OSDMap)message["Message"]);

                    AgentPosition pos = new AgentPosition();
                    pos.Unpack((OSDMap)body["AgentPos"]);

                    SendChildAgentUpdate(pos, regionCaps);
                    regionCaps.Disabled = false;
                }
            }
            else if (message["Method"] == "TeleportAgent")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService ();
                if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle)
                {
                    OSDMap body = ((OSDMap)message["Message"]);

                    GridRegion destination = new GridRegion();
                    destination.FromOSD((OSDMap)body["Region"]);

                    uint TeleportFlags = body["TeleportFlags"].AsUInteger();
                    int DrawDistance = body["DrawDistance"].AsInteger();

                    AgentCircuitData Circuit = new AgentCircuitData();
                    Circuit.UnpackAgentCircuitData((OSDMap)body["Circuit"]);

                    AgentData AgentData = new AgentData();
                    AgentData.Unpack((OSDMap)body["AgentData"]);
                    regionCaps.Disabled = false;

                    OSDMap result = new OSDMap();
                    string reason = "";
                    result["Success"] = TeleportAgent(destination, TeleportFlags, DrawDistance,
                        Circuit, AgentData, AgentID, requestingRegion, out reason);
                    result["Reason"] = reason;
                    return result;
                }
            }
            else if (message["Method"] == "CrossAgent")
            {
                if (regionCaps == null || clientCaps == null)
                    return null;
                if (clientCaps.GetRootCapsService().RegionHandle == regionCaps.RegionHandle)
                {
                    //This is a simulator message that tells us to cross the agent
                    OSDMap body = ((OSDMap)message["Message"]);

                    Vector3 pos = body["Pos"].AsVector3();
                    Vector3 Vel = body["Vel"].AsVector3();
                    GridRegion Region = new GridRegion();
                    Region.FromOSD((OSDMap)body["Region"]);
                    AgentCircuitData Circuit = new AgentCircuitData();
                    Circuit.UnpackAgentCircuitData((OSDMap)body["Circuit"]);
                    AgentData AgentData = new AgentData();
                    AgentData.Unpack((OSDMap)body["AgentData"]);
                    regionCaps.Disabled = false;

                    OSDMap result = new OSDMap();
                    string reason = "";
                    result["Success"] = CrossAgent(Region, pos, Vel, Circuit, AgentData,
                        AgentID, requestingRegion, out reason);
                    result["Reason"] = reason;
                    return result;
                }
                else if (clientCaps.InTeleport)
                {
                    OSDMap result = new OSDMap ();
                    result["Success"] = false;
                    result["Note"] = false;
                    return result;
                }
                else
                {
                    OSDMap result = new OSDMap ();
                    result["Success"] = false;
                    result["Note"] = false;
                    return result;
                }
            }
            return null;
        }
예제 #17
0
 /// <summary>
 /// Send a console message to the viewer
 /// </summary>
 /// <param name="AgentID"></param>
 /// <param name="text"></param>
 private void SendConsoleEventEQM(UUID AgentID, string text)
 {
     OSDMap item = new OSDMap ();
     item.Add ("body", text);
     item.Add ("message", OSD.FromString ("SimConsoleResponse"));
     IEventQueueService eq = m_scenes[0].RequestModuleInterface<IEventQueueService> ();
     if (eq != null)
         eq.Enqueue (item, AgentID, findScene(AgentID).RegionInfo.RegionHandle);
 }
예제 #18
0
 public OSDMap OnRegisterCaps(UUID agentID, IHttpServer server)
 {
     OSDMap retVal = new OSDMap ();
     retVal["SimConsole"] = CapsUtil.CreateCAPS ("SimConsole", "");
     retVal["SimConsoleAsync"] = CapsUtil.CreateCAPS ("SimConsoleAsync", "");
     
     //This message is depriated, but we still have it around for now, feel free to remove sometime in the future
     server.AddStreamHandler(new RestHTTPHandler("POST", retVal["SimConsole"],
                                               delegate(Hashtable m_dhttpMethod)
                                               {
                                                   return SimConsoleResponder(m_dhttpMethod, agentID);
                                               }));
     server.AddStreamHandler(new RestHTTPHandler("POST", retVal["SimConsoleAsync"],
                                               delegate(Hashtable m_dhttpMethod)
                                               {
                                                   return SimConsoleAsyncResponder(m_dhttpMethod, agentID);
                                               }));
     return retVal;
 }
예제 #19
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="data"></param>
            /// <param name="path"></param>
            /// <param name="param"></param>
            /// <returns></returns>
            public string uploaderCaps(byte[] data, string path, string param)
            {
                UUID inv = inventoryItemID;
                string res = String.Empty;
                OSDMap map = new OSDMap();
                map["new_asset"] = newAssetID.ToString();
                map["new_inventory_item"] = inv;
                map["state"] = "complete";
                res = OSDParser.SerializeLLSDXmlString(map);

                clientCaps.RemoveStreamHandler(uploadMethod, "POST", uploaderPath);

                m_invCaps.UploadCompleteHandler(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType);
                
                return res;
            }
예제 #20
0
 private void LoadItems(OSDMap items, UUID OwnerID, InventoryFolderBase folderForAppearance, AvatarAppearance appearance, out List<InventoryItemBase> litems)
 {
     litems = new List<InventoryItemBase>();
     foreach (KeyValuePair<string, OSD> kvp in items)
     {
         string serialization = kvp.Value.AsString();
         InventoryItemBase item = OpenSim.Framework.Serialization.External.UserInventoryItemSerializer.Deserialize(serialization);
         m_log.Info("[AvatarArchive]: Loading item " + item.ID.ToString());
         UUID oldID = item.ID;
         item = GiveInventoryItem(item.CreatorIdAsUuid, OwnerID, item, folderForAppearance);
         litems.Add(item);
         FixItemIDs(oldID, item, appearance);
     }
 }
예제 #21
0
        /// <summary>
        ///   Set up the CAPS for friend conferencing
        /// </summary>
        /// <param name = "agentID"></param>
        /// <param name = "caps"></param>
        public OSDMap RegisterCaps(UUID agentID, IHttpServer server)
        {
            OSDMap retVal = new OSDMap();
            retVal["ChatSessionRequest"] = CapsUtil.CreateCAPS("ChatSessionRequest", "");

#if (!ISWIN)
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["ChatSessionRequest"],
                                                      delegate(Hashtable m_dhttpMethod)
                                                      {
                                                          return ProcessChatSessionRequest(m_dhttpMethod, agentID);
                                                      }));
#else
            server.AddStreamHandler(new RestHTTPHandler("POST", retVal["ChatSessionRequest"],
                                                        m_dhttpMethod =>
                                                        ProcessChatSessionRequest(m_dhttpMethod, agentID)));
#endif
            return retVal;
        }
예제 #22
0
        private string GroupProposalBallot(string request, UUID agentID)
        {
            OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(request);

            UUID groupid = map["group-id"].AsUUID();
            UUID proposalid = map["proposal-id"].AsUUID();
            UUID sessionid = map["session-id"].AsUUID();
            string vote = map["vote"].AsString();

            OSDMap resp = new OSDMap();
            resp["voted"] = OSD.FromBoolean(true);
            return OSDParser.SerializeLLSDXmlString(resp);
        }
예제 #23
0
        public OSDMap OnRegisterCaps(UUID agentID, IHttpServer server)
        {
//            m_log.DebugFormat(
//                "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID);

            OSDMap retVal = new OSDMap();
            retVal["ObjectMedia"] = CapsUtil.CreateCAPS("ObjectMedia", "");
            
            lock (m_omCapUsers)
            {
                m_omCapUsers[retVal["ObjectMedia"]] = agentID;
                m_omCapUrls[agentID] = retVal["ObjectMedia"];
                
                // Even though we're registering for POST we're going to get GETS and UPDATES too
                server.AddStreamHandler(new RestStreamHandler("POST", retVal["ObjectMedia"], HandleObjectMediaMessage));
            }

            retVal["ObjectMediaNavigate"] = CapsUtil.CreateCAPS("ObjectMediaNavigate", "");
            
            lock (m_omuCapUsers)
            {
                m_omuCapUsers[retVal["ObjectMediaNavigate"]] = agentID;
                m_omuCapUrls[agentID] = retVal["ObjectMediaNavigate"];
                
                // Even though we're registering for POST we're going to get GETS and UPDATES too
                server.AddStreamHandler(new RestStreamHandler("POST", retVal["ObjectMediaNavigate"], HandleObjectMediaNavigateMessage));
            }
            return retVal;
        }
예제 #24
0
파일: MapCAPS.cs 프로젝트: kow/Aurora-Sim
 protected static OSDMap MapLayerResponce(OSDArray layerData, OSDArray mapBlocksData, int flags)
 {
     OSDMap map = new OSDMap();
     OSDMap agentMap = new OSDMap();
     agentMap["Flags"] = flags;
     map["AgentData"] = agentMap;
     map["LayerData"] = layerData;
     map["MapBlocks"] = mapBlocksData;
     return map;
 }
예제 #25
0
        public OSD buildEvent(string eventName, OSD eventBody)
        {
            OSDMap llsdEvent = new OSDMap(2);
            llsdEvent.Add("body", eventBody);
            llsdEvent.Add("message", new OSDString(eventName));

            return llsdEvent;
        }
예제 #26
0
        private AvatarAppearance ConvertXMLToAvatarAppearance(OSDMap map, out string FolderNameToPlaceAppearanceIn)
        {
            AvatarAppearance appearance = new AvatarAppearance();

            appearance.Unpack(map);
            FolderNameToPlaceAppearanceIn = map["FolderName"].AsString();
            return appearance;
        }
예제 #27
0
        private string StartGroupProposal(string request, UUID agentID)
        {
            OSDMap map = (OSDMap)OSDParser.DeserializeLLSDXml(request);

            int duration = map["duration"].AsInteger();
            UUID group = map["group-id"].AsUUID();
            double majority = map["majority"].AsReal();
            string text = map["proposal-text"].AsString();
            int quorum = map["quorum"].AsInteger();
            UUID session = map["session-id"].AsUUID();

            GroupProposalInfo info = new GroupProposalInfo();
            info.GroupID = group;
            info.Majority = (float)majority;
            info.Quorum = quorum;
            info.Session = session;
            info.Text = text;
            info.Duration = duration;

            m_groupData.AddGroupProposal(agentID, info);

            OSDMap resp = new OSDMap();
            resp["voted"] = OSD.FromBoolean(true);
            return OSDParser.SerializeLLSDXmlString(resp);
        }
예제 #28
0
        protected void HandleSaveAvatarArchive(string[] cmdparams)
        {
            if (cmdparams.Length < 7)
            {
                m_log.Info("[AvatarArchive] Not enough parameters!");
                return;
            }
            UserAccount account = UserAccountService.GetUserAccount(UUID.Zero, cmdparams[3], cmdparams[4]);
            if (account == null)
            {
                m_log.Error("[AvatarArchive] User not found!");
                return;
            }

            AvatarAppearance appearance = AvatarService.GetAppearance(account.PrincipalID);
            OSDMap map = new OSDMap();
            OSDMap body = new OSDMap();
            OSDMap assets = new OSDMap();
            OSDMap items = new OSDMap();
            body = appearance.Pack();
            body.Add("FolderName", OSD.FromString(cmdparams[6]));

            try
            {
                foreach (AvatarWearable wear in appearance.Wearables)
                {
                    for (int i = 0; i < wear.Count; i++)
                    {
                        WearableItem w = wear[i];
                        if (w.AssetID != UUID.Zero)
                        {
                            SaveItem(w.ItemID, items, assets);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                m_log.Warn("Excpetion: " + ex.ToString());
            }
            try
            {
                List<AvatarAttachment> attachments = appearance.GetAttachments();
                foreach (AvatarAttachment a in attachments)
                {
                    if (a.AssetID != UUID.Zero)
                    {
                        SaveItem(a.ItemID, items, assets); 
                    }
                }
            }
            catch(Exception ex)
            {
                m_log.Warn("Excpetion: " + ex.ToString());
            }

            map.Add("Body", body);
            map.Add("Assets", assets);
            map.Add("Items", items);
            //Write the map

            if (cmdparams[5].EndsWith(".database"))
            {
                //Remove the .database
                string ArchiveName = cmdparams[5].Substring(0, cmdparams[5].Length - 9);
                string ArchiveXML = OSDParser.SerializeLLSDXmlString(map);

                AvatarArchive archive = new AvatarArchive();
                archive.ArchiveXML = ArchiveXML;
                archive.Name = ArchiveName;

                if ((cmdparams.Length >= 8) && (cmdparams[7].Length == 36)) archive.Snapshot = cmdparams[7];
                if ((cmdparams.Length >= 9) && (cmdparams[8].Length == 1)) archive.IsPublic = int.Parse(cmdparams[8]);
				
                DataManager.RequestPlugin<IAvatarArchiverConnector>().SaveAvatarArchive(archive);

                m_log.Info("[AvatarArchive] Saved archive to database " + cmdparams[5]);
            }
            else
            {
                m_log.Info("[AvatarArchive] Saving archive to " + cmdparams[5]);
                StreamWriter writer = new StreamWriter(cmdparams[5], false);
                writer.Write(OSDParser.SerializeLLSDXmlString(map));
                writer.Close();
                writer.Dispose();
                m_log.Info("[AvatarArchive] Saved archive to " + cmdparams[5]);
            }
        }
예제 #29
0
파일: MapCAPS.cs 프로젝트: kow/Aurora-Sim
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected static OSDMap GetOSDMapLayerResponse(int bottom, int left, int right, int top, UUID imageID)
        {
            OSDMap mapLayer = new OSDMap();
            mapLayer["Bottom"] = bottom;
            mapLayer["Left"] = left;
            mapLayer["Right"] = right;
            mapLayer["Top"] = top;
            mapLayer["ImageID"] = imageID;

            return mapLayer;
        }
예제 #30
0
 private void SaveAsset(UUID AssetID, OSDMap assetMap)
 {
     AssetBase asset = AssetService.Get(AssetID.ToString());
     if (asset != null && AssetID != UUID.Zero)
     {
         OSDMap assetData = new OSDMap();
         m_log.Info("[AvatarArchive]: Saving asset " + asset.ID);
         CreateMetaDataMap(asset, assetData);
         assetData.Add("AssetData", OSD.FromBinary(asset.Data));
         assetMap[asset.ID.ToString()] = assetData;
     }
     else
     {
         m_log.Warn("[AvatarArchive]: Could not find asset to save: " + AssetID.ToString());
         return;
     }
 }