diff options
author | Merov Linden <merov@lindenlab.com> | 2012-09-20 17:50:58 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-09-20 17:50:58 -0700 |
commit | 1107803a5c6da07cd5171f06afc0490f3eca7bf7 (patch) | |
tree | 332b1f9de3f92f074b54bacb0c6110730c503064 /indra/newview/llconversationmodel.cpp | |
parent | bb8820c70b6dc50524fa8e35a4a14b3cb66bf26c (diff) |
CHUI-340 : WIP : Implement time update and comparison for sessions and participants
Diffstat (limited to 'indra/newview/llconversationmodel.cpp')
-rw-r--r-- | indra/newview/llconversationmodel.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 612744c3e9..b39b997a55 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -167,6 +167,31 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +// The time of activity of a session is the time of the most recent participation +const bool LLConversationItemSession::getTime(F64& time) const +{ + bool has_time = false; + F64 most_recent_time = 0.0; + LLConversationItemParticipant* participant = NULL; + child_list_t::const_iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast<LLConversationItemParticipant*>(*iter); + F64 participant_time; + if (participant->getTime(participant_time)) + { + has_time = true; + most_recent_time = llmax(most_recent_time,participant_time); + } + } + if (has_time) + { + time = most_recent_time; + } + llinfos << "Merov debug : get time session, uuid = " << mUUID << ", has_time = " << has_time << ", time = " << time << llendl; + return has_time; +} + void LLConversationItemSession::dumpDebugData() { llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; @@ -186,7 +211,8 @@ void LLConversationItemSession::dumpDebugData() LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), - mIsModerator(false) + mIsModerator(false), + mLastActiveTime(0.0) { mConvType = CONV_PARTICIPANT; } @@ -228,8 +254,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL U32 sort_order = getSortOrderParticipants(); if (sort_order == LLConversationFilter::SO_DATE) { - F32 time_a = 0.0; - F32 time_b = 0.0; + F64 time_a = 0.0; + F64 time_b = 0.0; if (a->getTime(time_a) && b->getTime(time_b)) { return (time_a > time_b); @@ -251,8 +277,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL U32 sort_order = getSortOrderSessions(); if (sort_order == LLConversationFilter::SO_DATE) { - F32 time_a = 0.0; - F32 time_b = 0.0; + F64 time_a = 0.0; + F64 time_b = 0.0; if (a->getTime(time_a) && b->getTime(time_b)) { return (time_a > time_b); @@ -260,7 +286,10 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) { - return (type_a < type_b); + if (type_a != type_b) + { + return (type_a < type_b); + } } } else @@ -270,7 +299,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first return (type_a < type_b); } - // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), sort by name + // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), + // we sort by name S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); return (compare < 0); } |