summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llmessage/llcachename.cpp6
-rw-r--r--indra/llmessage/llcachename.h4
-rw-r--r--indra/newview/llviewermessage.cpp30
3 files changed, 22 insertions, 18 deletions
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 0e8f9f4828..9ca0347f83 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -520,6 +520,12 @@ std::string LLCacheName::buildFullName(const std::string& first, const std::stri
return fullname;
}
+//static
+std::string LLCacheName::cleanFullName(const std::string& full_name)
+{
+ return full_name.substr(0, full_name.find(" Resident"));
+}
+
// This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer.
// The reason it is a slot is so that the legacy get() function below can bind an old callback
// and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior
diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h
index 59ad03cfcc..083975d4ca 100644
--- a/indra/llmessage/llcachename.h
+++ b/indra/llmessage/llcachename.h
@@ -86,6 +86,10 @@ public:
// IDEVO Temporary code
// Clean up new-style "bobsmith123 Resident" names to "bobsmith123" for display
static std::string buildFullName(const std::string& first, const std::string& last);
+
+ // Clean up legacy "bobsmith123 Resident" to "bobsmith123"
+ // If name does not contain "Resident" returns it unchanged.
+ static std::string cleanFullName(const std::string& full_name);
// If available, this method copies the group name into the string
// provided. The caller must allocate at least
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index f8da6eab3d..6ead920946 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1631,7 +1631,6 @@ static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("Ser
// (rather than a script)
static std::string clean_name_from_im(const std::string& name, EInstantMessage type)
{
- U32 pos = 0;
switch(type)
{
case IM_NOTHING_SPECIAL:
@@ -1674,8 +1673,7 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t
case IM_FRIENDSHIP_DECLINED_DEPRECATED:
//IM_TYPING_START
//IM_TYPING_STOP
- pos = name.find(" Resident");
- return name.substr(0, pos);
+ return LLCacheName::cleanFullName(name);
default:
return name;
}
@@ -2557,16 +2555,6 @@ void process_decline_callingcard(LLMessageSystem* msg, void**)
LLNotificationsUtil::add("CallingCardDeclined");
}
-static std::string clean_name_from_chat(const std::string& full_name, EChatSourceType type)
-{
- if (type == CHAT_SOURCE_AGENT)
- {
- U32 pos = full_name.find(" Resident");
- return full_name.substr(0, pos);
- }
- return full_name;
-}
-
void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
{
LLChat chat;
@@ -2582,7 +2570,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
LLViewerObject* chatter;
msg->getString("ChatData", "FromName", from_name);
- //chat.mFromName = from_name;
msg->getUUID("ChatData", "SourceID", from_id);
chat.mFromID = from_id;
@@ -2602,7 +2589,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
chat.mTime = LLFrameTimer::getElapsedSeconds();
// IDEVO Correct for new-style "Resident" names
- chat.mFromName = clean_name_from_chat(from_name, chat.mSourceType);
+ if (chat.mChatType == CHAT_SOURCE_AGENT)
+ {
+ chat.mFromName = LLCacheName::cleanFullName(from_name);
+ }
+ else
+ {
+ chat.mFromName = from_name;
+ }
BOOL is_busy = gAgent.getBusy();
@@ -4470,7 +4464,7 @@ static void show_money_balance_notification(const std::string& desc)
{
name = match[1].str();
// IDEVO strip legacy "Resident" name
- name = name.substr(0, name.find(" Resident"));
+ name = LLCacheName::cleanFullName(name);
args["NAME"] = name;
args["AMOUNT"] = match[2].str();
args["REASON"] = match[3].str();
@@ -4480,7 +4474,7 @@ static void show_money_balance_notification(const std::string& desc)
{
name = match[1].str();
// IDEVO strip legacy "Resident" name
- name = name.substr(0, name.find(" Resident"));
+ name = LLCacheName::cleanFullName(name);
args["NAME"] = name;
args["AMOUNT"] = match[2].str();
notification_name = "PaymentReceived";
@@ -4489,7 +4483,7 @@ static void show_money_balance_notification(const std::string& desc)
{
name = match[1].str();
// IDEVO strip legacy "Resident" name
- name = name.substr(0, name.find(" Resident"));
+ name = LLCacheName::cleanFullName(name);
args["NAME"] = name;
args["AMOUNT"] = match[2].str();
args["REASON"] = match[3].str();