Ejemplo n.º 1
0
        public void SaveEstateSettings(OpenSim.Framework.EstateSettings es)
        {
            List <string> query = null;

            try
            {
                query = GD.Query(new string[] { "ID", "`Key`" }, new object[] { es.EstateID, "EstateSettings" }, "estates", "Value");
            }
            catch
            {
            }
            if (query == null || query.Count == 0)
            {
                return; //Couldn't find it, return default then.
            }
            OSDMap estateInfo = (OSDMap)OSDParser.DeserializeLLSDXml(query[0]);

            if (estateInfo["EstatePass"].AsString() != es.EstatePass)
            {
                m_log.Warn("[ESTATE SERVICE]: Wrong estate password in updating of estate " + es.EstateName + "! Possible attempt to hack this estate!");
                return;
            }

            List <string> Keys = new List <string>();

            Keys.Add("Value");
            List <object> Values = new List <object>();

            Values.Add(OSDParser.SerializeLLSDXmlString(Util.DictionaryToOSD(es.ToKeyValuePairs(true))));

            GD.Update("estates", Values.ToArray(), Keys.ToArray(), new string[] { "ID", "`Key`" }, new object[] { es.EstateID, "EstateSettings" });

            SaveBanList(es);
            SaveUUIDList(es.EstateID, "EstateManagers", es.EstateManagers);
            SaveUUIDList(es.EstateID, "EstateAccess", es.EstateAccess);
            SaveUUIDList(es.EstateID, "EstateGroups", es.EstateGroups);

            m_registry.RequestModuleInterface <ISimulationBase>().EventManager.FireGenericEventHandler("EstateUpdated", es);
        }
        public byte[] CreateEstate(Dictionary<string, object> request)
        {
            EstateSettings ES = new EstateSettings(request);

            UUID RegionID = new UUID(request["REGIONID"].ToString());

            ES = EstateConnector.CreateEstate(ES, RegionID);

            //This is not a local transfer, MUST be false!
            Dictionary<string, object> result = ES.ToKeyValuePairs(false);
            string xmlString = WebUtils.BuildXmlResponse(result);
            //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString);
            UTF8Encoding encoding = new UTF8Encoding();
            return encoding.GetBytes(xmlString);
        }
Ejemplo n.º 3
0
        public EstateSettings CreateEstate(EstateSettings es, UUID RegionID)
		{
            int EstateID = 0;
            List<string> QueryResults = GD.Query("`Key`", "EstateID", "estates", "`Value`", " ORDER BY `Value` DESC");
            if (QueryResults.Count == 0)
                EstateID = 99;
            else
                EstateID = int.Parse(QueryResults[0]);

            if (EstateID == 0)
                EstateID = 99;

            //Check for other estates with the same name
            List<int> Estates = GetEstates(es.EstateName);
            if (Estates != null)
            {
                foreach (int otherEstateID in Estates)
                {
                    EstateSettings otherEstate = this.LoadEstateSettings(otherEstateID);
                    if (otherEstate.EstateName == es.EstateName)
                    { //Cant have two estates with the same name.
                        //We set the estate name so that the region can get the error and so we don't have to spit out more junk to find it.
                        return new EstateSettings()
                        {
                            EstateID = 0,
                            EstateName = "Duplicate Estate Name. Please Change."
                        };
                    }
                }
            }

            EstateID++;
            es.EstateID = (uint)EstateID;

            List<object> Values = new List<object>();
            Values.Add(es.EstateID);
            Values.Add("EstateSettings");
            OSDMap map = Util.DictionaryToOSD(es.ToKeyValuePairs(true));
            Values.Add(OSDParser.SerializeLLSDXmlString(map));
            GD.Insert("estates", Values.ToArray());

            GD.Insert("estates", new object[] {
					RegionID,
                    "EstateID",
					EstateID
				});

            es.OnSave += SaveEstateSettings;
            return es;
		}
Ejemplo n.º 4
0
        public EstateSettings CreateEstate(EstateSettings es, UUID RegionID)
        {
            Dictionary<string, object> sendData = es.ToKeyValuePairs(true);

            sendData["REGIONID"] = RegionID.ToString();
            sendData["METHOD"] = "createestate";

            string reqString = ServerUtils.BuildXmlResponse(sendData);

            try
            {
                string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/auroradata",
                        reqString);
                if (reply != string.Empty)
                {
                    Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                    if (replyData != null)
                    {
                        es = new EstateSettings(replyData);
                        es.OnSave += SaveEstateSettings;
                        return es;
                    }

                    else
                        m_log.DebugFormat("[AuroraRemoteEstateConnector]: CreateEstate {0} received null response",
                            RegionID);

                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteEstateConnector]: Exception when contacting server: {0}", e.Message);
            }
            return null;
        }
Ejemplo n.º 5
0
        public void SaveEstateSettings(EstateSettings es)
        {
            Dictionary<string, object> sendData = es.ToKeyValuePairs(true);

            sendData["METHOD"] = "saveestatesettings";

            string reqString = ServerUtils.BuildXmlResponse(sendData);

            try
            {
                SynchronousRestFormsRequester.MakeRequest("POST",
                        m_ServerURI + "/auroradata",
                        reqString);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteEstateConnector]: Exception when contacting server: {0}", e.Message);
            }
        }
Ejemplo n.º 6
0
        public EstateSettings CreateEstate(EstateSettings es, UUID RegionID)
        {
            Dictionary<string, object> sendData = es.ToKeyValuePairs(true);

            sendData["REGIONID"] = RegionID.ToString();
            sendData["METHOD"] = "createestate";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                           m_ServerURI,
                           reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        if (replyData != null)
                        {
                            es = new EstateSettings(replyData);
                            es.OnSave += SaveEstateSettings;
                            return es;
                        }

                        else
                            m_log.DebugFormat("[AuroraRemoteEstateConnector]: CreateEstate {0} received null response",
                                RegionID);
                    }
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteEstateConnector]: Exception when contacting server: {0}", e.ToString());
            }
            return null;
        }
Ejemplo n.º 7
0
        public void SaveEstateSettings(EstateSettings es)
        {
            Dictionary<string, object> sendData = es.ToKeyValuePairs(true);

            sendData["METHOD"] = "saveestatesettings";

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                           m_ServerURI,
                           reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteEstateConnector]: Exception when contacting server: {0}", e.ToString());
            }
        }