public FriendInfo[] GetFriends(UUID principalID)
        {
            List<FriendInfo> infos = new List<FriendInfo>();
            List<string> query = GD.Query("PrincipalID", principalID, m_realm, "Friend,Flags");

            //These are used to get the other flags below
            List<string> keys = new List<string>();
            List<object> values = new List<object>();

            for (int i = 0; i < query.Count; i += 2)
            {
                FriendInfo info = new FriendInfo();
                info.PrincipalID = principalID;
                info.Friend = query[i];
                info.MyFlags = int.Parse(query[i + 1]);
                infos.Add(info);

                keys.Add("PrincipalID");
                keys.Add("Friend");
                values.Add(info.Friend);
                values.Add(info.PrincipalID);

                List<string> query2 = GD.Query(keys.ToArray(), values.ToArray(), m_realm, "Flags");
                if (query2.Count >= 1) infos[infos.Count - 1].TheirFlags = int.Parse(query2[0]);

                keys = new List<string>();
                values = new List<object>();
            }
            return infos.ToArray();
        }
 /// <summary>
 ///     Sends the details about what
 /// </summary>
 /// <param name="client"></param>
 /// <param name="agentID"></param>
 /// <param name="groupID"></param>
 /// <param name="transactionID"></param>
 /// <param name="sessionID"></param>
 /// <param name="currentInterval"></param>
 /// <param name="intervalDays"></param>
 private void client_OnGroupAccountDetailsRequest(IClientAPI client, UUID agentID, UUID groupID,
     UUID transactionID, UUID sessionID, int currentInterval,
     int intervalDays)
 {
     IGroupsModule groupsModule = client.Scene.RequestModuleInterface<IGroupsModule>();
     if (groupsModule != null && groupsModule.GroupPermissionCheck(agentID, groupID, GroupPowers.Accountable))
     {
         IMoneyModule moneyModule = client.Scene.RequestModuleInterface<IMoneyModule>();
         if (moneyModule != null)
         {
             int amt = moneyModule.Balance(groupID);
             List<GroupAccountHistory> history = moneyModule.GetTransactions(groupID, agentID, currentInterval,
                                                                             intervalDays);
             history = (from h in history where h.Stipend select h).ToList();
                 //We don't want payments, we only want stipends which we sent to users
             GroupBalance balance = moneyModule.GetGroupBalance(groupID);
             client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, amt, currentInterval,
                                               intervalDays,
                                               Util.BuildYMDDateString(
                                                   balance.StartingDate.AddDays(-currentInterval*intervalDays)),
                                               history.ToArray());
         }
         else
             client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, 0, currentInterval,
                                               intervalDays,
                                               "Never", new GroupAccountHistory[0]);
     }
 }
Exemple #3
1
        public UUID RegisterRequest(UUID primID, UUID itemID,
                                      string identifier)
        {
            DataserverRequest ds = new DataserverRequest();

            ds.primID = primID;
            ds.itemID = itemID;

            ds.ID = UUID.Random();
            ds.handle = identifier;

            ds.startTime = DateTime.Now;
            ds.IsCompleteAt = DateTime.Now.AddHours(1);
            ds.Reply = "";

            lock (DataserverRequests)
            {
                if (DataserverRequests.ContainsKey(identifier))
                    return UUID.Zero;

                DataserverRequests[identifier] = ds;
            }

            //Make sure that the cmd handler thread is running
            m_ScriptEngine.MaintenanceThread.PokeThreads ();

            return ds.ID;
        }
Exemple #4
1
 public void InstantMessage(UUID target, string message)
 {
     OnInstantMessage(this, new GridInstantMessage(m_scene,
             m_uuid, m_firstname + " " + m_lastname,
             target, 0, false, message,
             UUID.Zero, false, Position, new byte[0]));
 }
        public void Init()
        {
            TestHelper.InMethod();
            
            scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
            scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
            scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);

            ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
            interregionComms.Initialise(new IniConfigSource());
            interregionComms.PostInitialise();
            SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
            SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
            SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);

            agent1 = UUID.Random();
            agent2 = UUID.Random();
            agent3 = UUID.Random();
            random = new Random();
            sog1 = NewSOG(UUID.Random(), scene, agent1);
            sog2 = NewSOG(UUID.Random(), scene, agent1);
            sog3 = NewSOG(UUID.Random(), scene, agent1);

            //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
            region1 = scene.RegionInfo.RegionHandle;
            region2 = scene2.RegionInfo.RegionHandle;
            region3 = scene3.RegionInfo.RegionHandle;
        }
 public string Authenticate(UUID principalID, string password, int lifetime)
 {
     AuthenticationData data = m_Database.Get(principalID);
     string result = String.Empty;
     if (data != null && data.Data != null)
     {
         if (data.Data.ContainsKey("webLoginKey"))
         {
             m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID);
             result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime);
             if (result == String.Empty)
             {
                 m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID);
             }
         }
         if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt"))
         {
             m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID);
             result = m_svcChecks["password"].Authenticate(principalID, password, lifetime);
             if (result == String.Empty)
             {
                 m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID);
             }
         }
         if (result == string.Empty)
         {
             m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID);
         }
     }
     else
     {
         m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
     }
     return result;
 }
Exemple #7
1
        public void RequestGodlikePowers(
            UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
        {
            ScenePresence sp = m_scene.GetScenePresence(agentID);

            if (sp != null)
            {
                if (godLike == false)
                {
                    sp.GrantGodlikePowers(agentID, sessionID, token, godLike);
                    return;
                }

                // First check that this is the sim owner
                if (m_scene.Permissions.IsGod(agentID))
                {
                    // Next we check for spoofing.....
                    UUID testSessionID = sp.ControllingClient.SessionId;
                    if (sessionID == testSessionID)
                    {
                        if (sessionID == controllingClient.SessionId)
                        {
                            //m_log.Info("godlike: " + godLike.ToString());
                            sp.GrantGodlikePowers(agentID, testSessionID, token, godLike);
                        }
                    }
                }
                else
                {
                    if (m_dialogModule != null)
                        m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied");
                }
            }
        }        
 private string UserAssetURL(UUID userID)
 {
     CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
     if (uinfo != null)
         return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI;
     return null;
 }
        public bool CheckToken(UUID principalID, string token, int lifetime)
        {
            if (m_Tokens.ContainsKey(principalID))
                return m_Tokens[principalID] == token;

            return false;
        }
 public AvatarAppearance GetAppearance(UUID principalID)
 {
     AvatarData avatar = GetAvatar(principalID);
     if (avatar == null || avatar.Data.Count == 0)
         return null;
     return avatar.ToAvatarAppearance(principalID);
 }
        public bool Get(UUID userID, out UserAccount account)
        {
            if (m_UUIDCache.TryGetValue(userID, out account))
                return true;

            return false;
        }
 public AvatarAppearance GetAndEnsureAppearance(UUID principalID, string defaultUserAvatarArchive, out bool loadedArchive)
 {
     loadedArchive = false;
     AvatarAppearance avappearance = GetAppearance(principalID);
     if (avappearance == null)
     {
         //Create an appearance for the user if one doesn't exist
         if (defaultUserAvatarArchive != "")
         {
             AvatarArchive arch = m_ArchiveService.LoadAvatarArchive(defaultUserAvatarArchive, principalID);
             if (arch != null)
             {
                 avappearance = arch.Appearance;
                 SetAppearance(principalID, avappearance);
                 loadedArchive = true;
             }
         }
         if(avappearance == null)//Set as ruth
         {
             avappearance = new AvatarAppearance(principalID);
             SetAppearance(principalID, avappearance);
         }
     }
     return avappearance;
 }
 public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge, TransactionType type, string identifer, bool chargeImmediately)
 {
     IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
     if (moneyModule != null)
     {
         if (chargeImmediately)
         {
             bool success = moneyModule.Charge(agentID, amount, text, type);
             if (!success)
                 return false;
         }
         IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
         if (scheduler != null)
         {
             OSDMap itemInfo = new OSDMap();
             itemInfo.Add("AgentID", agentID);
             itemInfo.Add("Amount", amount);
             itemInfo.Add("Text", text);
             itemInfo.Add("Type", (int)type);
             SchedulerItem item = new SchedulerItem("ScheduledPayment " + identifer,
                                                    OSDParser.SerializeJsonString(itemInfo), false,
                                                    DateTime.UtcNow, daysUntilNextCharge, RepeatType.days, agentID);
             itemInfo.Add("SchedulerID", item.id);
             scheduler.Save(item);
         }
     }
     return true;
 }
        public void FloodEffect (ITerrainChannel map, UUID userID, float north,
                                float west, float south, float east, float strength)
        {
            float sum = 0;
            float steps = 0;

            int x, y;
            for (x = (int)west; x < (int)east; x++) {
                for (y = (int)south; y < (int)north; y++) {
                    if (!map.Scene.Permissions.CanTerraformLand (userID, new Vector3 (x, y, 0)))
                        continue;
                    sum += map [x, y];
                    steps += 1;
                }
            }

            float avg = sum / steps;

            float str = 0.1f * strength; // == 0.2 in the default client

            for (x = (int)west; x < (int)east; x++) {
                for (y = (int)south; y < (int)north; y++) {
                    if (!map.Scene.Permissions.CanTerraformLand (userID, new Vector3 (x, y, 0)))
                        continue;
                    map [x, y] = (map [x, y] * (1 - str)) + (avg * str);
                }
            }
        }
 public Link( uint folderID, Guid objectGUID, uint objectFolderTypeID, DateTime dateCreated )
 {
     FolderID           = folderID;
     ObjectGUID         = new UUID( objectGUID.ToByteArray() ).ToString();
     ObjectFolderTypeID = objectFolderTypeID;
     DateCreated        = dateCreated;
 }
        public AuthenticationData Get(UUID principalID)
        {
            if (m_DataByUUID.ContainsKey(principalID))
                return m_DataByUUID[principalID];

            return null;
        }
 public override PhysicsCharacter AddAvatar(string avName, Vector3 position, Quaternion rotation, Vector3 size,
                                            bool isFlying, uint localID, UUID UUID)
 {
     BasicCharacterActor act = new BasicCharacterActor {Position = position, Flying = isFlying};
     _actors.Add(act);
     return act;
 }
        public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge)
        {
            IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
            if (moneyModule != null)
            {
                bool success = moneyModule.Charge(agentID, amount, text);
                if (!success)
                    return false;
                IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
                if (scheduler != null)
                {
                    OSDMap itemInfo = new OSDMap();
                    itemInfo.Add("AgentID", agentID);
                    itemInfo.Add("Amount", amount);
                    itemInfo.Add("Text", text);
                    SchedulerItem item = new SchedulerItem("ScheduledPayment",
                        OSDParser.SerializeJsonString(itemInfo), false,
                        DateTime.Now.AddDays(daysUntilNextCharge) - DateTime.Now);
                    itemInfo.Add("SchedulerID", item.id);
                    scheduler.Save(item);

                }
            }
            return true;
        }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
                return "Usage: parceldetails parcelID (use parcelinfo to get ID)";

            int parcelID;
            Parcel parcel;

            // test argument that is is a valid integer, then verify we have that parcel data stored in the dictionary
            if (Int32.TryParse(args[0], out parcelID) && Client.Network.CurrentSim.Parcels.TryGetValue(parcelID, out parcel))
            {
                // this request will update the parcels dictionary
                Client.Parcels.PropertiesRequest(Client.Network.CurrentSim, parcelID, 0);

                // Use reflection to dynamically get the fields from the Parcel struct
                Type t = parcel.GetType();
                System.Reflection.FieldInfo[] fields = t.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);

                StringBuilder sb = new StringBuilder();
                foreach (System.Reflection.FieldInfo field in fields)
                {
                    sb.AppendFormat("{0} = {1}" + System.Environment.NewLine, field.Name, field.GetValue(parcel));
                }
                return sb.ToString();
            }
            else
            {
                return String.Format("Unable to find Parcel {0} in Parcels Dictionary, Did you run parcelinfo to populate the dictionary first?", args[0]);
            }
        }
        public UserProfileData GetUserByUUID(UUID user)
        {
            UserProfileData userProfile = null;
            m_userProfilesByUuid.TryGetValue(user, out userProfile);

            return userProfile;
        }
        public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, UUID ItemID, int AssetType, string ItemName)
        {
            Dictionary<string, object> sendData = new Dictionary<string, object>();

            sendData["METHOD"] = "AddGroupNotice";
            sendData["requestingAgentID"] = requestingAgentID;
            sendData["groupID"] = groupID;
            sendData["noticeID"] = noticeID;
            sendData["fromName"] = fromName;
            sendData["subject"] = subject;
            sendData["message"] = message;
            sendData["ItemID"] = ItemID;
            sendData["AssetType"] = AssetType;
            sendData["ItemName"] = ItemName;

            string reqString = WebUtils.BuildXmlResponse(sendData);

            try
            {
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    AsynchronousRestObjectRequester.MakeRequest("POST",
                           m_ServerURI + "/auroradata",
                           reqString);
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e.ToString());
            }
        }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
                return Description;

            string groupName = String.Empty;
            for (int i = 0; i < args.Length; i++)
                groupName += args[i] + " ";
            groupName = groupName.Trim();

            UUID groupUUID = Client.GroupName2UUID(groupName);
            if (UUID.Zero != groupUUID) {                
                Client.Groups.GroupLeaveReply += Groups_GroupLeft;
                Client.Groups.LeaveGroup(groupUUID);

                GroupsEvent.WaitOne(30000, false);
                Client.Groups.GroupLeaveReply -= Groups_GroupLeft;

                GroupsEvent.Reset();
                Client.ReloadGroupsCache();

                if (leftGroup)
                    return Client.ToString() + " has left the group " + groupName;
                return "failed to leave the group " + groupName;
            }
            return Client.ToString() + " doesn't seem to be member of the group " + groupName;
        }
        /// <summary>
        /// Called by code which actually renders the dynamic texture to supply texture data.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="data"></param>
        public void ReturnData(UUID id, byte[] data)
        {
            DynamicTextureUpdater updater = null;

            lock (Updaters)
            {
                if (Updaters.ContainsKey(id))
                {
                    updater = Updaters[id];
                }
            }

            if (updater != null)
            {
                if (RegisteredScenes.ContainsKey(updater.SimUUID))
                {
                    Scene scene = RegisteredScenes[updater.SimUUID];
                    updater.DataReceived(data, scene);
                }
            }

            if (updater.UpdateTimer == 0)
            {
                lock (Updaters)
                {
                    if (!Updaters.ContainsKey(updater.UpdaterID))
                    {
                        Updaters.Remove(updater.UpdaterID);
                    }
                }
            }
        }
        public void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback)
        {
            OpenJPEG.J2KLayerInfo[] result;

            // If it's cached, return the cached results
            if (m_decodedCache.TryGetValue(assetID, out result))
            {
                callback(assetID, result);
            }
            else
            {
                // Not cached, we need to decode it.
                // Add to notify list and start decoding.
                // Next request for this asset while it's decoding will only be added to the notify list
                // once this is decoded, requests will be served from the cache and all clients in the notifylist will be updated
                bool decode = false;
                lock (m_notifyList)
                {
                    if (m_notifyList.ContainsKey(assetID))
                    {
                        m_notifyList[assetID].Add(callback);
                    }
                    else
                    {
                        List<DecodedCallback> notifylist = new List<DecodedCallback> {callback};
                        m_notifyList.Add(assetID, notifylist);
                        decode = true;
                    }
                }

                // Do Decode!
                if (decode)
                    DoJ2KDecode(assetID, j2kData);
            }
        }
        /// <summary>
        /// Get a user's profile
        /// </summary>
        /// <param name="agentID"></param>
        /// <returns></returns>
		public IUserProfileInfo GetUserProfile(UUID agentID)
		{
			IUserProfileInfo UserProfile = new IUserProfileInfo();
            //Try from the user profile first before getting from the DB
            if (UserProfilesCache.TryGetValue(agentID, out UserProfile)) 
				return UserProfile;
            else 
            {
                UserProfile = new IUserProfileInfo();
                List<string> query = null;
                //Grab it from the almost generic interface
                query = GD.Query(new string[]{"ID", "`Key`"}, new object[]{agentID, "LLProfile"}, "userdata", "Value");
                
                if (query == null || query.Count == 0)
					return null;
                //Pull out the OSDmap
                OSDMap profile = (OSDMap)OSDParser.DeserializeLLSDXml(query[0]);
                UserProfile.FromOSD(profile);

				//Add to the cache
			    UserProfilesCache[agentID] = UserProfile;

				return UserProfile;
			}
		}
        public IAgentInfo GetAgent(UUID agentID)
        {
            /*object remoteValue = DoRemoteForUser(agentID, agentID);
            if (remoteValue != null)
                return (IAgentInfo)remoteValue;*/
            IAgentInfo agent = new IAgentInfo();
            List<string> query = null;
            try
            {
                QueryFilter filter = new QueryFilter();
                filter.andFilters["ID"] = agentID;
                filter.andFilters["`Key`"] = "AgentInfo";
                query = GD.Query(new string[1] { "`Value`" }, "userdata", filter, null, null, null);
            }
            catch
            {
            }

            if (query == null || query.Count == 0)
            {
                return null; //Couldn't find it, return null then.
            }

            OSDMap agentInfo = (OSDMap) OSDParser.DeserializeLLSDXml(query[0]);

            agent.FromOSD(agentInfo);
            agent.PrincipalID = agentID;
            return agent;
        }
        public void KickUser(UUID avatarID, string message)
        {
            //Get required interfaces
            IClientCapsService client = m_capsService.GetClientCapsService(avatarID);
            if (client != null)
            {
                IRegionClientCapsService regionClient = client.GetRootCapsService();
                if (regionClient != null)
                {
                    //Send the message to the client
                    m_messagePost.Get(regionClient.Region.ServerURI,
                                      BuildRequest("KickUserMessage", message, regionClient.AgentID.ToString()),
                                      (resp) =>
                                          {
                                              IAgentProcessing agentProcessor =
                                                  m_registry.RequestModuleInterface<IAgentProcessing>();
                                              if (agentProcessor != null)
                                                  agentProcessor.LogoutAgent(regionClient, true);
                                              MainConsole.Instance.Info("User has been kicked.");
                                          });

                    return;
                }
            }
            MainConsole.Instance.Info("Could not find user to send message to.");
        }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            string inventoryName;
            uint timeout;
            string fileName;

            if (args.Length != 3)
                return "Usage: uploadimage [inventoryname] [timeout] [filename]";

            TextureID = UUID.Zero;
            inventoryName = args[0];
            fileName = args[2];
            if (!UInt32.TryParse(args[1], out timeout))
                return "Usage: uploadimage [inventoryname] [timeout] [filename]";

            Console.WriteLine("Loading image " + fileName);
            byte[] jpeg2k = LoadImage(fileName);
            if (jpeg2k == null)
                return "Failed to compress image to JPEG2000";
            Console.WriteLine("Finished compressing image to JPEG2000, uploading...");
            start = DateTime.Now;
            DoUpload(jpeg2k, inventoryName);

            if (UploadCompleteEvent.WaitOne((int)timeout, false))
            {
                return String.Format("Texture upload {0}: {1}", (TextureID != UUID.Zero) ? "succeeded" : "failed",
                    TextureID);
            }
            else
            {
                return "Texture upload timed out";
            }
        }
 public bool Delete(UUID ownerID, string friend)
 {
     QueryFilter filter = new QueryFilter();
     filter.andFilters["PrincipalID"] = ownerID;
     filter.andFilters["Friend"] = friend;
     return GD.Delete(m_realm, filter);
 }
Exemple #30
0
        public CityMap(uint regionCount, UUID estateOwner, UUID avatar, List<Scene> centers,
            List<float> regionDensities, uint mapSeed)
        {
            //  Force the size of the city to be at least 1 region in size. If a list of regions
            // has been provided then make sure it is at least that long.
            if (regionCount <= 0)
            {
            //                if (centralRegions.Count > 1)
            //                    regionCount = centers.Count;
            //                else
                    regionCount = 1;
            }

            //  Allocate the space required for the number of regions specified.
            cityRegions = new Scene[regionCount, regionCount];
            plotArray = new int[regionCount, regionCount];

            if ( centralRegions.Capacity > 0 )
            {
                centralRegions.Clear();
            }

            centralRegions = new List<Scene>();
            foreach (Scene s in centers)
            {
                centralRegions.Add(s);
            }
        }
        protected static void TransformXml(XmlReader reader, XmlWriter writer, string sceneName, string homeURI, IUserAccountService userAccountService, UUID scopeID)
        {
            //            m_log.DebugFormat("[HG ASSET MAPPER]: Transforming XML");

            int         sopDepth       = -1;
            UserAccount creator        = null;
            bool        hasCreatorData = false;

            while (reader.Read())
            {
                //                Console.WriteLine("Depth: {0}, name {1}", reader.Depth, reader.Name);

                switch (reader.NodeType)
                {
                case XmlNodeType.Attribute:
                    //                    Console.WriteLine("FOUND ATTRIBUTE {0}", reader.Name);
                    writer.WriteAttributeString(reader.Name, reader.Value);
                    break;

                case XmlNodeType.CDATA:
                    writer.WriteCData(reader.Value);
                    break;

                case XmlNodeType.Comment:
                    writer.WriteComment(reader.Value);
                    break;

                case XmlNodeType.DocumentType:
                    writer.WriteDocType(reader.Name, reader.Value, null, null);
                    break;

                case XmlNodeType.Element:
                    //                    m_log.DebugFormat("Depth {0} at element {1}", reader.Depth, reader.Name);

                    writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);

                    if (reader.HasAttributes)
                    {
                        while (reader.MoveToNextAttribute())
                        {
                            writer.WriteAttributeString(reader.Name, reader.Value);
                        }

                        reader.MoveToElement();
                    }

                    if (reader.LocalName == "SceneObjectPart")
                    {
                        if (sopDepth < 0)
                        {
                            sopDepth = reader.Depth;
                            //                            m_log.DebugFormat("[HG ASSET MAPPER]: Set sopDepth to {0}", sopDepth);
                        }
                    }
                    else
                    {
                        if (sopDepth >= 0 && reader.Depth == sopDepth + 1)
                        {
                            if (reader.Name == "CreatorID")
                            {
                                reader.Read();
                                if (reader.NodeType == XmlNodeType.Element && reader.Name == "Guid" || reader.Name == "UUID")
                                {
                                    reader.Read();

                                    if (reader.NodeType == XmlNodeType.Text)
                                    {
                                        UUID uuid = UUID.Zero;
                                        UUID.TryParse(reader.Value, out uuid);
                                        creator = userAccountService.GetUserAccount(scopeID, uuid);
                                        writer.WriteElementString("UUID", reader.Value);
                                        reader.Read();
                                    }
                                    else
                                    {
                                        // If we unexpected run across mixed content in this node, still carry on
                                        // transforming the subtree (this replicates earlier behaviour).
                                        TransformXml(reader, writer, sceneName, homeURI, userAccountService, scopeID);
                                    }
                                }
                                else
                                {
                                    // If we unexpected run across mixed content in this node, still carry on
                                    // transforming the subtree (this replicates earlier behaviour).
                                    TransformXml(reader, writer, sceneName, homeURI, userAccountService, scopeID);
                                }
                            }
                            else if (reader.Name == "CreatorData")
                            {
                                reader.Read();
                                if (reader.NodeType == XmlNodeType.Text)
                                {
                                    hasCreatorData = true;
                                    writer.WriteString(reader.Value);
                                }
                                else
                                {
                                    // If we unexpected run across mixed content in this node, still carry on
                                    // transforming the subtree (this replicates earlier behaviour).
                                    TransformXml(reader, writer, sceneName, homeURI, userAccountService, scopeID);
                                }
                            }
                        }
                    }

                    if (reader.IsEmptyElement)
                    {
                        //                        m_log.DebugFormat("[HG ASSET MAPPER]: Writing end for empty element {0}", reader.Name);
                        writer.WriteEndElement();
                    }

                    break;

                case XmlNodeType.EndElement:
                    //                    m_log.DebugFormat("Depth {0} at EndElement", reader.Depth);
                    if (sopDepth == reader.Depth)
                    {
                        if (!hasCreatorData && creator != null)
                        {
                            writer.WriteElementString(reader.Prefix, "CreatorData", reader.NamespaceURI, string.Format("{0};{1} {2}", homeURI, creator.FirstName, creator.LastName));
                        }

                        //                        m_log.DebugFormat("[HG ASSET MAPPER]: Reset sopDepth");
                        sopDepth       = -1;
                        creator        = null;
                        hasCreatorData = false;
                    }
                    writer.WriteEndElement();
                    break;

                case XmlNodeType.EntityReference:
                    writer.WriteEntityRef(reader.Name);
                    break;

                case XmlNodeType.ProcessingInstruction:
                    writer.WriteProcessingInstruction(reader.Name, reader.Value);
                    break;

                case XmlNodeType.Text:
                    writer.WriteString(reader.Value);
                    break;

                case XmlNodeType.XmlDeclaration:
                    // For various reasons, not all serializations have xml declarations (or consistent ones)
                    // and as it's embedded inside a byte stream we don't need it anyway, so ignore.
                    break;

                default:
                    m_log.WarnFormat(
                        "[HG ASSET MAPPER]: Unrecognized node {0} in asset XML transform in {1}",
                        reader.NodeType, sceneName);
                    break;
                }
            }
        }
        private void BindClasses(IKernel k, IConfig config, string configFile, UUID hostID)
        {
            k.Unbind <IPrimFactory>();
            k.Unbind <IConfigSource>();

            k.Bind <IPrimFactory>().To <MRMPrimFactory>().InSingletonScope().WithConstructorArgument("hostID", hostID);
            k.Bind <IConfigSource>().To <DotNetConfigSource>().InSingletonScope().WithConstructorArgument("path", configFile);

            if (!config.Contains(CONTROL + ASSEMBLY))
            {
                throw new Exception("Unable to start up. Control is not properly specified in the configuration file. " +
                                    "Config must include the key '" + CONTROL + ASSEMBLY + "' in section 'Bootstrap'.");
            }
            if (!config.Contains(MODEL + ASSEMBLY))
            {
                throw new Exception("Unable to start up. Model is not properly specified in the configuration file. " +
                                    "Config must include the key '" + MODEL + ASSEMBLY + "' in section 'Bootstrap'.");
            }
            if (!config.Contains(VIEW + ASSEMBLY))
            {
                throw new Exception("Unable to start up. View is not properly specified in the configuration file. " +
                                    "Config must include the key '" + VIEW + ASSEMBLY + "' in section 'Bootstrap'.");
            }

            if (!config.Contains(CONTROL + CLASS))
            {
                throw new Exception("Unable to start up. Control is not properly specified in the configuration file. " +
                                    "Config must include the key '" + CONTROL + CLASS + "' in section 'Bootstrap'.");
            }
            if (!config.Contains(MODEL + CLASS))
            {
                throw new Exception("Unable to start up. Model is not properly specified in the configuration file. " +
                                    "Config must include the key '" + MODEL + CLASS + "' in section 'Bootstrap'.");
            }
            if (!config.Contains(VIEW + CLASS))
            {
                throw new Exception("Unable to start up. View is not properly specified in the configuration file. " +
                                    "Config must include the key '" + VIEW + CLASS + "' in section 'Bootstrap'.");
            }

            string baseDir         = AppDomain.CurrentDomain.BaseDirectory;
            string controlAssembly = Path.Combine(baseDir, config.GetString(CONTROL + ASSEMBLY));
            string modelAssembly   = Path.Combine(baseDir, config.GetString(MODEL + ASSEMBLY));
            string viewAssembly    = Path.Combine(baseDir, config.GetString(VIEW + ASSEMBLY));

            string controlName = config.GetString(CONTROL + CLASS);
            string modelName   = config.GetString(MODEL + CLASS);
            string ViewName    = config.GetString(VIEW + CLASS);

            TestModule(CONTROL, controlAssembly, controlName, typeof(IControl));
            TestModule(MODEL, modelAssembly, modelName, typeof(IModel));
            TestModule(VIEW, viewAssembly, ViewName, typeof(IView));

            IDynamicLoaderModule loader = k.Get <IDynamicLoaderModule>();

            k.Unbind <IView>();
            k.Unbind <IModel>();
            k.Unbind <IControl>();
            loader.BindDynamic(typeof(IView), viewAssembly, ViewName, true);
            loader.BindDynamic(typeof(IModel), modelAssembly, modelName, true);
            loader.BindDynamic(typeof(IControl), controlAssembly, controlName, true);

            k.Unbind <IKeyTableFactory>();
            string tableLibrary = Path.Combine(baseDir, config.GetString(TABLE + ASSEMBLY, typeof(MapTableFactory).Assembly.Location));
            string tableType    = config.GetString(TABLE + CLASS, typeof(MapTableFactory).FullName);

            loader.BindDynamic(typeof(IKeyTableFactory), tableLibrary, tableType, true);

            k.Unbind <IAlgorithm>();
            string algorithmFolder = Path.Combine(baseDir, config.GetString("AlgorithmFolder", "."));

            loader.BindAllInFolder(typeof(IAlgorithm), algorithmFolder);

            _clearCreated = config.GetBoolean("ClearCreated", true);
        }
Exemple #33
0
 public List <LandData> LoadLandObjects(UUID regionUUID)
 {
     return(new List <LandData>(m_landData.Values));
 }
Exemple #34
0
 public UUID[] GetObjectIDs(UUID regionID)
 {
     return(new UUID[0]);
 }
Exemple #35
0
 public void RemoveExtra(UUID regionID, string name)
 {
 }
        /// <summary>
        ///   Add an inventory item to a prim in this group.
        /// </summary>
        /// <param name = "remoteClient"></param>
        /// <param name = "localID"></param>
        /// <param name = "item"></param>
        /// <param name = "copyItemID">The item UUID that should be used by the new item.</param>
        /// <returns></returns>
        public bool AddInventoryItem(IClientAPI remoteClient, uint localID,
                                     InventoryItemBase item, UUID copyItemID)
        {
            UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;

            SceneObjectPart part = (SceneObjectPart)GetChildPart(localID);

            if (part != null)
            {
                TaskInventoryItem taskItem = new TaskInventoryItem
                {
                    ItemID      = newItemId,
                    AssetID     = item.AssetID,
                    Name        = item.Name,
                    Description = item.Description,
                    OwnerID     = part.OwnerID,
                    CreatorID   = item.CreatorIdAsUuid,
                    Type        = item.AssetType,
                    InvType     = item.InvType
                };

                // Transfer ownership

                if (remoteClient != null &&
                    remoteClient.AgentId != part.OwnerID &&
                    m_scene.Permissions.PropagatePermissions())
                {
                    taskItem.BasePermissions = item.BasePermissions &
                                               item.NextPermissions;
                    taskItem.CurrentPermissions = item.CurrentPermissions &
                                                  item.NextPermissions;
                    taskItem.EveryonePermissions = item.EveryOnePermissions &
                                                   item.NextPermissions;
                    taskItem.GroupPermissions = item.GroupPermissions &
                                                item.NextPermissions;
                    taskItem.NextPermissions = item.NextPermissions;
                    // We're adding this to a prim we don't own. Force
                    // owner change
                    taskItem.CurrentPermissions |= 16; // Slam
                }
                else
                {
                    taskItem.BasePermissions     = item.BasePermissions;
                    taskItem.CurrentPermissions  = item.CurrentPermissions;
                    taskItem.EveryonePermissions = item.EveryOnePermissions;
                    taskItem.GroupPermissions    = item.GroupPermissions;
                    taskItem.NextPermissions     = item.NextPermissions;
                }

                taskItem.Flags        = item.Flags;
                taskItem.SalePrice    = item.SalePrice;
                taskItem.SaleType     = item.SaleType;
                taskItem.CreationDate = (uint)item.CreationDate;

                bool addFromAllowedDrop = false;
                if (remoteClient != null)
                {
                    addFromAllowedDrop = remoteClient.AgentId != part.OwnerID;
                }

                part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);

                return(true);
            }
            MainConsole.Instance.ErrorFormat(
                "[PRIM INVENTORY]: " +
                "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
                localID, Name, UUID, newItemId);

            return(false);
        }
        byte[] StatusNotification(Dictionary <string, object> request)
        {
            UUID principalID = UUID.Zero;

            if (request.ContainsKey("userID"))
            {
                UUID.TryParse(request["userID"].ToString(), out principalID);
            }
            else
            {
                m_log.WarnFormat("[HGFRIENDS HANDLER]: no userID in request to notify");
                return(FailureResult());
            }

            bool online = true;

            if (request.ContainsKey("online"))
            {
                Boolean.TryParse(request["online"].ToString(), out online);
            }
            else
            {
                m_log.WarnFormat("[HGFRIENDS HANDLER]: no online in request to notify");
                return(FailureResult());
            }

            List <string> friends = new List <string>();
            int           i       = 0;

            foreach (KeyValuePair <string, object> kvp in request)
            {
                if (kvp.Key.Equals("friend_" + i.ToString()))
                {
                    friends.Add(kvp.Value.ToString());
                    i++;
                }
            }

            List <UUID> onlineFriends = m_TheService.StatusNotification(friends, principalID, online);

            Dictionary <string, object> result = new Dictionary <string, object>();

            if ((onlineFriends == null) || ((onlineFriends != null) && (onlineFriends.Count == 0)))
            {
                result["RESULT"] = "NULL";
            }
            else
            {
                i = 0;
                foreach (UUID f in onlineFriends)
                {
                    result["friend_" + i] = f.ToString();
                    i++;
                }
            }

            string xmlString = ServerUtils.BuildXmlResponse(result);

            //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
            return(Util.UTF8NoBomEncoding.GetBytes(xmlString));
        }
Exemple #38
0
 public List <GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
 {
     return(m_RemoteGridService.GetNeighbours(scopeID, regionID));
 }
Exemple #39
0
        public List <GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
        {
            List <GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber);
            //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count);

            // HG urls should not get here, strip them
            // side effect is that local regions with same name as HG may also be found
            // this mb good or bad
            string regionName = name;

            if (name.Contains("."))
            {
                if (string.IsNullOrWhiteSpace(m_ThisGatekeeperURI))
                {
                    return(rinfo); // no HG
                }
                string regionURI  = "";
                string regionHost = "";
                if (!Util.buildHGRegionURI(name, out regionURI, out regionHost, out regionName))
                {
                    return(rinfo); // invalid
                }
                if (!m_ThisGatekeeperHost.Equals(regionHost, StringComparison.InvariantCultureIgnoreCase) &&
                    !m_ThisGatekeeperIP.Equals(regionHost) &&
                    !m_ThisGateKeeperAlias.Contains(regionHost.ToLower()))
                {
                    return(rinfo); // not local grid
                }
            }

            List <GridRegion> grinfo = null;

            if (String.IsNullOrEmpty(regionName))
            {
                List <GridRegion> grinfos = m_RemoteGridService.GetDefaultRegions(scopeID);
                if (grinfos == null || grinfos.Count == 0)
                {
                    m_log.Warn("[REMOTE GRID CONNECTOR] returned no default regions");
                }
                else
                {
                    m_log.WarnFormat("[REMOTE GRID CONNECTOR] returned default regions {0}, ...", grinfos[0].RegionName);
                    // only return first
                    grinfo = new List <GridRegion>()
                    {
                        grinfos[0]
                    };
                }
            }
            else
            {
                grinfo = m_RemoteGridService.GetRegionsByName(scopeID, regionName, maxNumber);
            }

            if (grinfo != null)
            {
                //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionsByName {0} found {1} regions", name, grinfo.Count);
                foreach (GridRegion r in grinfo)
                {
                    m_RegionInfoCache.Cache(r);
                    if (rinfo.Find(delegate(GridRegion gr) { return(gr.RegionID == r.RegionID); }) == null)
                    {
                        rinfo.Add(r);
                    }
                }
            }

            return(rinfo);
        }
        public static string RewriteSOP_Old(string xml, string homeURL, IUserAccountService userService, UUID scopeID)
        {
            if (xml == string.Empty || homeURL == string.Empty || userService == null)
            {
                return(xml);
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");

            foreach (XmlNode sop in sops)
            {
                UserAccount creator        = null;
                bool        hasCreatorData = false;
                XmlNodeList nodes          = sop.ChildNodes;
                foreach (XmlNode node in nodes)
                {
                    if (node.Name == "CreatorID")
                    {
                        UUID uuid = UUID.Zero;
                        UUID.TryParse(node.InnerText, out uuid);
                        creator = userService.GetUserAccount(scopeID, uuid);
                    }

                    if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
                    {
                        hasCreatorData = true;
                    }

                    //if (node.Name == "OwnerID")
                    //{
                    //    UserAccount owner = GetUser(node.InnerText);
                    //    if (owner != null)
                    //        node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
                    //}
                }
                if (!hasCreatorData && creator != null)
                {
                    XmlElement creatorData = doc.CreateElement("CreatorData");
                    creatorData.InnerText = CalcCreatorData(homeURL, creator.FirstName + " " + creator.LastName);
                    sop.AppendChild(creatorData);
                }
            }

            using (StringWriter wr = new StringWriter())
            {
                doc.Save(wr);
                return(wr.ToString());
            }
        }
Exemple #41
0
 public void StoreTerrain(TerrainData ter, UUID regionID)
 {
     m_terrains[regionID] = ter;
 }
Exemple #42
0
 public void SetClientToken(UUID sessionID, string token)
 {
     // no-op
 }
Exemple #43
0
 public void StorePrimInventory(UUID primID, ICollection <TaskInventoryItem> items)
 {
     m_store.StorePrimInventory(primID, items);
 }
Exemple #44
0
 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
 {
     m_store.StoreObject(obj, regionUUID);
 }
        /// <summary>
        /// Creates/updates a region from console.
        /// </summary>
        /// <returns>The region from console.</returns>
        /// <param name="info">Info.</param>
        /// <param name="prompt">If set to <c>true</c> prompt.</param>
        /// <param name="currentInfo">Current info.</param>
        RegionInfo CreateRegionFromConsole(RegionInfo info, Boolean prompt, Dictionary <string, int> currentInfo)
        {
            if (info == null || info.NewRegion)
            {
                if (info == null)
                {
                    info = new RegionInfo();
                }

                info.RegionID = UUID.Random();

                if (currentInfo != null)
                {
                    info.RegionLocX = currentInfo ["minX"] > 0 ? currentInfo ["minX"] : 1000 * Constants.RegionSize;
                    info.RegionLocY = currentInfo ["minY"] > 0 ? currentInfo ["minY"] : 1000 * Constants.RegionSize;
                    info.RegionPort = currentInfo ["port"] > 0 ? currentInfo ["port"] + 1 : 9000;
                }
                else
                {
                    info.RegionLocX = 1000 * Constants.RegionSize;
                    info.RegionLocY = 1000 * Constants.RegionSize;
                    info.RegionPort = 9000;
                }
                prompt = true;
            }

            // prompt for user input
            if (prompt)
            {
                Utilities.MarkovNameGenerator rNames = new Utilities.MarkovNameGenerator();
                string regionName = rNames.FirstName(m_regionNameSeed == null ? Utilities.RegionNames: m_regionNameSeed, 3, 7);
                if (info.RegionName != "")
                {
                    regionName = info.RegionName;
                }

                do
                {
                    info.RegionName = MainConsole.Instance.Prompt("Region Name (? for suggestion)", regionName);
                    if (info.RegionName == "" || info.RegionName == "?")
                    {
                        regionName      = rNames.NextName;
                        info.RegionName = "";
                        continue;
                    }
                }while (info.RegionName == "");
                rNames.Reset();

                info.RegionLocX =
                    int.Parse(MainConsole.Instance.Prompt("Region Location X",
                                                          ((info.RegionLocX == 0
                            ? 1000
                            : info.RegionLocX / Constants.RegionSize)).ToString())) * Constants.RegionSize;

                info.RegionLocY =
                    int.Parse(MainConsole.Instance.Prompt("Region location Y",
                                                          ((info.RegionLocY == 0
                            ? 1000
                            : info.RegionLocY / Constants.RegionSize)).ToString())) * Constants.RegionSize;

                var haveSize  = true;
                var sizeCheck = "";
                do
                {
                    info.RegionSizeX = int.Parse(MainConsole.Instance.Prompt("Region size X", info.RegionSizeX.ToString()));
                    if (info.RegionSizeX > Constants.MaxRegionSize)
                    {
                        MainConsole.Instance.CleanInfo("    The currently recommended maximum size is " + Constants.MaxRegionSize);
                        sizeCheck = MainConsole.Instance.Prompt("Continue with the X size of " + info.RegionSizeX + "? (yes/no)", "no");
                        haveSize  = sizeCheck.ToLower().StartsWith("y");
                    }
                } while (!haveSize);

                // assume square regions
                info.RegionSizeY = info.RegionSizeX;

                do
                {
                    info.RegionSizeY = int.Parse(MainConsole.Instance.Prompt("Region size Y", info.RegionSizeY.ToString()));
                    if ((info.RegionSizeY > info.RegionSizeX) && (info.RegionSizeY > Constants.MaxRegionSize))
                    {
                        MainConsole.Instance.CleanInfo("    The currently recommended maximum size is " + Constants.MaxRegionSize);
                        sizeCheck = MainConsole.Instance.Prompt("Continue with the Y size of " + info.RegionSizeY + "? (yes/no)", "no");
                        haveSize  = sizeCheck.ToLower().StartsWith("y");
                    }
                } while (!haveSize);

                bool bigRegion = ((info.RegionSizeX > Constants.MaxRegionSize) || (info.RegionSizeY > Constants.MaxRegionSize));

                // * Mainland / Full Region (Private)
                // * Mainland / Homestead
                // * Mainland / Openspace
                //
                // * Estate / Full Region   (Private)
                info.RegionType = MainConsole.Instance.Prompt("Region Type (Mainland/Estate)",
                                                              (info.RegionType == "" ? "Estate" : info.RegionType));

                // Region presets or advanced setup
                string setupMode;
                string terrainOpen = "Grassland";
                string terrainFull = "Grassland";
                var    responses   = new List <string>();
                if (info.RegionType.ToLower().StartsWith("m"))
                {
                    // Mainland regions
                    info.RegionType = "Mainland / ";
                    responses.Add("Full Region");
                    responses.Add("Homestead");
                    responses.Add("Openspace");
                    responses.Add("Universe");                             // TODO: remove?
                    responses.Add("Custom");
                    setupMode = MainConsole.Instance.Prompt("Mainland region type?", "Full Region", responses).ToLower();

                    // allow specifying terrain for Openspace
                    if (bigRegion)
                    {
                        terrainOpen = "flatland";
                    }
                    else if (setupMode.StartsWith("o"))
                    {
                        terrainOpen = MainConsole.Instance.Prompt("Openspace terrain ( Grassland, Swamp, Aquatic)?", terrainOpen).ToLower();
                    }
                }
                else
                {
                    // Estate regions
                    info.RegionType = "Estate / ";
                    responses.Add("Full Region");
                    responses.Add("Universe");                             // TODO: Universe 'standard' setup, rename??
                    responses.Add("Custom");
                    setupMode = MainConsole.Instance.Prompt("Estate region type?", "Full Region", responses).ToLower();
                }

                // terrain can be specified for Full or custom regions
                if (bigRegion)
                {
                    terrainFull = "Flatland";
                }
                else if (setupMode.StartsWith("f") || setupMode.StartsWith("c"))
                {
                    var tresp = new List <string>();
                    tresp.Add("Flatland");
                    tresp.Add("Grassland");
                    tresp.Add("Hills");
                    tresp.Add("Mountainous");
                    tresp.Add("Island");
                    tresp.Add("Swamp");
                    tresp.Add("Aquatic");
                    string tscape = MainConsole.Instance.Prompt("Terrain Type?", terrainFull, tresp);
                    terrainFull = tscape;
                    // TODO: This would be where we allow selection of preset terrain files
                }

                if (setupMode.StartsWith("c"))
                {
                    info.RegionType    = info.RegionType + "Custom";
                    info.RegionTerrain = terrainFull;

                    // allow port selection
                    info.RegionPort = int.Parse(MainConsole.Instance.Prompt("Region Port", info.RegionPort.ToString()));

                    // Startup mode
                    string scriptStart = MainConsole.Instance.Prompt(
                        "Region Startup - Normal or Delayed startup (normal/delay) : ", "normal").ToLower();
                    info.Startup = scriptStart.StartsWith("n") ? StartupType.Normal : StartupType.Medium;

                    info.SeeIntoThisSimFromNeighbor = MainConsole.Instance.Prompt(
                        "See into this sim from neighbors (yes/no)",
                        info.SeeIntoThisSimFromNeighbor ? "yes" : "no").ToLower() == "yes";

                    info.InfiniteRegion = MainConsole.Instance.Prompt(
                        "Make an infinite region (yes/no)",
                        info.InfiniteRegion ? "yes" : "no").ToLower() == "yes";

                    info.ObjectCapacity =
                        int.Parse(MainConsole.Instance.Prompt("Object capacity",
                                                              info.ObjectCapacity == 0
                                               ? "50000"
                                               : info.ObjectCapacity.ToString()));
                }

                if (setupMode.StartsWith("w"))
                {
                    // 'standard' setup
                    info.RegionType = info.RegionType + "Universe";
                    //info.RegionPort;            // use auto assigned port
                    info.RegionTerrain = "Flatland";
                    info.Startup       = StartupType.Normal;
                    info.SeeIntoThisSimFromNeighbor = true;
                    info.InfiniteRegion             = false;
                    info.ObjectCapacity             = 50000;
                }
                if (setupMode.StartsWith("o"))
                {
                    // 'Openspace' setup
                    info.RegionType = info.RegionType + "Openspace";
                    //info.RegionPort;            // use auto assigned port

                    if (terrainOpen.StartsWith("a"))
                    {
                        info.RegionTerrain = "Aquatic";
                    }
                    else if (terrainOpen.StartsWith("s"))
                    {
                        info.RegionTerrain = "Swamp";
                    }
                    else if (terrainOpen.StartsWith("g"))
                    {
                        info.RegionTerrain = "Grassland";
                    }
                    else
                    {
                        info.RegionTerrain = "Flatland";
                    }

                    info.Startup = StartupType.Medium;
                    info.SeeIntoThisSimFromNeighbor         = true;
                    info.InfiniteRegion                     = false;
                    info.ObjectCapacity                     = 750;
                    info.RegionSettings.AgentLimit          = 10;
                    info.RegionSettings.AllowLandJoinDivide = false;
                    info.RegionSettings.AllowLandResell     = false;
                }
                if (setupMode.StartsWith("h"))
                {
                    // 'Homestead' setup
                    info.RegionType = info.RegionType + "Homestead";
                    //info.RegionPort;            // use auto assigned port
                    if (bigRegion)
                    {
                        info.RegionTerrain = "Flatland";
                    }
                    else
                    {
                        info.RegionTerrain = "Homestead";
                    }

                    info.Startup = StartupType.Medium;
                    info.SeeIntoThisSimFromNeighbor         = true;
                    info.InfiniteRegion                     = false;
                    info.ObjectCapacity                     = 3750;
                    info.RegionSettings.AgentLimit          = 20;
                    info.RegionSettings.AllowLandJoinDivide = false;
                    info.RegionSettings.AllowLandResell     = false;
                }

                if (setupMode.StartsWith("f"))
                {
                    // 'Full Region' setup
                    info.RegionType = info.RegionType + "Full Region";
                    //info.RegionPort;            // use auto assigned port
                    info.RegionTerrain = terrainFull;
                    info.Startup       = StartupType.Normal;
                    info.SeeIntoThisSimFromNeighbor = true;
                    info.InfiniteRegion             = false;
                    info.ObjectCapacity             = 15000;
                    info.RegionSettings.AgentLimit  = 100;
                    if (info.RegionType.StartsWith("M"))                            // defaults are 'true'
                    {
                        info.RegionSettings.AllowLandJoinDivide = false;
                        info.RegionSettings.AllowLandResell     = false;
                    }
                }
            }

            // are we updating or adding?
            if (m_scene != null)
            {
                IGridRegisterModule gridRegister = m_scene.RequestModuleInterface <IGridRegisterModule>();
                //Re-register so that if the position has changed, we get the new neighbors
                gridRegister.RegisterRegionWithGrid(m_scene, true, false, null);

                // Tell clients about changes
                IEstateModule es = m_scene.RequestModuleInterface <IEstateModule> ();
                if (es != null)
                {
                    es.sendRegionHandshakeToAll();
                }

                // in case we have changed the name
                if (m_scene.SimulationDataService.BackupFile != info.RegionName)
                {
                    string oldFile = BuildSaveFileName(m_scene.SimulationDataService.BackupFile);
                    if (File.Exists(oldFile))
                    {
                        File.Delete(oldFile);
                    }
                    m_scene.SimulationDataService.BackupFile = info.RegionName;
                }

                m_scene.SimulationDataService.ForceBackup();

                MainConsole.Instance.InfoFormat("[FileBasedSimulationData]: Save of {0} completed.", info.RegionName);
            }

            return(info);
        }
Exemple #46
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section GatekeeperService in config file"));
                }

                string accountService    = serverConfig.GetString("UserAccountService", String.Empty);
                string homeUsersService  = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService       = serverConfig.GetString("GridService", String.Empty);
                string presenceService   = serverConfig.GetString("PresenceService", String.Empty);
                string simulationService = serverConfig.GetString("SimulationService", String.Empty);

                // These 3 are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                {
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                }

                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
                m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
                if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
                {
                    m_ExternalName = m_ExternalName + "/";
                }

                Object[] args = new Object[] { config };
                m_GridService     = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                {
                    m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
                }
                if (homeUsersService != string.Empty)
                {
                    m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args);
                }

                if (simService != null)
                {
                    m_SimulationService = simService;
                }
                else if (simulationService != string.Empty)
                {
                    m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
                }

                m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty);
                m_DeniedClients  = serverConfig.GetString("DeniedClients", string.Empty);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                {
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
                }

                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
Exemple #47
0
 public void RemoveObject(UUID uuid, UUID regionUUID)
 {
     m_store.RemoveObject(uuid, regionUUID);
 }
Exemple #48
0
        private void TellMessageServersAboutUserInternal(UUID agentID, UUID sessionID, UUID RegionID,
                                                         ulong regionhandle, float positionX, float positionY,
                                                         float positionZ, string firstname, string lastname)
        {
            // Loop over registered Message Servers (AND THERE WILL BE MORE THEN ONE :D)
            lock (MessageServers)
            {
                if (MessageServers.Count > 0)
                {
                    m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers");
                }
//                else
//                {
//                    m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring");
//                }
                foreach (MessageServerInfo serv in MessageServers.Values)
                {
                    NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID,
                                                 regionhandle, positionX, positionY, positionZ,
                                                 firstname, lastname);
                }
            }
        }
Exemple #49
0
 public Dictionary <string, string> GetExtra(UUID regionID)
 {
     return(null);
 }
Exemple #50
0
 public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
 {
     return(m_store.LoadBakedTerrain(regionID, pSizeX, pSizeY, pSizeZ));
 }
Exemple #51
0
 public void SaveExtra(UUID regionID, string name, string value)
 {
 }
Exemple #52
0
 public double[,] LoadTerrain(UUID regionID)
 {
     return(m_store.LoadTerrain(regionID));
 }
Exemple #53
0
 public void StoreTerrain(double[,] ter, UUID regionID)
 {
     m_terrains[regionID] = new HeightmapTerrainData(ter);
 }
Exemple #54
0
 public void StoreBakedTerrain(TerrainData ter, UUID regionID)
 {
     m_bakedterrains[regionID] = ter;
 }
Exemple #55
0
 public void StoreBakedTerrain(TerrainData terrain, UUID regionID)
 {
     m_store.StoreBakedTerrain(terrain, regionID);
 }
 internal static string CalcCreatorData(string homeURL, UUID uuid, string name)
 {
     return(homeURL + "/" + uuid + ";" + name);
 }
Exemple #57
0
 public void StoreTerrain(double[,] terrain, UUID regionID)
 {
     m_store.StoreTerrain(terrain, regionID);
 }
Exemple #58
0
 public List <SceneObjectGroup> LoadObjects(UUID regionUUID)
 {
     return(m_store.LoadObjects(regionUUID));
 }
Exemple #59
0
 public void StorePrimInventory(UUID primID, ICollection <TaskInventoryItem> items)
 {
     m_primItems[primID] = items;
 }
        /// <summary>
        /// Takes a XML representation of a SceneObjectPart and returns another XML representation
        /// with creator data added to it.
        /// </summary>
        /// <param name="xml">The SceneObjectPart represented in XML2</param>
        /// <param name="sceneName">An identifier for the component that's calling this function</param>
        /// <param name="homeURL">The URL of the user agents service (home) for the creator</param>
        /// <param name="userService">The service for retrieving user account information</param>
        /// <param name="scopeID">The scope of the user account information (Grid ID)</param>
        /// <returns>The SceneObjectPart represented in XML2</returns>
        public static string RewriteSOP(string xmlData, string sceneName, string homeURL, IUserAccountService userService, UUID scopeID)
        {
            //            Console.WriteLine("Input XML [{0}]", xmlData);
            if (xmlData == string.Empty || homeURL == string.Empty || userService == null)
            {
                return(xmlData);
            }

            // Deal with bug
            xmlData = ExternalRepresentationUtils.SanitizeXml(xmlData);

            using (StringWriter sw = new StringWriter())
                using (XmlTextWriter writer = new XmlTextWriter(sw))
                    using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
                        using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings()
                        {
                            IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment
                        }))
                        {
                            TransformXml(reader, writer, sceneName, homeURL, userService, scopeID);

                            //                Console.WriteLine("Output: [{0}]", sw.ToString());

                            return(sw.ToString());
                        }
        }