aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorChristopher2015-08-04 08:56:37 +0200
committerMelanie Thielker2015-08-04 18:08:54 +0200
commitb5be5ca490771b664788dabe332022635d33ec4d (patch)
tree8a5d63061e85f728f0f560c7daa5f1666e1b5af0 /OpenSim/Region
parentIn the AgentCircuitData of HG users, set the last name to include the port (diff)
downloadopensim-SC-b5be5ca490771b664788dabe332022635d33ec4d.zip
opensim-SC-b5be5ca490771b664788dabe332022635d33ec4d.tar.gz
opensim-SC-b5be5ca490771b664788dabe332022635d33ec4d.tar.bz2
opensim-SC-b5be5ca490771b664788dabe332022635d33ec4d.tar.xz
Make osAvatarName2Key() able to get names from unknown HG users
Signed-off-by: Melanie Thielker <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs44
1 files changed, 40 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index d42a125..0461e1a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -63,6 +63,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
63using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 63using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
64using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 64using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
65using PermissionMask = OpenSim.Framework.PermissionMask; 65using PermissionMask = OpenSim.Framework.PermissionMask;
66using OpenSim.Services.Connectors.Hypergrid;
66 67
67namespace OpenSim.Region.ScriptEngine.Shared.Api 68namespace OpenSim.Region.ScriptEngine.Shared.Api
68{ 69{
@@ -2052,15 +2053,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2052 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); 2053 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
2053 m_host.AddScriptLPS(1); 2054 m_host.AddScriptLPS(1);
2054 2055
2055 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); 2056 if (lastname.Contains("@"))
2056 if (null == account)
2057 { 2057 {
2058 return UUID.Zero.ToString(); 2058 String realFirstName; String realLastName; String serverURI;
2059
2060 realFirstName = firstname.Split('.')[0];
2061 realLastName = firstname.Split('.')[1];
2062 serverURI = new Uri("http://" + lastname.Replace("@", "")).ToString();
2063
2064 try
2065 {
2066 UserAgentServiceConnector userConnection = new UserAgentServiceConnector(serverURI, true);
2067
2068 if (userConnection != null)
2069 {
2070 UUID ruserid = userConnection.GetUUID(realFirstName, realLastName);
2071
2072 if (ruserid != null)
2073 {
2074 IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>();
2075
2076 if (userManager != null)
2077 {
2078 //Use the HomeURI from the script to get user infos and then ask the remote gridserver for the real HomeURI.
2079 userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);
2080 serverURI = userManager.GetUserServerURL(ruserid, "HomeURI");
2081 userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);
2082
2083 return ruserid.ToString();
2084 }
2085 }
2086 }
2087 }
2088 catch (Exception osAvatarException)
2089 {
2090 //m_log.Warn("[osAvatarName2Key] UserAgentServiceConnector - Unable to connect to destination grid\n" + osAvatarException.Message);
2091 }
2059 } 2092 }
2060 else 2093 else
2061 { 2094 {
2062 return account.PrincipalID.ToString(); 2095 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
2096 if (account != null) return account.PrincipalID.ToString();
2063 } 2097 }
2098
2099 return UUID.Zero.ToString();
2064 } 2100 }
2065 2101
2066 public string osKey2Name(string id) 2102 public string osKey2Name(string id)