diff options
Diffstat (limited to 'linden/indra/newview/llfloaterfriends.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterfriends.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterfriends.cpp b/linden/indra/newview/llfloaterfriends.cpp index 0b4610c..cf25e8e 100644 --- a/linden/indra/newview/llfloaterfriends.cpp +++ b/linden/indra/newview/llfloaterfriends.cpp | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include <sstream> | 40 | #include <sstream> |
41 | 41 | ||
42 | #include "llavatarnamecache.h" | ||
42 | #include "lldir.h" | 43 | #include "lldir.h" |
43 | 44 | ||
44 | #include "llagent.h" | 45 | #include "llagent.h" |
@@ -254,6 +255,24 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id) | |||
254 | 255 | ||
255 | std::string fullname; | 256 | std::string fullname; |
256 | BOOL have_name = gCacheName->getFullName(agent_id, fullname); | 257 | BOOL have_name = gCacheName->getFullName(agent_id, fullname); |
258 | if (have_name) | ||
259 | { | ||
260 | if (LLAvatarNameCache::useDisplayNames() && !gSavedSettings.getBOOL("LegacyNamesForFriends")) | ||
261 | { | ||
262 | LLAvatarName avatar_name; | ||
263 | if (LLAvatarNameCache::get(agent_id, &avatar_name)) | ||
264 | { | ||
265 | if (LLAvatarNameCache::useDisplayNames() == 1) | ||
266 | { | ||
267 | fullname = avatar_name.mDisplayName; | ||
268 | } | ||
269 | else | ||
270 | { | ||
271 | fullname = avatar_name.getNames(); | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | } | ||
257 | 276 | ||
258 | LLSD element; | 277 | LLSD element; |
259 | element["id"] = agent_id; | 278 | element["id"] = agent_id; |
@@ -332,6 +351,24 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh | |||
332 | 351 | ||
333 | std::string fullname; | 352 | std::string fullname; |
334 | BOOL have_name = gCacheName->getFullName(agent_id, fullname); | 353 | BOOL have_name = gCacheName->getFullName(agent_id, fullname); |
354 | if (have_name) | ||
355 | { | ||
356 | if (LLAvatarNameCache::useDisplayNames() && !gSavedSettings.getBOOL("LegacyNamesForFriends")) | ||
357 | { | ||
358 | LLAvatarName avatar_name; | ||
359 | if (LLAvatarNameCache::get(agent_id, &avatar_name)) | ||
360 | { | ||
361 | if (LLAvatarNameCache::useDisplayNames() == 1) | ||
362 | { | ||
363 | fullname = avatar_name.mDisplayName; | ||
364 | } | ||
365 | else | ||
366 | { | ||
367 | fullname = avatar_name.getNames(); | ||
368 | } | ||
369 | } | ||
370 | } | ||
371 | } | ||
335 | 372 | ||
336 | // Name of the status icon to use | 373 | // Name of the status icon to use |
337 | std::string statusIcon; | 374 | std::string statusIcon; |
@@ -790,6 +827,25 @@ void LLPanelFriends::onClickRemove(void* user_data) | |||
790 | std::string first, last; | 827 | std::string first, last; |
791 | if(gCacheName->getName(agent_id, first, last)) | 828 | if(gCacheName->getName(agent_id, first, last)) |
792 | { | 829 | { |
830 | if (LLAvatarNameCache::useDisplayNames() && !gSavedSettings.getBOOL("LegacyNamesForFriends")) | ||
831 | { | ||
832 | LLAvatarName avatar_name; | ||
833 | if (LLAvatarNameCache::get(agent_id, &avatar_name)) | ||
834 | { | ||
835 | // Always show "Display Name [Legacy Name]" for security reasons | ||
836 | first = avatar_name.getNames(); | ||
837 | size_t i = first.find(" "); | ||
838 | if (i != std::string::npos) | ||
839 | { | ||
840 | last = first.substr(i + 1); | ||
841 | first = first.substr(0, i); | ||
842 | } | ||
843 | else | ||
844 | { | ||
845 | last = ""; | ||
846 | } | ||
847 | } | ||
848 | } | ||
793 | args["FIRST_NAME"] = first; | 849 | args["FIRST_NAME"] = first; |
794 | args["LAST_NAME"] = last; | 850 | args["LAST_NAME"] = last; |
795 | } | 851 | } |
@@ -854,6 +910,25 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command | |||
854 | std::string first, last; | 910 | std::string first, last; |
855 | if(gCacheName->getName(agent_id, first, last)) | 911 | if(gCacheName->getName(agent_id, first, last)) |
856 | { | 912 | { |
913 | if (LLAvatarNameCache::useDisplayNames() && !gSavedSettings.getBOOL("LegacyNamesForFriends")) | ||
914 | { | ||
915 | LLAvatarName avatar_name; | ||
916 | if (LLAvatarNameCache::get(agent_id, &avatar_name)) | ||
917 | { | ||
918 | // Always show "Display Name [Legacy Name]" for security reasons | ||
919 | first = avatar_name.getNames(); | ||
920 | size_t i = first.find(" "); | ||
921 | if (i != std::string::npos) | ||
922 | { | ||
923 | last = first.substr(i + 1); | ||
924 | first = first.substr(0, i); | ||
925 | } | ||
926 | else | ||
927 | { | ||
928 | last = ""; | ||
929 | } | ||
930 | } | ||
931 | } | ||
857 | args["FIRST_NAME"] = first; | 932 | args["FIRST_NAME"] = first; |
858 | args["LAST_NAME"] = last; | 933 | args["LAST_NAME"] = last; |
859 | } | 934 | } |