Make osAvatarName2Key() able to get names from unknown HG users
Signed-off-by: Melanie Thielker <melanie@t-data.com>0.8.2-post-fixes
parent
c4f8630968
commit
b5be5ca490
|
@ -63,6 +63,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
|
||||||
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||||
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
|
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
|
||||||
using PermissionMask = OpenSim.Framework.PermissionMask;
|
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||||
|
using OpenSim.Services.Connectors.Hypergrid;
|
||||||
|
|
||||||
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
|
@ -2052,15 +2053,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
|
CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
|
if (lastname.Contains("@"))
|
||||||
if (null == account)
|
|
||||||
{
|
{
|
||||||
return UUID.Zero.ToString();
|
String realFirstName; String realLastName; String serverURI;
|
||||||
|
|
||||||
|
realFirstName = firstname.Split('.')[0];
|
||||||
|
realLastName = firstname.Split('.')[1];
|
||||||
|
serverURI = new Uri("http://" + lastname.Replace("@", "")).ToString();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UserAgentServiceConnector userConnection = new UserAgentServiceConnector(serverURI, true);
|
||||||
|
|
||||||
|
if (userConnection != null)
|
||||||
|
{
|
||||||
|
UUID ruserid = userConnection.GetUUID(realFirstName, realLastName);
|
||||||
|
|
||||||
|
if (ruserid != null)
|
||||||
|
{
|
||||||
|
IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>();
|
||||||
|
|
||||||
|
if (userManager != null)
|
||||||
|
{
|
||||||
|
//Use the HomeURI from the script to get user infos and then ask the remote gridserver for the real HomeURI.
|
||||||
|
userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);
|
||||||
|
serverURI = userManager.GetUserServerURL(ruserid, "HomeURI");
|
||||||
|
userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);
|
||||||
|
|
||||||
|
return ruserid.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception osAvatarException)
|
||||||
|
{
|
||||||
|
//m_log.Warn("[osAvatarName2Key] UserAgentServiceConnector - Unable to connect to destination grid\n" + osAvatarException.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return account.PrincipalID.ToString();
|
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
|
||||||
|
if (account != null) return account.PrincipalID.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return UUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string osKey2Name(string id)
|
public string osKey2Name(string id)
|
||||||
|
|
|
@ -2272,6 +2272,7 @@
|
||||||
<Reference name="OpenSim.Region.CoreModules"/>
|
<Reference name="OpenSim.Region.CoreModules"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="OpenSim.Services.Interfaces"/>
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
|
<Reference name="OpenSim.Services.Connectors"/>
|
||||||
<Reference name="OpenSim.Region.ScriptEngine.Shared"/>
|
<Reference name="OpenSim.Region.ScriptEngine.Shared"/>
|
||||||
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/>
|
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/>
|
||||||
<Reference name="Nini" path="../../../../../../bin/"/>
|
<Reference name="Nini" path="../../../../../../bin/"/>
|
||||||
|
|
Loading…
Reference in New Issue