Display names from Phoenix. Thanks Wolfspirit!

That's quite a piece of work. I have NO idea how Jess can downplay the
effort that went into this.

And it's still not complete, local chat is not affected, perhaps group
chat too.
This commit is contained in:
Siana Gearz
2010-11-20 06:01:09 +01:00
parent a80470865f
commit 6866a36a5c
31 changed files with 2151 additions and 27 deletions

View File

@@ -171,10 +171,7 @@
#include "llviewerthrottle.h"
#include "llparcel.h"
#include "llavatarnamecache.h"
#include "llinventoryview.h"
#include "llcommandlineparser.h"
@@ -1199,6 +1196,8 @@ bool LLAppViewer::cleanup()
LLPolyMesh::freeAllMeshes();
LLAvatarNameCache::cleanupClass();
delete gCacheName;
gCacheName = NULL;
@@ -3201,6 +3200,15 @@ void LLAppViewer::saveFinalSnapshot()
void LLAppViewer::loadNameCache()
{
// Phoenix: Wolfspirit: Loads the Display Name Cache. And set if we are using Display Names.
std::string filename =
gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
llifstream name_cache_stream(filename);
if(name_cache_stream.is_open())
{
LLAvatarNameCache::importFile(name_cache_stream);
}
if (!gCacheName) return;
std::string name_cache;
@@ -3223,6 +3231,15 @@ void LLAppViewer::loadNameCache()
void LLAppViewer::saveNameCache()
{
// Phoenix: Wolfspirit: Saves the Display Name Cache.
std::string filename =
gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
llofstream name_cache_stream(filename);
if(name_cache_stream.is_open())
{
LLAvatarNameCache::exportFile(name_cache_stream);
}
if (!gCacheName) return;
std::string name_cache;
@@ -3406,6 +3423,9 @@ void LLAppViewer::idle()
{
LLFastTimer t(LLFastTimer::FTM_NETWORK);
// Phoenix: Wolfspirit: Prepare the namecache.
idleNameCache();
////////////////////////////////////////////////
//
// Network processing
@@ -3739,6 +3759,61 @@ public:
};
void LLAppViewer::idleNameCache()
{
// Neither old nor new name cache can function before agent has a region
LLViewerRegion* region = gAgent.getRegion();
if (!region) return;
// deal with any queued name requests and replies.
gCacheName->processPending();
// Can't run the new cache until we have the list of capabilities
// for the agent region, and can therefore decide whether to use
// display names or fall back to the old name system.
if (!region->capabilitiesReceived()) return;
// Agent may have moved to a different region, so need to update cap URL
// for name lookups. Can't do this in the cap grant code, as caps are
// granted to neighbor regions before the main agent gets there. Can't
// do it in the move-into-region code because cap not guaranteed to be
// granted yet, for example on teleport.
bool had_capability = LLAvatarNameCache::hasNameLookupURL();
std::string name_lookup_url;
name_lookup_url.reserve(128); // avoid a memory allocation below
name_lookup_url = region->getCapability("GetDisplayNames");
bool have_capability = !name_lookup_url.empty();
if (have_capability)
{
// we have support for display names, use it
U32 url_size = name_lookup_url.size();
// capabilities require URLs with slashes before query params:
// https://<host>:<port>/cap/<uuid>/?ids=<blah>
// but the caps are granted like:
// https://<host>:<port>/cap/<uuid>
if (url_size > 0 && name_lookup_url[url_size-1] != '/')
{
name_lookup_url += '/';
}
LLAvatarNameCache::setNameLookupURL(name_lookup_url);
}
else
{
// Display names not available on this region
LLAvatarNameCache::setNameLookupURL( std::string() );
}
// Error recovery - did we change state?
if (had_capability != have_capability)
{
// name tags are persistant on screen, so make sure they refresh
//LLVOAvatar::invalidateNameTags();
}
// Phoenix: Wolfspirit: Check if we are using Display Names and set it. Then idle the cache.
LLAvatarNameCache::idle();
}
void LLAppViewer::sendLogoutRequest()
{