summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-10-03 16:46:46 -0700
committerMerov Linden <merov@lindenlab.com>2012-10-03 16:46:46 -0700
commitbd64c483639ae33518609398fce7c51ddc73dae7 (patch)
treea9c4a06faa6d9cb5b8125b4ade34c1198d396921 /indra/newview
parent4a25ce8b9d5d56b160d0d13c4681cd916c4ea4e0 (diff)
CHUI-358 : Fixed the removal of participants as they leave conversations. Used the event mechanism for this.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llconversationmodel.cpp18
-rwxr-xr-xindra/newview/llconversationmodel.h2
-rw-r--r--indra/newview/llimfloatercontainer.cpp31
3 files changed, 34 insertions, 17 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 1057dbaf31..7ddb725fb1 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -64,15 +64,13 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod
{
}
-void LLConversationItem::postEvent(const std::string& event_type)
+void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemParticipant* participant)
{
LLSD event;
- event["pump"] = "ConversationModelEvent";
- LLSD payload;
- payload["type"] = event_type;
- payload["name"] = getName();
- payload["uuid"] = getUUID();
- event["payload"] = payload;
+ event["type"] = event_type;
+ event["session_uuid"] = getUUID();
+ event["participant_name"] = participant->getName();
+ event["participant_uuid"] = participant->getUUID();
LLEventPumps::instance().obtain("ConversationsEvents").post(event);
}
@@ -124,14 +122,14 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa
addChild(participant);
mIsLoaded = true;
mNeedsRefresh = true;
- postEvent("add_participant");
+ postEvent("add_participant", participant);
}
void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant)
{
removeChild(participant);
mNeedsRefresh = true;
- postEvent("remove_participant");
+ postEvent("remove_participant", participant);
}
void LLConversationItemSession::removeParticipant(const LLUUID& participant_id)
@@ -269,7 +267,7 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam
mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername);
mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName);
mNeedsRefresh = true;
- postEvent("update_participant");
+ postEvent("update_participant", this);
if (mParent)
{
mParent->requestSort();
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index 97e5b0fc31..32280f3293 100755
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -124,7 +124,7 @@ public:
void resetRefresh() { mNeedsRefresh = false; }
bool needsRefresh() { return mNeedsRefresh; }
- void postEvent(const std::string& event_type);
+ void postEvent(const std::string& event_type, LLConversationItemParticipant* participant);
protected:
std::string mName; // Name of the session or the participant
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 8642eaf5e1..e58154b2a2 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -391,21 +391,39 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event)
//llinfos << "Merov debug : onConversationModelEvent, event = " << llsd_value.str() << llendl;
// end debug
- // Note: In conversations, the model is not responsible for creating the view which is a good thing. This means that
- // the model could change substantially and the view could decide to echo only a portion of this model.
+ // Note: In conversations, the model is not responsible for creating the view, which is a good thing. This means that
+ // the model could change substantially and the view could echo only a portion of this model (though currently the
+ // conversation view does echo the conversation model 1 to 1).
// Consequently, the participant views need to be created either by the session view or by the container panel.
- // For the moment, we create them here to conform to the pattern implemented in llinventorypanel.cpp
+ // For the moment, we create them here, at the container level, to conform to the pattern implemented in llinventorypanel.cpp
// (see LLInventoryPanel::buildNewViews()).
- // Note: For the moment, we're not very smart about the event paramter and we just refresh the whole set of views/widgets
+ // Note: For the moment, we're not very smart about the event parameter and we just refresh the whole set of views/widgets
// according to the current state of the whole model.
- // We should at least analyze the event payload and do things differently for a handful of useful cases:
+ // We should at least analyze the event payload and do things differently for a handful of cases:
// - add session or participant
// - remove session or participant
// - update session or participant (e.g. rename, change sort order, etc...)
- // see LLConversationItem::postEvent() for the payload formatting.
+ // Please see LLConversationItem::postEvent() for the payload formatting.
// *TODO: Add handling for various event signatures (add, remove, update, resort)
+ std::string type = event.get("type").asString();
+ if (type == "remove_participant")
+ {
+ LLUUID session_id = event.get("session_uuid").asUUID();
+ LLConversationViewSession* session_view = dynamic_cast<LLConversationViewSession*>(mConversationsWidgets[session_id]);
+ LLUUID participant_id = event.get("participant_uuid").asUUID();
+ LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id);
+ if (participant_view)
+ {
+ session_view->extractItem(participant_view);
+ delete participant_view;
+ session_view->refresh();
+ mConversationsRoot->arrangeAll();
+ }
+ }
+ else
+ {
// On each session in mConversationsItems
for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++)
{
@@ -449,6 +467,7 @@ bool LLIMFloaterContainer::onConversationModelEvent(const LLSD& event)
current_participant_model++;
}
}
+ }
return false;
}