From 1a61c49fc765ab6ac100d7914502f66ee584daf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Liru=20F=C3=A6rs?= Date: Sat, 29 Feb 2020 04:47:17 -0500 Subject: [PATCH] Display name change notifications that link to the user --- indra/newview/llviewerdisplayname.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index c7f817032..1e559072a 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -56,25 +56,22 @@ namespace LLViewerDisplayName void doNothing() { } } -class LLSetDisplayNameResponder : public LLHTTPClient::ResponderIgnoreBody +class LLSetDisplayNameResponder final : public LLHTTPClient::ResponderIgnoreBody { LOG_CLASS(LLSetDisplayNameResponder); private: // only care about errors - /*virtual*/ void httpFailure() + void httpFailure() override { - LL_WARNS() << dumpResponse() << LL_ENDL; - LLViewerDisplayName::sSetDisplayNameSignal(false, "", LLSD()); + LLViewerDisplayName::sSetDisplayNameSignal(false, LLStringUtil::null, LLSD()); LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); } - /*virtual*/ char const* getName(void) const { return "LLSetDisplayNameResponder"; } + char const* getName() const override { return "LLSetDisplayNameResponder"; } }; void LLViewerDisplayName::set(const std::string& display_name, const set_name_slot_t& slot) { - // TODO: simple validation here - LLViewerRegion* region = gAgent.getRegion(); llassert(region); std::string cap_url = region->getCapability("SetDisplayName"); @@ -93,7 +90,7 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl // Our display name will be in cache before the viewer's UI is available // to request a change, so we can use direct lookup without callback. LLAvatarName av_name; - if (!LLAvatarNameCache::get( gAgent.getID(), &av_name)) + if (!LLAvatarNameCache::get(gAgent.getID(), &av_name)) { slot(false, "name unavailable", LLSD()); return; @@ -104,8 +101,6 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl change_array.append(av_name.getDisplayName()); change_array.append(display_name); - LL_INFOS() << "Set name POST to " << cap_url << LL_ENDL; - // Record our caller for when the server sends back a reply sSetDisplayNameSignal.connect(slot); @@ -117,14 +112,14 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl LLHTTPClient::post(cap_url, body, new LLSetDisplayNameResponder, headers); } -class LLSetDisplayNameReply : public LLHTTPNode +class LLSetDisplayNameReply final : public LLHTTPNode { LOG_CLASS(LLSetDisplayNameReply); public: /*virtual*/ void post( LLHTTPNode::ResponsePtr response, const LLSD& context, - const LLSD& input) const + const LLSD& input) const override { LLSD body = input["body"]; @@ -157,12 +152,12 @@ public: }; -class LLDisplayNameUpdate : public LLHTTPNode +class LLDisplayNameUpdate final : public LLHTTPNode { /*virtual*/ void post( LLHTTPNode::ResponsePtr response, const LLSD& context, - const LLSD& input) const + const LLSD& input) const override { LLSD body = input["body"]; LLUUID agent_id = body["agent_id"]; @@ -195,7 +190,7 @@ class LLDisplayNameUpdate : public LLHTTPNode { LLSD args; args["OLD_NAME"] = old_display_name; - args["SLID"] = av_name.getUserName(); + args["SLID"] = "secondlife:///app/agent/" + agent_id.asString() + "/username"; args["NEW_NAME"] = av_name.getDisplayName(); LLNotificationsUtil::add("DisplayNameUpdate", args); }