diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llappviewer.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index d920e84..0c3c657 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp | |||
@@ -1259,6 +1259,7 @@ bool LLAppViewer::cleanup() | |||
1259 | 1259 | ||
1260 | LLPolyMesh::freeAllMeshes(); | 1260 | LLPolyMesh::freeAllMeshes(); |
1261 | 1261 | ||
1262 | LLAvatarNameCache::cleanupClass(); | ||
1262 | delete gCacheName; | 1263 | delete gCacheName; |
1263 | gCacheName = NULL; | 1264 | gCacheName = NULL; |
1264 | 1265 | ||
@@ -3300,6 +3301,14 @@ void LLAppViewer::saveFinalSnapshot() | |||
3300 | 3301 | ||
3301 | void LLAppViewer::loadNameCache() | 3302 | void LLAppViewer::loadNameCache() |
3302 | { | 3303 | { |
3304 | // display names cache | ||
3305 | std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); | ||
3306 | llifstream name_cache_stream(filename); | ||
3307 | if (name_cache_stream.is_open()) | ||
3308 | { | ||
3309 | LLAvatarNameCache::importFile(name_cache_stream); | ||
3310 | } | ||
3311 | |||
3303 | if (!gCacheName) return; | 3312 | if (!gCacheName) return; |
3304 | 3313 | ||
3305 | std::string name_cache; | 3314 | std::string name_cache; |
@@ -3322,6 +3331,14 @@ void LLAppViewer::loadNameCache() | |||
3322 | 3331 | ||
3323 | void LLAppViewer::saveNameCache() | 3332 | void LLAppViewer::saveNameCache() |
3324 | { | 3333 | { |
3334 | // display names cache | ||
3335 | std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); | ||
3336 | llofstream name_cache_stream(filename); | ||
3337 | if (name_cache_stream.is_open()) | ||
3338 | { | ||
3339 | LLAvatarNameCache::exportFile(name_cache_stream); | ||
3340 | } | ||
3341 | |||
3325 | if (!gCacheName) return; | 3342 | if (!gCacheName) return; |
3326 | 3343 | ||
3327 | std::string name_cache; | 3344 | std::string name_cache; |
@@ -3526,6 +3543,8 @@ void LLAppViewer::idle() | |||
3526 | // floating throughout the various object lists. | 3543 | // floating throughout the various object lists. |
3527 | // | 3544 | // |
3528 | 3545 | ||
3546 | idleNameCache(); | ||
3547 | |||
3529 | gFrameStats.start(LLFrameStats::IDLE_NETWORK); | 3548 | gFrameStats.start(LLFrameStats::IDLE_NETWORK); |
3530 | stop_glerror(); | 3549 | stop_glerror(); |
3531 | idleNetwork(); | 3550 | idleNetwork(); |
@@ -3907,6 +3926,60 @@ void LLAppViewer::sendLogoutRequest() | |||
3907 | } | 3926 | } |
3908 | } | 3927 | } |
3909 | 3928 | ||
3929 | void LLAppViewer::idleNameCache() | ||
3930 | { | ||
3931 | // Neither old nor new name cache can function before agent has a region | ||
3932 | LLViewerRegion* region = gAgent.getRegion(); | ||
3933 | if (!region) return; | ||
3934 | |||
3935 | // deal with any queued name requests and replies. | ||
3936 | gCacheName->processPending(); | ||
3937 | |||
3938 | // Can't run the new cache until we have the list of capabilities | ||
3939 | // for the agent region, and can therefore decide whether to use | ||
3940 | // display names or fall back to the old name system. | ||
3941 | if (!region->capabilitiesReceived()) return; | ||
3942 | |||
3943 | // Agent may have moved to a different region, so need to update cap URL | ||
3944 | // for name lookups. Can't do this in the cap grant code, as caps are | ||
3945 | // granted to neighbor regions before the main agent gets there. Can't | ||
3946 | // do it in the move-into-region code because cap not guaranteed to be | ||
3947 | // granted yet, for example on teleport. | ||
3948 | bool had_capability = LLAvatarNameCache::hasNameLookupURL(); | ||
3949 | std::string name_lookup_url; | ||
3950 | name_lookup_url.reserve(128); // avoid a memory allocation below | ||
3951 | name_lookup_url = region->getCapability("GetDisplayNames"); | ||
3952 | bool have_capability = !name_lookup_url.empty(); | ||
3953 | if (have_capability) | ||
3954 | { | ||
3955 | // we have support for display names, use it | ||
3956 | U32 url_size = name_lookup_url.size(); | ||
3957 | // capabilities require URLs with slashes before query params: | ||
3958 | // https://<host>:<port>/cap/<uuid>/?ids=<blah> | ||
3959 | // but the caps are granted like: | ||
3960 | // https://<host>:<port>/cap/<uuid> | ||
3961 | if (url_size > 0 && name_lookup_url[url_size-1] != '/') | ||
3962 | { | ||
3963 | name_lookup_url += '/'; | ||
3964 | } | ||
3965 | LLAvatarNameCache::setNameLookupURL(name_lookup_url); | ||
3966 | } | ||
3967 | else | ||
3968 | { | ||
3969 | // Display names not available on this region | ||
3970 | LLAvatarNameCache::setNameLookupURL( std::string() ); | ||
3971 | } | ||
3972 | |||
3973 | // Error recovery - did we change state? | ||
3974 | if (had_capability != have_capability) | ||
3975 | { | ||
3976 | // name tags are persistant on screen, so make sure they refresh | ||
3977 | LLVOAvatar::invalidateNameTags(); | ||
3978 | } | ||
3979 | |||
3980 | LLAvatarNameCache::idle(); | ||
3981 | } | ||
3982 | |||
3910 | // | 3983 | // |
3911 | // Handle messages, and all message related stuff | 3984 | // Handle messages, and all message related stuff |
3912 | // | 3985 | // |