From: Christopher Yeoh <yeohc@au1.ibm.com>
The attached patch implements osKey2Name and osName2Key which converts between a UUID key for an avatar and an avatar name and vice-versa. osKey2Name is similar to llKey2Name except that it will work even if the avatar being looked up is not in the same region as the script.0.6.5-rc1
parent
8ee81f98ea
commit
a5ceb1a2a0
|
@ -1344,6 +1344,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.Inventory.AddInventoryItem(taskItem, false);
|
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
|
/// Threat level is Moderate because intentional abuse, for instance
|
||||||
/// scripts that are written to be malicious only on one grid,
|
/// scripts that are written to be malicious only on one grid,
|
||||||
/// for instance in a HG scenario, are a distinct possibility.
|
/// for instance in a HG scenario, are a distinct possibility.
|
||||||
|
|
|
@ -117,6 +117,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
void osMessageObject(key objectUUID,string message);
|
void osMessageObject(key objectUUID,string message);
|
||||||
|
|
||||||
void osMakeNotecard(string notecardName, LSL_Types.list contents);
|
void osMakeNotecard(string notecardName, LSL_Types.list contents);
|
||||||
|
string osAvatarName2Key(string firstname, string lastname);
|
||||||
|
string osKey2Name(string id);
|
||||||
|
|
||||||
// Grid Info Functions
|
// Grid Info Functions
|
||||||
string osGetGridNick();
|
string osGetGridNick();
|
||||||
|
|
|
@ -300,6 +300,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_OSSL_Functions.osMakeNotecard(notecardName, contents);
|
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()
|
public string osGetGridNick()
|
||||||
{
|
{
|
||||||
return m_OSSL_Functions.osGetGridNick();
|
return m_OSSL_Functions.osGetGridNick();
|
||||||
|
|
Loading…
Reference in New Issue