summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-04-15 16:22:15 -0700
committerJames Cook <james@lindenlab.com>2010-04-15 16:22:15 -0700
commit4218819951a5caa1499e79d8bd4f1bf08fe3b3cc (patch)
treecb9a4b19346e9e04d89098681ea67e20633c7353 /indra/llmessage
parentfedfbbb8d8696044cace410365e348b20a1e2420 (diff)
DEV-47529 Viewer looks up display names via a sim cap
Squire asked me to route display name lookups via a simulator capability using HTTP GET. This buys us authentication until the data services team can implement a public-facing authenticating web service for People API.
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llavatarnamecache.cpp87
-rw-r--r--indra/llmessage/llavatarnamecache.h19
2 files changed, 18 insertions, 88 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index bb1f6fdb3a..8268624b84 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -50,10 +50,9 @@ namespace LLAvatarNameCache
// Base lookup URL for name service.
// On simulator, loaded from indra.xml
- // On viewer, sent down from login.cgi
- // from login.cgi
- // Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/"
- std::string sNameServiceURL;
+ // On viewer, usually a simulator capability (at People API team's request)
+ // Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/agents/"
+ std::string sNameLookupURL;
// accumulated agent IDs for next query against service
typedef std::set<LLUUID> ask_queue_t;
@@ -155,7 +154,7 @@ void LLAvatarNameCache::processNameFromService(const LLSD& row)
LLAvatarName av_name;
av_name.mSLID = row["sl_id"].asString();
av_name.mDisplayName = row["display_name"].asString();
- //av_name.mIsDisplayNameDefault = row["is_display_name_default"].asBoolean();
+ av_name.mIsDisplayNameDefault = row["is_display_name_default"].asBoolean();
U32 now = (U32)LLFrameTimer::getTotalSeconds();
S32 seconds_until_expires = row["seconds_until_display_name_expires"].asInteger();
@@ -173,23 +172,6 @@ void LLAvatarNameCache::processNameFromService(const LLSD& row)
av_name.mDisplayName = av_name.mSLID;
}
- // HACK: Legacy users have '.' in their SLID
- // JAMESDEBUG TODO: change to using is_display_name_default once that works
- std::string mangled_name = av_name.mDisplayName;
- for (U32 i = 0; i < mangled_name.size(); i++)
- {
- char c = mangled_name[i];
- if (c == ' ')
- {
- mangled_name[i] = '.';
- }
- else
- {
- mangled_name[i] = tolower(c);
- }
- }
- av_name.mIsDisplayNameDefault = (mangled_name == av_name.mSLID);
-
// add to cache
LLUUID agent_id = row["id"].asUUID();
sCache[agent_id] = av_name;
@@ -227,8 +209,8 @@ void LLAvatarNameCache::requestNames()
if (url.empty())
{
// ...starting new request
- url += sNameServiceURL;
- url += "agents/?ids=";
+ url += sNameLookupURL;
+ url += "?ids=";
}
else
{
@@ -253,9 +235,8 @@ void LLAvatarNameCache::requestNames()
}
}
-void LLAvatarNameCache::initClass(const std::string& name_service_url)
+void LLAvatarNameCache::initClass()
{
- setNameServiceURL(name_service_url);
}
void LLAvatarNameCache::cleanupClass()
@@ -270,9 +251,9 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr)
{
}
-void LLAvatarNameCache::setNameServiceURL(const std::string& name_service_url)
+void LLAvatarNameCache::setNameLookupURL(const std::string& name_lookup_url)
{
- sNameServiceURL = name_service_url;
+ sNameLookupURL = name_lookup_url;
}
void LLAvatarNameCache::idle()
@@ -292,6 +273,12 @@ void LLAvatarNameCache::idle()
eraseExpired();
}
+ if (sNameLookupURL.empty())
+ {
+ // ...viewer has not yet received capability from region
+ return;
+ }
+
if (sAskQueue.empty())
{
return;
@@ -392,50 +379,6 @@ void LLAvatarNameCache::get(const LLUUID& agent_id, callback_slot_t slot)
}
}
-// JAMESDEBUG TODO: Eliminate and only route changes through simulator
-class LLSetNameResponder : public LLHTTPClient::Responder
-{
-public:
- LLUUID mAgentID;
- LLAvatarNameCache::set_name_signal_t mSignal;
-
- LLSetNameResponder(const LLUUID& agent_id,
- const LLAvatarNameCache::set_name_slot_t& slot)
- : mAgentID(agent_id),
- mSignal()
- {
- mSignal.connect(slot);
- }
-
- /*virtual*/ void result(const LLSD& content)
- {
- // force re-fetch
- LLAvatarNameCache::sCache.erase(mAgentID);
-
- mSignal(true, "", content);
- }
-
- /*virtual*/ void error(U32 status, const std::string& reason)
- {
- llinfos << "LLSetNameResponder failed " << status
- << " reason " << reason << llendl;
-
- mSignal(false, reason, LLSD());
- }
-};
-
-// JAMESDEBUG TODO: Eliminate and only route changes through simulator
-void LLAvatarNameCache::setDisplayName(const LLUUID& agent_id,
- const std::string& display_name,
- const set_name_slot_t& slot)
-{
- LLSD body;
- body["display_name"] = display_name;
-
- std::string url = sNameServiceURL + "agent/";
- url += agent_id.asString();
- LLHTTPClient::post(url, body, new LLSetNameResponder(agent_id, slot));
-}
void LLAvatarNameCache::toggleDisplayNames()
{
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index a4e101899a..111e56433b 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -42,13 +42,14 @@ class LLUUID;
namespace LLAvatarNameCache
{
- void initClass(const std::string& name_service_url);
+ void initClass();
void cleanupClass();
void importFile(std::istream& istr);
void exportFile(std::ostream& ostr);
- void setNameServiceURL(const std::string& name_service_url);
+ // On the viewer, usually a simulator capabilitity
+ void setNameLookupURL(const std::string& name_lookup_url);
// Periodically makes a batch request for display names not already in
// cache. Call once per frame.
@@ -68,20 +69,6 @@ namespace LLAvatarNameCache
// If name information is in cache, callback will be called immediately.
void get(const LLUUID& agent_id, callback_slot_t slot);
- // JAMESDEBUG TODO: remove code to set display name, handle in
- // application layer because it's different for client and server
-
- // Callback types for setDisplayName() below
- typedef boost::signals2::signal<
- void (bool success, const std::string& reason, const LLSD& content)>
- set_name_signal_t;
- typedef set_name_signal_t::slot_type set_name_slot_t;
-
- // Sends an update to the server to change a display name
- // and calls back the application layer when done
- void setDisplayName(const LLUUID& agent_id, const std::string& display_name,
- const set_name_slot_t& slot);
-
// HACK: turn display names on and off
void toggleDisplayNames();
bool useDisplayNames();