FIRE-16343: Add option to set group chat snooze duration individually per group

master
Ansariel 2015-06-24 09:41:55 +02:00
parent 0bb87294ad
commit bb4e705ce2
9 changed files with 129 additions and 8 deletions

View File

@ -23389,6 +23389,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<string/>
</map>
<key>FSEnablePerGroupSnoozeDuration</key>
<map>
<key>Comment</key>
<string>Enables input of a snooze duration per group.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>

View File

@ -211,8 +211,7 @@ void FSFloaterIM::onClose(bool app_quitting)
void FSFloaterIM::onSnooze()
{
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
mSessionID);
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID);
if (session == NULL)
{
@ -234,6 +233,52 @@ void FSFloaterIM::onSnooze()
return;
}
confirmSnooze();
}
void FSFloaterIM::confirmSnooze()
{
if (gSavedSettings.getBOOL("FSEnablePerGroupSnoozeDuration"))
{
LLSD args;
args["DURATION"] = gSavedSettings.getS32("GroupSnoozeTime");
LLNotificationsUtil::add("SnoozeDuration", args, LLSD(), boost::bind(&FSFloaterIM::snoozeDurationCallback, this, _1, _2));
return;
}
snooze();
}
void FSFloaterIM::snoozeDurationCallback(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (0 == option)
{
std::istringstream duration_str(response["duration"].asString());
S32 duration(-1);
if (duration_str >> duration && duration >= 0)
{
snooze(duration);
}
else
{
LLNotificationsUtil::add("SnoozeDurationInvalidInput");
}
}
}
void FSFloaterIM::snooze(S32 duration /*= -1*/)
{
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID);
if (session == NULL)
{
LL_WARNS("FSFloaterIM") << "Empty session." << LL_ENDL;
return;
}
session->mSnoozeTime = duration;
session->mCloseAction = LLIMModel::LLIMSession::CLOSE_SNOOZE;
LLFloater::onClickCloseBtn();
@ -1764,7 +1809,7 @@ void FSFloaterIM::confirmLeaveCallCallback(const LLSD& notification, const LLSD&
LLUUID session_id = payload["session_id"];
bool snooze = payload["snooze"].asBoolean();
LLFloater* im_floater = LLFloaterReg::findInstance("fs_impanel", session_id);
FSFloaterIM* im_floater = LLFloaterReg::findTypedInstance<FSFloaterIM>("fs_impanel", session_id);
if (option == 0 && im_floater != NULL)
{
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
@ -1772,12 +1817,11 @@ void FSFloaterIM::confirmLeaveCallCallback(const LLSD& notification, const LLSD&
{
if (snooze)
{
session->mCloseAction = LLIMModel::LLIMSession::CLOSE_SNOOZE;
}
else
{
session->mCloseAction = LLIMModel::LLIMSession::CLOSE_DEFAULT;
im_floater->confirmSnooze();
return;
}
session->mCloseAction = LLIMModel::LLIMSession::CLOSE_DEFAULT;
}
im_floater->closeFloater();
}

View File

@ -213,6 +213,10 @@ private:
void sendParticipantsAddedNotification(const uuid_vec_t& uuids);
void confirmSnooze();
void snoozeDurationCallback(const LLSD& notification, const LLSD& response);
void snooze(S32 duration = -1);
FSPanelChatControlPanel* mControlPanel;
LLUUID mSessionID;
S32 mLastMessageIndex;

View File

@ -538,6 +538,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
mHasOfflineMessage(has_offline_msg),
// [SL:KB] - Patch: Chat-GroupSnooze | Checked: 2012-08-01 (Catznip-3.3)
mCloseAction(CLOSE_DEFAULT),
mSnoozeTime(-1),
// [/SL:KB]
mParticipantUnreadMessageCount(0),
mNumUnread(0),
@ -3415,6 +3416,11 @@ bool LLIMMgr::leaveSession(const LLUUID& session_id)
static LLCachedControl<S32> s_nSnoozeTime(gSavedSettings, "GroupSnoozeTime", 900);
snoozed_sessions_t::iterator itSession = mSnoozedSessions.find(session_id);
F64 expirationTime = LLTimer::getTotalSeconds() + F64(s_nSnoozeTime);
if (im_session->mSnoozeTime > -1)
{
expirationTime = LLTimer::getTotalSeconds() + F64(im_session->mSnoozeTime);
im_session->mSnoozeTime = -1;
}
if (mSnoozedSessions.end() != itSession)
itSession->second = expirationTime;

View File

@ -116,6 +116,7 @@ public:
SType mSessionType;
// [SL:KB] - Patch: Chat-GroupSnooze | Checked: 2014-03-01 (Catznip-3.6)
SCloseAction mCloseAction;
S32 mSnoozeTime;
// [/SL:KB]
LLUUID mOtherParticipantID;
uuid_vec_t mInitialTargetIDs;

View File

@ -4909,4 +4909,15 @@ Welche Bezeichnung soll für die Region
Sollen das ausgewählte Objekt wirklich getrennt werden?
<usetemplate ignoretext="Bestätigen, bevor ich ein Objekt trenne" name="okcancelignore" notext="Abbrechen" yestext="Trennen"/>
</notification>
<notification name="SnoozeDuration">
Zeitspanne in Sekunden, für die der Gruppenchat temporär unterdrückt werden soll:
<form name="form">
<button name="OK" text="OK"/>
<button name="Cancel" text="Abbrechen"/>
</form>
</notification>
<notification name="SnoozeDurationInvalidInput">
Bitte geben Sie einen gültigen Wert für die Zeitspanne ein!
<usetemplate name="okbutton" yestext="OK"/>
</notification>
</notifications>

View File

@ -129,6 +129,7 @@
<text name="group_snooze_time_seconds_label" tool_tip="Legt die Zeitspanne fest, für die ein Gruppenchat beim Klicken auf den Button „Temporär unterdrücken“ unterdrückt wird. Bei einem Wert von 0 wird das Fenster bis zum Eintreffen der nächsten Nachricht geschlossen.">
Sekunden
</text>
<check_box name="FSEnablePerGroupSnoozeDuration" label="Zeitspanne für temporäres Unterdrücken von Gruppenchats per Gruppe setzen"/>
</panel>
<!-- Chat: Typing -->

View File

@ -12090,4 +12090,37 @@ Do you really want to unlink the selected object?
notext="Cancel"
yestext="Unlink"/>
</notification>
<notification
icon="alertmodal.tga"
name="SnoozeDuration"
type="alertmodal">
<unique/>
Time in seconds to snooze group chat:
<tag>confirm</tag>
<form name="form">
<input name="duration" type="text" default="true">
[DURATION]
</input>
<button
default="true"
index="0"
name="OK"
text="OK"/>
<button
index="1"
name="Cancel"
text="Cancel"/>
</form>
</notification>
<notification
icon="alertmodal.tga"
name="SnoozeDurationInvalidInput"
type="alertmodal">
Please enter a valid number for the snooze duration!
<tag>fail</tag>
<usetemplate
name="okbutton"
yestext="OK"/>
</notification>
</notifications>

View File

@ -758,6 +758,16 @@
width="70">
seconds
</text>
<check_box
layout="topleft"
follows="left|top"
left="20"
top_pad="-1"
width="400"
height="18"
name="FSEnablePerGroupSnoozeDuration"
control_name="FSEnablePerGroupSnoozeDuration"
label="Set group chat snooze duration individually per group"/>
</panel>
<!-- Chat: Typing -->