From 650171af1788435e200c62965c3ffe314d2082db Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 19 Aug 2010 14:20:49 -0700 Subject: DEV-51021 Viewer returns misleading error message when a blocked user attempts to change his display name --- indra/newview/llpanelme.cpp | 24 +++++++++++------------- indra/newview/llpanelme.h | 3 +++ 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 5e8e07b962..75abad8fc7 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -194,6 +194,8 @@ void LLPanelMyProfileEdit::onOpen(const LLSD& key) LLUICtrl* set_name = getChild("set_name"); set_name->setVisible(use_display_names); set_name->setEnabled(use_display_names); + // force new avatar name fetch so we have latest update time + LLAvatarNameCache::fetch(gAgent.getID()); LLPanelMyProfile::onOpen(getAvatarId()); } @@ -373,19 +375,15 @@ void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD& } void LLPanelMyProfileEdit::onClickSetName() +{ + LLAvatarNameCache::get(getAvatarId(), + boost::bind(&LLPanelMyProfileEdit::onAvatarNameCache, + this, _1, _2)); +} + +void LLPanelMyProfileEdit::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - LLUUID agent_id = getAvatarId(); - std::string display_name; - LLAvatarName av_name; - if (!LLAvatarNameCache::get(agent_id, &av_name)) - { - // something is wrong, tell user to try again later - LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); - return; - } - - display_name = av_name.mDisplayName; - if (display_name.empty()) + if (av_name.mDisplayName.empty()) { // something is wrong, tell user to try again later LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); @@ -421,7 +419,7 @@ void LLPanelMyProfileEdit::onClickSetName() } LLSD args; - args["DISPLAY_NAME"] = display_name; + args["DISPLAY_NAME"] = av_name.mDisplayName; LLSD payload; payload["agent_id"] = agent_id; LLNotificationsUtil::add("SetDisplayName", args, payload, diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h index f3caf026dc..be292002cf 100644 --- a/indra/newview/llpanelme.h +++ b/indra/newview/llpanelme.h @@ -99,6 +99,7 @@ private: void onClickSetName(); void onDialogSetName(const LLSD& notification, const LLSD& response); void onCacheSetName(bool success, const std::string& reason, const LLSD& content); + void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); /** * Enabled/disables controls to prevent overwriting edited data upon receiving @@ -106,6 +107,8 @@ private: */ void enableEditing(bool enable); + + private: // map TexturePicker name => Edit Icon pointer should be visible while hovering Texture Picker typedef std::map texture_edit_icon_map_t; -- cgit v1.2.3