FIRE-20193: Bringing IM window with large number of unread messages into focus might lead to viewer disconnect

meow-7.2.2
Ansariel 2016-10-05 11:18:38 +02:00
parent bbd3ea2418
commit 949e7ace31
3 changed files with 20 additions and 3 deletions

View File

@ -24130,6 +24130,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>FSMaxPendingIMMessages</key>
<map>
<key>Comment</key>
<string>Maxmimum number of pending IM or group messages before a minimized or not visible chat window will be updated</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>25</integer>
</map>
</map>
</llsd>

View File

@ -87,6 +87,7 @@ FSFloaterIM::FSFloaterIM(const LLUUID& session_id)
mControlPanel(NULL),
mSessionID(session_id),
mLastMessageIndex(-1),
mPendingMessages(0),
mDialog(IM_NOTHING_SPECIAL),
mChatHistory(NULL),
mInputEditor(NULL),
@ -301,8 +302,10 @@ void FSFloaterIM::newIMCallback(const LLSD& data){
FSFloaterIM* floater = LLFloaterReg::findTypedInstance<FSFloaterIM>("fs_impanel", session_id);
if (floater == NULL) return;
// update if visible, otherwise will be updated when opened
if (floater->getVisible())
// update if visible or max pending messages exceeded, otherwise will be updated when opened
static LLCachedControl<S32> fsMaxPendingIMMessages(gSavedSettings, "FSMaxPendingIMMessages");
floater->mPendingMessages++;
if (floater->getVisible() || floater->mPendingMessages > fsMaxPendingIMMessages)
{
floater->updateMessages();
}
@ -1355,7 +1358,7 @@ void FSFloaterIM::updateMessages()
std::list<LLSD> messages;
// we shouldn't reset unread message counters if IM floater doesn't have focus
LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex + 1, hasFocus());
LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex + 1, hasFocus());
if (messages.size())
{
@ -1447,6 +1450,8 @@ void FSFloaterIM::updateMessages()
}
}
}
mPendingMessages = 0;
}
void FSFloaterIM::reloadMessages(bool clean_messages/* = false*/)

View File

@ -239,6 +239,7 @@ private:
FSPanelChatControlPanel* mControlPanel;
LLUUID mSessionID;
S32 mLastMessageIndex;
S32 mPendingMessages;
EInstantMessage mDialog;
LLUUID mOtherParticipantUUID;