summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-05-19 11:23:29 -0700
committerJames Cook <james@lindenlab.com>2010-05-19 11:23:29 -0700
commit31220ceffbacdf0f14929b735b0c9e250e1225ca (patch)
tree920ce90aa50997ce1b540cb14e5fde62a53c7e16 /indra
parentd822206a48633e03f7456663d7d7d82b73ba209f (diff)
DEV-50013 Viewer reads legacy first/last name from People API
Useful for voice subsystem and muting subsystem.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llavatarname.cpp18
-rw-r--r--indra/llcommon/llavatarname.h19
2 files changed, 36 insertions, 1 deletions
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index de51a7f2aa..e30f353a6c 100644
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -42,12 +42,16 @@
// LLSD map lookups
static const std::string SL_ID("sl_id");
static const std::string DISPLAY_NAME("display_name");
+static const std::string LEGACY_FIRST_NAME("legacy_first_name");
+static const std::string LEGACY_LAST_NAME("legacy_last_name");
static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default");
static const std::string DISPLAY_NAME_EXPIRES("display_name_expires");
LLAvatarName::LLAvatarName()
: mUsername(),
mDisplayName(),
+ mLegacyFirstName(),
+ mLegacyLastName(),
mIsDisplayNameDefault(false),
mIsDummy(false),
mExpires(F64_MAX)
@@ -68,6 +72,8 @@ LLSD LLAvatarName::asLLSD() const
// "SLID" to "Username", but it was too late to change the wire format.
sd[SL_ID] = mUsername;
sd[DISPLAY_NAME] = mDisplayName;
+ sd[LEGACY_FIRST_NAME] = mLegacyFirstName;
+ sd[LEGACY_LAST_NAME] = mLegacyLastName;
sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault;
sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires);
return sd;
@@ -77,6 +83,8 @@ void LLAvatarName::fromLLSD(const LLSD& sd)
{
mUsername = sd[SL_ID].asString(); // see asLLSD() above
mDisplayName = sd[DISPLAY_NAME].asString();
+ mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString();
+ mLegacyLastName = sd[LEGACY_LAST_NAME].asString();
mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean();
LLDate expires = sd[DISPLAY_NAME_EXPIRES];
mExpires = expires.secondsSinceEpoch();
@@ -96,3 +104,13 @@ std::string LLAvatarName::getNameAndSLID() const
}
return name;
}
+
+std::string LLAvatarName::getLegacyName() const
+{
+ std::string name;
+ name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() );
+ name = mLegacyFirstName;
+ name += " ";
+ name += mLegacyLastName;
+ return name;
+}
diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h
index 39071ec4c7..fb5cb277a2 100644
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -53,14 +53,31 @@ public:
// When display names are disabled returns just "James Linden"
std::string getNameAndSLID() const;
+ // Returns "James Linden" or "bobsmith123 Resident" for backwards
+ // compatibility with systems like voice and muting
+ // *TODO: Eliminate this in favor of username only
+ std::string getLegacyName() const;
+
// "bobsmith123" or "james.linden", US-ASCII only
std::string mUsername;
// "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode
// Contains data whether or not user has explicitly set
- // a display name; may duplicate their SLID.
+ // a display name; may duplicate their username.
std::string mDisplayName;
+ // For "James Linden", "James"
+ // For "bobsmith123", "bobsmith123"
+ // Used to communicate with legacy systems like voice and muting which
+ // rely on old-style names.
+ // *TODO: Eliminate this in favor of username only
+ std::string mLegacyFirstName;
+
+ // For "James Linden", "Linden"
+ // For "bobsmith123", "Resident"
+ // see above for rationale
+ std::string mLegacyLastName;
+
// If true, both display name and SLID were generated from
// a legacy first and last name, like "James Linden (james.linden)"
bool mIsDisplayNameDefault;