Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions indra/newview/llfloaterimsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,28 @@ void LLFloaterIMSession::GearDoToSelectedGroup(const LLSD& userdata)
// [/SL:KB]

// [SL:KB] - Patch: Chat-Misc | Checked: 2014-03-22 (Catznip-3.6)
void LLFloaterIMSession::onSnoozeGroupClicked(const LLUICtrl* pCtrl)
{
if (!pCtrl)
{
return;
}

const std::string value = pCtrl->getValue().asString();
if (value == "-1")
{
LLGroupActions::leaveIM(mSessionID);
}
else if (value.empty())
{
LLGroupActions::snoozeIM(mSessionID, 0);
}
else
{
LLGroupActions::snoozeIM(mSessionID, boost::lexical_cast<S32>(value) * 60);
}
}

Comment thread
coderabbitai[bot] marked this conversation as resolved.
void LLFloaterIMSession::onTeleportClicked(const LLUICtrl* pCtrl)
{
if (pCtrl)
Expand Down Expand Up @@ -478,6 +500,7 @@ bool LLFloaterIMSession::postBuild()
mExtendedButtonPanel->getChild<LLUICtrl>("profile_btn")->setCommitCallback(boost::bind(&LLFloaterIMSession::GearDoToSelectedGroup, this, "view_profile"));
mExtendedButtonPanel->getChild<LLUICtrl>("chat_history_btn")->setCommitCallback(boost::bind(&LLFloaterIMSession::GearDoToSelectedGroup, this, "chat_history"));
mExtendedButtonPanel->getChild<LLUICtrl>("view_notices_btn")->setCommitCallback(boost::bind(&LLFloaterIMSession::GearDoToSelectedGroup, this, "view_notices"));
mExtendedButtonPanel->getChild<LLUICtrl>("snooze_groupt_btn")->setCommitCallback(boost::bind(&LLFloaterIMSession::onSnoozeGroupClicked, this, _1));
}
// [/SL:KB]

Expand Down
1 change: 1 addition & 0 deletions indra/newview/llfloaterimsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class LLFloaterIMSession
bool checkGearMenuItem(const LLSD& userdata);
// [SL:KB] - Patch: Chat-Misc | Checked: 2014-03-22 (Catznip-3.6)
void onTeleportClicked(const LLUICtrl* pCtrl);
void onSnoozeGroupClicked(const LLUICtrl* pCtrl);
// [/SL:KB]
// [SL:KB] - Patch: Chat-BaseGearBtn | Checked: 2014-04-10 (Catznip-3.6)
void GearDoToSelectedGroup(const LLSD& userdata);
Expand Down
33 changes: 33 additions & 0 deletions indra/newview/llgroupactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,27 @@ LLUUID LLGroupActions::startIM(const LLUUID& group_id)
}
}

static void close_group_im(const LLUUID& group_id, LLIMModel::LLIMSession::SCloseAction close_action, S32 snooze_duration = -1)
{
if (group_id.isNull())
{
return;
}

LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id);
if (session_id.notNull())
{
LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id);
if (session)
{
session->mCloseAction = close_action;
session->mSnoozeDuration = snooze_duration;
}

gIMMgr->leaveSession(session_id);
}
}

// static
void LLGroupActions::endIM(const LLUUID& group_id)
{
Expand All @@ -618,6 +639,18 @@ void LLGroupActions::endIM(const LLUUID& group_id)
}
}

// static
void LLGroupActions::leaveIM(const LLUUID& group_id)
{
close_group_im(group_id, LLIMModel::LLIMSession::SCloseAction::CLOSE_LEAVE);
}

// static
void LLGroupActions::snoozeIM(const LLUUID& group_id, S32 snooze_duration)
{
close_group_im(group_id, LLIMModel::LLIMSession::SCloseAction::CLOSE_SNOOZE, snooze_duration);
}

// static
bool LLGroupActions::isInGroup(const LLUUID& group_id)
{
Expand Down
2 changes: 2 additions & 0 deletions indra/newview/llgroupactions.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class LLGroupActions
* End group instant messaging session.
*/
static void endIM(const LLUUID& group_id);
static void leaveIM(const LLUUID& group_id);
static void snoozeIM(const LLUUID& group_id, S32 snooze_duration = -1);

/// Returns if the current user is a member of the group
static bool isInGroup(const LLUUID& group_id);
Expand Down
7 changes: 6 additions & 1 deletion indra/newview/llimprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,12 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
// should happen after you get an "invitation"
if (!gIMMgr->hasSession(session_id))
{
return;
if (!gAgent.isInGroup(session_id) ||
!gIMMgr->checkSnoozeExpiration(session_id) ||
!gIMMgr->restoreSnoozedSession(session_id))
{
return;
}
}

else if (offline == IM_ONLINE && is_do_not_disturb)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
Expand Down
52 changes: 50 additions & 2 deletions indra/newview/llimview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3556,7 +3556,17 @@ bool LLIMMgr::leaveSession(const LLUUID& session_id)
LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
if (!im_session) return false;

LLIMModel::getInstance()->sendLeaveSession(session_id, im_session->mOtherParticipantID);
if (im_session->isGroupSessionType() && im_session->mCloseAction == LLIMModel::LLIMSession::SCloseAction::CLOSE_SNOOZE)
{
const F64 duration = llmax(0, im_session->mSnoozeDuration);
mSnoozedSessions[session_id] = LLTimer::getTotalSeconds() + duration;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}
else
{
LLIMModel::getInstance()->sendLeaveSession(session_id, im_session->mOtherParticipantID);
mSnoozedSessions.erase(session_id);
}

gIMMgr->removeSession(session_id);
return true;
}
Expand Down Expand Up @@ -3747,6 +3757,45 @@ bool LLIMMgr::hasSession(const LLUUID& session_id)
return LLIMModel::getInstance()->findIMSession(session_id) != NULL;
}

bool LLIMMgr::checkSnoozeExpiration(const LLUUID& session_id) const
{
snoozed_sessions_t::const_iterator it = mSnoozedSessions.find(session_id);
return it != mSnoozedSessions.end() && it->second <= LLTimer::getTotalSeconds();
}

bool LLIMMgr::isSnoozedSession(const LLUUID& session_id) const
{
return mSnoozedSessions.find(session_id) != mSnoozedSessions.end();
}

bool LLIMMgr::restoreSnoozedSession(const LLUUID& session_id)
{
snoozed_sessions_t::iterator it = mSnoozedSessions.find(session_id);
if (it == mSnoozedSessions.end())
{
return false;
}

mSnoozedSessions.erase(it);

LLGroupData group_data;
if (!gAgent.getGroupData(session_id, group_data))
{
return false;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

gIMMgr->addSession(group_data.mName, IM_SESSION_GROUP_START, session_id);

uuid_vec_t ids;
LLIMModel::sendStartSession(session_id, session_id, ids, IM_SESSION_GROUP_START, false);

if (!gAgent.isDoNotDisturb())
{
make_ui_sound("UISndStartIM");
}
return true;
}

void LLIMMgr::clearPendingInvitation(const LLUUID& session_id)
{
if ( mPendingInvitations.has(session_id.asString()) )
Expand Down Expand Up @@ -4441,4 +4490,3 @@ LLHTTPRegistration<LLViewerChatterBoxSessionUpdate>
LLHTTPRegistration<LLViewerChatterBoxInvitation>
gHTTPRegistrationMessageChatterBoxInvitation(
"/message/ChatterBoxInvitation");

15 changes: 15 additions & 0 deletions indra/newview/llimview.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ class LLIMModel : public LLSingleton<LLIMModel>
NONE_SESSION,
} SType;

enum class SCloseAction
{
CLOSE_DEFAULT,
CLOSE_LEAVE,
CLOSE_SNOOZE
};

LLIMSession(const LLUUID& session_id, const std::string& name,
const EInstantMessage& type, const LLUUID& other_participant_id, const LLSD& voiceChannelInfo, const uuid_vec_t& ids, bool has_offline_msg);
virtual ~LLIMSession();
Expand Down Expand Up @@ -122,6 +129,8 @@ class LLIMModel : public LLSingleton<LLIMModel>
std::string mName;
EInstantMessage mType;
SType mSessionType;
SCloseAction mCloseAction = SCloseAction::CLOSE_DEFAULT;
S32 mSnoozeDuration = -1;
LLUUID mOtherParticipantID;
uuid_vec_t mInitialTargetIDs;
std::string mHistoryFileName;
Expand Down Expand Up @@ -444,6 +453,9 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
void disconnectAllSessions();

bool hasSession(const LLUUID& session_id);
bool checkSnoozeExpiration(const LLUUID& session_id) const;
bool isSnoozedSession(const LLUUID& session_id) const;
bool restoreSnoozedSession(const LLUUID& session_id);

static LLUUID computeSessionID(EInstantMessage dialog, const LLUUID& other_participant_id);

Expand Down Expand Up @@ -529,6 +541,9 @@ class LLIMMgr : public LLSingleton<LLIMMgr>

LLSD mPendingInvitations;
LLSD mPendingAgentListUpdates;

typedef std::map<LLUUID, F64> snoozed_sessions_t;
snoozed_sessions_t mSnoozedSessions;
};

class LLCallDialogManager : public LLSingleton<LLCallDialogManager>
Expand Down
50 changes: 50 additions & 0 deletions indra/newview/skins/default/xui/en/floater_im_session.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,56 @@
tool_tip="View group notices"
top="1"
width="31" />
<flyout_button
arrow_button_width="18"
follows="top|left"
height="25"
halign="left"
label=""
layout="topleft"
left_pad="2"
name="snooze_groupt_btn"
tool_tip="Snooze group chat"
top="1"
width="44">
<flyout_button.item
label="Next message"
value="0" />
<flyout_button.item
label="5 minutes"
value="5" />
<flyout_button.item
label="15 minutes"
value="15" />
<flyout_button.item
label="30 minutes"
value="30" />
<flyout_button.item
label="45 minutes"
value="45" />
<flyout_button.item
label="1 hour"
value="60" />
<flyout_button.item
label="Next relog"
value="-1" />
<flyout_button.action_button
image_bottom_pad="1"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="Conv_toolbar_snooze"
image_overlay_alignment="left"
image_selected="Toolbar_Middle_Selected"
image_unselected="transparent.j2c"
imgoverlay_label_space="0" />
<flyout_button.drop_down_button
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="Arrow_Small_Down"
image_overlay_alignment="right"
image_pressed="none"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
pad_right="-2" />
</flyout_button>
</panel>
<button
follows="right|top"
Expand Down
Loading