diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 764f061c95..36c163914e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1344,6 +1344,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.Inventory.AddInventoryItem(taskItem, false); } + public string osAvatarName2Key(string firstname, string lastname) + { + CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); + + UserProfileData UserProfile = World.CommsManager.UserService + .GetUserProfile(firstname, lastname); + if (UserProfile==null) + { + return UUID.Zero.ToString(); + } + else + { + return UserProfile.ID.ToString(); + } + } + + public string osKey2Name(string id) + { + CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); + UUID key = new UUID(); + + if (UUID.TryParse(id, out key)) + { + UserProfileData UserProfile = World.CommsManager.UserService + .GetUserProfile(key); + if (UserProfile==null) + { + return ""; + } + else + { + return UserProfile.Name; + } + } + else + { + return ""; + } + + } + /// Threat level is Moderate because intentional abuse, for instance /// scripts that are written to be malicious only on one grid, /// for instance in a HG scenario, are a distinct possibility. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 533ed27f37..cf4e107794 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -117,6 +117,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osMessageObject(key objectUUID,string message); void osMakeNotecard(string notecardName, LSL_Types.list contents); + string osAvatarName2Key(string firstname, string lastname); + string osKey2Name(string id); // Grid Info Functions string osGetGridNick(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 3ca40954dd..b42505f0a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -300,6 +300,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osMakeNotecard(notecardName, contents); } + public string osAvatarName2Key(string firstname, string lastname) + { + return m_OSSL_Functions.osAvatarName2Key(firstname, lastname); + } + + public string osKey2Name(string id) + { + return m_OSSL_Functions.osKey2Name(id); + } + public string osGetGridNick() { return m_OSSL_Functions.osGetGridNick();