From 6b00537c871fb08f760016698c7e83f178c1cf55 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 16:30:57 -0700 Subject: DEV-50013 WIP Added utility to get name and SLID in single string --- indra/llcommon/llavatarname.cpp | 15 +++++++++++++++ indra/llcommon/llavatarname.h | 4 ++++ 2 files changed, 19 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 4eeb6e706d..7415acadd4 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -79,3 +79,18 @@ void LLAvatarName::fromLLSD(const LLSD& sd) LLDate expires = sd[DISPLAY_NAME_EXPIRES]; mExpires = expires.secondsSinceEpoch(); } + +std::string LLAvatarName::getNameAndSLID() const +{ + std::string name; + if (!mSLID.empty()) + { + name = mDisplayName + " (" + mSLID + ")"; + } + else + { + // ...display names are off, legacy name is in mDisplayName + name = mDisplayName; + } + return name; +} diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index d7d91e1c7a..87750210c6 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -49,6 +49,10 @@ public: void fromLLSD(const LLSD& sd); + // For normal names, returns "James Linden (james.linden)" + // When display names are disabled returns just "James Linden" + std::string getNameAndSLID() const; + // "bobsmith123" or "james.linden", US-ASCII only std::string mSLID; -- cgit v1.2.3