summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-03-18 17:19:57 -0700
committerJames Cook <james@lindenlab.com>2010-03-18 17:19:57 -0700
commit639b234762133e4d09d6d7b1bac9d25c5a681926 (patch)
treed99a727f3fa9c53faecd434b2735da1094b9a519 /indra/newview
parent10fc6ee4a012fa7232868261d6e11a76652c3cca (diff)
Partial support for Set Name returning error msg from service
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelme.cpp57
-rw-r--r--indra/newview/llpanelme.h5
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml21
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_profile.xml1
4 files changed, 60 insertions, 24 deletions
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index 84ed7356f1..d6c7d7ea8d 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -235,21 +235,14 @@ void LLPanelMyProfileEdit::processProfileProperties(const LLAvatarData* avatar_d
//{
// childSetTextArg("name_text", "[NAME]", full_name);
//}
- std::string full_name;
- LLAvatarName av_name;
- if (LLAvatarNameCache::useDisplayNames()
- && LLAvatarNameCache::get(avatar_data->avatar_id, &av_name))
- {
- getChild<LLUICtrl>("user_name")->setValue( av_name.mDisplayName );
- getChild<LLUICtrl>("user_slid")->setValue( av_name.mSLID );
- }
- else if (gCacheName->getFullName(avatar_data->avatar_id, full_name))
- {
- getChild<LLUICtrl>("user_name")->setValue(full_name);
- getChild<LLUICtrl>("user_slid")->setValue("");
- }
+ LLAvatarNameCache::get(avatar_data->avatar_id,
+ boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2));
+}
- getChild<LLUICtrl>("set_name")->setVisible( LLAvatarNameCache::useDisplayNames() );
+void LLPanelMyProfileEdit::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
+{
+ getChild<LLUICtrl>("user_name")->setValue( av_name.mDisplayName );
+ getChild<LLUICtrl>("user_slid")->setValue( av_name.mSLID );
}
BOOL LLPanelMyProfileEdit::postBuild()
@@ -307,7 +300,30 @@ void LLPanelMyProfileEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl)
// IDEVO HACK
extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
-void LLPanelMyProfileEdit::callbackSetName(const LLSD& notification, const LLSD& response)
+void LLPanelMyProfileEdit::onCacheSetName(bool success,
+ const std::string& reason,
+ const LLSD& content)
+{
+ if (success)
+ {
+ // HACK: Use chat to invalidate names
+ send_chat_from_viewer("refreshname", CHAT_TYPE_NORMAL, 0);
+
+ // Re-fetch my name, as it may have been sanitized by the service
+ LLAvatarNameCache::get(getAvatarId(),
+ boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2));
+ }
+ else
+ {
+ // JAMESDEBUG TODO: localize strings for reasons we couldn't
+ // change the name
+ LLNotificationsUtil::add("SetDisplayNameFailedGeneric");
+ // TODO: SetDisplayNameFailedThrottle with [FREQUENCY]
+ // TODO: SetDisplayNameFailedUnavailable
+ }
+}
+
+void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0)
@@ -316,12 +332,9 @@ void LLPanelMyProfileEdit::callbackSetName(const LLSD& notification, const LLSD&
if (agent_id.isNull()) return;
std::string display_name = response["display_name"].asString();
- LLAvatarNameCache::setDisplayName(agent_id, display_name);
-
- // HACK: Use chat to invalidate names
- send_chat_from_viewer("refreshname", CHAT_TYPE_NORMAL, 0);
-
- getChild<LLUICtrl>("user_name")->setValue( display_name );
+ LLAvatarNameCache::setDisplayName(agent_id, display_name,
+ boost::bind(&LLPanelMyProfileEdit::onCacheSetName, this,
+ _1, _2, _3));
}
}
@@ -348,7 +361,7 @@ void LLPanelMyProfileEdit::onClickSetName()
LLSD payload;
payload["agent_id"] = agent_id;
LLNotificationsUtil::add("SetDisplayName", args, payload,
- boost::bind(&LLPanelMyProfileEdit::callbackSetName, this, _1, _2));
+ boost::bind(&LLPanelMyProfileEdit::onDialogSetName, this, _1, _2));
}
}
diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h
index ed630133ca..9304bc1d82 100644
--- a/indra/newview/llpanelme.h
+++ b/indra/newview/llpanelme.h
@@ -36,6 +36,7 @@
#include "llpanel.h"
#include "llpanelprofile.h"
+class LLAvatarName;
class LLPanelMyProfileEdit;
class LLPanelProfile;
class LLIconCtrl;
@@ -90,13 +91,15 @@ protected:
/*virtual*/void resetData();
void processProfileProperties(const LLAvatarData* avatar_data);
+ void onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
private:
void initTexturePickerMouseEvents();
void onTexturePickerMouseEnter(LLUICtrl* ctrl);
void onTexturePickerMouseLeave(LLUICtrl* ctrl);
void onClickSetName();
- void callbackSetName(const LLSD& notification, const LLSD& response);
+ void onDialogSetName(const LLSD& notification, const LLSD& response);
+ void onCacheSetName(bool success, const std::string& reason, const LLSD& content);
/**
* Enabled/disables controls to prevent overwriting edited data upon receiving
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 8c07198111..e7d64fd82f 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3055,6 +3055,27 @@ Change your display name?
<notification
icon="alertmodal.tga"
+ name="SetDisplayNameFailedGeneric"
+ type="alertmodal">
+ Sorry, we could not set your display name. Please try again later.
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="SetDisplayNameFailedThrottle"
+ type="alertmodal">
+ Sorry, you can only change your display name once every [FREQUENCY] hour(s).
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
+ name="SetDisplayNameFailedUnavailable"
+ type="alertmodal">
+ Sorry, we could not set that display name. Please try a different name.
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="OfferTeleport"
type="alertmodal">
Offer a teleport to your location with the following message?
diff --git a/indra/newview/skins/default/xui/en/panel_edit_profile.xml b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
index 1b624da68a..bce988da9d 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
@@ -115,7 +115,6 @@
left="170"
name="set_name"
top_delta="-4"
- visible="false"
width="110" />
<panel
name="lifes_images_panel"