diff options
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 33 | ||||
-rw-r--r-- | indra/llmessage/llavatarnamecache.h | 3 | ||||
-rw-r--r-- | indra/newview/llpanelme.cpp | 60 | ||||
-rw-r--r-- | indra/newview/llpanelme.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 21 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_edit_profile.xml | 38 |
6 files changed, 152 insertions, 4 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index cd05a80bc1..37b7a48244 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -241,6 +241,39 @@ void LLAvatarNameCache::get(const LLUUID& agent_id, name_cache_callback_t callba { } +class LLSetNameResponder : public LLHTTPClient::Responder +{ +public: + LLUUID mAgentID; + + LLSetNameResponder(const LLUUID& agent_id) : mAgentID(agent_id) { } + + /*virtual*/ void result(const LLSD& content) + { + // force re-fetch + LLAvatarNameCache::sCache.erase(mAgentID); + llinfos << "JAMESDEBUG set names worked" << llendl; + } + + /*virtual*/ void error(U32 status, const std::string& reason) + { + llinfos << "JAMESDEBUG set names failed " << status + << " reason " << reason << llendl; + } +}; + +void LLAvatarNameCache::setDisplayName(const LLUUID& agent_id, const std::string& display_name) +{ + LLSD body; + body["display_name"] = display_name; + + // *TODO: configure the base URL for this + std::string url = "http://pdp15.lindenlab.com:8050/my-service/agent/"; + url += agent_id.asString(); + url += "/set-display-name/"; + LLHTTPClient::post(url, body, new LLSetNameResponder(agent_id)); +} + void LLAvatarNameCache::toggleDisplayNames() { sUseDisplayNames = !sUseDisplayNames; diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 9f0472095d..369c8f8fff 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -56,6 +56,9 @@ namespace LLAvatarNameCache typedef void (*name_cache_callback_t)(const LLUUID& agent_id, const LLAvatarName& av_name); void get(const LLUUID& agent_id, name_cache_callback_t callback); + // Sends an update to the server + void setDisplayName(const LLUUID& agent_id, const std::string& display_name); + // HACK: turn display names on and off void toggleDisplayNames(); bool useDisplayNames(); diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 77a2ac3a8c..211187a769 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -33,11 +33,14 @@ #include "llviewerprecompiledheaders.h" #include "llpanelprofile.h" + #include "llavatarconstants.h" +#include "llavatarnamecache.h" // IDEVO #include "llpanelme.h" #include "llagent.h" #include "llagentwearables.h" #include "lliconctrl.h" +#include "llnotificationsutil.h" // IDEVO #include "llsidetray.h" #include "lltabcontainer.h" #include "lltexturectrl.h" @@ -228,6 +231,21 @@ 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(""); + } + + getChild<LLUICtrl>("set_name")->setVisible( LLAvatarNameCache::useDisplayNames() ); } BOOL LLPanelMyProfileEdit::postBuild() @@ -237,6 +255,9 @@ BOOL LLPanelMyProfileEdit::postBuild() childSetTextArg("partner_edit_link", "[URL]", getString("partner_edit_link_url")); childSetTextArg("my_account_link", "[URL]", getString("my_account_link_url")); + getChild<LLUICtrl>("set_name")->setCommitCallback( + boost::bind(&LLPanelMyProfileEdit::onClickSetName, this)); + return LLPanelAvatarProfile::postBuild(); } /** @@ -277,6 +298,45 @@ void LLPanelMyProfileEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl) mTextureEditIconMap[ctrl->getName()]->setVisible(FALSE); } +static void set_name_callback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + LLUUID agent_id = notification["payload"]["agent_id"]; + if (agent_id.isNull()) return; + + std::string display_name = response["display_name"].asString(); + LLAvatarNameCache::setDisplayName(agent_id, display_name); + } +} + +void LLPanelMyProfileEdit::onClickSetName() +{ + // IDEVO + LLUUID agent_id = getAvatarId(); + std::string display_name; + LLAvatarName av_name; + if (LLAvatarNameCache::useDisplayNames() + && LLAvatarNameCache::get(agent_id, &av_name)) + { + display_name = av_name.mDisplayName; + } + else + { + gCacheName->getFullName(agent_id, display_name); + } + + if (!display_name.empty()) + { + LLSD args; + args["DISPLAY_NAME"] = display_name; + LLSD payload; + payload["agent_id"] = agent_id; + LLNotificationsUtil::add("SetDisplayName", args, payload, set_name_callback); + } +} + void LLPanelMyProfileEdit::enableEditing(bool enable) { childSetEnabled("2nd_life_pic", enable); diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h index 1325192bbf..368fdb307a 100644 --- a/indra/newview/llpanelme.h +++ b/indra/newview/llpanelme.h @@ -95,6 +95,7 @@ private: void initTexturePickerMouseEvents(); void onTexturePickerMouseEnter(LLUICtrl* ctrl); void onTexturePickerMouseLeave(LLUICtrl* ctrl); + void onClickSetName(); /** * 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 a69d9c78a7..b21afe5d96 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3032,6 +3032,27 @@ You are no longer frozen. <notification icon="alertmodal.tga" + name="SetDisplayName" + type="alertmodal"> +Change your display name? + <form name="form"> + <input name="display_name" type="text"> +[DISPLAY_NAME] + </input> + <button + default="true" + index="0" + name="Change" + text="Change"/> + <button + index="1" + name="Cancel" + text="Cancel"/> + </form> + </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 2a2199fc87..f400acc1d4 100644 --- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml @@ -87,12 +87,42 @@ min_height="300" left="0" width="290"> - <panel + <text + follows="top|left" + font="SansSerifHuge" + height="13" + layout="topleft" + left="10" + name="user_name" + text_color="LtGray" + top="0" + value="James Linden" + width="150" /> + <button + follows="top|left" + height="23" + label="Set Name..." + left="170" + name="set_name" + top="0" + visible="false" + width="110" /> + <text + follows="top|left" + height="13" + layout="topleft" + left="10" + name="user_slid" + text_color="LtGray" + top_pad="4" + value="(james.linden)" + width="150" /> + <panel name="lifes_images_panel" follows="left|top|right" height="244" layout="topleft" - top="0" + top="37" left="0" width="290"> <panel @@ -145,7 +175,7 @@ height="102" layout="topleft" left="123" - top="25" + top="62" max_length="512" name="sl_description_edit" width="157" @@ -201,7 +231,7 @@ layout="topleft" left="123" max_length="512" - top="157" + top="195" name="fl_description_edit" width="157" word_wrap="true"> |