public GridRegion GetRegionByURI(UUID scopeID, RegionURI uri) { GridRegion rinfo = m_LocalGridService.GetRegionByURI(scopeID, uri); if (rinfo != null) { m_RegionInfoCache.Cache(scopeID, rinfo); return(rinfo); } if (m_RemoteGridService == null || !uri.IsLocalGrid) { return(rinfo); } if (uri.HasRegionName) { rinfo = m_RemoteGridService.GetRegionByName(scopeID, uri.RegionName); } else { rinfo = m_RemoteGridService.GetDefaultRegions(UUID.Zero)[0]; if (rinfo == null) { m_log.Warn("[REMOTE GRID CONNECTOR] returned null default region"); } else { m_log.WarnFormat("[REMOTE GRID CONNECTOR] returned default region {0}", rinfo.RegionName); } } m_RegionInfoCache.Cache(scopeID, rinfo); return(rinfo); }
public GridRegion GetRegionByName(UUID scopeID, string name) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name); if (rinfo != null) { return(rinfo); } // 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_ThisGatekeeper)) { return(rinfo); // no HG } string regionURI = ""; if (!Util.buildHGRegionURI(name, out regionURI, out regionName) || string.IsNullOrWhiteSpace(regionName)) { return(rinfo); // invalid } if (m_ThisGatekeeper != regionURI) { return(rinfo); // not local grid } } rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); m_RegionInfoCache.Cache(scopeID, rinfo); return(rinfo); }
private GridRegion FindDefaultRegion() { GridRegion region = null; if (m_defaultRegion != "")//This overrides all { region = m_GridService.GetRegionByName(null, m_defaultRegion); if (region != null) { m_foundDefaultRegion = true; return(region); } } List <GridRegion> defs = m_GridService.GetDefaultRegions(null); if (defs != null && defs.Count > 0) { region = FindRegion(defs); } if (region == null) { defs = m_GridService.GetFallbackRegions(null, 0, 0); if (defs != null && defs.Count > 0) { region = FindRegion(defs); } if (region == null) { defs = m_GridService.GetSafeRegions(null, 0, 0); if (defs != null && defs.Count > 0) { region = FindRegion(defs); } if (region == null) { MainConsole.Instance.WarnFormat("[GATEKEEPER SERVICE]: Please specify a default region for this grid!"); } } } if (region != null) { m_foundDefaultRegion = true; } return(region); }
public GridRegion GetRegionByName(UUID scopeID, string regionName) { GridRegion r = m_localService.GetRegionByName(scopeID, regionName); if (r == null) { r = (GridRegion)DoRemoteForced(scopeID, regionName); UpdateGridRegionForIWC(ref r); } return(r); }
public override GridRegion GetRegionByName(UUID scopeID, string regionName) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); if (rinfo == null) { rinfo = base.GetRegionByName(scopeID, regionName); } return(rinfo); }
public GridRegion GetRegionByName(UUID scopeID, string regionName) { bool inCache = false; GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionName, out inCache); if (inCache) return rinfo; rinfo = m_GridService.GetRegionByName(scopeID, regionName); if(rinfo != null) m_RegionInfoCache.Cache(scopeID, rinfo); return rinfo; }
public GridRegion GetRegionByName(UUID scopeID, string name) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name); if (rinfo != null) { return(rinfo); } // 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_ThisGatekeeperIP)) { 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 } } if (String.IsNullOrEmpty(regionName)) { rinfo = m_RemoteGridService.GetDefaultRegions(UUID.Zero)[0]; if (rinfo == null) { m_log.Warn("[REMOTE GRID CONNECTOR] returned null default region"); } else { m_log.WarnFormat("[REMOTE GRID CONNECTOR] returned default region {0}", rinfo.RegionName); } } else { rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); } m_RegionInfoCache.Cache(scopeID, rinfo); return(rinfo); }
public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason) { regionID = UUID.Zero; regionHandle = 0; externalName = m_ExternalName; imageURL = string.Empty; reason = string.Empty; m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) { List <GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); if (defs != null && defs.Count > 0) { m_DefaultGatewayRegion = defs[0]; } try { regionID = m_DefaultGatewayRegion.RegionID; regionHandle = m_DefaultGatewayRegion.RegionHandle; } catch { reason = "Grid setup problem. Try specifying a particular region here."; m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!"); return(false); } return(true); } GridRegion region = m_GridService.GetRegionByName(m_ScopeID, regionName); if (region == null) { reason = "Region not found"; return(false); } regionID = region.RegionID; regionHandle = region.RegionHandle; string regionimage = "regionImage" + region.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; return(true); }
public GridRegion GetRegionByName(UUID scopeID, string name) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name); if (rinfo != null) { return(rinfo); } // 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 (!m_ThisGridInfo.HasHGConfig) { return(rinfo); // no HG } string regionURI = ""; if (!Util.buildHGRegionURI(name, out regionURI, out regionName)) { return(rinfo); // invalid } if (m_ThisGridInfo.IsLocalGrid(regionURI) != 1) { return(rinfo); // not local grid } } if (String.IsNullOrEmpty(regionName)) { rinfo = m_RemoteGridService.GetDefaultRegions(UUID.Zero)[0]; if (rinfo == null) { m_log.Warn("[REMOTE GRID CONNECTOR] returned null default region"); } else { m_log.WarnFormat("[REMOTE GRID CONNECTOR] returned default region {0}", rinfo.RegionName); } } else { rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); } m_RegionInfoCache.Cache(scopeID, rinfo); return(rinfo); }
public bool LinkRegion(string regionName, out UUID regionID, out ulong regionHandle, out string externalName, out string imageURL, out string reason, out int sizeX, out int sizeY) { regionID = UUID.Zero; regionHandle = 0; sizeX = (int)Constants.RegionSize; sizeY = (int)Constants.RegionSize; externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : ""); imageURL = string.Empty; reason = string.Empty; GridRegion region = null; m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) { List <GridRegion> defs = m_GridService.GetDefaultHypergridRegions(m_ScopeID); if (defs != null && defs.Count > 0) { region = defs[0]; m_DefaultGatewayRegion = region; } else { reason = "Grid setup problem. Try specifying a particular region here."; m_log.DebugFormat("[GATEKEEPER SERVICE]: Unable to send information. Please specify a default region for this grid!"); return(false); } } else { region = m_GridService.GetRegionByName(m_ScopeID, regionName); if (region == null) { reason = "Region not found"; return(false); } } regionID = region.RegionID; regionHandle = region.RegionHandle; sizeX = region.RegionSizeX; sizeY = region.RegionSizeY; string regionimage = "regionImage" + regionID.ToString(); regionimage = regionimage.Replace("-", ""); imageURL = region.ServerURI + "index.php?method=" + regionimage; return(true); }
private byte[] GetRegionByName(Dictionary <string, object> request) { UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPEID")) { UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); } else { MainConsole.Instance.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); } string regionName = string.Empty; if (request.ContainsKey("NAME")) { regionName = request["NAME"].ToString(); } else { MainConsole.Instance.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); } GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName); rinfo = CleanRegion(rinfo); //MainConsole.Instance.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); Dictionary <string, object> result = new Dictionary <string, object>(); if (rinfo == null) { result["result"] = "null"; } else { result["result"] = rinfo.ToKVP(); } string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
/// <summary> /// Create secure Urls that only us and the sim that called us know of /// This Urls is used to add/remove agents and other information from the other sim /// </summary> /// <param name="c"></param> /// <returns></returns> public IWCCertificate BuildSecureUrlsForConnection(IWCCertificate c) { IGridRegistrationService gridRegistration = Registry.RequestModuleInterface <IGridRegistrationService>(); if (gridRegistration != null) { IGridService gridService = Registry.RequestModuleInterface <IGridService>(); if (gridService != null) { GridRegion r = gridService.GetRegionByName(UUID.Zero, c.Connection.UserName + "_Link"); if (r == null) { uint rX = (uint)Util.RandomClass.Next(10000, 1000000); uint rY = (uint)Util.RandomClass.Next(10000, 1000000); ulong regionhandle = Utils.UIntsToLong(rX, rY); r = new GridRegion(); r.RegionID = UUID.Random(); r.RegionHandle = regionhandle; IHttpServer server = m_registry.RequestModuleInterface <ISimulationBase>().GetHttpServer(0); r.ExternalHostName = server.HostName; if (r.ExternalHostName.StartsWith("http://")) { r.ExternalHostName = r.ExternalHostName.Remove(0, 7); } else if (r.ExternalHostName.StartsWith("https://")) { r.ExternalHostName = r.ExternalHostName.Remove(0, 8); } r.InternalEndPoint = new IPEndPoint(IPAddress.Any, (int)server.Port); r.Flags = (int)Aurora.Framework.RegionFlags.Foreign; r.RegionName = c.Connection.UserName + "_Link"; r.RegionType = "Link"; UUID SessionID; gridService.RegisterRegion(r, UUID.Zero, out SessionID); } //Give the basic Urls that we have c.Connection.SecureUrls = gridRegistration.GetUrlForRegisteringClient(c.Connection.UserName, r.RegionHandle); } } return(c); }
byte[] GetRegionByName(Dictionary <string, object> request) { UUID scopeID = UUID.Zero; if (request.ContainsKey("SCOPEID")) { UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); } else { m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); } string regionName = string.Empty; if (request.ContainsKey("NAME")) { regionName = request["NAME"].ToString(); } else { m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); } GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName); //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); Dictionary <string, object> result = new Dictionary <string, object>(); if (rinfo == null) { result["result"] = "null"; } else { result["result"] = rinfo.ToKeyValuePairs(); } string xmlString = ServerUtils.BuildXmlResponse(result); //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); return(Util.UTF8NoBomEncoding.GetBytes(xmlString)); }
public GridRegion GetRegionByName(UUID scopeID, string regionName) { bool inCache = false; GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionName, out inCache); if (inCache) { return(rinfo); } rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); if (rinfo == null) { rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); } // can't cache negative results for name lookups m_RegionInfoCache.Cache(rinfo); return(rinfo); }
public GridRegion GetRegionByName(UUID scopeID, string name) { GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, name); if (rinfo != null) { return(rinfo); } // 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_ThisGatekeeperIP)) { 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)) { return(rinfo); // not local grid } if (String.IsNullOrEmpty(regionName)) { return(m_RemoteGridService.GetDefaultRegions(scopeID)[0]); } } rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName); m_RegionInfoCache.Cache(scopeID, rinfo); return(rinfo); }
private byte[] ProcessCreateAccount(OSDMap map) { bool Verified = false; string Name = map["Name"].AsString(); string PasswordHash = map["PasswordHash"].AsString(); //string PasswordSalt = map["PasswordSalt"].AsString(); string HomeRegion = map["HomeRegion"].AsString(); string Email = map["Email"].AsString(); string AvatarArchive = map["AvatarArchive"].AsString(); IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService>(); if (accountService == null) { return(null); } if (!PasswordHash.StartsWith("$1$")) { PasswordHash = "$1$" + Util.Md5Hash(PasswordHash); } PasswordHash = PasswordHash.Remove(0, 3); //remove $1$ accountService.CreateUser(Name, PasswordHash, Email); UserAccount user = accountService.GetUserAccount(UUID.Zero, Name); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); IGridService gridService = m_registry.RequestModuleInterface <IGridService> (); if (agentInfoService != null && gridService != null) { GridRegion r = gridService.GetRegionByName(UUID.Zero, HomeRegion); agentInfoService.SetHomePosition(user.PrincipalID.ToString(), r.RegionID, new Vector3(r.RegionSizeX / 2, r.RegionSizeY / 2, 20), Vector3.Zero); } Verified = user != null; UUID userID = UUID.Zero; if (Verified) { // could not find a way to save this data here. /*DateTime RLDOB = map["RLDOB"].AsDate(); * string RLFirstName = map["RLFisrtName"].AsString(); * string RLLastName = map["RLLastName"].AsString(); * string RLAdress = map["RLAdress"].AsString(); * string RLCity = map["RLCity"].AsString(); * string RLZip = map["RLZip"].AsString(); * string RLCountry = map["RLCountry"].AsString(); * string RLIP = map["RLIP"].AsString();*/ // could not find a way to save this data here. userID = user.PrincipalID; user.UserLevel = -1; accountService.StoreUserAccount(user); IProfileConnector profileData = DataManager.RequestPlugin <IProfileConnector>(); IUserProfileInfo profile = profileData.GetUserProfile(user.PrincipalID); if (profile == null) { profileData.CreateNewProfile(user.PrincipalID); profile = profileData.GetUserProfile(user.PrincipalID); } if (AvatarArchive.Length > 0) { profile.AArchiveName = AvatarArchive + ".database"; } profile.IsNewUser = true; profileData.UpdateUserProfile(profile); } OSDMap resp = new OSDMap(); resp["Verified"] = OSD.FromBoolean(Verified); resp["UUID"] = OSD.FromUUID(userID); string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
/// <summary> /// Un-link a region from an estate region. /// </summary> /// <param name="scene">Scene.</param> /// <param name="cmd">Cmd.</param> void EstateUnLinkRegionCommand(IScene scene, string [] cmd) { IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> (); IGridService gridService = m_registry.RequestModuleInterface <IGridService> (); string estateName = ""; string regionName = ""; // check for passed estate name estateName = (cmd.Length < 4) ? MainConsole.Instance.Prompt("Estate name", estateName) : cmd [3]; if (estateName == "") { return; } // verify that the estate does exist EstateSettings ES = estateConnector.GetEstateSettings(estateName); if (ES == null) { MainConsole.Instance.ErrorFormat("[EstateService]: The estate '{0}' does not exist!", estateName); return; } // check for passed region to link to if (scene != null) { regionName = scene.RegionInfo.RegionName; } regionName = (cmd.Length < 4) ? MainConsole.Instance.Prompt("Region to remove", regionName) : cmd [4]; if (regionName == "") { return; } // verify that the region does exist var region = gridService.GetRegionByName(null, regionName); if (region == null) { MainConsole.Instance.ErrorFormat("[EstateService]: The requested region '{0}' does not exist!", regionName); return; } regionName = region.RegionName; // verify that the region is actually part of the estate if (!estateConnector.EstateRegionExists((int)ES.EstateID, region.RegionID)) { MainConsole.Instance.ErrorFormat("[EstateService]: The requested region '{0}' is not part of the '{1}' estate!", regionName, ES.EstateName); return; } // have all details.. do it... if (!estateConnector.DelinkRegion(region.RegionID)) { MainConsole.Instance.Warn("Unlinking the region failed. Please try again."); return; } // unlink was successful.. MainConsole.Instance.InfoFormat("Region '{0}' has been removed from estate '{1}'", regionName, estateName); //We really need to attach it to another estate though... ISystemEstateService sysEstateInfo = m_registry.RequestModuleInterface <ISystemEstateService> (); ES = estateConnector.GetEstateSettings(sysEstateInfo.SystemEstateName); if (ES != null) { if (estateConnector.LinkRegion(region.RegionID, (int)ES.EstateID)) { MainConsole.Instance.WarnFormat("'{0}' has been placed in the '{1}' estate until re-assigned", regionName, sysEstateInfo.SystemEstateName); UpdateConsoleRegionEstate(regionName, ES); } } }
/// <summary> /// Link a region to an estate. /// </summary> /// <param name="scene">Scene.</param> /// <param name="cmd">Cmd.</param> void EstateLinkRegionCommand(IScene scene, string [] cmd) { IEstateConnector estateConnector = Framework.Utilities.DataManager.RequestPlugin <IEstateConnector> (); IGridService gridService = m_registry.RequestModuleInterface <IGridService> (); string estateName = ""; string regionName = ""; // check for passed estate name estateName = (cmd.Length < 4) ? MainConsole.Instance.Prompt("Estate name", estateName) : cmd [3]; if (estateName == "") { return; } // verify that the estate does exist EstateSettings ES = estateConnector.GetEstateSettings(estateName); if (ES == null) { MainConsole.Instance.ErrorFormat("[EstateService]: The estate '{0}' does not exist!", estateName); return; } // check for passed region to link to if (scene != null) { regionName = scene.RegionInfo.RegionName; } regionName = (cmd.Length < 4) ? MainConsole.Instance.Prompt("Region to add to " + estateName, regionName) : cmd [4]; if (regionName == "") { return; } // verify that the region does exist var region = gridService.GetRegionByName(null, regionName); if (region == null) { MainConsole.Instance.ErrorFormat("[EstateService]: The requested region '{0}' does not exist!", regionName); return; } // have all details.. do it... regionName = region.RegionName; if (estateConnector.LinkRegion(region.RegionID, (int)ES.EstateID)) { // check for update.. var es = estateConnector.GetRegionEstateSettings(region.RegionID); if ((es == null) || (es.EstateID == 0)) { MainConsole.Instance.Warn("The region link failed, please try again soon."); } else { MainConsole.Instance.InfoFormat("Region '{0}' is now attached to estate '{1}'", regionName, estateName); UpdateConsoleRegionEstate(regionName, es); } } else { MainConsole.Instance.Warn("Joining the estate failed. Please try again."); } }
OSDMap CreateAccount(OSDMap map) { bool Verified = false; string Name = map ["Name"].AsString(); string Password = ""; if (map.ContainsKey("Password")) { Password = map ["Password"].AsString(); } else { Password = map ["PasswordHash"].AsString(); //is really plaintext password, the system hashes it later. Not sure why it was called PasswordHash to start with. I guess the original design was to have the PHP code generate the salt and password hash, then just simply store it here } //string PasswordSalt = map["PasswordSalt"].AsString(); //not being used string HomeRegion = map ["HomeRegion"].AsString(); string Email = map ["Email"].AsString(); string AvatarArchive = map ["AvatarArchive"].AsString(); int userLevel = map ["UserLevel"].AsInteger(); string UserTitle = map ["UserTitle"].AsString(); //server expects: 0 is PG, 1 is Mature, 2 is Adult - use this when setting MaxMaturity and MaturityRating //viewer expects: 13 is PG, 21 is Mature, 42 is Adult int MaxMaturity = 2; //set to adult by default if (map.ContainsKey("MaxMaturity")) //MaxMaturity is the highest level that they can change the maturity rating to in the viewer { MaxMaturity = map ["MaxMaturity"].AsInteger(); } int MaturityRating = MaxMaturity; //set the default to whatever MaxMaturity was set tom incase they didn't define MaturityRating if (map.ContainsKey("MaturityRating")) //MaturityRating is the rating the user wants to be able to see { MaturityRating = map ["MaturityRating"].AsInteger(); } bool activationRequired = map.ContainsKey("ActivationRequired") ? map ["ActivationRequired"].AsBoolean() : false; IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService> (); if (accountService == null) { return(null); } if (!Password.StartsWith("$1$", System.StringComparison.Ordinal)) { Password = "******" + Util.Md5Hash(Password); } Password = Password.Remove(0, 3); //remove $1$ accountService.CreateUser(Name, Password, Email); UserAccount user = accountService.GetUserAccount(null, Name); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); IGridService gridService = m_registry.RequestModuleInterface <IGridService> (); if (agentInfoService != null && gridService != null) { GridRegion r = gridService.GetRegionByName(null, HomeRegion); if (r != null) { agentInfoService.SetHomePosition(user.PrincipalID.ToString(), r.RegionID, new Vector3(r.RegionSizeX / 2, r.RegionSizeY / 2, 20), Vector3.Zero); } else { MainConsole.Instance.DebugFormat("[API]: Could not set home position for user {0}, region \"{1}\" did not produce a result from the grid service", Name, HomeRegion); } } Verified = user != null; UUID userID = UUID.Zero; OSDMap resp = new OSDMap(); resp ["Verified"] = OSD.FromBoolean(Verified); if (Verified) { userID = user.PrincipalID; user.UserLevel = userLevel; // could not find a way to save this data here. DateTime RLDOB = map ["RLDOB"].AsDate(); string RLGender = map ["RLGender"].AsString(); string RLName = map ["RLName"].AsString(); string RLAddress = map ["RLAddress"].AsString(); string RLCity = map ["RLCity"].AsString(); string RLZip = map ["RLZip"].AsString(); string RLCountry = map ["RLCountry"].AsString(); string RLIP = map ["RLIP"].AsString(); IAgentConnector con = DataPlugins.RequestPlugin <IAgentConnector> (); con.CreateNewAgent(userID); IAgentInfo agent = con.GetAgent(userID); agent.MaxMaturity = MaxMaturity; agent.MaturityRating = MaturityRating; agent.OtherAgentInformation ["RLDOB"] = RLDOB; agent.OtherAgentInformation ["RLGender"] = RLGender; agent.OtherAgentInformation ["RLName"] = RLName; agent.OtherAgentInformation ["RLAddress"] = RLAddress; agent.OtherAgentInformation ["RLCity"] = RLCity; agent.OtherAgentInformation ["RLZip"] = RLZip; agent.OtherAgentInformation ["RLCountry"] = RLCountry; agent.OtherAgentInformation ["RLIP"] = RLIP; if (activationRequired) { UUID activationToken = UUID.Random(); agent.OtherAgentInformation ["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + Password); resp ["WebUIActivationToken"] = activationToken; } con.UpdateAgent(agent); accountService.StoreUserAccount(user); IProfileConnector profileData = DataPlugins.RequestPlugin <IProfileConnector> (); IUserProfileInfo profile = profileData.GetUserProfile(user.PrincipalID); if (profile == null) { profileData.CreateNewProfile(user.PrincipalID); profile = profileData.GetUserProfile(user.PrincipalID); } if (AvatarArchive.Length > 0) { profile.AArchiveName = AvatarArchive; } // MainConsole.Instance.InfoFormat("[WebUI] Triggered Archive load of " + profile.AArchiveName); profile.IsNewUser = true; profile.MembershipGroup = UserTitle; profile.CustomType = UserTitle; profileData.UpdateUserProfile(profile); // MainConsole.Instance.RunCommand("load avatar archive " + user.FirstName + " " + user.LastName + " Devil"); } resp ["UUID"] = OSD.FromUUID(userID); return(resp); }
public byte [] MapAPIRequest(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { byte [] response = MainServer.BlankResponse; var resp = "var {0} = {{regionName:\"{1}\",xloc:\"{2}\",yloc:\"{3}\",xsize:\"{4}\",ysize:\"{5}\"}};"; var varName = httpRequest.Query ["var"].ToString(); var requestType = path.Substring(0, path.IndexOf("?", StringComparison.Ordinal)); if (requestType == "/MapAPI/get-region-coords-by-name") { string sim_name = httpRequest.Query ["sim_name"].ToString(); var region = m_gridService.GetRegionByName(null, sim_name); if (region == null) { resp = "var " + varName + "={error: true};"; } else { resp = string.Format(resp, varName, region.RegionName, region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize, region.RegionSizeX, region.RegionSizeY); } response = System.Text.Encoding.UTF8.GetBytes(resp); httpResponse.ContentType = "text/javascript"; } else if (requestType == "/MapAPI/get-region-name-by-coords") { int grid_x = int.Parse(httpRequest.Query ["grid_x"].ToString()); int grid_y = int.Parse(httpRequest.Query ["grid_y"].ToString()); var region = m_gridService.GetRegionByPosition(null, grid_x * Constants.RegionSize, grid_y * Constants.RegionSize); if (region == null) { var maxRegionSize = m_gridService.GetMaxRegionSize(); List <GridRegion> regions = m_gridService.GetRegionRange(null, (grid_x * Constants.RegionSize) - maxRegionSize, (grid_x * Constants.RegionSize) + maxRegionSize, (grid_y * Constants.RegionSize) - maxRegionSize, (grid_y * Constants.RegionSize) + maxRegionSize); bool found = false; foreach (var r in regions) { if (r.PointIsInRegion(grid_x * Constants.RegionSize, grid_y * Constants.RegionSize)) { resp = string.Format(resp, varName, r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize, r.RegionSizeX, r.RegionSizeY); found = true; break; } } if (!found) { resp = "var " + varName + "={error: true};"; } } else { resp = string.Format(resp, varName, region.RegionName, region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize, region.RegionSizeX, region.RegionSizeY); } response = System.Text.Encoding.UTF8.GetBytes(resp); httpResponse.ContentType = "text/javascript"; } return(response); }
public GridRegion GetRegionByName(UUID scopeID, string regionName) { return(m_GridService.GetRegionByName(scopeID, regionName)); }
public byte[] MapAPIRequest(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { byte[] response = MainServer.BlankResponse; string var = httpRequest.Query["var"].ToString(); string requestType = path.Substring(0, path.IndexOf("?")); if (requestType == "/MapAPI/get-region-coords-by-name") { string resp = "var {0} = {\"x\":{1},\"y\":{2}};"; string sim_name = httpRequest.Query["sim_name"].ToString(); var region = m_gridService.GetRegionByName(null, sim_name); if (region == null) { resp = "var " + var + " = {error: true};"; } else { resp = "var " + var + " = {\"x\":" + region.RegionLocX + ",\"y\":" + region.RegionLocY + "};"; } response = System.Text.Encoding.UTF8.GetBytes(resp); httpResponse.ContentType = "text/javascript"; } else if (requestType == "/MapAPI/get-region-name-by-coords") { string resp = "var {0} = \"{1}\";"; int grid_x = int.Parse(httpRequest.Query["grid_x"].ToString()); int grid_y = int.Parse(httpRequest.Query["grid_y"].ToString()); var region = m_gridService.GetRegionByPosition(null, grid_x * Constants.RegionSize, grid_y * Constants.RegionSize); if (region == null) { List <GridRegion> regions = m_gridService.GetRegionRange(null, (grid_x * Constants.RegionSize) - (m_gridService.GetMaxRegionSize()), (grid_x * Constants.RegionSize), (grid_y * Constants.RegionSize) - (m_gridService.GetMaxRegionSize()), (grid_y * Constants.RegionSize)); bool found = false; foreach (var r in regions) { if (r.PointIsInRegion(grid_x * Constants.RegionSize, grid_y * Constants.RegionSize)) { resp = string.Format(resp, var, r.RegionName); found = true; break; } } if (!found) { resp = "var " + var + " = {error: true};"; } } else { resp = string.Format(resp, var, region.RegionName); } response = System.Text.Encoding.UTF8.GetBytes(resp); httpResponse.ContentType = "text/javascript"; } return(response); }