summaryrefslogtreecommitdiff
path: root/indra/llmessage/llavatarnamecache.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-02-22 16:41:56 -0800
committerJames Cook <james@lindenlab.com>2010-02-22 16:41:56 -0800
commit3791745054546dbebb3373371aaf7a0ddad608a3 (patch)
treeae5225cf9265eac3262c518dc508f937f09e75c7 /indra/llmessage/llavatarnamecache.cpp
parentd3582dc3ffb1ecb8a8888d17c4196c1c446a9a9a (diff)
Simple button to change your display name
Talks to web service so other people can see the change, but for now they need to relog or toggle display names on/off to clear their cache.
Diffstat (limited to 'indra/llmessage/llavatarnamecache.cpp')
-rw-r--r--indra/llmessage/llavatarnamecache.cpp33
1 files changed, 33 insertions, 0 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;