diff options
| -rwxr-xr-x | indra/newview/llagent.cpp | 1 | ||||
| -rwxr-xr-x | indra/newview/llimview.cpp | 33 | ||||
| -rwxr-xr-x | indra/newview/llimview.h | 8 | ||||
| -rwxr-xr-x | indra/newview/llviewermessage.cpp | 13 | 
4 files changed, 51 insertions, 4 deletions
| diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 27d2a92f77..0582916362 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1457,6 +1457,7 @@ void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)  	{  		LLDoNotDisturbNotificationStorage::getInstance()->updateNotifications();  	} +	gIMMgr->updateDNDMessageStatus();  }  //----------------------------------------------------------------------------- diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 70ffdc14ff..d55922af93 100755 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -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); diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index da6039a3ae..4270304de9 100755 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -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); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2dbdceed66..624f62e37e 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -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())  		{ | 
