From 37669a8abc8fc1017743b5265a0876dd27618dfb Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Fri, 26 Jul 2013 08:59:14 -0400 Subject: [PATCH] Add LLAvatarActions::buildResidentsString --- indra/newview/llavataractions.cpp | 42 +++++++++++++++++++ indra/newview/llavataractions.h | 17 ++++++++ .../skins/default/xui/en-us/strings.xml | 4 ++ 3 files changed, 63 insertions(+) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 47cd24766..cce26284e 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -497,6 +497,48 @@ void LLAvatarActions::csr(const LLUUID& id) // Singu TODO: Share inventory code block should live here +// static +void LLAvatarActions::buildResidentsString(std::vector avatar_names, std::string& residents_string) +{ + llassert(avatar_names.size() > 0); + + std::sort(avatar_names.begin(), avatar_names.end()); + const std::string& separator = LLTrans::getString("words_separator"); + for (std::vector::const_iterator it = avatar_names.begin(); ; ) + { + residents_string.append((*it).getCompleteName()); + if (++it == avatar_names.end()) + { + break; + } + residents_string.append(separator); + } +} + +// static +void LLAvatarActions::buildResidentsString(const uuid_vec_t& avatar_uuids, std::string& residents_string) +{ + std::vector avatar_names; + uuid_vec_t::const_iterator it = avatar_uuids.begin(); + for (; it != avatar_uuids.end(); ++it) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(*it, &av_name)) + { + avatar_names.push_back(av_name); + } + } + + // We should check whether the vector is not empty to pass the assertion + // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. + if (!avatar_names.empty()) + { + LLAvatarActions::buildResidentsString(avatar_names, residents_string); + } +} + +// Singu TODO: Share inventory code block should live here, too + // static void LLAvatarActions::toggleBlock(const LLUUID& id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index a9c71f575..5e52e71d8 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -27,6 +27,7 @@ #ifndef LL_LLAVATARACTIONS_H #define LL_LLAVATARACTIONS_H +class LLAvatarName; class LLFloater; /** @@ -181,6 +182,22 @@ public: */ static bool canOfferTeleport(const uuid_vec_t& ids); + /** + * Builds a string of residents' display names separated by "words_separator" string. + * + * @param avatar_names - a vector of given avatar names from which resulting string is built + * @param residents_string - the resulting string + */ + static void buildResidentsString(std::vector avatar_names, std::string& residents_string); + + /** + * Builds a string of residents' display names separated by "words_separator" string. + * + * @param avatar_uuids - a vector of given avatar uuids from which resulting string is built + * @param residents_string - the resulting string + */ + static void buildResidentsString(const uuid_vec_t& avatar_uuids, std::string& residents_string); + private: static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static bool handleRemove(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/skins/default/xui/en-us/strings.xml b/indra/newview/skins/default/xui/en-us/strings.xml index 9ecd2c66e..07151f0f9 100644 --- a/indra/newview/skins/default/xui/en-us/strings.xml +++ b/indra/newview/skins/default/xui/en-us/strings.xml @@ -4313,6 +4313,10 @@ Abuse Report dance7 dance8 none/none + + + + Chat