diff options
author | Melanie | 2011-04-08 03:50:27 +0200 |
---|---|---|
committer | Melanie | 2011-04-08 03:50:27 +0200 |
commit | 33dd74e410bcd95364d8029a3f2a21b522c9f9d2 (patch) | |
tree | 06d8a6e482ad1dd464a8f4cd292275a9878f133d /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.zip opensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.tar.gz opensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.tar.bz2 opensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.tar.xz |
Add support for the new display name related functions in LSL. This does not
implement the display names functionality as such, but it allows scripts
that are display name aware to function as if the display name were implemented
and set to the avatar name.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c0b490a..8ceb814 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10909,6 +10909,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10909 | 10909 | ||
10910 | return GetNumberOfSides(parts[0]); | 10910 | return GetNumberOfSides(parts[0]); |
10911 | } | 10911 | } |
10912 | |||
10913 | private string Name2Username(string name) | ||
10914 | { | ||
10915 | string[] parts = name.Split(new char[] {' '}); | ||
10916 | if (parts.Length < 2) | ||
10917 | return name.ToLower(); | ||
10918 | if (parts[1] == "Resident") | ||
10919 | return parts[0].ToLower(); | ||
10920 | |||
10921 | return name.Replace(" ", ".").ToLower(); | ||
10922 | } | ||
10923 | |||
10924 | public LSL_String llGetUsername(string id) | ||
10925 | { | ||
10926 | return Name2Username(llKey2Name(id)); | ||
10927 | } | ||
10928 | |||
10929 | public LSL_String llRequestUsername(string id) | ||
10930 | { | ||
10931 | UUID rq = UUID.Random(); | ||
10932 | |||
10933 | UUID tid = AsyncCommands. | ||
10934 | DataserverPlugin.RegisterRequest(m_localID, | ||
10935 | m_itemID, rq.ToString()); | ||
10936 | |||
10937 | AsyncCommands. | ||
10938 | DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); | ||
10939 | |||
10940 | return rq.ToString(); | ||
10941 | } | ||
10942 | |||
10943 | public LSL_String llGetDisplayName(string id) | ||
10944 | { | ||
10945 | return llKey2Name(id); | ||
10946 | } | ||
10947 | |||
10948 | public LSL_String llRequestDisplayName(string id) | ||
10949 | { | ||
10950 | UUID rq = UUID.Random(); | ||
10951 | |||
10952 | UUID tid = AsyncCommands. | ||
10953 | DataserverPlugin.RegisterRequest(m_localID, | ||
10954 | m_itemID, rq.ToString()); | ||
10955 | |||
10956 | AsyncCommands. | ||
10957 | DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); | ||
10958 | |||
10959 | return rq.ToString(); | ||
10960 | } | ||
10912 | } | 10961 | } |
10913 | 10962 | ||
10914 | public class NotecardCache | 10963 | public class NotecardCache |