summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-03-03 10:10:55 -0800
committerJames Cook <james@lindenlab.com>2010-03-03 10:10:55 -0800
commit75cc897c062ffb4d59649a7af760d5e89396a3f8 (patch)
tree3bc5262cf51c60b99a941f6b1e0a6d975f22e56d
parent0957fa04395453e5b336ee77af3a21215f9369ca (diff)
Underlined display names now update reliably.
-rw-r--r--indra/llui/llurlentry.cpp61
-rw-r--r--indra/llui/llurlentry.h3
-rw-r--r--indra/llui/tests/llurlentry_stub.cpp5
3 files changed, 45 insertions, 24 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 22920d1656..5a2956311e 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -324,21 +324,18 @@ void LLUrlEntryAgent::onNameCache(const LLUUID& id,
const std::string& full_name,
bool is_group)
{
+ callObservers(id.asString(), full_name, mIcon);
+}
+
+void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id,
+ const LLAvatarName& av_name)
+{
// IDEVO demo code
- LLAvatarName av_name;
- if (LLAvatarNameCache::useDisplayNames()
- && LLAvatarNameCache::get(id, &av_name))
- {
- std::string label = av_name.mDisplayName + " (" + av_name.mSLID + ")";
- // use custom icon if available
- std::string icon = (!av_name.mBadge.empty() ? av_name.mBadge : mIcon);
- // received the agent name from the server - tell our observers
- callObservers(id.asString(), label, icon);
- }
- else
- {
- callObservers(id.asString(), full_name, mIcon);
- }
+ std::string label = av_name.mDisplayName + " (" + av_name.mSLID + ")";
+ // use custom icon if available
+ std::string icon = (!av_name.mBadge.empty() ? av_name.mBadge : mIcon);
+ // received the agent name from the server - tell our observers
+ callObservers(id.asString(), label, icon);
}
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
@@ -357,27 +354,43 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
}
LLUUID agent_id(agent_id_string);
- std::string full_name;
if (agent_id.isNull())
{
return LLTrans::getString("AvatarNameNobody");
}
- else if (gCacheName->getFullName(agent_id, full_name))
+
+ if (LLAvatarNameCache::useDisplayNames())
{
LLAvatarName av_name;
- if (LLAvatarNameCache::useDisplayNames()
- && LLAvatarNameCache::get(agent_id, &av_name))
+ if (LLAvatarNameCache::get(agent_id, &av_name))
+ {
return av_name.mDisplayName + " (" + av_name.mSLID + ")";
+ }
else
- return full_name;
+ {
+ LLAvatarNameCache::get(agent_id,
+ boost::bind(&LLUrlEntryAgent::onAvatarNameCache,
+ this, _1, _2));
+ addObserver(agent_id_string, url, cb);
+ return LLTrans::getString("LoadingData");
+ }
}
else
{
- gCacheName->get(agent_id, false,
- boost::bind(&LLUrlEntryAgent::onNameCache,
- this, _1, _2, _3));
- addObserver(agent_id_string, url, cb);
- return LLTrans::getString("LoadingData");
+ // ...no display names
+ std::string full_name;
+ if (gCacheName->getFullName(agent_id, full_name))
+ {
+ return full_name;
+ }
+ else
+ {
+ gCacheName->get(agent_id, false,
+ boost::bind(&LLUrlEntryAgent::onNameCache,
+ this, _1, _2, _3));
+ addObserver(agent_id_string, url, cb);
+ return LLTrans::getString("LoadingData");
+ }
}
}
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 1f0caeacf5..c075ccc30e 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -41,6 +41,8 @@
#include <string>
#include <map>
+class LLAvatarName;
+
typedef boost::signals2::signal<void (const std::string& url,
const std::string& label,
const std::string& icon)> LLUrlLabelSignal;
@@ -173,6 +175,7 @@ public:
private:
void onNameCache(const LLUUID& id, const std::string& full_name, bool is_group);
+ void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name);
};
///
diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index 280554b954..e984f5cf81 100644
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -34,6 +34,11 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
return false;
}
+void LLAvatarNameCache::get(const LLUUID& agent_id, callback_slot_t slot)
+{
+ return;
+}
+
bool LLAvatarNameCache::useDisplayNames()
{
return false;