CHUI-395 (Group moderators are not shown as Moderators in group conversation)

meow-7.2.2
mberezhnoy 2013-01-28 18:06:27 +02:00
parent daa9db305a
commit 4a96941b73
3 changed files with 44 additions and 2 deletions

View File

@ -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
//

View File

@ -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;

View File

@ -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<LLConversationItemParticipant*>(*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)