From 4a96941b73254538c27a83fe28c637065e93f2e2 Mon Sep 17 00:00:00 2001 From: mberezhnoy Date: Mon, 28 Jan 2013 18:06:27 +0200 Subject: CHUI-395 (Group moderators are not shown as Moderators in group conversation) --- indra/newview/llconversationmodel.cpp | 18 ++++++++++++++++++ indra/newview/llconversationmodel.h | 6 ++++-- indra/newview/llfloaterimsessiontab.cpp | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a8da4908ce..7184a70db5 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -35,6 +35,7 @@ #include "llsdutil.h" #include "llconversationmodel.h" #include "llimview.h" //For LLIMModel +#include "lltrans.h" // // Conversation items : common behaviors @@ -461,6 +462,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), mIsModerator(false), + mDisplayModeratorLabel(false), mDistToAgent(-1.0) { mDisplayName = display_name; @@ -471,6 +473,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLConversationItem(uuid,root_view_model), mIsMuted(false), mIsModerator(false), + mDisplayModeratorLabel(false), mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; @@ -503,6 +506,12 @@ void LLConversationItemParticipant::updateName(const LLAvatarName& av_name) { mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); + + if (mDisplayModeratorLabel) + { + mDisplayName += " " + LLTrans::getString("IM_moderator_label"); + } + renameItem(mDisplayName); if (mParent != NULL) { @@ -541,6 +550,15 @@ void LLConversationItemParticipant::dumpDebugData() llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; } +void LLConversationItemParticipant::setDisplayModeratorRole(bool displayRole) +{ + if (displayRole != mDisplayModeratorLabel) + { + mDisplayModeratorLabel = displayRole; + updateName(); + } +} + // // LLConversationSort // diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 6aaea041e4..c907d1d6d2 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -205,13 +205,15 @@ public: void dumpDebugData(); void setModeratorOptionsVisible(bool visible) { mDisplayModeratorOptions = visible; } + void setDisplayModeratorRole(bool displayRole); private: void onAvatarNameCache(const LLAvatarName& av_name); // callback used by fetchAvatarName void updateName(const LLAvatarName& av_name); - bool mIsMuted; // default is false - bool mIsModerator; // default is false + bool mIsMuted; // default is false + bool mIsModerator; // default is false + bool mDisplayModeratorLabel; // default is false std::string mDisplayName; F64 mDistToAgent; // Distance to the agent. A negative (meaningless) value means the distance has not been set. boost::signals2::connection mAvatarNameCacheConnection; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 37404ab716..2f6a9d22c1 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -497,6 +497,28 @@ void LLFloaterIMSessionTab::refreshConversation() } updateSessionName(session_name); } + + LLParticipantList* participant_list = getParticipantList(); + if (participant_list) + { + LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = participant_list->getChildrenBegin(); + LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = participant_list->getChildrenEnd(); + LLIMSpeakerMgr *speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + while (current_participant_model != end_participant_model) + { + LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); + if (speaker_mgr && participant_model) + { + LLSpeaker *participant_speaker = speaker_mgr->findSpeaker(participant_model->getUUID()); + LLSpeaker *agent_speaker = speaker_mgr->findSpeaker(gAgentID); + if (participant_speaker && agent_speaker) + { + participant_model->setDisplayModeratorRole(agent_speaker->mIsModerator && participant_speaker->mIsModerator); + } + } + current_participant_model++; + } + } mConversationViewModel.requestSortAll(); if(mConversationsRoot != NULL) -- cgit v1.2.3