summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2010-05-27 15:12:03 -0700
committerLeyla Farazha <leyla@lindenlab.com>2010-05-27 15:12:03 -0700
commit6cb420b20bd509e7bf62c8450f12d433c5a81be2 (patch)
tree31f82be57c849e8ac6210b94704d781d0ee40c2f /indra
parentc5c13a92eb62e1e9927a9685d5433c040e6ef2ce (diff)
added function for building a username from a legacy name and fixed group notice panel
reviewed by James
Diffstat (limited to 'indra')
-rw-r--r--indra/llmessage/llcachename.cpp24
-rw-r--r--indra/llmessage/llcachename.h5
-rw-r--r--indra/newview/llpanelgroupnotices.cpp4
3 files changed, 31 insertions, 2 deletions
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index c6c189c7a1..f8c0d05baa 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -527,6 +527,30 @@ std::string LLCacheName::cleanFullName(const std::string& full_name)
return full_name.substr(0, full_name.find(" Resident"));
}
+//static
+std::string LLCacheName::buildUsername(const std::string& full_name)
+{
+ std::string::size_type index = full_name.find(' ');
+
+ if (index != std::string::npos)
+ {
+ std::string username;
+ username = full_name.substr(0, index);
+ std::string lastname = full_name.substr(index+1);
+
+ if (lastname != "Resident")
+ {
+ username = username + "." + lastname;
+ }
+
+ LLStringUtil::toLower(username);
+ return username;
+ }
+
+ // if the input wasn't a correctly formatted legacy name just return it unchanged
+ return full_name;
+}
+
// 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 45dae562ad..697bb27556 100644
--- a/indra/llmessage/llcachename.h
+++ b/indra/llmessage/llcachename.h
@@ -91,6 +91,11 @@ public:
// If name does not contain "Resident" returns it unchanged.
static std::string cleanFullName(const std::string& full_name);
+ // Converts a standard legacy name to a username
+ // "bobsmith123 Resident" -> "bobsmith"
+ // "Random Linden" -> "random.linden"
+ static std::string buildUsername(const std::string& name);
+
// If available, this method copies the group name into the string
// provided. The caller must allocate at least
// DB_GROUP_NAME_BUF_SIZE characters. If not available, this
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 2a955004e9..b71ece2be3 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -548,8 +548,8 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
msg->getU8("Data","AssetType",asset_type,i);
msg->getU32("Data","Timestamp",timestamp,i);
- // IDEVO clean up legacy "Resident" names
- name = LLCacheName::cleanFullName(name);
+ // we only have the legacy name here, convert it to a username
+ name = LLCacheName::buildUsername(name);
LLSD row;
row["id"] = id;