DEV-50013 Viewer reads legacy first/last name from People API
Useful for voice subsystem and muting subsystem.meow-7.2.2
parent
d822206a48
commit
31220ceffb
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue