CHUI 796 (User doesn't get all messages in 'do not disturb' mode): Now IM DND notifications will be stored as p2p, ad-hoc or group. When loading these notifications upon app start ad-hoc/group notifications will launch the conversation log and play a sound.

master
Gilbert Gonzales 2013-03-19 11:34:13 -07:00
parent f2ddebe431
commit c4f283334c
2 changed files with 25 additions and 2 deletions

View File

@ -33,6 +33,7 @@
#include "lldir.h"
#include "llerror.h"
#include "llfloaterreg.h"
#include "llimview.h"
#include "llnotifications.h"
#include "llnotificationhandler.h"
#include "llnotificationstorage.h"
@ -145,6 +146,8 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
LLNotifications& instance = LLNotifications::instance();
bool imToastExists = false;
bool group_ad_hoc_toast_exists = false;
S32 toastSessionType;
bool offerExists = false;
for (LLSD::array_const_iterator notification_it = data.beginArray();
@ -158,7 +161,20 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
if(notificationName == toastName)
{
imToastExists = true;
toastSessionType = notification_params["payload"]["SESSION_TYPE"];
if(toastSessionType == LLIMModel::LLIMSession::P2P_SESSION)
{
imToastExists = true;
}
//Don't add group/ad-hoc messages to the notification system because
//this means the group/ad-hoc session has to be re-created
else if(toastSessionType == LLIMModel::LLIMSession::GROUP_SESSION
|| toastSessionType == LLIMModel::LLIMSession::ADHOC_SESSION)
{
//Just allows opening the conversation log for group/ad-hoc messages upon startup
group_ad_hoc_toast_exists = true;
continue;
}
}
else if(notificationName == offerName)
{
@ -197,7 +213,12 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
LLFloaterReg::showInstance("im_container");
}
if(imToastExists || offerExists)
if(group_ad_hoc_toast_exists)
{
LLFloaterReg::showInstance("conversation");
}
if(imToastExists || group_ad_hoc_toast_exists || offerExists)
{
make_ui_sound_deferred("UISndNewIncomingIMSession");
}

View File

@ -154,6 +154,7 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id,
args["FROM"] = av_name.getCompleteName();
args["FROM_ID"] = msg["from_id"];
args["SESSION_ID"] = msg["session_id"];
args["SESSION_TYPE"] = msg["session_type"];
LLNotificationsUtil::add("IMToast", args, args, boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
}
@ -1008,6 +1009,7 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
arg["from"] = from;
arg["from_id"] = from_id;
arg["time"] = LLLogChat::timestamp(false);
arg["session_type"] = session->mSessionType;
mNewMsgSignal(arg);
return true;