summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationhandlerutil.cpp
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2018-01-12 09:08:49 -0500
committerJonathan Yap <jhwelch@gmail.com>2018-01-12 09:08:49 -0500
commit1e586749efeeb8c40503330572680a8709ae5487 (patch)
tree5c1ebee5dbdb5004f354b9fb0837d60f6dd3cfcc /indra/newview/llnotificationhandlerutil.cpp
parent32f16633c77564d567ed0752e56eb38abb916ccd (diff)
parent1693ccba58eef676df1f91e50627545ac35bb819 (diff)
STORM-2145 Merge up to viewer-release
Diffstat (limited to 'indra/newview/llnotificationhandlerutil.cpp')
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index a078889d46..6a58196760 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -114,11 +114,11 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
}
}
-void log_name_callback(const std::string& full_name, const std::string& from_name,
+void log_name_callback(const LLAvatarName& av_name, const std::string& from_name,
const std::string& message, const LLUUID& from_id)
{
- LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, full_name, from_name, message,
+ LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, av_name.getUserName(), from_name, message,
from_id, LLUUID());
}
@@ -141,11 +141,11 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi
if(to_file_only)
{
- gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, "", notification->getMessage(), LLUUID()));
+ LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", notification->getMessage(), LLUUID()));
}
else
{
- gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id));
+ LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id));
}
}
@@ -167,9 +167,18 @@ void LLHandlerUtil::logGroupNoticeToIMGroup(
const std::string group_name = groupData.mName;
const std::string sender_name = payload["sender_name"].asString();
- // we can't retrieve sender id from group notice system message, so try to lookup it from cache
LLUUID sender_id;
- gCacheName->getUUID(sender_name, sender_id);
+ if (payload.has("sender_id"))
+ {
+ sender_id = payload["sender_id"].asUUID();
+ }
+
+ if (sender_id.notNull())
+ {
+ // Legacy support and fallback method
+ // if we can't retrieve sender id from group notice system message, try to lookup it from cache
+ sender_id = LLAvatarNameCache::findIdByName(sender_name);
+ }
logToIM(IM_SESSION_GROUP_START, group_name, sender_name, payload["message"],
payload["group_id"], sender_id);
@@ -219,7 +228,12 @@ std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notifica
{
from_id = notification->getPayload()["from_id"];
}
- if(!gCacheName->getFullName(from_id, res))
+ LLAvatarName av_name;
+ if(LLAvatarNameCache::get(from_id, &av_name))
+ {
+ res = av_name.getUserName();
+ }
+ else
{
res = "";
}
@@ -228,6 +242,20 @@ std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notifica
}
// static
+std::string LLHandlerUtil::getSubstitutionOriginalName(const LLNotificationPtr& notification)
+{
+ if(notification->getSubstitutions().has("ORIGINAL_NAME"))
+ {
+ std::string name = notification->getSubstitutions()["ORIGINAL_NAME"];
+ if(!name.empty())
+ {
+ return name;
+ }
+ }
+ return LLHandlerUtil::getSubstitutionName(notification);
+}
+
+// static
void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification)
{
const std::string name = LLHandlerUtil::getSubstitutionName(notification);