FIRE-18167: Per group snooze duration doesn't work from chiclet context menu

Mon, 18 Apr 2016 09:46:50 +0200

author
Ansariel
date
Mon, 18 Apr 2016 09:46:50 +0200
changeset 48952
040e26898579
parent 48951
42afbe8657cf
child 48953
a023d711ba5c

FIRE-18167: Per group snooze duration doesn't work from chiclet context menu

indra/newview/llgroupactions.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/llgroupactions.cpp	Sun Apr 17 19:15:13 2016 +0200
     1.2 +++ b/indra/newview/llgroupactions.cpp	Mon Apr 18 09:46:50 2016 +0200
     1.3 @@ -661,13 +661,72 @@
     1.4  }
     1.5  
     1.6  // [SL:KB] - Patch: Chat-GroupSnooze | Checked: 2012-06-17 (Catznip-3.3)
     1.7 +static void snooze_group_im(const LLUUID& group_id, S32 duration = -1)
     1.8 +{
     1.9 +	LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id);
    1.10 +	if (session_id.notNull())
    1.11 +	{
    1.12 +		LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
    1.13 +
    1.14 +		if (!session)
    1.15 +		{
    1.16 +			LL_WARNS() << "Empty session." << LL_ENDL;
    1.17 +			return;
    1.18 +		}
    1.19 +
    1.20 +		session->mSnoozeTime = duration;
    1.21 +		session->mCloseAction = LLIMModel::LLIMSession::CLOSE_SNOOZE;
    1.22 +
    1.23 +		gIMMgr->leaveSession(session_id);
    1.24 +	}
    1.25 +}
    1.26 +
    1.27 +static void snooze_group_im_duration_callback(const LLSD& notification, const LLSD& response, const LLUUID& group_id)
    1.28 +{
    1.29 +	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
    1.30 +	if (0 == option)
    1.31 +	{
    1.32 +		std::istringstream duration_str(response["duration"].asString());
    1.33 +		S32 duration(-1);
    1.34 +		if (duration_str >> duration && duration >= 0)
    1.35 +		{
    1.36 +			snooze_group_im(group_id, duration);
    1.37 +		}
    1.38 +		else
    1.39 +		{
    1.40 +			LLNotificationsUtil::add("SnoozeDurationInvalidInput");
    1.41 +		}
    1.42 +	}
    1.43 +}
    1.44 +
    1.45 +static void confirm_group_im_snooze(const LLUUID& group_id)
    1.46 +{
    1.47 +	if (group_id.isNull())
    1.48 +	{
    1.49 +		return;
    1.50 +	}
    1.51 +
    1.52 +	if (gSavedSettings.getBOOL("FSEnablePerGroupSnoozeDuration"))
    1.53 +	{
    1.54 +		LLSD args;
    1.55 +		args["DURATION"] = gSavedSettings.getS32("GroupSnoozeTime");
    1.56 +
    1.57 +		LLNotificationsUtil::add("SnoozeDuration", args, LLSD(), boost::bind(&snooze_group_im_duration_callback, _1, _2, group_id));
    1.58 +		return;
    1.59 +	}
    1.60 +
    1.61 +	snooze_group_im(group_id);
    1.62 +}
    1.63 +
    1.64  static void close_group_im(const LLUUID& group_id, LLIMModel::LLIMSession::SCloseAction close_action)
    1.65  {
    1.66  	if (group_id.isNull())
    1.67 +	{
    1.68  		return;
    1.69 +	}
    1.70  	
    1.71  	LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id);
    1.72 -	if (session_id != LLUUID::null)
    1.73 +	if (session_id.notNull())
    1.74  	{
    1.75  		LLIMModel::LLIMSession* pIMSession = LLIMModel::getInstance()->findIMSession(session_id);
    1.76  		if (pIMSession)
    1.77 @@ -685,7 +744,7 @@
    1.78  
    1.79  void LLGroupActions::snoozeIM(const LLUUID& group_id)
    1.80  {
    1.81 -	close_group_im(group_id, LLIMModel::LLIMSession::CLOSE_SNOOZE);
    1.82 +	confirm_group_im_snooze(group_id);
    1.83  }
    1.84  
    1.85  void LLGroupActions::endIM(const LLUUID& group_id)

mercurial