summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfolderviewmodel.h2
-rw-r--r--indra/newview/llconversationmodel.cpp90
-rwxr-xr-xindra/newview/llconversationmodel.h9
-rw-r--r--indra/newview/llimconversation.cpp8
-rw-r--r--indra/newview/llimfloater.cpp1
-rwxr-xr-xindra/newview/llimfloatercontainer.cpp15
-rw-r--r--indra/newview/llimfloatercontainer.h1
-rw-r--r--indra/newview/llparticipantlist.cpp26
-rw-r--r--indra/newview/llparticipantlist.h9
-rw-r--r--indra/newview/llspeakers.cpp15
-rw-r--r--indra/newview/llspeakers.h9
11 files changed, 170 insertions, 15 deletions
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 22bfc4dfb4..c99fa07c8b 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -226,7 +226,7 @@ public:
mParent(NULL),
mRootViewModel(root_view_model)
{
- std::for_each(mChildren.begin(), mChildren.end(), DeletePointer());
+ mChildren.clear();
}
void requestSort() { mSortVersion = -1; }
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 612744c3e9..e090d1647f 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -38,7 +38,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u
mName(display_name),
mUUID(uuid),
mNeedsRefresh(true),
- mConvType(CONV_UNKNOWN)
+ mConvType(CONV_UNKNOWN),
+ mLastActiveTime(0.0)
{
}
@@ -47,7 +48,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte
mName(""),
mUUID(uuid),
mNeedsRefresh(true),
- mConvType(CONV_UNKNOWN)
+ mConvType(CONV_UNKNOWN),
+ mLastActiveTime(0.0)
{
}
@@ -56,7 +58,8 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod
mName(""),
mUUID(),
mNeedsRefresh(true),
- mConvType(CONV_UNKNOWN)
+ mConvType(CONV_UNKNOWN),
+ mLastActiveTime(0.0)
{
}
@@ -167,6 +170,41 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip
}
}
+void LLConversationItemSession::setTimeNow(const LLUUID& participant_id)
+{
+ mLastActiveTime = LLFrameTimer::getElapsedSeconds();
+ mNeedsRefresh = true;
+ LLConversationItemParticipant* participant = findParticipant(participant_id);
+ if (participant)
+ {
+ participant->setTimeNow();
+ }
+}
+
+// The time of activity of a session is the time of the most recent activity, session and participants included
+const bool LLConversationItemSession::getTime(F64& time) const
+{
+ F64 most_recent_time = mLastActiveTime;
+ bool has_time = (most_recent_time > 0.1);
+ 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;
+ }
+ return has_time;
+}
+
void LLConversationItemSession::dumpDebugData()
{
llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl;
@@ -228,21 +266,36 @@ 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;
- if (a->getTime(time_a) && b->getTime(time_b))
+ F64 time_a = 0.0;
+ F64 time_b = 0.0;
+ bool has_time_a = a->getTime(time_a);
+ bool has_time_b = b->getTime(time_b);
+ if (has_time_a && has_time_b)
{
return (time_a > time_b);
}
+ else if (has_time_a || has_time_b)
+ {
+ // If we have only one time updated, we consider the element with time as the "highest".
+ // That boils down to "has_time_a" if you think about it.
+ return has_time_a;
+ }
+ // If not time available, we'll default to sort by name at the end of this method
}
else if (sort_order == LLConversationFilter::SO_DISTANCE)
{
F32 dist_a = 0.0;
F32 dist_b = 0.0;
- if (a->getDistanceToAgent(dist_a) && b->getDistanceToAgent(dist_b))
+ bool has_dist_a = a->getDistanceToAgent(dist_a);
+ bool has_dist_b = b->getDistanceToAgent(dist_b);
+ if (has_dist_a && has_dist_b)
{
return (dist_a > dist_b);
}
+ else if (has_dist_a || has_dist_b)
+ {
+ return has_dist_a;
+ }
}
}
else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT))
@@ -251,16 +304,28 @@ 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;
- if (a->getTime(time_a) && b->getTime(time_b))
+ F64 time_a = 0.0;
+ F64 time_b = 0.0;
+ bool has_time_a = a->getTime(time_a);
+ bool has_time_b = b->getTime(time_b);
+ if (has_time_a && has_time_b)
{
return (time_a > time_b);
}
+ else if (has_time_a || has_time_b)
+ {
+ // If we have only one time updated, we consider the element with time as the "highest".
+ // That boils down to "has_time_a" if you think about it.
+ return has_time_a;
+ }
+ // If not time available, we'll default to sort by name at the end of this method
}
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 +335,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);
}
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index dbc04223af..e67aeb9aca 100755
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -104,9 +104,9 @@ public:
virtual void selectItem(void) { }
virtual void showProperties(void);
- // Methods used in sorting (see LLConversationSort::operator()
+ // Methods used in sorting (see LLConversationSort::operator())
EConversationType const getType() const { return mConvType; }
- virtual const bool getTime(F32& time) const { return false; }
+ virtual const bool getTime(F64& time) const { time = mLastActiveTime; return (time > 0.1); }
virtual const bool getDistanceToAgent(F32& distance) const { return false; }
// This method will be called to determine if a drop can be
@@ -129,6 +129,7 @@ protected:
LLUUID mUUID; // UUID of the session or the participant
EConversationType mConvType; // Type of conversation item
bool mNeedsRefresh; // Flag signaling to the view that something changed for this item
+ F64 mLastActiveTime;
};
class LLConversationItemSession : public LLConversationItem
@@ -149,9 +150,12 @@ public:
void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted);
void setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator);
+ void setTimeNow(const LLUUID& participant_id);
bool isLoaded() { return mIsLoaded; }
+ virtual const bool getTime(F64& time) const;
+
void dumpDebugData();
private:
@@ -169,6 +173,7 @@ public:
bool isModerator() {return mIsModerator; }
void setIsMuted(bool is_muted) { mIsMuted = is_muted; mNeedsRefresh = true; }
void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; mNeedsRefresh = true; }
+ void setTimeNow() { mLastActiveTime = LLFrameTimer::getElapsedSeconds(); mNeedsRefresh = true; }
void onAvatarNameCache(const LLAvatarName& av_name);
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index ca8493f787..64f171ce8f 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -251,6 +251,14 @@ std::string LLIMConversation::appendTime()
void LLIMConversation::appendMessage(const LLChat& chat, const LLSD &args)
{
+ // Update the participant activity time
+ LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance();
+ if (im_box)
+ {
+ im_box->setTimeNow(mSessionID,chat.mFromID);
+ }
+
+
LLChat& tmp_chat = const_cast<LLChat&>(chat);
if(tmp_chat.mTimeStr.empty())
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 2474fe0891..43adfdfd08 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -907,6 +907,7 @@ void LLIMFloater::updateMessages()
chat.mText = message;
}
+ // Add the message to the chat log
appendMessage(chat);
mLastMessageIndex = msg["index"].asInteger();
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index de1fd58661..3c21794d28 100755
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -710,6 +710,21 @@ void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id)
}
}
+void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id)
+{
+ conversations_items_map::iterator item_it = mConversationsItems.find(session_id);
+ if (item_it != mConversationsItems.end())
+ {
+ LLConversationItemSession* item = dynamic_cast<LLConversationItemSession*>(item_it->second);
+ if (item)
+ {
+ item->setTimeNow(participant_id);
+ mConversationViewModel.requestSortAll();
+ mConversationsRoot->arrangeAll();
+ }
+ }
+}
+
void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
{
bool is_nearby_chat = uuid.isNull();
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index 077ecd192b..4546029e93 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -124,6 +124,7 @@ private:
public:
void removeConversationListItem(const LLUUID& uuid, bool change_focus = true);
void addConversationListItem(const LLUUID& uuid);
+ void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
private:
LLConversationViewSession* createConversationItemWidget(LLConversationItem* item);
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 339cee3f95..09f2716773 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -34,6 +34,7 @@
#include "llagent.h"
#include "llimview.h"
+#include "llimfloatercontainer.h"
#include "llpanelpeoplemenus.h"
#include "llnotificationsutil.h"
#include "llparticipantlist.h"
@@ -224,12 +225,14 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source,
mSpeakerRemoveListener = new SpeakerRemoveListener(*this);
mSpeakerClearListener = new SpeakerClearListener(*this);
mSpeakerModeratorListener = new SpeakerModeratorUpdateListener(*this);
+ mSpeakerUpdateListener = new SpeakerUpdateListener(*this);
mSpeakerMuteListener = new SpeakerMuteListener(*this);
mSpeakerMgr->addListener(mSpeakerAddListener, "add");
mSpeakerMgr->addListener(mSpeakerRemoveListener, "remove");
mSpeakerMgr->addListener(mSpeakerClearListener, "clear");
mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator");
+ mSpeakerMgr->addListener(mSpeakerUpdateListener, "update_speaker");
setSessionID(mSpeakerMgr->getSessionID());
@@ -584,6 +587,21 @@ bool LLParticipantList::onClearListEvent(LLPointer<LLOldEvents::LLEvent> event,
return true;
}
+bool LLParticipantList::onSpeakerUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
+{
+ const LLSD& evt_data = event->getValue();
+ if ( evt_data.has("id") )
+ {
+ LLUUID participant_id = evt_data["id"];
+ LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance();
+ if (im_box)
+ {
+ im_box->setTimeNow(mUUID,participant_id);
+ }
+ }
+ return true;
+}
+
bool LLParticipantList::onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
const LLSD& evt_data = event->getValue();
@@ -746,6 +764,14 @@ bool LLParticipantList::SpeakerClearListener::handleEvent(LLPointer<LLOldEvents:
}
//
+// LLParticipantList::SpeakerUpdateListener
+//
+bool LLParticipantList::SpeakerUpdateListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
+{
+ return mParent.onSpeakerUpdateEvent(event, userdata);
+}
+
+//
// LLParticipantList::SpeakerModeratorListener
//
bool LLParticipantList::SpeakerModeratorUpdateListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index f8165aa292..acee68873c 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -95,6 +95,7 @@ protected:
bool onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ bool onSpeakerUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
/**
@@ -136,6 +137,13 @@ protected:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
+ class SpeakerUpdateListener : public BaseSpeakerListener
+ {
+ public:
+ SpeakerUpdateListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+ /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+ };
+
class SpeakerModeratorUpdateListener : public BaseSpeakerListener
{
public:
@@ -264,6 +272,7 @@ private:
LLPointer<SpeakerAddListener> mSpeakerAddListener;
LLPointer<SpeakerRemoveListener> mSpeakerRemoveListener;
LLPointer<SpeakerClearListener> mSpeakerClearListener;
+ LLPointer<SpeakerUpdateListener> mSpeakerUpdateListener;
LLPointer<SpeakerModeratorUpdateListener> mSpeakerModeratorListener;
LLPointer<SpeakerMuteListener> mSpeakerMuteListener;
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 07d2f1ad6f..2d2b5202e0 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -84,6 +84,19 @@ bool LLSpeaker::isInVoiceChannel()
return mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || mStatus == LLSpeaker::STATUS_MUTED;
}
+LLSpeakerUpdateSpeakerEvent::LLSpeakerUpdateSpeakerEvent(LLSpeaker* source)
+: LLEvent(source, "Speaker update speaker event"),
+ mSpeakerID (source->mID)
+{
+}
+
+LLSD LLSpeakerUpdateSpeakerEvent::getValue()
+{
+ LLSD ret;
+ ret["id"] = mSpeakerID;
+ return ret;
+}
+
LLSpeakerUpdateModeratorEvent::LLSpeakerUpdateModeratorEvent(LLSpeaker* source)
: LLEvent(source, "Speaker add moderator event"),
mSpeakerID (source->mID),
@@ -374,6 +387,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
{
speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32();
speakerp->mHasSpoken = TRUE;
+ fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker");
}
speakerp->mStatus = LLSpeaker::STATUS_SPEAKING;
// interpolate between active color and full speaking color based on power of speech output
@@ -548,6 +562,7 @@ void LLSpeakerMgr::speakerChatted(const LLUUID& speaker_id)
{
speakerp->mLastSpokeTime = mSpeechTimer.getElapsedTimeF32();
speakerp->mHasSpoken = TRUE;
+ fireEvent(new LLSpeakerUpdateSpeakerEvent(speakerp), "update_speaker");
}
}
diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h
index 1c6f51e131..8ab08661d3 100644
--- a/indra/newview/llspeakers.h
+++ b/indra/newview/llspeakers.h
@@ -79,6 +79,15 @@ public:
BOOL mModeratorMutedText;
};
+class LLSpeakerUpdateSpeakerEvent : public LLOldEvents::LLEvent
+{
+public:
+ LLSpeakerUpdateSpeakerEvent(LLSpeaker* source);
+ /*virtual*/ LLSD getValue();
+private:
+ const LLUUID& mSpeakerID;
+};
+
class LLSpeakerUpdateModeratorEvent : public LLOldEvents::LLEvent
{
public: