MAINT-3822 FIXED Show busy mode message only once for each im session.

meow-7.2.2
maxim@mnikolenko 2014-03-14 12:21:25 +02:00
parent cb91708332
commit 09d1c27d4f
4 changed files with 51 additions and 4 deletions

View File

@ -1466,6 +1466,7 @@ void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
{
LLDoNotDisturbNotificationStorage::getInstance()->updateNotifications();
}
gIMMgr->updateDNDMessageStatus();
}
//-----------------------------------------------------------------------------

View File

@ -409,6 +409,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
mOtherParticipantIsAvatar(true),
mStartCallOnInitialize(false),
mStartedAsIMCall(voice),
mIsDNDsend(false),
mAvatarNameCacheConnection()
{
// set P2P type by default
@ -3306,6 +3307,38 @@ bool LLIMMgr::isVoiceCall(const LLUUID& session_id)
return im_session->mStartedAsIMCall;
}
void LLIMMgr::updateDNDMessageStatus()
{
if (LLIMModel::getInstance()->mId2SessionMap.empty()) return;
std::map<LLUUID, LLIMModel::LLIMSession*>::const_iterator it = LLIMModel::getInstance()->mId2SessionMap.begin();
for (; it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it)
{
LLIMModel::LLIMSession* session = (*it).second;
if (session->isP2P())
{
setDNDMessageSent(session->mSessionID,false);
}
}
}
bool LLIMMgr::isDNDMessageSend(const LLUUID& session_id)
{
LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
if (!im_session) return false;
return im_session->mIsDNDsend;
}
void LLIMMgr::setDNDMessageSent(const LLUUID& session_id, bool is_send)
{
LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
if (!im_session) return;
im_session->mIsDNDsend = is_send;
}
void LLIMMgr::addNotifiedNonFriendSessionID(const LLUUID& session_id)
{
mNotifiedNonFriendSessions.insert(session_id);

View File

@ -140,6 +140,8 @@ public:
bool mHasOfflineMessage;
bool mIsDNDsend;
private:
void onAdHocNameCache(const LLAvatarName& av_name);
@ -443,6 +445,12 @@ public:
bool isVoiceCall(const LLUUID& session_id);
void updateDNDMessageStatus();
bool isDNDMessageSend(const LLUUID& session_id);
void setDNDMessageSent(const LLUUID& session_id, bool is_send);
void addNotifiedNonFriendSessionID(const LLUUID& session_id);
bool isNonFriendSessionNotified(const LLUUID& session_id);

View File

@ -2409,10 +2409,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
&& from_id.notNull() //not a system message
&& to_id.notNull()) //not global message
{
// return a standard "do not disturb" message, but only do it to online IM
// (i.e. not other auto responses and not store-and-forward IM)
send_do_not_disturb_message(msg, from_id, session_id);
// now store incoming IM in chat history
@ -2433,6 +2429,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
region_id,
position,
true);
if (!gIMMgr->isDNDMessageSend(session_id))
{
// return a standard "do not disturb" message, but only do it to online IM
// (i.e. not other auto responses and not store-and-forward IM)
send_do_not_disturb_message(msg, from_id, session_id);
gIMMgr->setDNDMessageSent(session_id, true);
}
}
else if (from_id.isNull())
{