diff options
| author | James Cook <james@lindenlab.com> | 2010-05-19 14:35:29 -0700 | 
|---|---|---|
| committer | James Cook <james@lindenlab.com> | 2010-05-19 14:35:29 -0700 | 
| commit | aee08f53f7a71bb7373345cae19c988ff985aa03 (patch) | |
| tree | 85161302242558ec4f907bf0fee5291c0f3b999c /indra/llcommon | |
| parent | b62d1472be7e64c176ea663562d8747f46ace316 (diff) | |
Temporarily accept both username and sl_id from People API
Need this for testing during transition, soon we can remove
the code to read "sl_id"
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llavatarname.cpp | 17 | 
1 files changed, 13 insertions, 4 deletions
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index e30f353a6c..5a20aff4e6 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -41,6 +41,7 @@  // Store these in pre-built std::strings to avoid memory allocations in  // LLSD map lookups  static const std::string SL_ID("sl_id"); +static const std::string USERNAME("username");  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"); @@ -68,9 +69,7 @@ bool LLAvatarName::operator<(const LLAvatarName& rhs) const  LLSD LLAvatarName::asLLSD() const  {  	LLSD sd; -	// Due to a late-breaking change request from Product, we renamed -	// "SLID" to "Username", but it was too late to change the wire format. -	sd[SL_ID] = mUsername; +	sd[USERNAME] = mUsername;  	sd[DISPLAY_NAME] = mDisplayName;  	sd[LEGACY_FIRST_NAME] = mLegacyFirstName;  	sd[LEGACY_LAST_NAME] = mLegacyLastName; @@ -81,7 +80,17 @@ LLSD LLAvatarName::asLLSD() const  void LLAvatarName::fromLLSD(const LLSD& sd)  { -	mUsername = sd[SL_ID].asString(); // see asLLSD() above +	// *HACK: accept both wire formats for now, as we are transitioning +	// People API to use "username" +	if (sd.has(USERNAME)) +	{ +		mUsername = sd[USERNAME].asString(); +	} +	else +	{ +		// *TODO: Remove +		mUsername = sd[SL_ID].asString(); +	}  	mDisplayName = sd[DISPLAY_NAME].asString();  	mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString();  	mLegacyLastName = sd[LEGACY_LAST_NAME].asString();  | 
