summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llmessage/llcachename.cpp6
-rw-r--r--indra/llmessage/llcachename.h7
-rw-r--r--indra/llui/llnotifications.cpp42
-rw-r--r--indra/llui/llnotifications.h16
-rw-r--r--indra/llui/llurlentry.cpp2
-rw-r--r--indra/llui/tests/llurlentry_stub.cpp5
-rw-r--r--indra/newview/llavatariconctrl.cpp27
-rw-r--r--indra/newview/llavatariconctrl.h7
-rw-r--r--indra/newview/llimview.cpp24
-rw-r--r--indra/newview/llinspectgroup.cpp2
-rw-r--r--indra/newview/lllogchat.cpp27
-rw-r--r--indra/newview/lllogchat.h2
-rw-r--r--indra/newview/llnearbychat.cpp8
-rw-r--r--indra/newview/llpanelme.cpp14
-rw-r--r--indra/newview/llviewermessage.cpp2
-rw-r--r--indra/newview/llvoicevivox.cpp8
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml8
17 files changed, 158 insertions, 49 deletions
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 8e87b6f9b9..c6c189c7a1 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -582,6 +582,12 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, co
return res;
}
+boost::signals2::connection LLCacheName::getGroup(const LLUUID& group_id,
+ const LLCacheNameCallback& callback)
+{
+ return get(group_id, true, callback);
+}
+
boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, old_callback_t callback, void* user_data)
{
return get(id, is_group, boost::bind(callback, _1, _2, _3, user_data));
diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h
index 6b6bbde6ab..45dae562ad 100644
--- a/indra/llmessage/llcachename.h
+++ b/indra/llmessage/llcachename.h
@@ -102,7 +102,12 @@ public:
// otherwise, will request the data, and will call the callback when
// available. There is no garuntee the callback will ever be called.
boost::signals2::connection get(const LLUUID& id, bool is_group, const LLCacheNameCallback& callback);
-
+
+ // Convenience method for looking up a group name, so you can
+ // tell the difference between avatar lookup and group lookup
+ // in global searches
+ boost::signals2::connection getGroup(const LLUUID& group_id, const LLCacheNameCallback& callback);
+
// LEGACY
boost::signals2::connection get(const LLUUID& id, bool is_group, old_callback_t callback, void* user_data);
// This method needs to be called from time to time to send out
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 23f79aad36..27e59a0475 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -34,6 +34,8 @@
#include "llnotifications.h"
+#include "llavatarnamecache.h"
+#include "llcachename.h"
#include "llxmlnode.h"
#include "lluictrl.h"
#include "lluictrlfactory.h"
@@ -1488,12 +1490,42 @@ std::ostream& operator<<(std::ostream& s, const LLNotification& notification)
return s;
}
-void LLPostponedNotification::onCachedNameReceived(const LLUUID& id,
- const std::string& full_name,
- bool is_group)
+//static
+void LLPostponedNotification::lookupName(LLPostponedNotification* thiz,
+ const LLUUID& id,
+ bool is_group)
+{
+ if (is_group)
+ {
+ gCacheName->getGroup(id,
+ boost::bind(&LLPostponedNotification::onGroupNameCache,
+ thiz, _1, _2, _3));
+ }
+ else
+ {
+ LLAvatarNameCache::get(id,
+ boost::bind(&LLPostponedNotification::onAvatarNameCache,
+ thiz, _1, _2));
+ }
+}
+
+void LLPostponedNotification::onGroupNameCache(const LLUUID& id,
+ const std::string& full_name,
+ bool is_group)
+{
+ finalizeName(full_name);
+}
+
+void LLPostponedNotification::onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name)
+{
+ std::string name = av_name.getCompleteName();
+ finalizeName(name);
+}
+
+void LLPostponedNotification::finalizeName(const std::string& name)
{
- // *TODO: This is dumb, just use full_name as given
- gCacheName->getFullName(id, mName);
+ mName = name;
modifyNotificationParams();
LLNotifications::instance().add(mParams);
cleanup();
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index f818b386b5..73357daaef 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -104,8 +104,8 @@
#include "llinitparam.h"
#include "llnotificationslistener.h"
#include "llnotificationptr.h"
-#include "llcachename.h"
+class LLAvatarName;
typedef enum e_notification_priority
{
@@ -1000,16 +1000,20 @@ public:
{
// upcast T to the base type to restrict T derivation from LLPostponedNotification
LLPostponedNotification* thiz = new T();
-
thiz->mParams = params;
- gCacheName->get(id, is_group, boost::bind(
- &LLPostponedNotification::onCachedNameReceived, thiz, _1, _2,
- _3));
+ // Avoid header file dependency on llcachename.h
+ lookupName(thiz, id, is_group);
}
private:
- void onCachedNameReceived(const LLUUID& id, const std::string& full_name, bool is_group);
+ static void lookupName(LLPostponedNotification* thiz, const LLUUID& id, bool is_group);
+ // only used for groups
+ void onGroupNameCache(const LLUUID& id, const std::string& full_name, bool is_group);
+ // only used for avatars
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+ // used for both group and avatar names
+ void finalizeName(const std::string& name);
void cleanup()
{
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 2dda64c434..866c228a12 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -665,7 +665,7 @@ std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCa
}
else
{
- gCacheName->get(group_id, true,
+ gCacheName->getGroup(group_id,
boost::bind(&LLUrlEntryGroup::onGroupNameReceived,
this, _1, _2, _3));
addObserver(group_id_string, url, cb);
diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index 5c57ac786e..bc0f5dc9c2 100644
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -64,6 +64,11 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, co
return boost::signals2::connection();
}
+boost::signals2::connection LLCacheName::getGroup(const LLUUID& id, const LLCacheNameCallback& callback)
+{
+ return boost::signals2::connection();
+}
+
LLCacheName* gCacheName = NULL;
//
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index 11cc456695..f4d5d45726 100644
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -34,17 +34,19 @@
#include "llavatariconctrl.h"
+// viewer includes
#include "llagent.h"
#include "llavatarconstants.h"
#include "llcallingcard.h" // for LLAvatarTracker
#include "llavataractions.h"
#include "llmenugl.h"
#include "lluictrlfactory.h"
-
-#include "llcachename.h"
#include "llagentdata.h"
#include "llimfloater.h"
+// library includes
+#include "llavatarnamecache.h"
+
#define MENU_ITEM_VIEW_PROFILE 0
#define MENU_ITEM_SEND_IM 1
@@ -233,6 +235,9 @@ void LLAvatarIconCtrl::setValue(const LLSD& value)
// Check if cache already contains image_id for that avatar
if (!updateFromCache())
{
+ // *TODO: Consider getting avatar icon/badge directly from
+ // People API, rather than sending AvatarPropertyRequest
+ // messages. People API already hits the user table.
LLIconCtrl::setValue(mDefaultIconName);
app->addObserver(mAvatarId, this);
app->sendAvatarPropertiesRequest(mAvatarId);
@@ -244,8 +249,9 @@ void LLAvatarIconCtrl::setValue(const LLSD& value)
LLIconCtrl::setValue(value);
}
- gCacheName->get(mAvatarId, false,
- boost::bind(&LLAvatarIconCtrl::nameUpdatedCallback, this, _1, _2, _3));
+ LLAvatarNameCache::get(mAvatarId,
+ boost::bind(&LLAvatarIconCtrl::onAvatarNameCache,
+ this, _1, _2));
}
bool LLAvatarIconCtrl::updateFromCache()
@@ -288,18 +294,17 @@ void LLAvatarIconCtrl::processProperties(void* data, EAvatarProcessorType type)
}
}
-void LLAvatarIconCtrl::nameUpdatedCallback(
- const LLUUID& id,
- const std::string& name,
- bool is_group)
+void LLAvatarIconCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
{
- if (id == mAvatarId)
+ if (agent_id == mAvatarId)
{
- mFullName = name;
+ // Most avatar icon controls are next to a UI element that shows
+ // a display name, so only show username.
+ mFullName = av_name.mUsername;
if (mDrawTooltip)
{
- setToolTip(name);
+ setToolTip(mFullName);
}
else
{
diff --git a/indra/newview/llavatariconctrl.h b/indra/newview/llavatariconctrl.h
index a5452ee1d3..5befc73d92 100644
--- a/indra/newview/llavatariconctrl.h
+++ b/indra/newview/llavatariconctrl.h
@@ -37,6 +37,8 @@
#include "llavatarpropertiesprocessor.h"
#include "llviewermenu.h"
+class LLAvatarName;
+
class LLAvatarIconIDCache: public LLSingleton<LLAvatarIconIDCache>
{
public:
@@ -90,10 +92,7 @@ public:
// LLAvatarPropertiesProcessor observer trigger
virtual void processProperties(void* data, EAvatarProcessorType type);
- void nameUpdatedCallback(
- const LLUUID& id,
- const std::string& name,
- bool is_group);
+ void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
const LLUUID& getAvatarId() const { return mAvatarId; }
const std::string& getFullName() const { return mFullName; }
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index e915d3ad70..e6db942bad 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -270,7 +270,7 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
// no text notifications
break;
case P2P_SESSION:
- gCacheName->getFullName(mOtherParticipantID, other_avatar_name);
+ gCacheName->getFullName(mOtherParticipantID, other_avatar_name); // voice
if(direction == LLVoiceChannel::INCOMING_CALL)
{
@@ -405,13 +405,17 @@ void LLIMModel::LLIMSession::addMessagesFromHistory(const std::list<LLSD>& histo
const LLSD& msg = *it;
std::string from = msg[IM_FROM];
- LLUUID from_id = LLUUID::null;
- if (msg[IM_FROM_ID].isUndefined())
+ LLUUID from_id;
+ if (msg[IM_FROM_ID].isDefined())
{
+ from_id = msg[IM_FROM_ID].asUUID();
+ }
+ else
+ {
+ // Legacy chat logs only wrote the legacy name, not the agent_id
gCacheName->getUUID(from, from_id);
}
-
std::string timestamp = msg[IM_TIME];
std::string text = msg[IM_TEXT];
@@ -2582,7 +2586,7 @@ void LLIMMgr::inviteToSession(
{
if (caller_name.empty())
{
- gCacheName->get(caller_id, false,
+ gCacheName->get(caller_id, false, // voice
boost::bind(&LLIMMgr::onInviteNameLookup, payload, _1, _2, _3));
}
else
@@ -2816,12 +2820,14 @@ void LLIMMgr::noteOfflineUsers(
for(S32 i = 0; i < count; ++i)
{
info = at.getBuddyInfo(ids.get(i));
- std::string full_name;
- if(info && !info->isOnline()
- && gCacheName->getFullName(ids.get(i), full_name))
+ LLAvatarName av_name;
+ if (info
+ && !info->isOnline()
+ && LLAvatarNameCache::get(ids.get(i), &av_name))
{
LLUIString offline = LLTrans::getString("offline_message");
- offline.setArg("[NAME]", full_name);
+ // Use display name only because this user is your friend
+ offline.setArg("[NAME]", av_name.mDisplayName);
im_model.proccessOnlineOfflineNotification(session_id, offline);
}
}
diff --git a/indra/newview/llinspectgroup.cpp b/indra/newview/llinspectgroup.cpp
index 364da3f64c..fa1640c4c7 100644
--- a/indra/newview/llinspectgroup.cpp
+++ b/indra/newview/llinspectgroup.cpp
@@ -224,7 +224,7 @@ void LLInspectGroup::requestUpdate()
mPropertiesRequest = new LLFetchGroupData(mGroupID, this);
// Name lookup will be faster out of cache, use that
- gCacheName->get(mGroupID, true,
+ gCacheName->getGroup(mGroupID,
boost::bind(&LLInspectGroup::nameUpdatedCallback,
this, _1, _2, _3));
}
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index be8b2363ad..1d348834fe 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -426,6 +426,12 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const
return;
}
+ if (im[IM_FROM_ID].isDefined())
+ {
+ LLUUID from_id = im[IM_FROM_ID].asUUID();
+ ostr << '{' << from_id.asString() << '}';
+ }
+
if (im[IM_TIME].isDefined())
{
std::string timestamp = im[IM_TIME].asString();
@@ -456,15 +462,32 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const
}
}
-bool LLChatLogParser::parse(std::string& raw, LLSD& im)
+bool LLChatLogParser::parse(const std::string& raw, LLSD& im)
{
if (!raw.length()) return false;
im = LLSD::emptyMap();
+ // In Viewer 2.1 we added UUID to chat/IM logging so we can look up
+ // display names
+ std::string line = raw;
+ if (raw[0] == '{')
+ {
+ const S32 UUID_LEN = 36;
+ size_t pos = line.find_first_of('}');
+ // If it matches, pos will be 37
+ if (pos != line.npos && pos > UUID_LEN)
+ {
+ std::string uuid_string = line.substr(1, UUID_LEN);
+ LLUUID from_id(uuid_string);
+ im[IM_FROM_ID] = from_id;
+ line = line.substr(pos + 1);
+ }
+ }
+
//matching a timestamp
boost::match_results<std::string::const_iterator> matches;
- if (!boost::regex_match(raw, matches, TIMESTAMP_AND_STUFF)) return false;
+ if (!boost::regex_match(line, matches, TIMESTAMP_AND_STUFF)) return false;
bool has_timestamp = matches[IDX_TIMESTAMP].matched;
if (has_timestamp)
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index 4290e4bbc0..a67b58e55b 100644
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -106,7 +106,7 @@ public:
*
* @return false if failed to parse mandatory data - message text
*/
- static bool parse(std::string& raw, LLSD& im);
+ static bool parse(const std::string& raw, LLSD& im);
protected:
LLChatLogParser();
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index f1c13de8bb..74ede67c97 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -301,8 +301,12 @@ void LLNearbyChat::loadHistory()
const LLSD& msg = *it;
std::string from = msg[IM_FROM];
- LLUUID from_id = LLUUID::null;
- if (msg[IM_FROM_ID].isUndefined())
+ LLUUID from_id;
+ if (msg[IM_FROM_ID].isDefined())
+ {
+ from_id = msg[IM_FROM_ID].asUUID();
+ }
+ else
{
gCacheName->getUUID(from, from_id);
}
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index c1d02fae39..544ca47da4 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -347,12 +347,22 @@ void LLPanelMyProfileEdit::onCacheSetName(bool success,
void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
+ if (option == 0 || option == 1)
{
LLUUID agent_id = notification["payload"]["agent_id"];
if (agent_id.isNull()) return;
- std::string display_name_utf8 = response["display_name"].asString();
+ std::string display_name_utf8;
+ if (option == 0)
+ {
+ // user gave us a name
+ display_name_utf8 = response["display_name"].asString();
+ }
+ else
+ {
+ // reset back to People API default
+ display_name_utf8 = "";
+ }
const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes
LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8);
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index bb64494d87..21ba38ecfc 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5069,7 +5069,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
// the user sees a "Loading..." message
if (is_name_group)
{
- gCacheName->get(name_id, true,
+ gCacheName->getGroup(name_id,
boost::bind(&money_balance_group_notify,
_1, _2, _3,
notification, final_args, payload));
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 409e507c16..a9e14e4e89 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -2658,12 +2658,16 @@ void LLVivoxVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
void LLVivoxVoiceClient::checkFriend(const LLUUID& id)
{
- std::string name;
buddyListEntry *buddy = findBuddy(id);
// Make sure we don't add a name before it's been looked up.
- if(gCacheName->getFullName(id, name))
+ LLAvatarName av_name;
+ if(LLAvatarNameCache::get(id, &av_name))
{
+ // *NOTE: For now, we feed legacy names to Vivox because I don't know
+ // if their service can support a mix of new and old clients with
+ // different sorts of names.
+ std::string name = av_name.getLegacyName();
const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
bool canSeeMeOnline = false;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index cc32941633..51b88cf59a 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3145,7 +3145,9 @@ You are no longer frozen.
icon="alertmodal.tga"
name="SetDisplayName"
type="alertmodal">
-Change your display name?
+Change your display name (used for name tags, chat, etc.)?
+
+You can also reset it back to your original username.
<form name="form">
<input name="display_name" type="text">
[DISPLAY_NAME]
@@ -3157,6 +3159,10 @@ Change your display name?
text="Change"/>
<button
index="1"
+ name="Reset"
+ text="Reset"/>
+ <button
+ index="2"
name="Cancel"
text="Cancel"/>
</form>