aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2009-04-09 15:04:02 +0000
committerSean Dague2009-04-09 15:04:02 +0000
commita5ceb1a2a06c7975f53603a3eb735e192745211e (patch)
tree1100ad85ee8f3b80189e52bf057bf390a6538bf8 /OpenSim
parent* Implements IObject.Materials[].* (diff)
downloadopensim-SC_OLD-a5ceb1a2a06c7975f53603a3eb735e192745211e.zip
opensim-SC_OLD-a5ceb1a2a06c7975f53603a3eb735e192745211e.tar.gz
opensim-SC_OLD-a5ceb1a2a06c7975f53603a3eb735e192745211e.tar.bz2
opensim-SC_OLD-a5ceb1a2a06c7975f53603a3eb735e192745211e.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs41
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
3 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 764f061..36c1639 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
1344 m_host.Inventory.AddInventoryItem(taskItem, false); 1344 m_host.Inventory.AddInventoryItem(taskItem, false);
1345 } 1345 }
1346 1346
1347 public string osAvatarName2Key(string firstname, string lastname)
1348 {
1349 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
1350
1351 UserProfileData UserProfile = World.CommsManager.UserService
1352 .GetUserProfile(firstname, lastname);
1353 if (UserProfile==null)
1354 {
1355 return UUID.Zero.ToString();
1356 }
1357 else
1358 {
1359 return UserProfile.ID.ToString();
1360 }
1361 }
1362
1363 public string osKey2Name(string id)
1364 {
1365 CheckThreatLevel(ThreatLevel.Low, "osKey2Name");
1366 UUID key = new UUID();
1367
1368 if (UUID.TryParse(id, out key))
1369 {
1370 UserProfileData UserProfile = World.CommsManager.UserService
1371 .GetUserProfile(key);
1372 if (UserProfile==null)
1373 {
1374 return "";
1375 }
1376 else
1377 {
1378 return UserProfile.Name;
1379 }
1380 }
1381 else
1382 {
1383 return "";
1384 }
1385
1386 }
1387
1347 /// Threat level is Moderate because intentional abuse, for instance 1388 /// Threat level is Moderate because intentional abuse, for instance
1348 /// scripts that are written to be malicious only on one grid, 1389 /// scripts that are written to be malicious only on one grid,
1349 /// for instance in a HG scenario, are a distinct possibility. 1390 /// 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 533ed27..cf4e107 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
117 void osMessageObject(key objectUUID,string message); 117 void osMessageObject(key objectUUID,string message);
118 118
119 void osMakeNotecard(string notecardName, LSL_Types.list contents); 119 void osMakeNotecard(string notecardName, LSL_Types.list contents);
120 string osAvatarName2Key(string firstname, string lastname);
121 string osKey2Name(string id);
120 122
121 // Grid Info Functions 123 // Grid Info Functions
122 string osGetGridNick(); 124 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 3ca4095..b42505f 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
300 m_OSSL_Functions.osMakeNotecard(notecardName, contents); 300 m_OSSL_Functions.osMakeNotecard(notecardName, contents);
301 } 301 }
302 302
303 public string osAvatarName2Key(string firstname, string lastname)
304 {
305 return m_OSSL_Functions.osAvatarName2Key(firstname, lastname);
306 }
307
308 public string osKey2Name(string id)
309 {
310 return m_OSSL_Functions.osKey2Name(id);
311 }
312
303 public string osGetGridNick() 313 public string osGetGridNick()
304 { 314 {
305 return m_OSSL_Functions.osGetGridNick(); 315 return m_OSSL_Functions.osGetGridNick();