Commits

dessie linden  committed f1a71b1 Merge

Merged in 2.3.0-beta1 tag

  • Participants
  • Parent commits 6b649f3, 2d950ab

Comments (0)

Files changed (3)

File indra/llmessage/llcachename.cpp

 //static 
 std::string LLCacheName::buildLegacyName(const std::string& complete_name)
 {
-	boost::regex complete_name_regex("(.+)( \\()([A-Za-z]+)(.[A-Za-z]+)*(\\))");
-	boost::match_results<std::string::const_iterator> name_results;
-	if (!boost::regex_match(complete_name, name_results, complete_name_regex)) return complete_name;
+	// regexp doesn't play nice with unicode, chop off the display name
+	S32 open_paren = complete_name.rfind(" (");
 
-	std::string legacy_name = name_results[3];
+	if (open_paren == std::string::npos)
+	{
+		return complete_name;
+	}
+
+	std::string username = complete_name.substr(open_paren);
+	boost::regex complete_name_regex("( \\()([a-z0-9]+)(.[a-z]+)*(\\))");
+	boost::match_results<std::string::const_iterator> name_results;
+	if (!boost::regex_match(username, name_results, complete_name_regex)) return complete_name;
+
+	std::string legacy_name = name_results[2];
 	// capitalize the first letter
 	std::string cap_letter = legacy_name.substr(0, 1);
 	LLStringUtil::toUpper(cap_letter);
-	legacy_name = cap_letter + legacy_name.substr(1);
-
-	if (name_results[4].matched)
-	{
-		std::string last_name = name_results[4];
+	legacy_name = cap_letter + legacy_name.substr(1);
+
+	if (name_results[4].matched)
+	{
+		std::string last_name = name_results[3];
 		std::string cap_letter = last_name.substr(1, 1);
 		LLStringUtil::toUpper(cap_letter);
-		last_name = cap_letter + last_name.substr(2);
-		legacy_name = legacy_name + " " + last_name;
-	}
-
+		last_name = cap_letter + last_name.substr(2);
+		legacy_name = legacy_name + " " + last_name;
+	}
+	else
+	{
+		legacy_name = legacy_name + " Resident";
+	}
+
 	return legacy_name;
 }
 

File indra/newview/llimview.cpp

 	// history files have consistent (English) names in different locales.
 	if (isAdHocSessionType() && IM_SESSION_INVITE == type)
 	{
-		// Name here has a form of "<Avatar's name> Conference"
-		// Lets update it to localize the "Conference" word. See EXT-8429.
-		S32 separator_index = mName.rfind(" ");
-		std::string name = mName.substr(0, separator_index);
-		++separator_index;
-		std::string conference_word = mName.substr(separator_index, mName.length());
-
-		// additional check that session name is what we expected
-		if ("Conference" == conference_word)
-		{
+		LLAvatarNameCache::get(mOtherParticipantID, 
+							   boost::bind(&LLIMModel::LLIMSession::onAdHocNameCache, 
+							   this, _2));
+	}
+}
+
+void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name)
+{
 			LLStringUtil::format_map_t args;
-			args["[AGENT_NAME]"] = name;
+	args["[AGENT_NAME]"] = av_name.getCompleteName();
 			LLTrans::findString(mName, "conference-title-incoming", args);
-		}
-	}
 }
 
 void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction)

File indra/newview/llimview.h

 
 		void onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name);
 
+		void onAdHocNameCache(const LLAvatarName& av_name);
+
 		//*TODO make private
 		static std::string generateHash(const std::set<LLUUID>& sorted_uuids);